Rendering a chart with multiple y axes will display both datasets on the larger scale. I'm trying multiple ways in the chart options to tell the second y axis to use another scale. Expected behavior is the second dataset to render on the second scale.
I've forked the vue-chartjs repo example to share
https://stackblitz.com/edit/github-xchppm?file=src%2FchartConfig.ts
If your y-axis scale objects are y: {...}
and y1: {...}
, then y
and y1
are your y-axis IDs.
These IDs are added to the appropriate dataset options as yAxisID
, (your code has a typo in yAxisId
where the 'd' should be uppercase)
datasets: [
{
yAxisID: 'y',
label: 'Data One',
backgroundColor: '#f87979',
data: [6027, 5369, 5739, 6123, 6345, 6901, 5802],
},
{
yAxisID: 'y1',
label: 'Data Two',
data: [0.004, 0.006, 0.002, 0.008, 0.001, 0.003, 0.005],
},
],