|
|
|
@ -2,11 +2,14 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Author: your name
|
|
|
|
|
* @Date: 2021-10-09 11:38:06
|
|
|
|
|
* @LastEditTime: 2021-10-26 13:53:19
|
|
|
|
|
* @LastEditTime: 2021-10-29 10:43:30
|
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
|
* @Description: In User Settings Edit
|
|
|
|
|
* @FilePath: /data-show/src/views/Index/barometer/opt.js
|
|
|
|
|
*/
|
|
|
|
|
import * as echarts from "echarts";
|
|
|
|
|
|
|
|
|
|
let colors = ['#3172ca', '#459c97', '#ab8921']
|
|
|
|
|
function createData(ds = []) {
|
|
|
|
|
let arr = [];
|
|
|
|
|
for (let i = 0; i < ds.length; i++) {
|
|
|
|
@ -21,8 +24,19 @@ function createData(ds = []) {
|
|
|
|
|
name: arr1[j].key,
|
|
|
|
|
type: 'line',
|
|
|
|
|
symbol: 'none',
|
|
|
|
|
itemStyle: {
|
|
|
|
|
color: colors[j]
|
|
|
|
|
},
|
|
|
|
|
areaStyle: {
|
|
|
|
|
opacity: 0.4
|
|
|
|
|
normal: {
|
|
|
|
|
opacity: 0.3,
|
|
|
|
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
|
|
|
|
|
offset: 0, color: colors[j] // 0% 处的颜色
|
|
|
|
|
}, {
|
|
|
|
|
offset: 1, color: '#000' // 100% 处的颜色
|
|
|
|
|
}]
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
@ -37,7 +51,7 @@ function createData(ds = []) {
|
|
|
|
|
}
|
|
|
|
|
return arr;
|
|
|
|
|
}
|
|
|
|
|
export default function createOpt(dx = [],ds = []) {
|
|
|
|
|
export default function createOpt(dx = [], ds = []) {
|
|
|
|
|
const data = createData(ds);
|
|
|
|
|
return {
|
|
|
|
|
grid: {
|
|
|
|
@ -54,7 +68,7 @@ export default function createOpt(dx = [],ds = []) {
|
|
|
|
|
start: 1, //数据窗口范围的起始百分比 范围是:0 ~ 100。表示 0% ~ 100%。
|
|
|
|
|
end: 50, //数据窗口范围的结束百分比。范围是:0 ~ 100。
|
|
|
|
|
zoomLock: true, //如果设置为 true 则锁定选择区域的大小,也就是说,只能平移,不能缩放。
|
|
|
|
|
}],
|
|
|
|
|
}],
|
|
|
|
|
tooltip: {
|
|
|
|
|
trigger: "axis",
|
|
|
|
|
backgroundColor: "#08182F",
|
|
|
|
@ -84,9 +98,9 @@ export default function createOpt(dx = [],ds = []) {
|
|
|
|
|
color: "#fff",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
axisLabel : {
|
|
|
|
|
axisLabel: {
|
|
|
|
|
formatter: (value) => {
|
|
|
|
|
let str = value.substring(10,16)
|
|
|
|
|
let str = value.substring(10, 16)
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|