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

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -