mariusmuntean / ChartJs.Blazor

Brings Chart.js charts to Blazor
https://www.iheartblazor.com/
MIT License
676 stars 151 forks source link

Support for stacked line charts #103

Open dfederm opened 4 years ago

dfederm commented 4 years ago

Describe the feature request

Add support for a stacked line chart

Which charts does this feature request apply to?

Line/Time

Describe the solution you'd like

The ability to set stacked: true for the y axis

JavaScript equivalent

var stackedLine = new Chart(ctx, {
    type: 'line',
    data: data,
    options: {
        scales: {
            yAxes: [{
                stacked: true
            }]
        }
    }
});

Describe alternatives you've considered

See first comment below

Additional context

Docs are at the very bottom of this page: https://www.chartjs.org/docs/latest/charts/line.html

Joelius300 commented 4 years ago

Thanks for contacting us. I appreciate the well-written issue :)

We should add this feature, nothing to debate there.

How to implement:

Workaround / alternative

Just create a sub class of the axis you want to use e.g. StackedLinearCartesianAxis : LinearCartesianAxis. Then add the Stacked property (type bool) to your class and use that instead of the original one when creating your config.
Let me know if that works as a temporary solution @dfederm.

dfederm commented 4 years ago

@Joelius300 thanks that workaround worked great. I didn't realize these objects were just straight up serialized and used directly as the js config objects.