You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check this if you would like to implement a PR, we are more than happy to help you go through the process.
Current and expected behavior
Issue Title: Unable to Assign 'position' Property in Chart.js Options
Issue Description:
When attempting to add the 'position' property as per the Chart.js documentation, it successfully produces the desired output. However, it results in a type error in the options object when passing it to the Bar component from react-chartjs-2.
The issue seems to be related to conflicting types for the 'position' property within the plugins.legend object.
The error message suggests that 'position' is expected to be of type "bottom" | "center" | "left" | "top" | "right" but is being assigned a string value.
This might be related to custom type definitions for these values.
Expected Behavior:
The code should allow the 'position' property to be set in the plugins.legend object without type errors, in accordance with the Chart.js documentation.
Reproduction
running the above code to create a sample react app in nextjs with ts reproduces the issue.
chart.js version
4.4.0
react-chartjs-2 version
5.2.0
Possible solution
constoptions={// ... (other options)plugins: {tooltip: {// ... (other tooltip options)},legend: {labels: {usePointStyle: true,padding: 20,},position: "bottom"as"bottom",// Type assertion to specify the typealign: "end"as"end",//Type assertion to specify the type},},};
this works . so I am guessing that instead of a string, "bottom","end" ..etc are defined as types of their own . correcting the type definitions will be enough (i think ) .
I'd be happy to do the same with some guidance (kinda new to this ) thanks :)
The text was updated successfully, but these errors were encountered:
Would you like to work on a fix?
Current and expected behavior
Issue Title: Unable to Assign 'position' Property in Chart.js Options
Issue Description:
When attempting to add the 'position' property as per the Chart.js documentation, it successfully produces the desired output. However, it results in a type error in the options object when passing it to the
Bar
component fromreact-chartjs-2
.Code:
Error Message:
Notes:
plugins.legend
object."bottom" | "center" | "left" | "top" | "right"
but is being assigned a string value.Expected Behavior:
The code should allow the 'position' property to be set in the
plugins.legend
object without type errors, in accordance with the Chart.js documentation.Reproduction
running the above code to create a sample react app in nextjs with ts reproduces the issue.
chart.js version
4.4.0
react-chartjs-2 version
5.2.0
Possible solution
this works . so I am guessing that instead of a string, "bottom","end" ..etc are defined as types of their own . correcting the type definitions will be enough (i think ) .
I'd be happy to do the same with some guidance (kinda new to this ) thanks :)
The text was updated successfully, but these errors were encountered: