|
|
@ -11,8 +11,8 @@ import {eventBusParams} from "@/utils/screen";
|
|
|
|
let scale = [];
|
|
|
|
let scale = [];
|
|
|
|
let max;
|
|
|
|
let max;
|
|
|
|
let min;
|
|
|
|
let min;
|
|
|
|
let Gradient = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 横刻度尺
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: "widgetScaleHorizontal",
|
|
|
|
name: "widgetScaleHorizontal",
|
|
|
|
components: {},
|
|
|
|
components: {},
|
|
|
@ -92,11 +92,11 @@ export default {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: "值",
|
|
|
|
name: "值",
|
|
|
|
type: "bar",
|
|
|
|
type: "bar",
|
|
|
|
yAxisIndex : 0,
|
|
|
|
yAxisIndex: 0,
|
|
|
|
barWidth: 35,
|
|
|
|
barWidth: 35,
|
|
|
|
itemStyle: {
|
|
|
|
itemStyle: {
|
|
|
|
normal: {
|
|
|
|
normal: {
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, Gradient),
|
|
|
|
color: '#0C2F6F',
|
|
|
|
barBorderRadius: 50,
|
|
|
|
barBorderRadius: 50,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -126,7 +126,7 @@ export default {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name: '白框',
|
|
|
|
name: '白框',
|
|
|
|
type: 'bar',
|
|
|
|
type: 'bar',
|
|
|
|
yAxisIndex : 1,
|
|
|
|
yAxisIndex: 1,
|
|
|
|
barGap: '-100%',
|
|
|
|
barGap: '-100%',
|
|
|
|
data: [max - 1],
|
|
|
|
data: [max - 1],
|
|
|
|
barWidth: 35,
|
|
|
|
barWidth: 35,
|
|
|
@ -305,7 +305,7 @@ export default {
|
|
|
|
// 显示
|
|
|
|
// 显示
|
|
|
|
if (optionsSetup.isShowScale) {
|
|
|
|
if (optionsSetup.isShowScale) {
|
|
|
|
series.data = scale;
|
|
|
|
series.data = scale;
|
|
|
|
}else {
|
|
|
|
} else {
|
|
|
|
series.data = 0;
|
|
|
|
series.data = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
series.barWidth = optionsSetup.scaleBarWidth;
|
|
|
|
series.barWidth = optionsSetup.scaleBarWidth;
|
|
|
@ -351,29 +351,21 @@ export default {
|
|
|
|
// 内框设置
|
|
|
|
// 内框设置
|
|
|
|
setOptionsInBar() {
|
|
|
|
setOptionsInBar() {
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const series1 = this.options.series[1];
|
|
|
|
const series = this.options.series[1];
|
|
|
|
series1.barWidth = optionsSetup.inBarWidth;
|
|
|
|
series.barWidth = optionsSetup.inBarWidth;
|
|
|
|
series1.itemStyle = {
|
|
|
|
series.itemStyle = {
|
|
|
|
normal: {
|
|
|
|
normal: {
|
|
|
|
color: optionsSetup.inBarColor,
|
|
|
|
color: optionsSetup.inBarColor,
|
|
|
|
barBorderRadius: optionsSetup.inBarRadius,
|
|
|
|
barBorderRadius: optionsSetup.inBarRadius,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
series1.data = [max - 1];
|
|
|
|
series.data = [max - 1];
|
|
|
|
const series0 = this.options.series[0];
|
|
|
|
|
|
|
|
series0.barWidth = optionsSetup.inBarWidth;
|
|
|
|
|
|
|
|
series0.itemStyle = {
|
|
|
|
|
|
|
|
normal: {
|
|
|
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, Gradient),
|
|
|
|
|
|
|
|
barBorderRadius: optionsSetup.inBarRadius,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// 渐变色设置
|
|
|
|
// 渐变色设置
|
|
|
|
setOptionsColor(inputValue, max) {
|
|
|
|
setOptionsColor(inputValue, inputMax) {
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
const optionsSetup = this.optionsSetup;
|
|
|
|
let gradient = [];
|
|
|
|
let gradient = [];
|
|
|
|
if (inputValue > (max * 0.7)) {
|
|
|
|
if (inputValue > (inputMax * 0.7)) {
|
|
|
|
gradient.push(
|
|
|
|
gradient.push(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
offset: 0,
|
|
|
|
offset: 0,
|
|
|
@ -391,7 +383,7 @@ export default {
|
|
|
|
offset: 1,
|
|
|
|
offset: 1,
|
|
|
|
color: optionsSetup.bar100Color,
|
|
|
|
color: optionsSetup.bar100Color,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else if (inputValue > (max * 0.3)) {
|
|
|
|
} else if (inputValue > (inputMax * 0.3)) {
|
|
|
|
gradient.push(
|
|
|
|
gradient.push(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
offset: 0,
|
|
|
|
offset: 0,
|
|
|
@ -418,10 +410,10 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return gradient;
|
|
|
|
return gradient;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
setShowValue(inputValue, max) {
|
|
|
|
setShowValue(inputValue, inputMax) {
|
|
|
|
let showValue = inputValue;
|
|
|
|
let showValue = inputValue;
|
|
|
|
if (inputValue > max) {
|
|
|
|
if (inputValue > inputMax) {
|
|
|
|
showValue = max
|
|
|
|
showValue = inputMax
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (inputValue < 0) {
|
|
|
|
if (inputValue < 0) {
|
|
|
|
showValue = 0
|
|
|
|
showValue = 0
|
|
|
@ -468,7 +460,6 @@ export default {
|
|
|
|
const num = val[0]["num"];
|
|
|
|
const num = val[0]["num"];
|
|
|
|
// 渐变色
|
|
|
|
// 渐变色
|
|
|
|
const gradient = this.setOptionsColor(num, optionsSetup.maxScale);
|
|
|
|
const gradient = this.setOptionsColor(num, optionsSetup.maxScale);
|
|
|
|
Gradient = gradient;
|
|
|
|
|
|
|
|
// 数值设定
|
|
|
|
// 数值设定
|
|
|
|
const series = this.options.series[0];
|
|
|
|
const series = this.options.series[0];
|
|
|
|
const data = {
|
|
|
|
const data = {
|
|
|
@ -493,6 +484,13 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
series.barWidth = optionsSetup.inBarWidth;
|
|
|
|
|
|
|
|
series.itemStyle = {
|
|
|
|
|
|
|
|
normal: {
|
|
|
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, gradient),
|
|
|
|
|
|
|
|
barBorderRadius: optionsSetup.inBarRadius,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
series.data[0] = data;
|
|
|
|
series.data[0] = data;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dynamicDataFn(val, refreshTime) {
|
|
|
|
dynamicDataFn(val, refreshTime) {
|
|
|
@ -517,9 +515,8 @@ export default {
|
|
|
|
const num = val[0].value;
|
|
|
|
const num = val[0].value;
|
|
|
|
// 渐变色
|
|
|
|
// 渐变色
|
|
|
|
const gradient = this.setOptionsColor(num, optionsSetup.maxScale);
|
|
|
|
const gradient = this.setOptionsColor(num, optionsSetup.maxScale);
|
|
|
|
Gradient = gradient;
|
|
|
|
|
|
|
|
// 数值设定
|
|
|
|
// 数值设定
|
|
|
|
const series = this.options.series;
|
|
|
|
const series = this.options.series[0];
|
|
|
|
const data = {
|
|
|
|
const data = {
|
|
|
|
value: this.setShowValue(num, optionsSetup.maxScale),
|
|
|
|
value: this.setShowValue(num, optionsSetup.maxScale),
|
|
|
|
label: {
|
|
|
|
label: {
|
|
|
@ -542,7 +539,14 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
series[0].data[0] = data;
|
|
|
|
series.barWidth = optionsSetup.inBarWidth;
|
|
|
|
|
|
|
|
series.itemStyle = {
|
|
|
|
|
|
|
|
normal: {
|
|
|
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 1, 0, gradient),
|
|
|
|
|
|
|
|
barBorderRadius: optionsSetup.inBarRadius,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
series.data[0] = data;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|