Can you disable the animation of a Charts.js chart?

1
  

How to disable an animation of a Charts.js chart?   I'm putting together a graph that updates every 300 milliseconds via ajax, but the Charts.js chart animation disrupts the view.

the chart assembly code:

function montaGrafico(report_one, report_two, report_three, report_four, datas) {
var ctx = document.getElementById('myChart2').getContext('2d');
var chart = new Chart(ctx, {
    type: 'line',
    // The data for our dataset
    data: {
        labels: [datas[4], datas[3], datas[2], datas[1], datas[0]],
        datasets: [
            {
                label: "Linha 1",
                backgroundColor: 'rgba(0, 140, 204, 0.5)',
                borderColor: 'rgba(0, 140, 204, 0.6)',
                borderWidth: 2,
                data: [report_one[4], report_one[3], report_one[2], report_one[1], report_one[0]]
            },
            {
                label: "Linha 2",
                backgroundColor: 'rgba(255, 150, 102, 0.5)',
                borderColor: 'rgba(255, 150, 102, 0.6)',
                borderWidth: 2,
                data: [report_two[4], report_two[3], report_two[2], report_two[1], report_two[0]]
            },
            {
                label: "Linha 3",
                backgroundColor: 'rgba(248, 255, 33, 0.5)',
                borderColor: 'rgba(248, 255, 33, 0.6)',
                borderWidth: 2,
                data: [report_three[4], report_three[3], report_three[2], report_three[1], report_three[0]]
            },
            {
                label: "Linha 4",
                backgroundColor: 'rgba(112, 204, 124, 0.5)',
                borderColor: 'rgba(112, 204, 124, 0.6)',
                borderWidth: 2,
                data: [report_four[4], report_four[3], report_four[2], report_four[2], report_four[0]]
            }
        ]
    },
    // Configuration options go here
    options: {}
});

}

    
asked by anonymous 14.08.2017 / 15:22

1 answer

3

To disable animations, go to the following settings in the options:

options: {
   animation: false
}
    
14.08.2017 / 15:30