Spaces:
Running
Running
Jimin Huang
commited on
Commit
·
5a3c2b5
1
Parent(s):
ca3ff8a
Change settings
Browse files- src/views/RequestView.vue +39 -10
src/views/RequestView.vue
CHANGED
|
@@ -6,7 +6,9 @@
|
|
| 6 |
<h2 class="section-title">
|
| 7 |
<span class="ama-gradient">Assets in the Arena</span>
|
| 8 |
</h2>
|
| 9 |
-
<p class="section-sub">
|
|
|
|
|
|
|
| 10 |
</header>
|
| 11 |
|
| 12 |
<div class="grid grid-assets-4">
|
|
@@ -168,24 +170,52 @@ import * as echarts from 'echarts/core'
|
|
| 168 |
import { LineChart } from 'echarts/charts'
|
| 169 |
import { GridComponent, TooltipComponent } from 'echarts/components'
|
| 170 |
import { CanvasRenderer } from 'echarts/renderers'
|
|
|
|
| 171 |
echarts.use([LineChart, GridComponent, TooltipComponent, CanvasRenderer])
|
| 172 |
|
| 173 |
/**
|
| 174 |
-
*
|
| 175 |
*/
|
| 176 |
const MiniEchart = {
|
| 177 |
name: 'MiniEchart',
|
| 178 |
props: {
|
| 179 |
-
data: { type: Array,
|
| 180 |
color: { type: String, default: '#22c55e' }
|
| 181 |
},
|
|
|
|
|
|
|
|
|
|
| 182 |
mounted() {
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
|
|
|
|
|
|
|
|
|
| 186 |
},
|
| 187 |
methods: {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
render(arr) {
|
|
|
|
| 189 |
const d = Array.isArray(arr) ? arr : []
|
| 190 |
this._chart.setOption({
|
| 191 |
animation: true,
|
|
@@ -215,7 +245,6 @@ const MiniEchart = {
|
|
| 215 |
})
|
| 216 |
}
|
| 217 |
},
|
| 218 |
-
beforeUnmount() { if (this._chart) { this._chart.dispose(); this._chart = null } },
|
| 219 |
template: `<div ref="c" class="echart-mini"></div>`
|
| 220 |
}
|
| 221 |
|
|
@@ -227,10 +256,10 @@ export default {
|
|
| 227 |
assetFormUrl: 'https://forms.gle/your-asset-request-form',
|
| 228 |
agentFormUrl: 'https://forms.gle/your-agent-submit-form',
|
| 229 |
|
| 230 |
-
// dynamic
|
| 231 |
assets: [],
|
| 232 |
|
| 233 |
-
// agents
|
| 234 |
agents: [
|
| 235 |
{
|
| 236 |
name: 'InvestorAgent',
|
|
@@ -418,7 +447,7 @@ export default {
|
|
| 418 |
.truncate{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
| 419 |
.clamp-2{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
|
| 420 |
.w-full{ width:100%; }
|
| 421 |
-
.echart-mini{ width:100%; height:
|
| 422 |
|
| 423 |
/* ===== Sections ===== */
|
| 424 |
.section{ margin-top:18px; }
|
|
|
|
| 6 |
<h2 class="section-title">
|
| 7 |
<span class="ama-gradient">Assets in the Arena</span>
|
| 8 |
</h2>
|
| 9 |
+
<p class="section-sub">
|
| 10 |
+
Live from dataService • B&H sparkline (ECharts LineChart) • 1M change • coverage
|
| 11 |
+
</p>
|
| 12 |
</header>
|
| 13 |
|
| 14 |
<div class="grid grid-assets-4">
|
|
|
|
| 170 |
import { LineChart } from 'echarts/charts'
|
| 171 |
import { GridComponent, TooltipComponent } from 'echarts/components'
|
| 172 |
import { CanvasRenderer } from 'echarts/renderers'
|
| 173 |
+
import { nextTick } from 'vue'
|
| 174 |
echarts.use([LineChart, GridComponent, TooltipComponent, CanvasRenderer])
|
| 175 |
|
| 176 |
/**
|
| 177 |
+
* Robust ECharts mini line spark that waits for layout
|
| 178 |
*/
|
| 179 |
const MiniEchart = {
|
| 180 |
name: 'MiniEchart',
|
| 181 |
props: {
|
| 182 |
+
data: { type: Array, default: () => [] },
|
| 183 |
color: { type: String, default: '#22c55e' }
|
| 184 |
},
|
| 185 |
+
data() {
|
| 186 |
+
return { _chart: null, _ro: null, _raf: 0 }
|
| 187 |
+
},
|
| 188 |
mounted() {
|
| 189 |
+
nextTick(() => this.initChartSafely())
|
| 190 |
+
},
|
| 191 |
+
beforeUnmount() {
|
| 192 |
+
if (this._ro) { this._ro.disconnect(); this._ro = null }
|
| 193 |
+
if (this._raf) { cancelAnimationFrame(this._raf); this._raf = 0 }
|
| 194 |
+
if (this._chart) { this._chart.dispose(); this._chart = null }
|
| 195 |
},
|
| 196 |
methods: {
|
| 197 |
+
initChartSafely() {
|
| 198 |
+
const el = this.$refs.c || this.$el
|
| 199 |
+
if (!el) {
|
| 200 |
+
this._raf = requestAnimationFrame(() => this.initChartSafely())
|
| 201 |
+
return
|
| 202 |
+
}
|
| 203 |
+
const { clientWidth: w, clientHeight: h } = el
|
| 204 |
+
if (!w || !h) {
|
| 205 |
+
this._raf = requestAnimationFrame(() => this.initChartSafely())
|
| 206 |
+
return
|
| 207 |
+
}
|
| 208 |
+
this._chart = echarts.init(el, null, { renderer: 'canvas' })
|
| 209 |
+
this.render(this.data)
|
| 210 |
+
|
| 211 |
+
// Listen for container resize
|
| 212 |
+
this._ro = new ResizeObserver(() => {
|
| 213 |
+
if (this._chart) this._chart.resize()
|
| 214 |
+
})
|
| 215 |
+
this._ro.observe(el)
|
| 216 |
+
},
|
| 217 |
render(arr) {
|
| 218 |
+
if (!this._chart) return
|
| 219 |
const d = Array.isArray(arr) ? arr : []
|
| 220 |
this._chart.setOption({
|
| 221 |
animation: true,
|
|
|
|
| 245 |
})
|
| 246 |
}
|
| 247 |
},
|
|
|
|
| 248 |
template: `<div ref="c" class="echart-mini"></div>`
|
| 249 |
}
|
| 250 |
|
|
|
|
| 256 |
assetFormUrl: 'https://forms.gle/your-asset-request-form',
|
| 257 |
agentFormUrl: 'https://forms.gle/your-agent-submit-form',
|
| 258 |
|
| 259 |
+
// dynamic from dataService
|
| 260 |
assets: [],
|
| 261 |
|
| 262 |
+
// agents (no performance fields shown)
|
| 263 |
agents: [
|
| 264 |
{
|
| 265 |
name: 'InvestorAgent',
|
|
|
|
| 447 |
.truncate{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
| 448 |
.clamp-2{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
|
| 449 |
.w-full{ width:100%; }
|
| 450 |
+
.echart-mini{ width:100%; height:100%; }
|
| 451 |
|
| 452 |
/* ===== Sections ===== */
|
| 453 |
.section{ margin-top:18px; }
|