I have 'mode' column on my database and I want to show mode on my chart but my chart doesn't show. I want to show date-mode on chart. I changed my code's type like type: 'category' from 'linear' and my chart showed me battery and date value on y-axis. How can I solve that problem?
This is my chart's JavaScript code:
const config = {
type: 'line',
data: {
datasets: [{
data: <%=lineData%>,
borderColor: 'rgb(244, 208, 63)',
label: "battery voltage",
yAxisID: 'yl',
}, {
data: <%=lineData2%>,
borderColor: 'rgb(118, 215, 196)',
label: "battery capacity",
yAxisID: 'yr',
}, {
data: <%=lineData3%>,
borderColor: 'rgb(231, 76, 60)',
label: "pv_input_voltage",
yAxisID: 'yr2',
}, {
data: <%=lineData4%>,
borderColor: 'rgb(100, 149, 237)',
label: "temperature",
yAxisID: 'yr3',
}, {
data: <%=lineData5%>,
borderColor: 'rgb(0, 255, 0)',
label: "humidity",
yAxisID: 'yr4',
}, {
data: <%=lineData6%>,
borderColor: 'rgb(255, 0, 255)',
label: "mode",
yAxisID: 'yr5',
}]
},
options: {
responsive: true,
interaction: {
mode: 'index',
intersect: false,
},
stacked: false,
plugins: {
title: {
display: true
}
},
scales: {
yl: {
type: 'linear',
display: true,
position: 'left',
},
yr: {
type: 'linear',
display: true,
position: 'right',
},
yr2: {
type: 'linear',
display: true,
position: 'right',
},
yr3: {
type: 'linear',
display: true,
position: 'right',
},
yr4: {
type: 'linear',
display: true,
position: 'right',
},
yr5: {
type: 'category',
display: true,
position: 'right',
},
}
},
};