Browse Source

fix:图表双y轴

master
guoapeng 3 days ago
parent
commit
fdc90a91d5
  1. 15
      src/components/home/LineChart.vue

15
src/components/home/LineChart.vue

@ -77,9 +77,16 @@ watch(
boundaryGap: false, boundaryGap: false,
data: newValue.data?.map(item => formatDateTime('HH:mm:ss', item.timestamp)), data: newValue.data?.map(item => formatDateTime('HH:mm:ss', item.timestamp)),
}, },
yAxis: {
type: 'value',
},
yAxis: [
{
type: 'value',
name: '温/湿度',
},
{
type: 'value',
name: 'H₂O₂浓度/相对饱和度',
},
],
series: [ series: [
{ {
name: '温度', name: '温度',
@ -109,6 +116,7 @@ watch(
data: newValue.data?.map(item => item.h2o2.toFixed(2)), data: newValue.data?.map(item => item.h2o2.toFixed(2)),
symbol: 'circle', symbol: 'circle',
symbolSize: 2, symbolSize: 2,
yAxisIndex: 1,
lineStyle: { lineStyle: {
color: '#ffd700', color: '#ffd700',
width: 1, width: 1,
@ -120,6 +128,7 @@ watch(
data: newValue.data?.map(item => item.rs.toFixed(2)), data: newValue.data?.map(item => item.rs.toFixed(2)),
symbol: 'circle', symbol: 'circle',
symbolSize: 2, symbolSize: 2,
yAxisIndex: 1,
lineStyle: { lineStyle: {
color: '#ff0000', color: '#ff0000',
width: 1, width: 1,

Loading…
Cancel
Save