think all charts and blocks are good

This commit is contained in:
Gerard Burns 2024-04-19 09:25:59 +01:00
parent 3f433bb710
commit 46ae350370
3 changed files with 15 additions and 12 deletions

View File

@ -32,7 +32,7 @@
// Bar/Line/Area
export let valueColumns
export let yAxisUnits
export let valueUnits
export let yAxisLabel
export let xAxisLabel
export let curve
@ -85,7 +85,7 @@
legend,
animate,
...colors,
yAxisUnits,
valueUnits,
yAxisLabel,
xAxisLabel,
stacked,

View File

@ -55,6 +55,9 @@
}
},
yaxis: {
labels: {
formatter: formatters[valueUnits]
},
title: {
text: yAxisLabel
}

View File

@ -13,7 +13,6 @@
export let width
export let dataLabels
export let animate
export let legend
export let stacked
export let palette
export let c1, c2, c3, c4, c5
@ -31,14 +30,6 @@
theme: {
palette: palette === "Custom" ? null : palette
},
legend: {
show: legend,
position: "top",
horizontalAlign: "right",
showForSingleSeries: true,
showForNullSeries: true,
showForZeroSeries: true,
},
title: {
text: title,
},
@ -141,8 +132,17 @@
}
const getFormatter = (horizontal, axis) => {
// Don't display decimals in between integers on the value axis
if ((horizontal && axis === "x") || (!horizontal && axis === "y")) {
return (value) => value.toFixed(0)
return (value) => {
if (Math.floor(value) === value) {
return value;
}
// Returning an empty string or even a normal space here causes Apex Charts to push the value axis label of the screen
// This is an `em space`, `U+2003`
return "";
}
}
return (value) => value