reactchartjs / react-chartjs-2

React components for Chart.js, the most popular charting library
https://react-chartjs-2.js.org
MIT License
6.57k stars 2.37k forks source link

"Bar" type definition does not allow for multi-type charts #846

Closed Sheldonfrith closed 2 years ago

Sheldonfrith commented 2 years ago

Using typescript.

Reproduce:

Simply try out the official "MultyType" chart example in typescript.

Problem:

The "data" object which you have to give to create a Multi-Type chart requires you to specify a "type" other than "bar", (Click here to see the offending line.) but the import {Bar} from 'react-chartjs-2' type does not allow for any other value for type besides "bar".

Workaround:

Right now I've just set //@ts-expect-error for the offending line type: 'line', which solves the problem.

A minor issue, but also a very quick fix so I thought it was worth posting.

dangreen commented 2 years ago

@Sheldonfrith Hi. For multitype charts please use Chart component. Example

Sheldonfrith commented 2 years ago

Thank you, in that case the example I referenced above needs to be updated.