Chartjs-How do you set up a chart.js scatter line chart through angular-chart.js?

0👍

I think you’re close. I think the only thing you need to do is to change your options and make a few minor modifications (it took a while for me to get it to work; originally, I tried what you had posted):

In your .js file:

$scope.data = [{
    x: -10,
    y: 0
}, {
    x: 0,
    y: 10
}, {
    x: 10,
    y: 5
}];

// The angular-chart directive will use this as the label
$scope.series = ['Scatter Dataset'];

$scope.options = {
    scales: {
        xAxes: [{
            type: 'linear',
            position: 'bottom'
        }]
    }
};

And then, in your html file:

<canvas class="chart chart-line"
        chart-data="data"
        chart-series="series"
        chart-options="options">
</canvas>

Leave a comment