peopledoc / django-chartjs

Django Class Based Views to generate Ajax charts js parameters.
Other
407 stars 112 forks source link

Allow users to specify chart options in the view #45

Closed cjohnson318 closed 5 years ago

cjohnson318 commented 5 years ago

Allow users to provide chart option in the view rather than the template. Then, in the template, write

$.get('{% url 'line_chart_with_options' %}', function (data) {
    var ctx = $("#lineChartWithOptions").get(0).getContext("2d");
    new Chart(ctx, {
        type: 'line',
        data: data.data,
        options: data.options,
    });
});
Natim commented 5 years ago

Released in https://github.com/peopledoc/django-chartjs/releases/tag/1.5.0