chartjs-plugin-stacked100 icon indicating copy to clipboard operation
chartjs-plugin-stacked100 copied to clipboard

multiple Y axis

Open olelis opened this issue 1 year ago • 4 comments

Hello,

it would be nice to have feature where you can select which scales should be used for stackings.

Case: I have some data that needs to be stacked (scale Y1), - they should be presented as bars. And I have some data that should be presented as line (scale Y2).

For example: https://www.chartjs.org/docs/latest/samples/other-charts/combo-bar-line.html

Currently, this plugin stacks all data, including ones that should not be stacked.

olelis avatar Apr 12 '23 11:04 olelis

Hello @olelis ,

Thank you for taking the time to share your suggestion with us. We appreciate your feedback and your desire to enhance our plugin's functionality.

We agree that the ability to select which scales should be used for stackings would be a useful feature for many users, and we will certainly consider adding it to our roadmap for future development. We understand the importance of this feature and will do our best to prioritize it in our development plan.

We also appreciate the example you provided and will use it as a reference as we continue to work on improving our plugin.

Thank you again for your contribution to our project. Please feel free to reach out to us if you have any further suggestions or feedback in the future. We aim to address this issue as soon as possible.

y-takey avatar Apr 13 '23 14:04 y-takey

@olelis Thank you for your request. :) We have added the axisId option, which allows you to stack only specific axes when there are multiple axes. We have released version 1.4.0 on npm, so please give it a try.

You can also see the sample in action in "Case-12, 13" on https://y-takey.github.io/chartjs-plugin-stacked100/

Please feel free to provide feedback if you notice anything.

y-takey avatar Apr 24 '23 09:04 y-takey

Hello @y-takey

can you give me an example how this should be used?

I have multiple datasets, each has "yAxisID": "y" One has "yAxisID": "y2" I have following in plugins: "stacked100": { "enable": true, "axisId": "y" },

However, some bars are not 100% because of data from y2 dataset.

olelis avatar Apr 28 '23 11:04 olelis

Hello @olelis

Here is the sample code: https://github.com/y-takey/chartjs-plugin-stacked100/blob/master/examples/demo/index.ts#L350-L389

Do you want to stack both axes? If so, is there any problem with removing the yAxisId from both datasets? and remove axisId from the plugin options.

y-takey avatar Apr 28 '23 14:04 y-takey