Back

render

This method triggers a redraw for all chart elements.Note, this does not update elements for new data. Use updateData() in that case.

Try the example below. Click the STOP button directly while the chart is animating. And click the RENDER button to redraw the chart.

myChart.render()

Parameter
undefined

Samples

Example - Render

app.LoadPlugin( "ChartJS" );

function OnStart() {
    chart = app.LoadChartJS()
    
    lay = app.CreateLayout("Linear", "FillXY, VCenter")
    lay.SetBackColor("#ffffff")

        data = {
            labels: ["Jan", "Feb", "Mar", "Apr", "May"],
            datasets: [{
                data: [50, 50, 30, 15, 30],
                backgroundColor: ["#f44336", "#e91e63", "#9c27b0", "#3f51b5", "#009688"],
                borderWidth: 4
            }]
        }

        doughnutChart = chart.CreateChart(data, "pie", 0.95, 0.4)
        lay.AddChild(doughnutChart)

        btn = app.CreateButton("STOP", 0.4)
        btn.SetMargins(0, 0.1, 0, 0)
        lay.AddChild(btn)
        btn.SetOnTouch(function() {
            doughnutChart.stop()
        });

        btn = app.CreateButton("RENDER", 0.4)
        btn.SetMargins(0, 0.025, 0, 0)
        lay.AddChild(btn)
        btn.SetOnTouch(function() {
            doughnutChart.render()
        })

    app.AddLayout( lay )
}
Copy Run