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 // Bar/Line/Area
export let valueColumns export let valueColumns
export let yAxisUnits export let valueUnits
export let yAxisLabel export let yAxisLabel
export let xAxisLabel export let xAxisLabel
export let curve export let curve
@ -85,7 +85,7 @@
legend, legend,
animate, animate,
...colors, ...colors,
yAxisUnits, valueUnits,
yAxisLabel, yAxisLabel,
xAxisLabel, xAxisLabel,
stacked, stacked,

View File

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

View File

@ -13,7 +13,6 @@
export let width export let width
export let dataLabels export let dataLabels
export let animate export let animate
export let legend
export let stacked export let stacked
export let palette export let palette
export let c1, c2, c3, c4, c5 export let c1, c2, c3, c4, c5
@ -31,14 +30,6 @@
theme: { theme: {
palette: palette === "Custom" ? null : palette palette: palette === "Custom" ? null : palette
}, },
legend: {
show: legend,
position: "top",
horizontalAlign: "right",
showForSingleSeries: true,
showForNullSeries: true,
showForZeroSeries: true,
},
title: { title: {
text: title, text: title,
}, },
@ -141,8 +132,17 @@
} }
const getFormatter = (horizontal, axis) => { const getFormatter = (horizontal, axis) => {
// Don't display decimals in between integers on the value axis
if ((horizontal && axis === "x") || (!horizontal && axis === "y")) { 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 return (value) => value