Spaces:
Running
Running
Jimin Huang
commited on
Commit
·
1a59392
1
Parent(s):
e334b8e
Change settings
Browse files
src/components/CompareChartE.vue
CHANGED
|
@@ -40,6 +40,12 @@ const AGENT_LOGOS = {
|
|
| 40 |
'DeepFundAgent': new URL('../assets/images/agents_images/deepfund.png', import.meta.url).href,
|
| 41 |
'TradeAgent': new URL('../assets/images/agents_images/trade.png', import.meta.url).href,
|
| 42 |
'InvestorAgent': new URL('../assets/images/agents_images/investor.png', import.meta.url).href,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
// 'InvestorAgent': new URL('../assets/images/agents_images/investor.png', import.meta.url).href,
|
| 44 |
};
|
| 45 |
const MODEL_LOGOS = {
|
|
@@ -71,7 +77,7 @@ async function composeBadge(agent, model, color = '#666') {
|
|
| 71 |
const mImg = await loadImg(MODEL_LOGOS[model]);
|
| 72 |
|
| 73 |
// uniform canvas
|
| 74 |
-
const S =
|
| 75 |
const R = S / 2;
|
| 76 |
const canvas = document.createElement('canvas');
|
| 77 |
canvas.width = S; canvas.height = S;
|
|
@@ -202,7 +208,7 @@ export default defineComponent({
|
|
| 202 |
type: 'scatter',
|
| 203 |
data: [ last ],
|
| 204 |
symbol: badgeUrl ? `image://${badgeUrl}` : 'circle',
|
| 205 |
-
symbolSize:
|
| 206 |
z: 20,
|
| 207 |
tooltip: { show: false },
|
| 208 |
label: {
|
|
@@ -244,14 +250,13 @@ export default defineComponent({
|
|
| 244 |
})
|
| 245 |
const lastBH = bhPoints[bhPoints.length - 1]
|
| 246 |
if (lastBH && Number.isFinite(lastBH[1])) {
|
| 247 |
-
const
|
| 248 |
-
const badgeUrl = new URL(`../assets/images/assets_images/${asset}.png`, import.meta.url).href;
|
| 249 |
series.push({
|
| 250 |
name: `${asset} · Buy&Hold •badge`,
|
| 251 |
type: 'scatter',
|
| 252 |
data: [ lastBH ],
|
| 253 |
symbol: badgeUrl ? `image://${badgeUrl}` : 'circle',
|
| 254 |
-
symbolSize:
|
| 255 |
z: 19,
|
| 256 |
tooltip: { show: false },
|
| 257 |
label: {
|
|
|
|
| 40 |
'DeepFundAgent': new URL('../assets/images/agents_images/deepfund.png', import.meta.url).href,
|
| 41 |
'TradeAgent': new URL('../assets/images/agents_images/trade.png', import.meta.url).href,
|
| 42 |
'InvestorAgent': new URL('../assets/images/agents_images/investor.png', import.meta.url).href,
|
| 43 |
+
'BTC': new URL('../assets/images/assets_images/BTC.png', import.meta.url).href,
|
| 44 |
+
'ETH': new URL('../assets/images/assets_images/ETH.png', import.meta.url).href,
|
| 45 |
+
'MSFT': new URL('../assets/images/assets_images/MSFT.png', import.meta.url).href,
|
| 46 |
+
'BMRN': new URL('../assets/images/assets_images/BMRN.png', import.meta.url).href,
|
| 47 |
+
'MRNA': new URL('../assets/images/assets_images/MRNA.png', import.meta.url).href,
|
| 48 |
+
'TSLA': new URL('../assets/images/assets_images/TSLA.png', import.meta.url).href,
|
| 49 |
// 'InvestorAgent': new URL('../assets/images/agents_images/investor.png', import.meta.url).href,
|
| 50 |
};
|
| 51 |
const MODEL_LOGOS = {
|
|
|
|
| 77 |
const mImg = await loadImg(MODEL_LOGOS[model]);
|
| 78 |
|
| 79 |
// uniform canvas
|
| 80 |
+
const S = 50; // badge size (px)
|
| 81 |
const R = S / 2;
|
| 82 |
const canvas = document.createElement('canvas');
|
| 83 |
canvas.width = S; canvas.height = S;
|
|
|
|
| 208 |
type: 'scatter',
|
| 209 |
data: [ last ],
|
| 210 |
symbol: badgeUrl ? `image://${badgeUrl}` : 'circle',
|
| 211 |
+
symbolSize: 50,
|
| 212 |
z: 20,
|
| 213 |
tooltip: { show: false },
|
| 214 |
label: {
|
|
|
|
| 250 |
})
|
| 251 |
const lastBH = bhPoints[bhPoints.length - 1]
|
| 252 |
if (lastBH && Number.isFinite(lastBH[1])) {
|
| 253 |
+
const badgeUrl = await composeBadge(asset, null, '#fff'); // ← NEW
|
|
|
|
| 254 |
series.push({
|
| 255 |
name: `${asset} · Buy&Hold •badge`,
|
| 256 |
type: 'scatter',
|
| 257 |
data: [ lastBH ],
|
| 258 |
symbol: badgeUrl ? `image://${badgeUrl}` : 'circle',
|
| 259 |
+
symbolSize: 50,
|
| 260 |
z: 19,
|
| 261 |
tooltip: { show: false },
|
| 262 |
label: {
|