When I attempt to call generateLegened() on my chart:
var ctx = $("#chart").get(0).getContext("2d");
var ctxOptions = {
responsive: false,
legendTemplate: "<ul>LEGEND</ul>"
};
var chart = new Chart(ctx);
chart.Line(data, ctxOptions);
var legend = chart.generateLegend();
it errors with:
Uncaught TypeError: undefined is not a function
on the chart.GenerateLegend() line.
I'm completely confused as to what the problem it. The function is clearly in the .js file being included.
I'm using this script: //cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.1/Chart.min.js
Is this a bug, or can someone tell me what I'm doing wrong?
Thanks
Interestingly, if I change the code as follows:
var chart = new Chart(ctx).Line(data, ctxOptions);
the legend works as expected!?
A bug with chart.js?
Try
legendTemplate: function(data) { return "<ul>LEGEND</ul>"; }
instead. Seems like some bug in the chart.js.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With