Home Forums Chart Support Here is how to re-render a chart with jQuery

Here is how to re-render a chart with jQuery

Viewing 2 posts - 1 through 2 (of 2 total)
  • #25407

    I have been asking myself the question but found no answer, as there is no chart.render(); for the jQuery integration of CanvasJS.

    So I found a workaround :

    let chartContainer = $('#chartContainerId');
    let optn = chartContainer.CanvasJSChart().options;
    chartContainer.CanvasJSChart(optn);

    If you have any question regarding this feel free to ask me ! :)

    #25432

    @bakanarchie,

    In jQuery plugin, you can get reference to the chart object using $(“#chartContainer”).CanvasJSChart(). And you can update any of the options – like $("#chartContainer").CanvasJSChart().options.data[0].type = "column".

    However if you like to update chart-options and call chart.render(), as a first step you need to get chart reference as $("#chartContainer").CanvasJSChart(). Once you have reference to the chart, you can update the chart-options and call chart.render(). Please refer second example in jQuery integration page for a live example.


    Vishwas R
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.