Skip to content

Commit 32979b9

Browse files
committed
Update safe-analytics.html to display absolute values for outflow data and chart ticks
1 parent ec93aee commit 32979b9

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

data-api/src/main/resources/templates/safe-analytics.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,7 +1499,7 @@ <h4 class="footer-title">Social</h4>
14991499
},
15001500
{
15011501
label: `${tokenData.tokenSymbol} Outflow`,
1502-
data: outflowData,
1502+
data: outflowData.map(value => -value), // Make outflow negative
15031503
backgroundColor: function(context) {
15041504
const chart = context.chart;
15051505
const {ctx, chartArea} = chart;
@@ -2109,7 +2109,9 @@ <h4 class="footer-title">Social</h4>
21092109
label += ': ';
21102110
}
21112111
if (context.parsed.y !== null) {
2112-
label += parseFloat(context.parsed.y.toFixed(2)).toLocaleString();
2112+
// Get the absolute value for display
2113+
const value = Math.abs(context.parsed.y);
2114+
label += parseFloat(value.toFixed(2)).toLocaleString();
21132115
}
21142116
return label;
21152117
}
@@ -2158,8 +2160,15 @@ <h4 class="footer-title">Social</h4>
21582160
font: {
21592161
family: "'Inter', sans-serif",
21602162
size: 11
2163+
},
2164+
callback: function(value) {
2165+
// Show absolute values for ticks to avoid -0
2166+
return Math.abs(value).toLocaleString();
21612167
}
2162-
}
2168+
},
2169+
// Ensure the chart shows negative values properly
2170+
stacked: false,
2171+
beginAtZero: false
21632172
}
21642173
}
21652174
}

0 commit comments

Comments
 (0)