Liquidity Heatmap
Vue 已实现 · 还原验收 0/1 · 上游演示 · 固定版本源码
预览
Where liquidity rests
SOL / USD · Simulated depth
$250.00$249.50$249.00$248.50$248.00$247.50$247.00$246.50$246.00$245.50$245.00$244.50$244.00$243.50$243.00$242.50$242.00$241.50
14:0014:46
LessMore
用法
vue
<script setup lang="ts">
import { LiquidityHeatmap } from 'beui-vue'
import { computed, ref } from 'vue'
const phase = ref(0)
const snapshots = computed(() => Array.from({ length: 24 }, (_, time) => ({
id: `minute-${time}`, label: `14:${String(time * 2).padStart(2, '0')}`,
price: 245.5 + Math.sin(time * .27 + phase.value * .4) * 1.2 + time * .035,
levels: Array.from({ length: 18 }, (_, row) => {
const shelf = Math.exp(-((row - 4 - Math.sin(time * .18 + phase.value) * .7) ** 2) / .8)
+ Math.exp(-((row - 13 + Math.cos(time * .15 + phase.value) * .8) ** 2) / 1.2)
const noise = (Math.sin(row * 12.9 + time * 7.3 + phase.value * 2.1) + 1) / 2
return { price: 250 - row * .5, size: Math.round(90 + noise * 350 + shelf * (1500 + Math.sin(time * .3 + phase.value) * 450)) }
}),
})))
</script>
<template><div class="chart-demo"><header><div><strong>Where liquidity rests</strong><p>SOL / USD · Simulated depth</p></div><button type="button" @click="phase++">Resimulate</button></header>
<LiquidityHeatmap :snapshots="snapshots" :max-size="2400" unit="SOL" :format-price="value => `$${value.toFixed(2)}`" />
<footer>Brighter bands hold more liquidity · White line tracks price</footer>
</div></template>
<style scoped>
.chart-demo { width: 100%; min-width: 0; margin-inline: auto; }
.chart-demo > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 20px; }
.chart-demo header strong { font-size: 14px; font-weight: 500; }
.chart-demo header p, .chart-demo > p { margin: 4px 0 0; color: var(--beui-muted-foreground); font-size: 12px; line-height: 16px; }
.chart-demo header button,.chart-demo fieldset button { padding: 6px 12px; background: transparent; border: 0; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; }
.chart-demo header button:hover,.chart-demo fieldset button[aria-pressed=true] { background: var(--beui-muted); }
.chart-demo > footer { margin-top: 24px; text-align: center; color: var(--beui-muted-foreground); font-size: 11px; }
.chart-demo .sim { margin-left: 6px; border: 1px solid var(--beui-border); padding: 2px 5px; border-radius: 3px; text-transform: uppercase; font-size: 9px; letter-spacing: .05em; color: var(--beui-muted-foreground); }
</style>API
snapshots 提供时间、分档流动性与市场价轨迹,maxSize 固定颜色量程。指针和方向键检查独立单元格。