Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit fa6140e

Browse files
committed
Add commas
1 parent 6e5de50 commit fa6140e

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/components/charts/depthChart.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -278,31 +278,31 @@ const DepthChart = ({
278278
setRenderedBuySideData((prev) => {
279279
const lastPoint = prev[prev.length - 1];
280280
if (lastPoint) {
281-
return [...prev, { x: -1, y: lastPoint.y }];
281+
return [...prev, { x: -1000000, y: lastPoint.y }];
282282
}
283-
return [{ x: -1, y: 0 }];
283+
return [{ x: -1000000, y: 0 }];
284284
});
285285
setRenderedSellSideData((prev) => {
286286
const lastPoint = prev[prev.length - 1];
287287
if (lastPoint) {
288288
return [...prev, { x: lastPoint.x + 1e18, y: lastPoint.y }];
289289
}
290-
return [{ x: -1, y: 0 }];
290+
return [{ x: -1000000, y: 0 }];
291291
});
292292

293293
setRenderedBuySideSingleHopData((prev) => {
294294
const lastPoint = prev[prev.length - 1];
295295
if (lastPoint) {
296-
return [...prev, { x: -1, y: lastPoint.y }];
296+
return [...prev, { x: -1000000, y: lastPoint.y }];
297297
}
298-
return [{ x: -1, y: 0 }];
298+
return [{ x: -1000000, y: 0 }];
299299
});
300300
setRenderedSellSideSingleHopData((prev) => {
301301
const lastPoint = prev[prev.length - 1];
302302
if (lastPoint) {
303303
return [...prev, { x: lastPoint.x + 1e18, y: lastPoint.y }];
304304
}
305-
return [{ x: -1, y: 0 }];
305+
return [{ x: -1000000, y: 0 }];
306306
});
307307

308308
// Min and max should be set based on the midMarketPrice and range
@@ -499,7 +499,7 @@ const DepthChart = ({
499499
// Customize x-axis ticks to show more decimals
500500
callback: function (val, index) {
501501
// Convert the value to a number and format it
502-
return Number(val).toFixed(3);
502+
return Number(Number(val).toFixed(3)).toLocaleString();
503503
},
504504
stepSize: tickStepSize,
505505
},
@@ -580,15 +580,15 @@ const DepthChart = ({
580580
label += ": ";
581581
}
582582
if (context.parsed.y !== null) {
583-
label += context.parsed.y.toFixed(3); // Adjust for y value
583+
label += Number(context.parsed.y.toFixed(3)).toLocaleString(); // Adjust for y value
584584
}
585585
if (context.parsed.x !== null) {
586-
label += " at " + context.parsed.x.toFixed(6); // Adjust for x value
586+
label += " at " + Number(context.parsed.x.toFixed(6)).toLocaleString(); // Adjust for x value
587587
}
588588
return label;
589589
},
590590
title: function (context) {
591-
return `Price: ${context[0].parsed.x.toFixed(6)}`;
591+
return `Price: ${Number(context[0].parsed.x.toFixed(6)).toLocaleString()}`;
592592
},
593593
},
594594
},
@@ -610,7 +610,7 @@ const DepthChart = ({
610610
borderWidth: 0,
611611
label: {
612612
display: true,
613-
content: `Mid Market Price: ${midMarketPrice.toFixed(6)}`,
613+
content: `Mid Market Price: ${Number(midMarketPrice.toFixed(6)).toLocaleString()}`,
614614
position: "end",
615615
backgroundColor: "#6e6eb8",
616616
font: {

src/components/charts/ohlcChart.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,17 +474,19 @@ const OHLCChart = ({ asset1Token, asset2Token }: OHLCChartProps) => {
474474
const [date, open, close, low, high] = param.data;
475475
tooltipText += `
476476
<strong>${params[0].name}</strong><br/>
477-
<strong>Open:</strong> ${open}<br/>
478-
<strong>Close:</strong> ${close}<br/>
479-
<strong>Low:</strong> ${low}<br/>
480-
<strong>High:</strong> ${high}<br/>
477+
<strong>Open:</strong> ${Number(open).toLocaleString()}<br/>
478+
<strong>Close:</strong> ${Number(close).toLocaleString()}<br/>
479+
<strong>Low:</strong> ${Number(low).toLocaleString()}<br/>
480+
<strong>High:</strong> ${Number(high).toLocaleString()}<br/>
481481
`;
482482
} else if (
483483
param.seriesType === "bar" &&
484484
param.seriesName === "Volume"
485485
) {
486486
tooltipText += `<strong>${params[0].name}</strong><br/>
487-
<strong>Volume:</strong> ${param.data}<br/>`;
487+
<strong>Volume:</strong> ${Number(
488+
param.data
489+
).toLocaleString()}<br/>`;
488490
}
489491
});
490492
return tooltipText;

0 commit comments

Comments
 (0)