1
0
Fork 0
mirror of synced 2024-06-02 02:25:17 +12:00

Custom colors line chart

This commit is contained in:
Mel O'Hagan 2022-08-11 17:52:09 +01:00
parent 3421febb1c
commit 864f8756bc
2 changed files with 62 additions and 3 deletions

View file

@ -1632,10 +1632,11 @@
},
{
"type": "select",
"label": "Colours",
"label": "Colors",
"key": "palette",
"defaultValue": "Palette 1",
"options": [
"Custom",
"Palette 1",
"Palette 2",
"Palette 3",
@ -1648,6 +1649,56 @@
"Palette 10"
]
},
{
"type": "color",
"label": "C1",
"key": "c1",
"barSeparator": false,
"dependsOn": {
"setting": "palette",
"value": "Custom"
}
},
{
"type": "color",
"label": "C2",
"key": "c2",
"barSeparator": false,
"dependsOn": {
"setting": "palette",
"value": "Custom"
}
},
{
"type": "color",
"label": "C3",
"key": "c3",
"barSeparator": false,
"dependsOn": {
"setting": "palette",
"value": "Custom"
}
},
{
"type": "color",
"label": "C4",
"key": "c4",
"barSeparator": false,
"dependsOn": {
"setting": "palette",
"value": "Custom"
}
},
{
"type": "color",
"label": "C5",
"key": "c5",
"barSeparator": false,
"dependsOn": {
"setting": "palette",
"value": "Custom"
}
},
{
"type": "select",
"label": "Curve",

View file

@ -17,6 +17,7 @@
export let legend
export let yAxisUnits
export let palette
export let c1, c2, c3, c4, c5
// Area specific props
export let area
@ -40,9 +41,13 @@
palette,
area,
stacked,
gradient
gradient,
c1 && c2 && c3 && c4 && c5 ? [c1, c2, c3, c4, c5] : null,
customColor
)
$: customColor = palette === "Custom"
const setUpChart = (
title,
dataProvider,
@ -60,7 +65,9 @@
palette,
area,
stacked,
gradient
gradient,
colors,
customColor
) => {
const allCols = [labelColumn, ...(valueColumns || [null])]
if (
@ -96,6 +103,7 @@
.legend(legend)
.yUnits(yAxisUnits)
.palette(palette)
.colors(customColor ? colors : null)
// Add data
let useDates = false