How Align the Legend Items in Chart.js 2?
See original GitHub issueI just need to align the Chart Legend so it don’t look too messy as the default shows, here is an example what I’m trying to achieve:
Please give some code suggestions: https://jsfiddle.net/holp/68wf75r8/
new Chart(document.getElementById("field-0"), { type: 'pie', data: { labels: ["Chat", "Prospeção", "Whatsapp", "Trial", "Site", "Telefone", "E-mail", "Evento"], datasets: [{ data: [700, 400, 200, 150, 80, 50, 20, 10], borderWidth: 2, hoverBorderWidth: 10, backgroundColor: pieColors, hoverBackgroundColor: pieColors, hoverBorderColor: pieColors, borderColor: pieColors }] }, options: { legend: { labels: { padding: 20 } } } });
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:22 (3 by maintainers)
Top Results From Across the Web
Legend | Chart.js
Legend. The chart legend displays data about the datasets that are appearing on the chart. # Configuration options.
Read more >Chart.js legend alignment left side - Stack Overflow
Your code is correct and you will be able to align the legend as following in the future: legend: { position: "top", align:...
Read more >Legend Attribute - Salesforce Labs Github Organization
Attribute name Type Default
display boolean true
position string 'top'
align string 'center'
Read more >Tutorial on Chart Legend | CanvasJS JavaScript Charts
When we want Legend to appear for a dataSeries, we set showInLegend to true in that dataSeries, this makes the dataSeries to appear...
Read more >[Solved]-How to align Chart JS "legend" on right-center-Chart.js
Chart js. · How to align Chart. · Chart js: how can I align the legend and the title · Angular-ChartJS align legend...
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 Free
Top 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
Where?
this http://stackoverflow.com/a/42957884/1779106 solved my alignment issue. I was changing labels alignment from bottom center to bottom left:
Really don’t know who would actually want it the original way 😦