Home > Web Front-end > HTML Tutorial > 【】How to display the legend using Chart.js drawing? _html/css_WEB-ITnose

【】How to display the legend using Chart.js drawing? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:45:11
Original
932 people have browsed it

As shown in the picture, now that Chart.js is used to draw a pie chart or bar chart, how can I display the corresponding legend next to it?


Reply to discussion (solution)

var myChart = new Chart(ctx).Pie(data, options)var legend = myChart.generateLegend();
Copy after login


legend is the HTML code generated by the template, which can be set It is the innerHTML of a certain element and then displayed

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template