Closed gauravndabhade closed 4 years ago
I don't think we should support writting JavaScript in a Python string and then evaluate it in JS.
I guess one should define the javascript callback in javascript and then add it like that:
$.get('{% url "line_chart_json" %}', function (response) {
var ctx = $("#myChart").get(0).getContext("2d");
var options = response.options;
options.scales.yAxes[0].ticks.callback = function (value) { if (value % 1 === 0) { return value; } };
new Chart(ctx, {
type: 'line',
data: response.data,
options: options
});
});
I am trying to configure line chart options, for formatting y-axes tick values.
I have called
line_chart_json
in template.