|
|
@ -1,145 +1,144 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div :style="styleObj">
|
|
|
|
<div :style="styleObj">
|
|
|
|
<v-chart :options="options"
|
|
|
|
<v-chart :options="options" autoresize />
|
|
|
|
autoresize />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: 'WidgetLinechart',
|
|
|
|
name: "WidgetLinechart",
|
|
|
|
components: {},
|
|
|
|
components: {},
|
|
|
|
props: {
|
|
|
|
props: {
|
|
|
|
value: Object,
|
|
|
|
value: Object,
|
|
|
|
ispreview: Boolean,
|
|
|
|
ispreview: Boolean
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
options: {
|
|
|
|
options: {
|
|
|
|
grid: {},
|
|
|
|
grid: {},
|
|
|
|
color: [],
|
|
|
|
color: [],
|
|
|
|
title: {
|
|
|
|
title: {
|
|
|
|
text: '',
|
|
|
|
text: "",
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: '#fff',
|
|
|
|
color: "#fff"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
tooltip: {
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'item',
|
|
|
|
trigger: "item",
|
|
|
|
formatter: '{a} <br/>{b} : {c}%',
|
|
|
|
formatter: "{a} <br/>{b} : {c}%"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
legend: {
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: '#fff',
|
|
|
|
color: "#fff"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
xAxis: {
|
|
|
|
type: 'category',
|
|
|
|
type: "category",
|
|
|
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
|
|
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: '#fff',
|
|
|
|
color: "#fff"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
yAxis: {
|
|
|
|
type: 'value',
|
|
|
|
type: "value",
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: '#fff',
|
|
|
|
color: "#fff"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
series: [
|
|
|
|
series: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
data: [],
|
|
|
|
data: [],
|
|
|
|
type: 'line',
|
|
|
|
type: "line"
|
|
|
|
},
|
|
|
|
}
|
|
|
|
],
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
optionsStyle: {}, // 样式
|
|
|
|
optionsStyle: {}, // 样式
|
|
|
|
optionsData: {}, // 数据
|
|
|
|
optionsData: {}, // 数据
|
|
|
|
optionsCollapse: {}, // 图标属性
|
|
|
|
optionsCollapse: {}, // 图标属性
|
|
|
|
optionsSetup: {},
|
|
|
|
optionsSetup: {}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
styleObj () {
|
|
|
|
styleObj() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
position: this.ispreview ? 'absolute' : 'static',
|
|
|
|
position: this.ispreview ? "absolute" : "static",
|
|
|
|
width: this.optionsStyle.width + 'px',
|
|
|
|
width: this.optionsStyle.width + "px",
|
|
|
|
height: this.optionsStyle.height + 'px',
|
|
|
|
height: this.optionsStyle.height + "px",
|
|
|
|
left: this.optionsStyle.left + 'px',
|
|
|
|
left: this.optionsStyle.left + "px",
|
|
|
|
top: this.optionsStyle.top + 'px',
|
|
|
|
top: this.optionsStyle.top + "px",
|
|
|
|
background: this.optionsSetup.background,
|
|
|
|
background: this.optionsSetup.background
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
watch: {
|
|
|
|
value: {
|
|
|
|
value: {
|
|
|
|
handler (val) {
|
|
|
|
handler(val) {
|
|
|
|
this.optionsStyle = val.position
|
|
|
|
this.optionsStyle = val.position;
|
|
|
|
this.optionsData = val.data
|
|
|
|
this.optionsData = val.data;
|
|
|
|
this.optionsCollapse = val.collapse
|
|
|
|
this.optionsCollapse = val.collapse;
|
|
|
|
this.optionsSetup = val.setup
|
|
|
|
this.optionsSetup = val.setup;
|
|
|
|
this.editorOptions()
|
|
|
|
this.editorOptions();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
deep: true,
|
|
|
|
deep: true
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created () {
|
|
|
|
created() {
|
|
|
|
this.optionsStyle = this.value.position
|
|
|
|
this.optionsStyle = this.value.position;
|
|
|
|
this.optionsData = this.value.data
|
|
|
|
this.optionsData = this.value.data;
|
|
|
|
this.optionsCollapse = this.value.collapse
|
|
|
|
this.optionsCollapse = this.value.collapse;
|
|
|
|
this.optionsSetup = this.value.setup
|
|
|
|
this.optionsSetup = this.value.setup;
|
|
|
|
this.editorOptions()
|
|
|
|
this.editorOptions();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
// 修改图标options属性
|
|
|
|
// 修改图标options属性
|
|
|
|
editorOptions () {
|
|
|
|
editorOptions() {
|
|
|
|
this.setOptionsTitle()
|
|
|
|
this.setOptionsTitle();
|
|
|
|
this.setOptionsX()
|
|
|
|
this.setOptionsX();
|
|
|
|
this.setOptionsY()
|
|
|
|
this.setOptionsY();
|
|
|
|
this.setOptionsTop()
|
|
|
|
this.setOptionsTop();
|
|
|
|
this.setOptionsTooltip()
|
|
|
|
this.setOptionsTooltip();
|
|
|
|
this.setOptionsData()
|
|
|
|
this.setOptionsData();
|
|
|
|
this.setOptionsMargin()
|
|
|
|
this.setOptionsMargin();
|
|
|
|
this.setOptionsLegend()
|
|
|
|
this.setOptionsLegend();
|
|
|
|
this.setOptionsColor()
|
|
|
|
this.setOptionsColor();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 标题修改
|
|
|
|
// 标题修改
|
|
|
|
setOptionsTitle () {
|
|
|
|
setOptionsTitle() {
|
|
|
|
const optionsCollapse = this.optionsSetup
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const title = {}
|
|
|
|
const title = {};
|
|
|
|
title.text = optionsCollapse.titleText
|
|
|
|
title.text = optionsCollapse.titleText;
|
|
|
|
title.show = optionsCollapse.isNoTitle
|
|
|
|
title.show = optionsCollapse.isNoTitle;
|
|
|
|
title.left = optionsCollapse.textAlign
|
|
|
|
title.left = optionsCollapse.textAlign;
|
|
|
|
title.textStyle = {
|
|
|
|
title.textStyle = {
|
|
|
|
color: optionsCollapse.textColor,
|
|
|
|
color: optionsCollapse.textColor,
|
|
|
|
fontSize: optionsCollapse.textFontSize,
|
|
|
|
fontSize: optionsCollapse.textFontSize,
|
|
|
|
fontWeight: optionsCollapse.textFontWeight,
|
|
|
|
fontWeight: optionsCollapse.textFontWeight
|
|
|
|
}
|
|
|
|
};
|
|
|
|
title.subtext = optionsCollapse.subText
|
|
|
|
title.subtext = optionsCollapse.subText;
|
|
|
|
title.subtextStyle = {
|
|
|
|
title.subtextStyle = {
|
|
|
|
color: optionsCollapse.subTextColor,
|
|
|
|
color: optionsCollapse.subTextColor,
|
|
|
|
fontWeight: optionsCollapse.subTextFontWeight,
|
|
|
|
fontWeight: optionsCollapse.subTextFontWeight,
|
|
|
|
fontSize: optionsCollapse.subTextFontSize,
|
|
|
|
fontSize: optionsCollapse.subTextFontSize
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.options.title = title
|
|
|
|
this.options.title = title;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// X轴设置
|
|
|
|
// X轴设置
|
|
|
|
setOptionsX () {
|
|
|
|
setOptionsX() {
|
|
|
|
const optionsCollapse = this.optionsSetup
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const xAxis = {
|
|
|
|
const xAxis = {
|
|
|
|
type: 'category',
|
|
|
|
type: "category",
|
|
|
|
show: optionsCollapse.hideX, // 坐标轴是否显示
|
|
|
|
show: optionsCollapse.hideX, // 坐标轴是否显示
|
|
|
|
name: optionsCollapse.xName, // 坐标轴名称
|
|
|
|
name: optionsCollapse.xName, // 坐标轴名称
|
|
|
|
nameTextStyle: {
|
|
|
|
nameTextStyle: {
|
|
|
|
color: optionsCollapse.xNameColor,
|
|
|
|
color: optionsCollapse.xNameColor,
|
|
|
|
fontSize: optionsCollapse.xNameFontSize,
|
|
|
|
fontSize: optionsCollapse.xNameFontSize
|
|
|
|
},
|
|
|
|
},
|
|
|
|
nameRotate: optionsCollapse.textAngle, // 文字角度
|
|
|
|
nameRotate: optionsCollapse.textAngle, // 文字角度
|
|
|
|
inverse: optionsCollapse.reversalX, // 轴反转
|
|
|
|
inverse: optionsCollapse.reversalX, // 轴反转
|
|
|
@ -149,181 +148,184 @@ export default {
|
|
|
|
rotate: optionsCollapse.textAngle, // 文字角度
|
|
|
|
rotate: optionsCollapse.textAngle, // 文字角度
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: optionsCollapse.Xcolor, // x轴 坐标文字颜色
|
|
|
|
color: optionsCollapse.Xcolor, // x轴 坐标文字颜色
|
|
|
|
fontSize: optionsCollapse.fontSizeX,
|
|
|
|
fontSize: optionsCollapse.fontSizeX
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
lineStyle: {
|
|
|
|
lineStyle: {
|
|
|
|
color: optionsCollapse.lineColorX,
|
|
|
|
color: optionsCollapse.lineColorX
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
splitLine: {
|
|
|
|
splitLine: {
|
|
|
|
show: optionsCollapse.isShowSplitLineX,
|
|
|
|
show: optionsCollapse.isShowSplitLineX,
|
|
|
|
lineStyle: {
|
|
|
|
lineStyle: {
|
|
|
|
color: optionsCollapse.splitLineColorX
|
|
|
|
color: optionsCollapse.splitLineColorX
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.options.xAxis = xAxis
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
this.options.xAxis = xAxis;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// Y轴设置
|
|
|
|
// Y轴设置
|
|
|
|
setOptionsY () {
|
|
|
|
setOptionsY() {
|
|
|
|
const optionsCollapse = this.optionsSetup
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const yAxis = {
|
|
|
|
const yAxis = {
|
|
|
|
type: 'value',
|
|
|
|
type: "value",
|
|
|
|
show: optionsCollapse.isShowY, // 坐标轴是否显示
|
|
|
|
show: optionsCollapse.isShowY, // 坐标轴是否显示
|
|
|
|
name: optionsCollapse.textNameY, // 坐标轴名称
|
|
|
|
name: optionsCollapse.textNameY, // 坐标轴名称
|
|
|
|
nameTextStyle: {
|
|
|
|
nameTextStyle: {
|
|
|
|
color: optionsCollapse.NameColorY,
|
|
|
|
color: optionsCollapse.NameColorY,
|
|
|
|
fontSize: optionsCollapse.NameFontSizeY,
|
|
|
|
fontSize: optionsCollapse.NameFontSizeY
|
|
|
|
},
|
|
|
|
},
|
|
|
|
inverse: optionsCollapse.reversalY, // 轴反转
|
|
|
|
inverse: optionsCollapse.reversalY, // 轴反转
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: optionsCollapse.colorY, // x轴 坐标文字颜色
|
|
|
|
color: optionsCollapse.colorY, // x轴 坐标文字颜色
|
|
|
|
fontSize: optionsCollapse.fontSizeY,
|
|
|
|
fontSize: optionsCollapse.fontSizeY
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
splitLine: {
|
|
|
|
splitLine: {
|
|
|
|
show: false,
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
lineStyle: {
|
|
|
|
lineStyle: {
|
|
|
|
color: optionsCollapse.lineColorY,
|
|
|
|
color: optionsCollapse.lineColorY
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
splitLine: {
|
|
|
|
splitLine: {
|
|
|
|
show: optionsCollapse.isShowSplitLineY,
|
|
|
|
show: optionsCollapse.isShowSplitLineY,
|
|
|
|
lineStyle: {
|
|
|
|
lineStyle: {
|
|
|
|
color: optionsCollapse.splitLineColorY
|
|
|
|
color: optionsCollapse.splitLineColorY
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.options.yAxis = yAxis
|
|
|
|
this.options.yAxis = yAxis;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 折线设置
|
|
|
|
// 折线设置
|
|
|
|
setOptionsTop () {
|
|
|
|
setOptionsTop() {
|
|
|
|
const optionsCollapse = this.optionsSetup
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const series = this.options.series
|
|
|
|
const series = this.options.series;
|
|
|
|
for (const key in series) {
|
|
|
|
for (const key in series) {
|
|
|
|
if (series[key].type == 'line') {
|
|
|
|
if (series[key].type == "line") {
|
|
|
|
series[key].showSymbol = optionsCollapse.markPoint
|
|
|
|
series[key].showSymbol = optionsCollapse.markPoint;
|
|
|
|
series[key].symbolSize = optionsCollapse.pointSize
|
|
|
|
series[key].symbolSize = optionsCollapse.pointSize;
|
|
|
|
series[key].smooth = optionsCollapse.smoothCurve
|
|
|
|
series[key].smooth = optionsCollapse.smoothCurve;
|
|
|
|
if (optionsCollapse.area) {
|
|
|
|
if (optionsCollapse.area) {
|
|
|
|
series[key].areaStyle = {
|
|
|
|
series[key].areaStyle = {
|
|
|
|
opacity: optionsCollapse.areaThickness / 100,
|
|
|
|
opacity: optionsCollapse.areaThickness / 100
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
series[key].areaStyle = {
|
|
|
|
series[key].areaStyle = {
|
|
|
|
opacity: 0,
|
|
|
|
opacity: 0
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
series[key].lineStyle = {
|
|
|
|
series[key].lineStyle = {
|
|
|
|
width: optionsCollapse.lineWidth,
|
|
|
|
width: optionsCollapse.lineWidth
|
|
|
|
}
|
|
|
|
};
|
|
|
|
series[key].label = {
|
|
|
|
series[key].label = {
|
|
|
|
show: optionsCollapse.isShow,
|
|
|
|
show: optionsCollapse.isShow,
|
|
|
|
position: 'top',
|
|
|
|
position: "top",
|
|
|
|
distance: 10,
|
|
|
|
distance: 10,
|
|
|
|
fontSize: optionsCollapse.fontSize,
|
|
|
|
fontSize: optionsCollapse.fontSize,
|
|
|
|
color: optionsCollapse.subTextColor,
|
|
|
|
color: optionsCollapse.subTextColor,
|
|
|
|
fontWeight: optionsCollapse.fontWeight,
|
|
|
|
fontWeight: optionsCollapse.fontWeight
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.options.series = series;
|
|
|
|
this.options.series = series
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// tooltip 设置
|
|
|
|
// tooltip 设置
|
|
|
|
setOptionsTooltip () {
|
|
|
|
setOptionsTooltip() {
|
|
|
|
const optionsCollapse = this.optionsSetup
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const tooltip = {
|
|
|
|
const tooltip = {
|
|
|
|
trigger: 'item',
|
|
|
|
trigger: "item",
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: optionsCollapse.lineColor,
|
|
|
|
color: optionsCollapse.lineColor,
|
|
|
|
fontSize: optionsCollapse.fontSize,
|
|
|
|
fontSize: optionsCollapse.fontSize
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.options.tooltip = tooltip
|
|
|
|
};
|
|
|
|
|
|
|
|
this.options.tooltip = tooltip;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 边距设置
|
|
|
|
// 边距设置
|
|
|
|
setOptionsMargin () {
|
|
|
|
setOptionsMargin() {
|
|
|
|
const optionsCollapse = this.optionsSetup
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const grid = {
|
|
|
|
const grid = {
|
|
|
|
left: optionsCollapse.marginLeft,
|
|
|
|
left: optionsCollapse.marginLeft,
|
|
|
|
right: optionsCollapse.marginRight,
|
|
|
|
right: optionsCollapse.marginRight,
|
|
|
|
bottom: optionsCollapse.marginBottom,
|
|
|
|
bottom: optionsCollapse.marginBottom,
|
|
|
|
top: optionsCollapse.marginTop,
|
|
|
|
top: optionsCollapse.marginTop,
|
|
|
|
containLabel: true,
|
|
|
|
containLabel: true
|
|
|
|
}
|
|
|
|
};
|
|
|
|
this.options.grid = grid
|
|
|
|
this.options.grid = grid;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 图例操作 legend
|
|
|
|
// 图例操作 legend
|
|
|
|
setOptionsLegend () {
|
|
|
|
setOptionsLegend() {
|
|
|
|
const optionsCollapse = this.optionsSetup
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const legend = this.options.legend
|
|
|
|
const legend = this.options.legend;
|
|
|
|
legend.show = optionsCollapse.isShowLegend
|
|
|
|
legend.show = optionsCollapse.isShowLegend;
|
|
|
|
legend.left = optionsCollapse.lateralPosition == 'left' ? 0 : 'auto'
|
|
|
|
legend.left = optionsCollapse.lateralPosition == "left" ? 0 : "auto";
|
|
|
|
legend.right = optionsCollapse.lateralPosition == 'right' ? 0 : 'auto'
|
|
|
|
legend.right = optionsCollapse.lateralPosition == "right" ? 0 : "auto";
|
|
|
|
legend.top = optionsCollapse.longitudinalPosition == 'top' ? 0 : 'auto'
|
|
|
|
legend.top = optionsCollapse.longitudinalPosition == "top" ? 0 : "auto";
|
|
|
|
legend.bottom = optionsCollapse.longitudinalPosition == 'bottom' ? 0 : 'auto'
|
|
|
|
legend.bottom =
|
|
|
|
legend.orient = optionsCollapse.layoutFront
|
|
|
|
optionsCollapse.longitudinalPosition == "bottom" ? 0 : "auto";
|
|
|
|
|
|
|
|
legend.orient = optionsCollapse.layoutFront;
|
|
|
|
legend.textStyle = {
|
|
|
|
legend.textStyle = {
|
|
|
|
color: optionsCollapse.lengedColor,
|
|
|
|
color: optionsCollapse.lengedColor,
|
|
|
|
fontSize: optionsCollapse.fontSize,
|
|
|
|
fontSize: optionsCollapse.fontSize
|
|
|
|
}
|
|
|
|
};
|
|
|
|
legend.itemWidth = optionsCollapse.lengedWidth
|
|
|
|
legend.itemWidth = optionsCollapse.lengedWidth;
|
|
|
|
console.log(legend)
|
|
|
|
console.log(legend);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 图例颜色修改
|
|
|
|
// 图例颜色修改
|
|
|
|
setOptionsColor () {
|
|
|
|
setOptionsColor() {
|
|
|
|
const optionsCollapse = this.optionsSetup
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const customColor = optionsCollapse.customColor
|
|
|
|
const customColor = optionsCollapse.customColor;
|
|
|
|
if (!customColor) return
|
|
|
|
if (!customColor) return;
|
|
|
|
const arrColor = []
|
|
|
|
const arrColor = [];
|
|
|
|
for (let i = 0; i < customColor.length; i++) {
|
|
|
|
for (let i = 0; i < customColor.length; i++) {
|
|
|
|
arrColor.push(customColor[i].color)
|
|
|
|
arrColor.push(customColor[i].color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.options.color = arrColor
|
|
|
|
this.options.color = arrColor;
|
|
|
|
this.options = Object.assign({}, this.options)
|
|
|
|
this.options = Object.assign({}, this.options);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 处理数据
|
|
|
|
// 处理数据
|
|
|
|
setOptionsData () {
|
|
|
|
setOptionsData() {
|
|
|
|
const optionsData = this.optionsData // 数据类型 静态 or 动态
|
|
|
|
const optionsData = this.optionsData; // 数据类型 静态 or 动态
|
|
|
|
optionsData.dataType == 'staticData' ? this.staticDataFn(optionsData.staticData) : this.dynamicDataFn(optionsData.dynamicData)
|
|
|
|
optionsData.dataType == "staticData"
|
|
|
|
},
|
|
|
|
? this.staticDataFn(optionsData.staticData)
|
|
|
|
staticDataFn (val) {
|
|
|
|
: this.dynamicDataFn(optionsData.dynamicData);
|
|
|
|
const staticData = JSON.parse(val)
|
|
|
|
},
|
|
|
|
|
|
|
|
staticDataFn(val) {
|
|
|
|
|
|
|
|
const staticData = JSON.parse(val);
|
|
|
|
// x轴
|
|
|
|
// x轴
|
|
|
|
this.options.xAxis.data = staticData.categories
|
|
|
|
this.options.xAxis.data = staticData.categories;
|
|
|
|
// series
|
|
|
|
// series
|
|
|
|
const series = this.options.series
|
|
|
|
const series = this.options.series;
|
|
|
|
for (const i in series) {
|
|
|
|
for (const i in series) {
|
|
|
|
if (series[i].type == 'line') {
|
|
|
|
if (series[i].type == "line") {
|
|
|
|
series[i].data = staticData.series[0].data
|
|
|
|
series[i].data = staticData.series[0].data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dynamicDataFn (val) {
|
|
|
|
dynamicDataFn(val) {
|
|
|
|
if (!val) return
|
|
|
|
if (!val) return;
|
|
|
|
// x轴
|
|
|
|
// x轴
|
|
|
|
this.options.xAxis.data = val.xAxis
|
|
|
|
this.options.xAxis.data = val.xAxis;
|
|
|
|
// series
|
|
|
|
// series
|
|
|
|
const series = this.options.series
|
|
|
|
const series = this.options.series;
|
|
|
|
for (const i in series) {
|
|
|
|
for (const i in series) {
|
|
|
|
if (series[i].type == 'line') {
|
|
|
|
if (series[i].type == "line") {
|
|
|
|
series[i].data = val.series[i].data
|
|
|
|
series[i].data = val.series[i].data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
<style scoped lang="scss">
|
|
|
|