1
This commit is contained in:
parent
d56efd1c2f
commit
f9fc8e8c66
@ -17,17 +17,14 @@ const hourData = ref([
|
|||||||
// { lineName: "005", hour: "00:50", num: 50 },
|
// { lineName: "005", hour: "00:50", num: 50 },
|
||||||
]);
|
]);
|
||||||
store.$subscribe((mutation, state) => {
|
store.$subscribe((mutation, state) => {
|
||||||
// console.log("[HourChart] =======>", state.data2.lineHourList?.length);
|
|
||||||
if (
|
if (
|
||||||
state.data2.lineHourList == undefined ||
|
state.data2.lineHourList == undefined ||
|
||||||
state.data2.lineHourList?.length == 0
|
state.data2.lineHourList?.length == 0
|
||||||
) {
|
) {
|
||||||
// console.log("[HourChart] 清除数据");
|
|
||||||
hourData.value.splice(0);
|
hourData.value.splice(0);
|
||||||
if (chart.value) chart.value.dispose();
|
if (chart.value) chart.value.dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// console.log("[HourChart] ===> 有数据: ", state.data2.lineHourList);
|
|
||||||
hourData.value = (state.data2?.lineHourList ?? [
|
hourData.value = (state.data2?.lineHourList ?? [
|
||||||
// { lineName: '001', hour: '00:00', num: 10 },
|
// { lineName: '001', hour: '00:00', num: 10 },
|
||||||
// { lineName: '002', hour: '00:20', num: 20 },
|
// { lineName: '002', hour: '00:20', num: 20 },
|
||||||
@ -36,8 +33,8 @@ store.$subscribe((mutation, state) => {
|
|||||||
// { lineName: '005', hour: '00:50', num: 50 },
|
// { lineName: '005', hour: '00:50', num: 50 },
|
||||||
]).map((item, index) => ({
|
]).map((item, index) => ({
|
||||||
id: `${item.lineName}_${index}`,
|
id: `${item.lineName}_${index}`,
|
||||||
hour: item.hour || `${index}`.padStart(2, "0"),
|
hour: item.hour || '__',
|
||||||
data: item.num || Math.floor(Math.random() * 100),
|
data: item.num || 0,
|
||||||
}));
|
}));
|
||||||
setupChart();
|
setupChart();
|
||||||
});
|
});
|
||||||
@ -46,7 +43,6 @@ function setupChart() {
|
|||||||
if (chart.value) chart.value.dispose();
|
if (chart.value) chart.value.dispose();
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
chart.value = echarts.init(chartChart.value);
|
chart.value = echarts.init(chartChart.value);
|
||||||
// console.log("[HourChart] ===> 设置chart: ", chart.value, hourData.value.map((item) => item.hour), hourData.value.map((item) => item.data));
|
|
||||||
chartSetup(
|
chartSetup(
|
||||||
chart.value,
|
chart.value,
|
||||||
hourData.value.map((item) => item.hour),
|
hourData.value.map((item) => item.hour),
|
||||||
|
@ -30,8 +30,8 @@ store.$subscribe((mutation, state) => {
|
|||||||
}
|
}
|
||||||
hourData.value = (state.data2?.lineHourList ?? []).map((item, index) => ({
|
hourData.value = (state.data2?.lineHourList ?? []).map((item, index) => ({
|
||||||
id: `${item.lineName}_${index}`,
|
id: `${item.lineName}_${index}`,
|
||||||
hour: item.hour || `${index}`.padStart(2, "0"),
|
hour: item.hour || `__`,
|
||||||
data: item.num || Math.floor(Math.random() * 100),
|
data: item.num || 0,
|
||||||
}));
|
}));
|
||||||
setupChart();
|
setupChart();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user