Chartjs-How can i add additional Data(Type) to chart.js

0👍

already found : between line 999 and 1023 in chart.js before drawing – i’ve added the line

id: ChartElements[0].id,

so the Data with the name ID is in the DOM avaiable.

1👍

As an alternative pass a JSON string as your label, then intercept to render. For example:

    var canvas = document.getElementById(id);
    var d = canvas.getContext("2d");
    var chart = new Chart(d).Pie(json, {
        segmentStrokeWidth: 1,
        tooltipTemplate: "<%=label%>", //default the label
        customTooltips: function (tooltip) {

            // Hide if no tooltip
            if (!tooltip) {
                return;
            }
            var tooltipObj = JSON.parse(tooltip.text);
            // etc

Leave a comment