Merge branch 'feat-im-0607-xwk' into msb_test

msb_test
向文可 2 years ago
commit 7dc8ce6a1e

@ -68,9 +68,18 @@
}; };
watch(systemId, handleLoadOnline); watch(systemId, handleLoadOnline);
const charts = ref({});
window.addEventListener('resize', () =>
setTimeout(() => {
Object.entries(unref(charts)).forEach((entry) => {
entry[1].resize();
});
}, 100)
);
const handleChart = (selector, name, data) => { const handleChart = (selector, name, data) => {
const chart = echarts.init(document.querySelector(selector)); let chart = charts.value[selector];
window.addEventListener('resize', () => nextTick(() => chart.resize())); chart?.dispose();
chart = charts.value[selector] = echarts.init(document.querySelector(selector));
const option = { const option = {
gradientColor: ['#1DE7FF', '#249AFF', '#6F41FA', '#6F41FA'], gradientColor: ['#1DE7FF', '#249AFF', '#6F41FA', '#6F41FA'],
visualMap: [ visualMap: [
@ -88,18 +97,17 @@
grid: { grid: {
left: '0', left: '0',
right: '0', right: '0',
top: '5%', bottom: '30px',
bottom: '0', top: '60px',
containLabel: true, containLabel: true,
}, },
xAxis: [ xAxis: {
{
data: data.map((item) => item.label), data: data.map((item) => item.label),
}, },
], yAxis: {
yAxis: [{}], minInterval: 1,
series: [ },
{ series: {
type: 'line', type: 'line',
name, name,
showSymbol: false, showSymbol: false,
@ -118,7 +126,6 @@
}, },
data: data.map((item) => item.value), data: data.map((item) => item.value),
}, },
],
}; };
chart.setOption(option); chart.setOption(option);
}; };

Loading…
Cancel
Save