format chart

This commit is contained in:
hackerESQ
2024-09-18 23:31:03 -05:00
parent 5bcbec82f4
commit 80b25115a3
@@ -53,7 +53,7 @@
], ],
'yaxis' => [ 'yaxis' => [
'labels' => [ 'labels' => [
'offsetX' => 0, 'offsetX' => -10,
'offsetY' => -10 'offsetY' => -10
], ],
'tooltip' => [ 'tooltip' => [
@@ -93,6 +93,10 @@
} --}} } --}}
} }
this.data.yaxis.labels.formatter = function (value) {
return `$${value}`
}
this.data.tooltip = { this.data.tooltip = {
enabled: true, enabled: true,
y: { y: {
@@ -100,7 +104,7 @@
const firstDataPoint = this.data.series[seriesIndex].data[0][1] const firstDataPoint = this.data.series[seriesIndex].data[0][1]
const percentageChange = ((value - firstDataPoint) / firstDataPoint) * 100; const percentageChange = ((value - firstDataPoint) / firstDataPoint) * 100;
return `${value} (${percentageChange.toFixed(2)}%)`; return `$${parseFloat(value.toFixed(2))} (${percentageChange.toFixed(2)}%)`;
} }
}, },
} }