Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 解决概览页折线图选择失败的问题 #4656

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions frontend/src/components/v-charts/components/Line.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ const seriesStyle = [

function initChart() {
let itemChart = echarts?.getInstanceByDom(document.getElementById(props.id) as HTMLElement);
// 如果不存在,就进行初始化
const optionItem = itemChart?.getOption();
const itemSelect = optionItem?.legend;
if (itemChart == null) {
itemChart = echarts.init(document.getElementById(props.id) as HTMLElement);
}
Expand All @@ -109,18 +110,16 @@ function initChart() {
yAxis.push({
splitLine: {
show: true,
//分隔辅助线
lineStyle: {
type: 'dashed', //线的类型 虚线0
opacity: theme === 'dark' ? 0.1 : 1, //透明度
type: 'dashed',
opacity: theme === 'dark' ? 0.1 : 1,
},
},
...item,
});
});
}

// 把配置和数据放这里
const option = {
title: [
{
Expand Down Expand Up @@ -168,7 +167,7 @@ function initChart() {
},
},
grid: props.option.grid || { left: '7%', right: '7%', bottom: '20%' },
legend: {
legend: itemSelect || {
right: 10,
itemWidth: 8,
textStyle: {
Expand Down
Loading