Skip to content

Commit 4a292f0

Browse files
authored
Merge pull request QuickSwap#1685 from 0xoscario/hotfix/analytics-chart
Fix liquidity chart in analytics page
2 parents e32413b + 6968f6b commit 4a292f0

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/components/AreaChart/AreaChart.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const AreaChart: React.FC<AreaChartProps> = ({
3939
const yMin = yAxisValues
4040
? Math.min(...yAxisValues.map((val) => Number(val)))
4141
: 0;
42-
4342
const options = {
4443
chart: {
4544
sparkline: {

src/components/styles/AreaChart.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
justify-content: space-between;
2020
margin-right: 8px;
2121
margin-bottom: 32px;
22+
width: 43px;
2223
& p {
2324
font-size: 10px;
2425
font-weight: 500;

src/pages/AnalyticsPage/AnalyticsLiquidityChart.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,16 @@ const AnalyticsLiquidityChart: React.FC<{
6868

6969
const minVolume = Math.floor(Math.min(...dailyVolumes));
7070
const maxVolume = Math.ceil(Math.max(...dailyVolumes));
71-
7271
const values: any[] = [];
7372
// show 10 values in the y axis of the graph
74-
const step = (maxVolume - minVolume) / 10;
73+
const step = (maxVolume - minVolume) / 9;
7574
if (step > 0) {
76-
for (let i = maxVolume; i >= minVolume; i -= step) {
77-
values.push(Math.floor(i));
75+
for (let i = 9; i >= 0; i--) {
76+
const value = minVolume + (i * (maxVolume - minVolume)) / 9;
77+
if (values.includes(value)) {
78+
continue;
79+
}
80+
values.push(value);
7881
}
7982
} else {
8083
values.push(minVolume);

0 commit comments

Comments
 (0)