The chart contains data positioned with respect to two Y-axes, y
and y2
.
This is how it looks like:
So, the red line is generated with one y-axis and the bars with the other.
The value of the red line is always positive in this case (the value is 13.91 but the line looks like it is around -5) but because the axes are not aligned it doesn't look well.
The code doing it:
const chartDataConfig = {
data: {
columns: series.columns,
},
...
axis: {
x: {
label: {
text: context.labels.xLabel,
},
},
y: {
label: {
text: context.labels.yLabel,
},
},
y2: {
label: {
text: context.labels.y2Label,
},
},
},
...
};
and
function getDefaultConfig() {
return {
data: {
x: "x",
},
...
axis: {
x: {
...
},
y: {
label: {
position: "outer-middle"
},
},
y2: {
show: true,
label: {
position: "outer-middle"
},
},
},
bindto: "#my-chart"
};
}
Is there any way to align these two axes in order to start from same point?