Displaying custom dataset properties in tooltip in chart.js -
what easiest way possible display custom properties in pie chart tooltip?
var piedata = [ { value: 40, color:"#f7464a", highlight: "#ff5a5e", label: "label 1", description: "this description label 1" }, { value: 60, color: "#46bfbd", highlight: "#5ad3d1", label: "label 2", description: "this description label 2" } ]; var options = { tooltiptemplate: "<%= label %> - <%= description %>" }; window.onload = function(){ var ctx = document.getelementbyid("chart-area").getcontext("2d"); window.mypie = new chart(ctx).doughnut(piedata, options); };
i tried adding "decription" property , printing it, without luck. gives me error saying description not defined. saw there custom tooltip functionality, seemed lot of work trivial. there easier way?
you should go:
var options = { tooltiptemplate: "<%= label + '-' + %> <%= description %>" };
Comments
Post a Comment