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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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