|
|
@ -143,57 +143,57 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 标题修改
|
|
|
|
// 标题修改
|
|
|
|
setOptionsTitle() {
|
|
|
|
setOptionsTitle() {
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const title = {};
|
|
|
|
const title = {};
|
|
|
|
title.text = optionsCollapse.titleText;
|
|
|
|
title.text = optionsSetup.titleText;
|
|
|
|
title.show = optionsCollapse.isNoTitle;
|
|
|
|
title.show = optionsSetup.isNoTitle;
|
|
|
|
title.left = optionsCollapse.textAlign;
|
|
|
|
title.left = optionsSetup.textAlign;
|
|
|
|
title.textStyle = {
|
|
|
|
title.textStyle = {
|
|
|
|
color: optionsCollapse.textColor,
|
|
|
|
color: optionsSetup.textColor,
|
|
|
|
fontSize: optionsCollapse.textFontSize,
|
|
|
|
fontSize: optionsSetup.textFontSize,
|
|
|
|
fontWeight: optionsCollapse.textFontWeight
|
|
|
|
fontWeight: optionsSetup.textFontWeight
|
|
|
|
};
|
|
|
|
};
|
|
|
|
title.subtext = optionsCollapse.subText;
|
|
|
|
title.subtext = optionsSetup.subText;
|
|
|
|
title.subtextStyle = {
|
|
|
|
title.subtextStyle = {
|
|
|
|
color: optionsCollapse.subTextColor,
|
|
|
|
color: optionsSetup.subTextColor,
|
|
|
|
fontWeight: optionsCollapse.subTextFontWeight,
|
|
|
|
fontWeight: optionsSetup.subTextFontWeight,
|
|
|
|
fontSize: optionsCollapse.subTextFontSize
|
|
|
|
fontSize: optionsSetup.subTextFontSize
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.options.title = title;
|
|
|
|
this.options.title = title;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// X轴设置
|
|
|
|
// X轴设置
|
|
|
|
setOptionsX() {
|
|
|
|
setOptionsX() {
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const xAxis = {
|
|
|
|
const xAxis = {
|
|
|
|
type: "category",
|
|
|
|
type: "category",
|
|
|
|
show: optionsCollapse.hideX, // 坐标轴是否显示
|
|
|
|
show: optionsSetup.hideX, // 坐标轴是否显示
|
|
|
|
name: optionsCollapse.xName, // 坐标轴名称
|
|
|
|
name: optionsSetup.xName, // 坐标轴名称
|
|
|
|
nameTextStyle: {
|
|
|
|
nameTextStyle: {
|
|
|
|
color: optionsCollapse.nameColorX,
|
|
|
|
color: optionsSetup.nameColorX,
|
|
|
|
fontSize: optionsCollapse.nameFontSizeX
|
|
|
|
fontSize: optionsSetup.nameFontSizeX
|
|
|
|
},
|
|
|
|
},
|
|
|
|
nameRotate: optionsCollapse.textAngle, // 文字角度
|
|
|
|
nameRotate: optionsSetup.textAngle, // 文字角度
|
|
|
|
inverse: optionsCollapse.reversalX, // 轴反转
|
|
|
|
inverse: optionsSetup.reversalX, // 轴反转
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
interval: optionsCollapse.textInterval, // 文字间隔
|
|
|
|
interval: optionsSetup.textInterval, // 文字间隔
|
|
|
|
rotate: optionsCollapse.textAngle, // 文字角度
|
|
|
|
rotate: optionsSetup.textAngle, // 文字角度
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: optionsCollapse.Xcolor, // x轴 坐标文字颜色
|
|
|
|
color: optionsSetup.Xcolor, // x轴 坐标文字颜色
|
|
|
|
fontSize: optionsCollapse.fontSizeX
|
|
|
|
fontSize: optionsSetup.fontSizeX
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
lineStyle: {
|
|
|
|
lineStyle: {
|
|
|
|
color: optionsCollapse.lineColorX
|
|
|
|
color: optionsSetup.lineColorX
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
splitLine: {
|
|
|
|
splitLine: {
|
|
|
|
show: optionsCollapse.isShowSplitLineX,
|
|
|
|
show: optionsSetup.isShowSplitLineX,
|
|
|
|
lineStyle: {
|
|
|
|
lineStyle: {
|
|
|
|
color: optionsCollapse.splitLineColorX
|
|
|
|
color: optionsSetup.splitLineColorX
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -201,29 +201,29 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// Y轴设置
|
|
|
|
// Y轴设置
|
|
|
|
setOptionsY() {
|
|
|
|
setOptionsY() {
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const yAxis = [
|
|
|
|
const yAxis = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
type: "value",
|
|
|
|
type: "value",
|
|
|
|
splitNumber: optionsCollapse.splitNumberLeft,// 均分
|
|
|
|
splitNumber: optionsSetup.splitNumberLeft,// 均分
|
|
|
|
show: optionsCollapse.isShowYLeft, // 坐标轴是否显示
|
|
|
|
show: optionsSetup.isShowYLeft, // 坐标轴是否显示
|
|
|
|
name: optionsCollapse.textNameYLeft, // 坐标轴名称
|
|
|
|
name: optionsSetup.textNameYLeft, // 坐标轴名称
|
|
|
|
nameTextStyle: { // 别名
|
|
|
|
nameTextStyle: { // 别名
|
|
|
|
color: optionsCollapse.nameColorYLeft,
|
|
|
|
color: optionsSetup.nameColorYLeft,
|
|
|
|
fontSize: optionsCollapse.namefontSizeYLeft
|
|
|
|
fontSize: optionsSetup.namefontSizeYLeft
|
|
|
|
},
|
|
|
|
},
|
|
|
|
inverse: optionsCollapse.reversalY, // 轴反转
|
|
|
|
inverse: optionsSetup.reversalY, // 轴反转
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: optionsCollapse.colorY, // y轴 坐标文字颜色
|
|
|
|
color: optionsSetup.colorY, // y轴 坐标文字颜色
|
|
|
|
fontSize: optionsCollapse.fontSizeY
|
|
|
|
fontSize: optionsSetup.fontSizeY
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
lineStyle: {
|
|
|
|
lineStyle: {
|
|
|
|
color: optionsCollapse.lineColorY
|
|
|
|
color: optionsSetup.lineColorY
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
splitLine: {
|
|
|
|
splitLine: {
|
|
|
@ -232,25 +232,25 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
type: "value",
|
|
|
|
type: "value",
|
|
|
|
splitNumber: optionsCollapse.splitNumberRight,// 均分
|
|
|
|
splitNumber: optionsSetup.splitNumberRight,// 均分
|
|
|
|
show: optionsCollapse.isShowYRight, // 坐标轴是否显示
|
|
|
|
show: optionsSetup.isShowYRight, // 坐标轴是否显示
|
|
|
|
name: optionsCollapse.textNameYRight, // 坐标轴名称
|
|
|
|
name: optionsSetup.textNameYRight, // 坐标轴名称
|
|
|
|
nameTextStyle: { // 别名
|
|
|
|
nameTextStyle: { // 别名
|
|
|
|
color: optionsCollapse.nameColorYRight,
|
|
|
|
color: optionsSetup.nameColorYRight,
|
|
|
|
fontSize: optionsCollapse.namefontSizeYRight
|
|
|
|
fontSize: optionsSetup.namefontSizeYRight
|
|
|
|
},
|
|
|
|
},
|
|
|
|
inverse: optionsCollapse.reversalY, // 轴反转
|
|
|
|
inverse: optionsSetup.reversalY, // 轴反转
|
|
|
|
axisLabel: {
|
|
|
|
axisLabel: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: optionsCollapse.colorY, // y轴 坐标文字颜色
|
|
|
|
color: optionsSetup.colorY, // y轴 坐标文字颜色
|
|
|
|
fontSize: optionsCollapse.fontSizeY
|
|
|
|
fontSize: optionsSetup.fontSizeY
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
axisLine: {
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
lineStyle: {
|
|
|
|
lineStyle: {
|
|
|
|
color: optionsCollapse.lineColorY
|
|
|
|
color: optionsSetup.lineColorY
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
splitLine: {
|
|
|
|
splitLine: {
|
|
|
@ -262,16 +262,16 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 折线设置 数值设置
|
|
|
|
// 折线设置 数值设置
|
|
|
|
setOptionsTop() {
|
|
|
|
setOptionsTop() {
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const optionsSetup = 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 = optionsSetup.markPoint;
|
|
|
|
series[key].symbolSize = optionsCollapse.pointSize;
|
|
|
|
series[key].symbolSize = optionsSetup.pointSize;
|
|
|
|
series[key].smooth = optionsCollapse.smoothCurve;
|
|
|
|
series[key].smooth = optionsSetup.smoothCurve;
|
|
|
|
if (optionsCollapse.area) {
|
|
|
|
if (optionsSetup.area) {
|
|
|
|
series[key].areaStyle = {
|
|
|
|
series[key].areaStyle = {
|
|
|
|
opacity: optionsCollapse.areaThickness / 100
|
|
|
|
opacity: optionsSetup.areaThickness / 100
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
series[key].areaStyle = {
|
|
|
|
series[key].areaStyle = {
|
|
|
@ -279,16 +279,16 @@ export default {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
series[key].lineStyle = {
|
|
|
|
series[key].lineStyle = {
|
|
|
|
width: optionsCollapse.lineWidth
|
|
|
|
width: optionsSetup.lineWidth
|
|
|
|
};
|
|
|
|
};
|
|
|
|
series[key].itemStyle.borderRadius = optionsCollapse.radius;
|
|
|
|
series[key].itemStyle.borderRadius = optionsSetup.radius;
|
|
|
|
series[key].label = {
|
|
|
|
series[key].label = {
|
|
|
|
show: optionsCollapse.isShowLine,
|
|
|
|
show: optionsSetup.isShowLine,
|
|
|
|
position: "top",
|
|
|
|
position: "top",
|
|
|
|
distance: optionsCollapse.distanceLine,
|
|
|
|
distance: optionsSetup.distanceLine,
|
|
|
|
fontSize: optionsCollapse.fontSizeLine,
|
|
|
|
fontSize: optionsSetup.fontSizeLine,
|
|
|
|
color: optionsCollapse.subTextColorLine,
|
|
|
|
color: optionsSetup.subTextColorLine,
|
|
|
|
fontWeight: optionsCollapse.fontWeightLine
|
|
|
|
fontWeight: optionsSetup.fontWeightLine
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -296,71 +296,54 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 柱体设置 数值设置
|
|
|
|
// 柱体设置 数值设置
|
|
|
|
setOptionsBar() {
|
|
|
|
setOptionsBar() {
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const optionsSetup = 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 == "bar") {
|
|
|
|
if (series[key].type == "bar") {
|
|
|
|
series[key].label = {
|
|
|
|
series[key].label = {
|
|
|
|
show: optionsCollapse.isShowBar,
|
|
|
|
show: optionsSetup.isShowBar,
|
|
|
|
position: "top",
|
|
|
|
position: "top",
|
|
|
|
distance: optionsCollapse.distanceBar,
|
|
|
|
distance: optionsSetup.distanceBar,
|
|
|
|
fontSize: optionsCollapse.fontSizeBar,
|
|
|
|
fontSize: optionsSetup.fontSizeBar,
|
|
|
|
color: optionsCollapse.subTextColorBar,
|
|
|
|
color: optionsSetup.subTextColorBar,
|
|
|
|
fontWeight: optionsCollapse.fontWeightBar
|
|
|
|
fontWeight: optionsSetup.fontWeightBar
|
|
|
|
};
|
|
|
|
};
|
|
|
|
series[key].barWidth = optionsCollapse.maxWidth;
|
|
|
|
series[key].barWidth = optionsSetup.maxWidth;
|
|
|
|
series[key].barMinHeight = optionsCollapse.minHeight;
|
|
|
|
series[key].barMinHeight = optionsSetup.minHeight;
|
|
|
|
series[key].itemStyle.barBorderRadius = optionsCollapse.radius;
|
|
|
|
series[key].itemStyle.barBorderRadius = optionsSetup.radius;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.options.series = series;
|
|
|
|
this.options.series = series;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// tooltip 设置
|
|
|
|
// tooltip 设置
|
|
|
|
setOptionsTooltip() {
|
|
|
|
setOptionsTooltip() {
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const tooltip = {
|
|
|
|
const tooltip = {
|
|
|
|
trigger: "item",
|
|
|
|
trigger: "item",
|
|
|
|
show: true,
|
|
|
|
show: true,
|
|
|
|
textStyle: {
|
|
|
|
textStyle: {
|
|
|
|
color: optionsCollapse.lineColor,
|
|
|
|
color: optionsSetup.lineColor,
|
|
|
|
fontSize: optionsCollapse.tipFontSize
|
|
|
|
fontSize: optionsSetup.tipFontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.options.tooltip = tooltip;
|
|
|
|
this.options.tooltip = tooltip;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 边距设置
|
|
|
|
// 边距设置
|
|
|
|
setOptionsMargin() {
|
|
|
|
setOptionsMargin() {
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const grid = {
|
|
|
|
const grid = {
|
|
|
|
left: optionsCollapse.marginLeft,
|
|
|
|
left: optionsSetup.marginLeft,
|
|
|
|
right: optionsCollapse.marginRight,
|
|
|
|
right: optionsSetup.marginRight,
|
|
|
|
bottom: optionsCollapse.marginBottom,
|
|
|
|
bottom: optionsSetup.marginBottom,
|
|
|
|
top: optionsCollapse.marginTop,
|
|
|
|
top: optionsSetup.marginTop,
|
|
|
|
containLabel: true
|
|
|
|
containLabel: true
|
|
|
|
};
|
|
|
|
};
|
|
|
|
this.options.grid = grid;
|
|
|
|
this.options.grid = grid;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/* // 图例操作 legend
|
|
|
|
|
|
|
|
setOptionsLegend() {
|
|
|
|
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
|
|
|
|
const legend = this.options.legend;
|
|
|
|
|
|
|
|
legend.show = optionsCollapse.isShowLegend;
|
|
|
|
|
|
|
|
legend.left = optionsCollapse.lateralPosition;
|
|
|
|
|
|
|
|
legend.top = optionsCollapse.longitudinalPosition == "top" ? 0 : "auto";
|
|
|
|
|
|
|
|
legend.bottom =
|
|
|
|
|
|
|
|
optionsCollapse.longitudinalPosition == "bottom" ? 0 : "auto";
|
|
|
|
|
|
|
|
legend.orient = optionsCollapse.layoutFront;
|
|
|
|
|
|
|
|
legend.textStyle = {
|
|
|
|
|
|
|
|
color: optionsCollapse.lengedColor,
|
|
|
|
|
|
|
|
fontSize: optionsCollapse.lengedFontSize
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
legend.itemWidth = optionsCollapse.lengedWidth;
|
|
|
|
|
|
|
|
console.log(legend);
|
|
|
|
|
|
|
|
},*/
|
|
|
|
|
|
|
|
// 图例颜色修改
|
|
|
|
// 图例颜色修改
|
|
|
|
setOptionsColor() {
|
|
|
|
setOptionsColor() {
|
|
|
|
const optionsCollapse = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const customColor = optionsCollapse.customColor;
|
|
|
|
const customColor = optionsSetup.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++) {
|
|
|
@ -377,16 +360,23 @@ export default {
|
|
|
|
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
|
|
|
|
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
staticDataFn(val) {
|
|
|
|
staticDataFn(val) {
|
|
|
|
const staticData = typeof val == "string" ? JSON.parse(val) : val;
|
|
|
|
const series = this.options.series;
|
|
|
|
|
|
|
|
let axis = [];
|
|
|
|
|
|
|
|
let bar = [];
|
|
|
|
|
|
|
|
let line = [];
|
|
|
|
|
|
|
|
for (const i in val) {
|
|
|
|
|
|
|
|
axis[i] = val[i].axis;
|
|
|
|
|
|
|
|
bar[i] = val[i].bar;
|
|
|
|
|
|
|
|
line[i] = val[i].line;
|
|
|
|
|
|
|
|
}
|
|
|
|
// x轴
|
|
|
|
// x轴
|
|
|
|
this.options.xAxis.data = staticData.xAxis;
|
|
|
|
this.options.xAxis.data = axis;
|
|
|
|
// series
|
|
|
|
// series
|
|
|
|
const series = this.options.series;
|
|
|
|
|
|
|
|
for (const i in series) {
|
|
|
|
for (const i in series) {
|
|
|
|
for (const j in staticData.series) {
|
|
|
|
if (series[i].type == "bar") {
|
|
|
|
if (series[i].type == staticData.series[j].type) {
|
|
|
|
series[i].data = bar;
|
|
|
|
series[i].data = staticData.series[j].data;
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
series[i].data = line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|