How to add labels into Chart.js canvas plugin?

I'm using the awesome plugin [**Chart.js**][1], and I'm trying to find the way of display labels within each percentage. So I googled it, and I found this pull: https://github.com/nnnick/Chart.js/pull/35 I did a simple fiddle to test it, but doesn't works: **http://jsfiddle.net/marianico2/7ktug/1/** This is the content: **HTML** **JS** $(document).ready(function () { var pieData = [{ value: 30, color: "#F38630", label: 'HELLO', labelColor: 'black', labelFontSize: '16' }, { value: 50, color: "#E0E4CC" }, { value: 100, color: "#69D2E7" }]; var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Pie(pieData, { labelAlign: 'center' }); }); ---------- I'm afraid there is no information about this in the [documentation][2]. Also I'd like to know how to display a label for each portion, but outside the chart. Linked by a line. As do the charts of [highcharts.js][3]. By the way, I'd be glad if you recommend me an html5 chart alternative which includes the options I said above. I've heard about the [flot][4] plugin, but I'm afraid does not support animations... If you need more info, let me know and I'll edit the post. [1]: http://www.chartjs.org/ [2]: http://www.chartjs.org/docs/ [3]: http://www.highcharts.com/demo/pie-basic [4]: http://www.flotcharts.org/flot/examples/series-pie/index.html
From that pull you posted github.com/Regaddi/Chart.js - It appears it is not in the master branch but that guys fork.

以上就是How to add labels into Chart.js canvas plugin?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏