Reputation: 1527
In chart js is it possible to have each bar exactly under each scatter dot? in below images the first one correct and second one is not.
You can check demo here demo
any help please?
Upvotes: 0
Views: 583
Reputation: 26190
You can do it on a per-case basis. The problem is that both charts have different xAxis
type (linear and category). Also the yAxis
labels are of different length.
To solve the problem on the chart from your demo, you can change the options from your scatter chart as follows.
- Define option
scales.xAxes.offset: true
to make it correspond to the default value defined for bar charts.- Add
min
andmax
toscales.xAxes.ticks
to horizontally adjust the points with the bars.
scales: {
xAxes: [{
offset: true,
gridLines: {
display: false
},
ticks: {
min: -0.2,
max: 3.3,
Please have a look at your amended Demo.
Upvotes: 1