Combo Bar/Line Chart
Would you like to work on this feature?
- [ ] Check this if you would like to implement a PR, we are more than happy to help you go through the process.
What problem are you trying to solve?
https://www.chartjs.org/docs/latest/samples/other-charts/combo-bar-line.html
It looks like the type signatures for a bar chart don't support this and I don't see an example at https://react-chartjs-2.js.org/examples
Describe the solution you'd like
Update type signatures to support mixed bar/line chart types or an example page in the documentation demonstrating how to make one.
Describe alternatives you've considered
No response
Documentation, Adoption, Migration Strategy
No response
Thanks for opening this! I think this would be a great improvement for both developer experience and documentation.
So my Proposed Solution:
-> TypeScript Update: Adjust the type definitions so the datasets array can accept multiple chart types, e.g. (ChartDataset<'bar'> | ChartDataset<'line'>)[]. This would remove the need for casting to any when mixing datasets. -> Docs Example: Add a dedicated example in the docs showing a mixed bar/line chart using <Chart type="bar" /> with one dataset using type: "bar" and another using type: "line". This would make it much clearer that combo charts are supported.
why this help ? -> Brings react-chartjs-2 closer to parity with Chart.js functionality. -> Makes it easier for developers to build mixed charts without type errors. -> Reduces friction for TypeScript users and avoids common workarounds.
No migration or breaking changes needed , just a type enhancement and a docs example to guide usage.
I’d be happy to work on a PR for this if it aligns with the project’s direction.