1
0
Fork 0
mirror of synced 2024-08-08 14:48:13 +12:00

fix palette stuff

This commit is contained in:
Gerard Burns 2024-05-14 11:17:54 +01:00
parent 1c14a71ef8
commit 2e238f814c
7 changed files with 26 additions and 27 deletions

View file

@ -1685,7 +1685,7 @@
{
"type": "select",
"label": "Format",
"key": "valueUnits",
"key": "yAxisUnits",
"options": ["Default", "Thousands", "Millions"],
"defaultValue": "Default"
},
@ -1854,7 +1854,7 @@
{
"type": "select",
"label": "Format",
"key": "valueUnits",
"key": "yAxisUnits",
"options": ["Default", "Thousands", "Millions"],
"defaultValue": "Default"
},
@ -2018,7 +2018,7 @@
{
"type": "select",
"label": "Format",
"key": "valueUnits",
"key": "yAxisUnits",
"options": ["Default", "Thousands", "Millions"],
"defaultValue": "Default"
},
@ -2510,7 +2510,7 @@
{
"type": "select",
"label": "Format",
"key": "valueUnits",
"key": "yAxisUnits",
"options": ["Default", "Thousands", "Millions"],
"defaultValue": "Default"
},
@ -5476,7 +5476,7 @@
{
"type": "select",
"label": "Format",
"key": "valueUnits",
"key": "yAxisUnits",
"options": ["Default", "Thousands", "Millions"],
"defaultValue": "Default"
},
@ -5586,7 +5586,7 @@
{
"type": "select",
"label": "Format",
"key": "valueUnits",
"key": "yAxisUnits",
"options": ["Default", "Thousands", "Millions"],
"defaultValue": "Default"
},
@ -5645,7 +5645,7 @@
{
"type": "select",
"label": "Format",
"key": "valueUnits",
"key": "yAxisUnits",
"options": ["Default", "Thousands", "Millions"],
"defaultValue": "Default"
},
@ -5752,7 +5752,7 @@
{
"type": "select",
"label": "Format",
"key": "valueUnits",
"key": "yAxisUnits",
"options": ["Default", "Thousands", "Millions"],
"defaultValue": "Default"
},

View file

@ -40,7 +40,6 @@
"sanitize-html": "^2.7.0",
"screenfull": "^6.0.1",
"shortid": "^2.2.15",
"svelte-apexcharts": "^1.0.2",
"svelte-flatpickr": "^3.3.4",
"svelte-spa-router": "^4.0.1"
},

View file

@ -14,7 +14,7 @@
export let dataLabels
export let curve
export let legend
export let valueUnits
export let yAxisUnits
export let palette
export let c1, c2, c3, c4, c5
@ -30,8 +30,8 @@
dataProvider?.schema?.[labelColumn]?.type === "datetime"
? "datetime"
: "category"
$: xAxisFormatter = getFormatter(labelType, valueUnits, "x")
$: yAxisFormatter = getFormatter(labelType, valueUnits, "y")
$: xAxisFormatter = getFormatter(labelType, yAxisUnits, "x")
$: yAxisFormatter = getFormatter(labelType, yAxisUnits, "y")
$: fill = getFill(gradient)
$: options = {
@ -125,7 +125,7 @@
})
}
const getFormatter = (labelType, valueUnits, axis) => {
const getFormatter = (labelType, yAxisUnits, axis) => {
const isLabelAxis = axis === "x"
if (labelType === "datetime" && isLabelAxis) {
@ -136,7 +136,7 @@
return formatters["Default"]
}
return formatters[valueUnits]
return formatters[yAxisUnits]
}
const getFill = gradient => {

View file

@ -15,7 +15,7 @@
export let animate
export let legend
export let stacked
export let valueUnits
export let yAxisUnits
export let palette
export let c1, c2, c3, c4, c5
export let horizontal
@ -27,8 +27,8 @@
dataProvider?.schema?.[labelColumn]?.type === "datetime"
? "datetime"
: "category"
$: xAxisFormatter = getFormatter(labelType, valueUnits, horizontal, "x")
$: yAxisFormatter = getFormatter(labelType, valueUnits, horizontal, "y")
$: xAxisFormatter = getFormatter(labelType, yAxisUnits, horizontal, "x")
$: yAxisFormatter = getFormatter(labelType, yAxisUnits, horizontal, "y")
$: options = {
series,
@ -124,7 +124,7 @@
})
}
const getFormatter = (labelType, valueUnits, horizontal, axis) => {
const getFormatter = (labelType, yAxisUnits, horizontal, axis) => {
const isLabelAxis =
(axis === "y" && horizontal) || (axis === "x" && !horizontal)
if (labelType === "datetime" && isLabelAxis) {
@ -135,7 +135,7 @@
return formatters["Default"]
}
return formatters[valueUnits]
return formatters[yAxisUnits]
}
</script>

View file

@ -14,7 +14,7 @@
export let height
export let width
export let animate
export let valueUnits
export let yAxisUnits
$: series = getSeries(
dataProvider,
@ -55,7 +55,7 @@
},
yaxis: {
labels: {
formatter: formatters[valueUnits],
formatter: formatters[yAxisUnits],
},
title: {
text: yAxisLabel,

View file

@ -14,7 +14,7 @@
export let dataLabels
export let curve
export let legend
export let valueUnits
export let yAxisUnits
export let palette
export let c1, c2, c3, c4, c5
@ -25,8 +25,8 @@
dataProvider?.schema?.[labelColumn]?.type === "datetime"
? "datetime"
: "category"
$: xAxisFormatter = getFormatter(labelType, valueUnits, "x")
$: yAxisFormatter = getFormatter(labelType, valueUnits, "y")
$: xAxisFormatter = getFormatter(labelType, yAxisUnits, "x")
$: yAxisFormatter = getFormatter(labelType, yAxisUnits, "y")
$: options = {
series,
@ -117,7 +117,7 @@
})
}
const getFormatter = (labelType, valueUnits, axis) => {
const getFormatter = (labelType, yAxisUnits, axis) => {
const isLabelAxis = axis === "x"
if (labelType === "datetime" && isLabelAxis) {
@ -128,7 +128,7 @@
return formatters["Default"]
}
return formatters[valueUnits]
return formatters[yAxisUnits]
}
</script>

View file

@ -13,7 +13,7 @@ export const parsePalette = (paletteName) => {
const [_, number] = paletteName.split(" ");
return `pallete${number}`
return `palette${number}`
}
// Deep clone which copies function references