Update linear x axis ticks.stepsize #10437
Unanswered
LechoDecho
asked this question in
Q&A
Replies: 1 comment
-
I guess you are adjusting your original object, this won't be reflected in the chart. You need to update the options within the chart itself and then it works fine: const options = {
type: 'line',
data: {
labels: [1, 2, 3, 4, 5, 6],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1
},
{
label: '# of Points',
data: [7, 11, 5, 8, 3, 7],
borderWidth: 1
}
]
},
options: {
scales: {
x: {
type: 'linear',
ticks: {
stepSize: 2
}
}
}
}
}
const ctx = document.getElementById('chartJSContainer').getContext('2d');
const c = new Chart(ctx, options);
c.options.scales.x.ticks.stepSize = 3;
c.update(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How do i update my linear x axis in a bar chart?
This is my configuration for the axis
x: { position: 'bottom', display: true, offset: false, min: 0, max: this.maximumAllowance, type: 'linear', beginAtZero: true, ticks: { stepSize: this.chartStepSize } }
When updating the ticks object and calling chart.update() nothing happens.
Beta Was this translation helpful? Give feedback.
All reactions