I've got two Y-axis in my line chart. One of the charts can show negative values between -1 and 1 (left axis). The other one has values from 0 to X (right axis). Problem is, that the left has the 0 point in the middle, the right axis shows 0 at the bottom.
Is there any fix to it? Some thing like set the negative max value as min value for the right axis would solve it. But I don't know how to perform this.
var ctx = document.getElementById('myChart');
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: dates,
datasets: [{
label: 'Sentiment',
yAxisID: 'left',
data: normalizedSentiment // contains from -1 to 1
}, {
label: 'Count',
yAxisID: 'right',
data: count // only positive
}]
},
options: {
scales: {
yAxes: [{
id: 'left',
type: 'linear',
position: 'left',
}, {
id: 'right',
type: 'linear',
position: 'right'
}]
}
}
});
I basically used this solution: https://stackoverflow.com/a/38094165/1193235