Closed sytheveenje closed 2 years ago
I'm sorry, I now see in the docs that there is an option for stacked()
on the columnchart. Do you have an example of how to use it @asantibanez ?
Hello, I am also looking for the stacked chart. I tried in many ways without success. @asantibanez
@sytheveenje Eureka! I already found it
$graficoStacked = $assignments->get()->groupBy('type')
->reduce(function ($multiColumnChartModel, $data) {
$type = $data->first()->type;
return $multiColumnChartModel
->addSeriesColumn($type, 1, $data->count('type'));
},
LivewireCharts::multiColumnChartModel()
->setHorizontal(false)
->multiColumn()
->setOpacity(0.80)
->setDataLabelsEnabled(true)
->withoutLegend()
->setTitle('Type Problem')
->withLegend()
->withGrid()
->stacked()
->withOnColumnClickEventName('onColumnClick')
->setXAxisCategories(['2019', '2020', '2021', '2022', '2022'])
Glad you found it @mafalda2007
Have you seen the demo repo @sytheveenje ? I've added some examples there
Summary
A column chart with stacked columns like Apex has: https://apexcharts.com/javascript-chart-demos/column-charts/stacked/
Proposal
Should work like this: https://apexcharts.com/javascript-chart-demos/column-charts/stacked/
I guess you should use it like this:
Additional Notes