Is it possible to change chartjs line value in one column ? No transition

1๐Ÿ‘

โœ…

If you use a scatter plot, it can be done.

See example below:

var scatterChart = new Chart(
    document.getElementById('c').getContext('2d'), 
    
    {
    type: 'scatter',
    data: {
        datasets: [{
            label: 'Scatter Dataset',
            data: [{
                x: 0,
                y: 0
            }, {
                x: 1,
                y: 1
            }, {
                x: 2,
                y: 2
            }, {
                x: 2,
                y: 1
            }, {
                x: 3,
                y: 1
            }
            ],
            tension: 0,
            showLine: true,
            fill:false
        }]
    },
    options: {
        scales: {
            xAxes: [{
                type: 'linear',
                position: 'top'
            }]
        }
    }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script>
<canvas id="c" width="200" height="200"></canvas>

Leave a comment