Bar/Line Chart - Offset Line #10255
Unanswered
parkerhillius
asked this question in
Q&A
Replies: 3 comments
-
You can use a second X axis on which you set the const options = {
type: 'bar',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
backgroundColor: 'orange',
order: 1
},
{
label: '# of Points',
data: [7, 11, 5, 8, 3, 7],
borderColor: 'pink',
type: 'line',
xAxisID: 'x2',
order: 0
}
]
},
options: {
scales: {
x: {},
x2: {
display: false,
offset: false
}
}
}
}
const ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options); |
Beta Was this translation helpful? Give feedback.
0 replies
-
@LeeLenaleee Thanks! That's close. Why do the line points not consistently hit the grid lines? They drift further and further right...? |
Beta Was this translation helpful? Give feedback.
0 replies
-
@parkerhillius 7 points vs 8 grid lines |
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.
-
Feature Proposal
I would like to be able to shift the black line below, from having the point in the middle to the right:

Possible Implementation
No response
Beta Was this translation helpful? Give feedback.
All reactions