Add stacked option to bar chart

This commit is contained in:
Andrew Kingston 2020-11-03 09:48:35 +00:00
parent 0ea30587de
commit ae876c6c09
4 changed files with 15 additions and 4 deletions

View File

@ -573,6 +573,13 @@ export default {
control: Input, control: Input,
defaultValue: "400", defaultValue: "400",
}, },
{
label: "Stacked",
key: "stacked",
control: Checkbox,
valueKey: "checked",
defaultValue: false,
},
{ {
label: "Horizontal", label: "Horizontal",
key: "horizontal", key: "horizontal",

View File

@ -573,10 +573,8 @@
}, },
"xAxisLabel": "string", "xAxisLabel": "string",
"yAxisLabel": "string", "yAxisLabel": "string",
"legend": { "legend": "bool",
"type": "bool", "stacked": "bool"
"default": false
}
} }
}, },
"line": { "line": {

View File

@ -104,4 +104,8 @@ export class ApexOptionsBuilder {
legend(legend) { legend(legend) {
return this.setOption(["legend", "show"], legend) return this.setOption(["legend", "show"], legend)
} }
stacked(stacked) {
return this.setOption(["chart", "stacked"], stacked)
}
} }

View File

@ -18,6 +18,7 @@
export let dataLabels export let dataLabels
export let animate export let animate
export let legend export let legend
export let stacked
let data let data
$: options = getChartOptions(data) $: options = getChartOptions(data)
@ -43,6 +44,7 @@
.dataLabels(dataLabels) .dataLabels(dataLabels)
.animate(animate) .animate(animate)
.legend(legend) .legend(legend)
.stacked(stacked)
// Add data if valid datasource // Add data if valid datasource
if (rows && rows.length) { if (rows && rows.length) {