CodeSandbox
How to move that legend to the left? I have tried to use options:{legend:{position: 'left'}}
.
Goal:
position: left
shifts the chart to the right what is not good for me:
Click the chart, and then click the Chart Layout tab. To change the position of the legend, under Labels, click Legend, and then click the legend position that you want. To change the format of the legend, under Labels, click Legend, click Legend Options, and then make the format changes that you want.
To make this behave the same as standard Chart. js charts, the function onLegendClicked is invoked when a mouse click occurs on a legend label. This function toggles the hidden state of individual datasets and changes label text style between normal and strike-through.
The chart legend displays data about the datasets that are appearing on the chart.
With ChartJS 3, you can change the color of the labels by setting the scales. x. ticks. color and scales.
Your code is correct and you will be able to align the legend as following in the future:
legend: {
position: "top",
align: "start"
}
But the feature is currently not implemented at the current time (2019-03-30). The feature is already merged and will be released with version 2.9. You either have to wait until version 2.9 will be released or use a development release, which is not recommended as they should only be used for testing purposes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With