plugins.legend.align are incompatible types
See original GitHub issueExpected Behavior
I shouldn’t be seeing any errors
Current Behavior
TypeScript is complaining that the type of align should be ‘start’, ‘center’ or ‘end’ and not a string. In the documentation, the type of align is string
Possible Solution
export interface LegendOptions<TType extends ChartType> {
....
/**
* Alignment of the legend.
* @default 'center'
*/
align: 'start' | 'center' | 'end';
}
If I change align to a type of string. The TypeScript error goes away but I shouldn’t be doing this from my end.
Steps to Reproduce
Make sure you are using TypeScript in your project, use any of the chart, and try to align the label.
Environment
- Chart.js version: 3.6.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
plugins.legend.align are incompatible types typescript chartjs
The alignment works fine, I am getting the desired result but typescript is complaining that the type of align should be 'start', 'center'...
Read more >plugins.legend.align are incompatible types typescript chartjs ...
Issue seems to be within the react-chartjs-2 lib. If you switch to the barebone version of chart.js you wont have this ...
Read more >chartist-plugin-legend examples
Sets the position of the legend element. top , bottom or any DOM2 Element are currently accepted. If a DOM Element is given,...
Read more >3.x Migration Guide - Chart.js
horizontalBar chart type was removed. ... renamed to tooltip to match the plugin name; legend , title and tooltip namespaces were moved from ......
Read more >Legend Toggling - Ultimate WordPress Plugins by Supsystic
Toggling option is compatible with all types of diagrams except Bubble: Area Chart; Line Chart; Pie Chart ... Legend Position – choose a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It seems to be a
react-chartjs-2
issue since if you just use barebone chart.js in typescript it doesnt throw an error unless you put a wrong value in there.React TS: https://codesandbox.io/s/goofy-curie-eyxrr?file=/src/App.tsx Angular TS: https://codesandbox.io/s/strange-almeida-f5hbz?file=/src/app/app.component.ts
I’m still running into this same problem on version 4.3.1