Issues with axes and gridlines #9836
-
Good morning, I'm trying to figure out how to hide my gridlines and move my axis label to the other side of the chart. Here's my configuration: {
type: 'line',
data: {
labels: ['Gravity', 'Temperature'],
datasets: [{
label: 'Gravity',
yAxisID: 'Gravity',
data: // my data is here
borderColor: 'blue'
},
{
label: 'Temperature',
yAxisID: 'Temperature',
data: // my other data is here
borderColor: 'red',
}]
},
options: {
scales: {
xAxis: {
type: 'time',
min: new_tilt_data.datapoints[0].timestamp.toDate(),
suggestedMax: new_tilt_data.datapoints[new_tilt_data.datapoints.length - 1].timestamp.toDate(),
},
yAxes: [{
id: 'Gravity',
type: 'linear',
display: true,
position: 'right',
color: 'blue',
suggestedMin: min_gravity - gravity_unit,
suggestedMax: max_gravity + gravity_unit,
gridLines: {
display: false,
}
}, {
id: 'Temperature',
type: 'linear',
display: true,
position: 'left',
color: 'red',
suggestedMin: min_temp - temp_unit,
suggestedMax: max_temp + temp_unit,
gridLines: {
display: false,
}
}]
}
}
} This is the result: How do I get rid of the gridlines and move one of the axis scales to the other side of the graph? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You are mixing v2 and v3 syntax, for all changes please read the migration guide. Scales are no arrays anymore but each scale is its own object where the key is the scale ID, also namespace scales: {
x: {},
Gravity: {
position: 'right',
grid: {
display: false
}
},
Temperature: {
// Same things for other axis
}
} |
Beta Was this translation helpful? Give feedback.
-
Good gravy; no wonder nothing I try seems to have any effect. Thank you! |
Beta Was this translation helpful? Give feedback.
You are mixing v2 and v3 syntax, for all changes please read the migration guide.
Scales are no arrays anymore but each scale is its own object where the key is the scale ID, also namespace
gridLines
has been changed togrid
.