|
@@ -1,1230 +1,1175 @@
|
|
|
-/**
|
|
|
- * 健康状态charts
|
|
|
- */
|
|
|
-
|
|
|
-// setTimeout(() => {
|
|
|
-// setChartsDom(document.querySelector('.charts1'))
|
|
|
-// }, 500);
|
|
|
-
|
|
|
-// setTimeout(() => {
|
|
|
-// setChartsDom(document.querySelector('.charts2'))
|
|
|
-// }, 1000);
|
|
|
-
|
|
|
-
|
|
|
-// setTimeout(() => {
|
|
|
-// setChartsDom(document.querySelector('.charts3'))
|
|
|
-// }, 1500);
|
|
|
-
|
|
|
-
|
|
|
-function setChartsDom(echartDom) {
|
|
|
- const myChart = echarts.init(echartDom);
|
|
|
- const option = {
|
|
|
- series: [{
|
|
|
- type: 'gauge',
|
|
|
- z: 100,
|
|
|
- axisLine: {
|
|
|
- lineStyle: {
|
|
|
- width: 5,
|
|
|
- color: [
|
|
|
- [
|
|
|
- 0.3, new echarts.graphic.LinearGradient(
|
|
|
- 0, 1, 1, 0, [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(0, 237, 3,0.1)',
|
|
|
- }, {
|
|
|
- offset: 0.5,
|
|
|
- color: 'rgba(0, 237, 3,0.6)',
|
|
|
- },
|
|
|
- {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(0, 237, 3,1)',
|
|
|
- }
|
|
|
- ]
|
|
|
- )
|
|
|
- ],
|
|
|
- [
|
|
|
- 0.7, new echarts.graphic.LinearGradient(
|
|
|
- 0, 1, 1, 0, [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(255, 184, 0,0.1)',
|
|
|
- }, {
|
|
|
- offset: 0.5,
|
|
|
- color: 'rgba(255, 184, 0,0.6)',
|
|
|
- },
|
|
|
- {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(255, 184, 0,1)',
|
|
|
- }
|
|
|
- ]
|
|
|
- )
|
|
|
- ],
|
|
|
- [
|
|
|
- 1, new echarts.graphic.LinearGradient(
|
|
|
- 0, 1, 1, 0, [{
|
|
|
- offset: 0,
|
|
|
- color: 'rgba(175, 36, 74,0.1)',
|
|
|
- }, {
|
|
|
- offset: 0.5,
|
|
|
- color: 'rgba(255, 36, 74,0.6)',
|
|
|
- },
|
|
|
- {
|
|
|
- offset: 1,
|
|
|
- color: 'rgba(255, 36, 74,1)',
|
|
|
- }
|
|
|
- ]
|
|
|
- )
|
|
|
- ]
|
|
|
- ],
|
|
|
- }
|
|
|
- },
|
|
|
- // radius: '50%',
|
|
|
- pointer: {
|
|
|
- itemStyle: {
|
|
|
- color: 'auto'
|
|
|
- }
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- distance: 0,
|
|
|
- length: 8,
|
|
|
- lineStyle: {
|
|
|
- color: 'auto',
|
|
|
- width: 2
|
|
|
- }
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- distance: 0,
|
|
|
- length: 20,
|
|
|
- lineStyle: {
|
|
|
- color: 'auto',
|
|
|
- width: 4
|
|
|
- }
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- color: 'white',
|
|
|
- distance: 30,
|
|
|
- fontSize: 110
|
|
|
- },
|
|
|
- detail: {
|
|
|
- valueAnimation: true,
|
|
|
- formatter: '{value} %',
|
|
|
- color: 'white'
|
|
|
- },
|
|
|
- data: [{
|
|
|
- value: 70
|
|
|
- }]
|
|
|
- }, ]
|
|
|
- };
|
|
|
-
|
|
|
-
|
|
|
- if (option) {
|
|
|
- myChart.setOption(option);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-function setCharts52(echartDom, testDom,temperature,humidity) {
|
|
|
- var myChart = echarts.init(echartDom);
|
|
|
- // 地图背景颜色
|
|
|
- var highlight = "#03b7c9";
|
|
|
-
|
|
|
- var demoData = [
|
|
|
- {
|
|
|
- name: "平均温度",
|
|
|
- value: temperature,
|
|
|
- unit: "℃",
|
|
|
- pos: ["25%", "40%"],
|
|
|
- range: [-40, 100],
|
|
|
- YS: [
|
|
|
- [0.4, "#119eff"],
|
|
|
- [0.5, "#30da74"],
|
|
|
- [1, "#f3390d"],
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "平均湿度",
|
|
|
- value: humidity,
|
|
|
- unit: "%",
|
|
|
- pos: ["75%", "40%"],
|
|
|
- range: [0, 100],
|
|
|
- splitNum: 10,
|
|
|
- YS: [
|
|
|
- [0.3, "#f3390d"],
|
|
|
- [0.8, "#30da74"],
|
|
|
- [1, "#119eff"],
|
|
|
- ],
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- option = {
|
|
|
-
|
|
|
- series: (function () {
|
|
|
- var result = [];
|
|
|
-
|
|
|
- demoData.forEach(function (item) {
|
|
|
- result.push(
|
|
|
- // 外围刻度
|
|
|
- {
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- radius: "50%", // 1行2个
|
|
|
- splitNumber: item.splitNum || 10,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- startAngle: 225,
|
|
|
- endAngle: -45,
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- width: 20,
|
|
|
- shadowBlur: 0,
|
|
|
- color: [[1, highlight]],
|
|
|
- },
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- color: highlight,
|
|
|
- width: 20,
|
|
|
- },
|
|
|
- length: -5,
|
|
|
- splitNumber: 10,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: true,
|
|
|
- length: -10,
|
|
|
- lineStyle: {
|
|
|
- color: highlight,
|
|
|
- },
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- distance: -18,
|
|
|
- textStyle: {
|
|
|
- color: highlight,
|
|
|
- fontSize: "100",
|
|
|
- },
|
|
|
- },
|
|
|
- pointer: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- name: "速度",
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- splitNumber: item.splitNum || 10,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- radius: "45%",
|
|
|
- axisLine: {
|
|
|
- // 坐标轴线
|
|
|
- show: false,
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle控制线条样式
|
|
|
- color: item.YS,
|
|
|
- shadowColor: "#ccc",
|
|
|
- shadowBlur: 25,
|
|
|
- width: 0,
|
|
|
- },
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 坐标轴小标记
|
|
|
- // show: false,
|
|
|
- length: 20, // 属性length控制线长
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle控制线条样式
|
|
|
- color: "auto",
|
|
|
- width: 20,
|
|
|
- },
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- // 分隔线
|
|
|
- show: false,
|
|
|
- length: 20, // 属性length控制线长
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle(详见lineStyle)控制线条样式
|
|
|
- color: "auto",
|
|
|
- },
|
|
|
- },
|
|
|
- title: {
|
|
|
- textStyle: {
|
|
|
- // 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
|
- fontWeight: "bolder",
|
|
|
- fontSize: 100,
|
|
|
- fontStyle: "italic",
|
|
|
- },
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: true,
|
|
|
- offsetCenter: [0, "100%"],
|
|
|
- textStyle: {
|
|
|
- fontSize: 100,
|
|
|
- },
|
|
|
- formatter: [
|
|
|
- "{value} " + (item.unit || ""),
|
|
|
- "{name|" + item.name + "}",
|
|
|
- ].join("\n"),
|
|
|
- rich: {
|
|
|
- name: {
|
|
|
- fontSize: 100,
|
|
|
- lineHeight: 30,
|
|
|
- color: "#4be4de",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- data: [
|
|
|
- {
|
|
|
- value: item.value,
|
|
|
- },
|
|
|
- ],
|
|
|
- pointer: {
|
|
|
- width: 50,
|
|
|
- },
|
|
|
- },
|
|
|
- // 内侧指针、数值显示
|
|
|
- {
|
|
|
- name: item.name,
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- radius: "40%",
|
|
|
- startAngle: 225,
|
|
|
- endAngle: -45,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- width: 16,
|
|
|
- color: [[1, "rgba(75,228,255,.1)"]],
|
|
|
- },
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- pointer: {
|
|
|
- show: true,
|
|
|
- length: "90%",
|
|
|
- width: 3,
|
|
|
- },
|
|
|
- itemStyle: {
|
|
|
- //表盘指针的颜色
|
|
|
- color: "rgba(255, 153, 0, 0.31)",
|
|
|
- borderColor: "#ff9900",
|
|
|
- borderWidth: 1,
|
|
|
- fontSize:110
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: false,
|
|
|
- offsetCenter: [0, "100%"],
|
|
|
- textStyle: {
|
|
|
- fontSize: 20,
|
|
|
- color: "#00eff2",
|
|
|
- },
|
|
|
- formatter: [
|
|
|
- "{value} " + (item.unit || ""),
|
|
|
- "{name|" + item.name + "}",
|
|
|
- ].join("\n"),
|
|
|
- rich: {
|
|
|
- name: {
|
|
|
- fontSize: 100,
|
|
|
- lineHeight: 30,
|
|
|
- color: "#00eff2",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- data: [
|
|
|
- {
|
|
|
- value: item.value,
|
|
|
- },
|
|
|
- ],
|
|
|
- }
|
|
|
- );
|
|
|
- });
|
|
|
- return result;
|
|
|
- })(),
|
|
|
- };
|
|
|
-
|
|
|
- if (option) {
|
|
|
- myChart.setOption(option);
|
|
|
- }
|
|
|
-
|
|
|
- obsDom(testDom, myChart);
|
|
|
-}
|
|
|
-
|
|
|
-function setCharts53(echartDom, testDom) {
|
|
|
- let timer = null;
|
|
|
-
|
|
|
- var myChart = echarts.init(echartDom);
|
|
|
- // 地图背景颜色
|
|
|
- data = [{
|
|
|
- name: "空调",
|
|
|
- value: (Math.random() * 10).toFixed(0),
|
|
|
- sum: 10,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "配电",
|
|
|
- value: (Math.random() * 10).toFixed(0),
|
|
|
- sum: 10,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "UPS",
|
|
|
- value: (Math.random() * 10).toFixed(0),
|
|
|
- sum: 10,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "温湿度",
|
|
|
- value: (Math.random() * 10).toFixed(0),
|
|
|
- sum: 10,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "烟感",
|
|
|
- value: (Math.random() * 10).toFixed(0),
|
|
|
- sum: 10,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "漏水",
|
|
|
- value: (Math.random() * 10).toFixed(0),
|
|
|
- sum: 10,
|
|
|
- },
|
|
|
- ];
|
|
|
- getArrByKey = (data, k) => {
|
|
|
- let key = k || "value";
|
|
|
- let res = [];
|
|
|
- if (data) {
|
|
|
- data.forEach(function(t) {
|
|
|
- res.push(t[key]);
|
|
|
- });
|
|
|
- }
|
|
|
- return res;
|
|
|
- };
|
|
|
- opt = {
|
|
|
- index: 0,
|
|
|
- };
|
|
|
- color = ["#f85e35", "#d68f52", "#3fa4a9"];
|
|
|
- data = data.sort((a, b) => {
|
|
|
- return b.value - a.value;
|
|
|
- });
|
|
|
- option = {
|
|
|
- grid: {
|
|
|
- top: "2%",
|
|
|
- bottom: -15,
|
|
|
- right: 30,
|
|
|
- left: -30,
|
|
|
- containLabel: true,
|
|
|
- },
|
|
|
- xAxis: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- yAxis: [{
|
|
|
- triggerEvent: true,
|
|
|
- show: true,
|
|
|
- inverse: true,
|
|
|
- data: getArrByKey(data, "name"),
|
|
|
- axisLine: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- interval: 0,
|
|
|
- color: "#fff",
|
|
|
- align: "left",
|
|
|
- margin: 80,
|
|
|
- fontSize: 100,
|
|
|
- formatter: function(value, index) {
|
|
|
- if (opt.index === 0 && index < 3) {
|
|
|
- return (
|
|
|
- "{idx" + index + "|" + (1 + index) + "} {title|" + value + "}"
|
|
|
- );
|
|
|
- } else if (opt.index !== 0 && index + opt.index < 9) {
|
|
|
- return (
|
|
|
- "{idx|0" + (1 + index + opt.index) + "} {title|" + value + "}"
|
|
|
- );
|
|
|
- } else {
|
|
|
- return (
|
|
|
- "{idx|" + (1 + index + opt.index) + "} {title|" + value + "}"
|
|
|
- );
|
|
|
- }
|
|
|
- },
|
|
|
- rich: {
|
|
|
- idx0: {
|
|
|
- color: "#FB375E",
|
|
|
- backgroundColor: "#FFE8EC",
|
|
|
- borderRadius: 100,
|
|
|
- padding: [5, 8],
|
|
|
- },
|
|
|
- idx1: {
|
|
|
- color: "#FF9023",
|
|
|
- backgroundColor: "#FFEACF",
|
|
|
- borderRadius: 100,
|
|
|
- padding: [5, 8],
|
|
|
- },
|
|
|
- idx2: {
|
|
|
- color: "#01B599",
|
|
|
- backgroundColor: "#E1F7F3",
|
|
|
- borderRadius: 100,
|
|
|
- padding: [5, 8],
|
|
|
- },
|
|
|
- idx: {
|
|
|
- color: "#fff",
|
|
|
- borderRadius: 100,
|
|
|
- padding: [5, 8],
|
|
|
- },
|
|
|
- title: {
|
|
|
- width: 165,
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- triggerEvent: true,
|
|
|
- show: true,
|
|
|
- inverse: true,
|
|
|
- data: getArrByKey(data, "name"),
|
|
|
- axisLine: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- interval: 0,
|
|
|
- color: "#fff",
|
|
|
- align: "left",
|
|
|
- margin: 20,
|
|
|
- fontSize: 100,
|
|
|
- formatter: function(value, index) {
|
|
|
- return data[index].value + "条";
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- ],
|
|
|
- series: [{
|
|
|
- name: "条",
|
|
|
- type: "bar",
|
|
|
- yAxisIndex: 0,
|
|
|
- data: data,
|
|
|
- barWidth: 10,
|
|
|
- itemStyle: {
|
|
|
- color: (val) => {
|
|
|
- if (val.dataIndex < 3 && opt.index === 0) {
|
|
|
- return color[val.dataIndex];
|
|
|
- } else {
|
|
|
- return "#1990FF";
|
|
|
- }
|
|
|
- },
|
|
|
- barBorderRadius: 30,
|
|
|
- },
|
|
|
- }, ],
|
|
|
- };
|
|
|
-
|
|
|
- if (option) {
|
|
|
- myChart.setOption(option);
|
|
|
- }
|
|
|
-
|
|
|
- window.addEventListener("resize", function() {
|
|
|
- if (timer) {
|
|
|
- clearTimeout(timer);
|
|
|
- timer = null;
|
|
|
- }
|
|
|
- timer = setTimeout(() => {
|
|
|
- move3(".test53 .test-box");
|
|
|
-
|
|
|
- myChart.resize();
|
|
|
- }, 500);
|
|
|
- });
|
|
|
-
|
|
|
- if (!testDom) {
|
|
|
- testDom = document.querySelectorAll(".test53 .box");
|
|
|
- }
|
|
|
- obsDom(testDom, myChart);
|
|
|
-}
|
|
|
-
|
|
|
-function setCharts54(echartDom, testDom) {
|
|
|
- var myChart = echarts.init(echartDom);
|
|
|
- // 地图背景颜色
|
|
|
- var seriesData = [
|
|
|
- {
|
|
|
- name: "机柜",
|
|
|
- value: "480",
|
|
|
- },
|
|
|
- {
|
|
|
- name: "服务器",
|
|
|
- value: "300",
|
|
|
- },
|
|
|
- {
|
|
|
- name: "交换机",
|
|
|
- value: "240",
|
|
|
- },
|
|
|
- {
|
|
|
- name: "路由器",
|
|
|
- value: "120",
|
|
|
- },
|
|
|
- {
|
|
|
- name: "PDU",
|
|
|
- value: "60",
|
|
|
- },
|
|
|
- ];
|
|
|
- var legendData = [
|
|
|
- "机柜",
|
|
|
- "服务器",
|
|
|
- "交换机",
|
|
|
- "路由器",
|
|
|
- "PDU",
|
|
|
- ];
|
|
|
- var colorList = ["#73DDFF", "#73ACFF", "#FDD56A", "#FDB36A", "#FD866A"];
|
|
|
- option = {
|
|
|
-
|
|
|
- title: {
|
|
|
- text: "",
|
|
|
- x: "center",
|
|
|
- y: "center",
|
|
|
- textStyle: {
|
|
|
- color: "#fff",
|
|
|
- },
|
|
|
- },
|
|
|
- tooltip: {
|
|
|
- trigger: "item",
|
|
|
- borderColor: "rgba(255,255,255,.3)",
|
|
|
- backgroundColor: "rgba(13,5,30,.6)",
|
|
|
- borderWidth: 1,
|
|
|
- padding: 5,
|
|
|
- formatter: function (parms) {
|
|
|
- var str =
|
|
|
- parms.marker +
|
|
|
- "" +
|
|
|
- parms.data.name +
|
|
|
- "</br>" +
|
|
|
- "数量:" +
|
|
|
- parms.data.value +
|
|
|
- "头</br>" +
|
|
|
- "占比:" +
|
|
|
- parms.percent +
|
|
|
- "%";
|
|
|
- return str;
|
|
|
- },
|
|
|
- },
|
|
|
- legend: {
|
|
|
- type: "scroll",
|
|
|
- orient: "vertical",
|
|
|
- left: "left",
|
|
|
- align: "auto",
|
|
|
- top: "middle",
|
|
|
- textStyle: {
|
|
|
- color: "#fff",
|
|
|
- },
|
|
|
- data: legendData,
|
|
|
- },
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: "pie",
|
|
|
- z: 3,
|
|
|
- center: ["50%", "50%"],
|
|
|
- radius: ["25%", "45%"],
|
|
|
- clockwise: true,
|
|
|
- avoidLabelOverlap: true,
|
|
|
- hoverOffset: 15,
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- color: function (params) {
|
|
|
- return colorList[params.dataIndex];
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: "outside",
|
|
|
- formatter: "{a|{b}:{d}%}\n{hr|}",
|
|
|
- rich: {
|
|
|
- hr: {
|
|
|
- backgroundColor: "t",
|
|
|
- borderRadius: 3,
|
|
|
- width: 3,
|
|
|
- height: 3,
|
|
|
- padding: [3, 3, 0, -12],
|
|
|
- },
|
|
|
- a: {
|
|
|
- padding: [-30, 15, -20, 15],
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- labelLine: {
|
|
|
- normal: {
|
|
|
- length: 20,
|
|
|
- length2: 30,
|
|
|
- lineStyle: {
|
|
|
- width: 1,
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- data: seriesData,
|
|
|
- },
|
|
|
- {
|
|
|
- name: "第一层环",
|
|
|
- type: "pie",
|
|
|
- z: 2,
|
|
|
- tooltip: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- center: ["50%", "50%"],
|
|
|
- radius: ["45%", "58%"],
|
|
|
- hoverAnimation: false,
|
|
|
- clockWise: false,
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- // shadowBlur: 40,
|
|
|
- // shadowColor: 'rgba(0, 255, 255,.3)',
|
|
|
- color: "rgba(1,15,80,.4)",
|
|
|
- },
|
|
|
- emphasis: {
|
|
|
- color: "rgba(1,15,80,.4)",
|
|
|
- },
|
|
|
- },
|
|
|
- label: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- data: [100],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "第二层环",
|
|
|
- type: "pie",
|
|
|
- z: 1,
|
|
|
- tooltip: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- center: ["50%", "50%"],
|
|
|
- radius: ["58%", "76%"],
|
|
|
- hoverAnimation: false,
|
|
|
- clockWise: false,
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- // shadowBlur: 40,
|
|
|
- // shadowColor: 'rgba(0, 255, 255,.3)',
|
|
|
- color: "rgba(0,15,69,.2)",
|
|
|
- },
|
|
|
- emphasis: {
|
|
|
- color: "rgba(0,15,69,.2)",
|
|
|
- },
|
|
|
- },
|
|
|
- label: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- data: [100],
|
|
|
- },
|
|
|
- ],
|
|
|
- };
|
|
|
- if (option) {
|
|
|
- myChart.setOption(option);
|
|
|
- }
|
|
|
-
|
|
|
- if (!testDom) {
|
|
|
- testDom = document.querySelectorAll(".test54 .box");
|
|
|
- }
|
|
|
- obsDom(testDom, myChart);
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-function setCharts58(echartDom, testDom,leackgePosition,eleRes) {
|
|
|
- var myChart = echarts.init(echartDom);
|
|
|
- // 地图背景颜色
|
|
|
- var highlight = "#03b7c9";
|
|
|
-
|
|
|
- var demoData = [
|
|
|
- {
|
|
|
- name: "漏水位置",
|
|
|
- value: leackgePosition,
|
|
|
- unit: "/米",
|
|
|
- pos: ["25%", "40%"],
|
|
|
- range: [-40, 100],
|
|
|
- YS: [
|
|
|
- [0.4, "#119eff"],
|
|
|
- [0.5, "#30da74"],
|
|
|
- [1, "#f3390d"],
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "电阻率",
|
|
|
- value: eleRes,
|
|
|
- unit: "",
|
|
|
- pos: ["75%", "40%"],
|
|
|
- range: [0, 100],
|
|
|
- splitNum: 10,
|
|
|
- YS: [
|
|
|
- [0.3, "#f3390d"],
|
|
|
- [0.8, "#30da74"],
|
|
|
- [1, "#119eff"],
|
|
|
- ],
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- option = {
|
|
|
- series: (function () {
|
|
|
- var result = [];
|
|
|
-
|
|
|
- demoData.forEach(function (item) {
|
|
|
- result.push(
|
|
|
- // 外围刻度
|
|
|
- {
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- radius: "50%", // 1行2个
|
|
|
- splitNumber: item.splitNum || 10,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- startAngle: 225,
|
|
|
- endAngle: -45,
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- width: 2,
|
|
|
- shadowBlur: 0,
|
|
|
- color: [[1, highlight]],
|
|
|
- },
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- color: highlight,
|
|
|
- width: 1,
|
|
|
- },
|
|
|
- length: -5,
|
|
|
- splitNumber: 10,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: true,
|
|
|
- length: -10,
|
|
|
- lineStyle: {
|
|
|
- color: highlight,
|
|
|
- },
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- distance: -18,
|
|
|
- textStyle: {
|
|
|
- color: highlight,
|
|
|
- fontSize: "100",
|
|
|
- },
|
|
|
- },
|
|
|
- pointer: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- name: "速度",
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- splitNumber: item.splitNum || 10,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- radius: "45%",
|
|
|
- axisLine: {
|
|
|
- // 坐标轴线
|
|
|
- show: false,
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle控制线条样式
|
|
|
- color: item.YS,
|
|
|
- shadowColor: "#ccc",
|
|
|
- shadowBlur: 25,
|
|
|
- width: 0,
|
|
|
- },
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 坐标轴小标记
|
|
|
- // show: false,
|
|
|
- length: 20, // 属性length控制线长
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle控制线条样式
|
|
|
- color: "auto",
|
|
|
- width: 2,
|
|
|
- },
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- // 分隔线
|
|
|
- show: false,
|
|
|
- length: 20, // 属性length控制线长
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle(详见lineStyle)控制线条样式
|
|
|
- color: "auto",
|
|
|
- },
|
|
|
- },
|
|
|
- title: {
|
|
|
- textStyle: {
|
|
|
- // 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
|
- fontWeight: "bolder",
|
|
|
- fontSize: 100,
|
|
|
- fontStyle: "italic",
|
|
|
- },
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: true,
|
|
|
- offsetCenter: [0, "100%"],
|
|
|
- textStyle: {
|
|
|
- fontSize: 100,
|
|
|
- },
|
|
|
- formatter: [
|
|
|
- "{value} " + (item.unit || ""),
|
|
|
- "{name|" + item.name + "}",
|
|
|
- ].join("\n"),
|
|
|
- rich: {
|
|
|
- name: {
|
|
|
- fontSize: 100,
|
|
|
- lineHeight: 30,
|
|
|
- color: "#4be4de",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- data: [
|
|
|
- {
|
|
|
- value: item.value,
|
|
|
- },
|
|
|
- ],
|
|
|
- pointer: {
|
|
|
- width: 5,
|
|
|
- },
|
|
|
- },
|
|
|
- // 内侧指针、数值显示
|
|
|
- {
|
|
|
- name: item.name,
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- radius: "40%",
|
|
|
- startAngle: 225,
|
|
|
- endAngle: -45,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- width: 16,
|
|
|
- color: [[1, "rgba(75,228,255,.1)"]],
|
|
|
- },
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- pointer: {
|
|
|
- show: true,
|
|
|
- length: "90%",
|
|
|
- width: 3,
|
|
|
- },
|
|
|
- itemStyle: {
|
|
|
- //表盘指针的颜色
|
|
|
- color: "rgba(255, 153, 0, 0.31)",
|
|
|
- borderColor: "#ff9900",
|
|
|
- borderWidth: 1,
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: false,
|
|
|
- offsetCenter: [0, "100%"],
|
|
|
- textStyle: {
|
|
|
- fontSize: 100,
|
|
|
- color: "#00eff2",
|
|
|
- },
|
|
|
- formatter: [
|
|
|
- "{value} " + (item.unit || ""),
|
|
|
- "{name|" + item.name + "}",
|
|
|
- ].join("\n"),
|
|
|
- rich: {
|
|
|
- name: {
|
|
|
- fontSize: 100,
|
|
|
- lineHeight: 30,
|
|
|
- color: "#00eff2",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- data: [
|
|
|
- {
|
|
|
- value: item.value,
|
|
|
- },
|
|
|
- ],
|
|
|
- }
|
|
|
- );
|
|
|
- });
|
|
|
- return result;
|
|
|
- })(),
|
|
|
- };
|
|
|
- if (option) {
|
|
|
- myChart.setOption(option);
|
|
|
- }
|
|
|
-
|
|
|
- if (!testDom) {
|
|
|
- testDom = document.querySelectorAll(".test58 .box");
|
|
|
- }
|
|
|
- obsDom(testDom, myChart);
|
|
|
-}
|
|
|
-
|
|
|
-function setCharts59(echartDom, testDom,temperature,humidity) {
|
|
|
- var myChart = echarts.init(echartDom);
|
|
|
- // 地图背景颜色
|
|
|
- var highlight = "#03b7c9";
|
|
|
-
|
|
|
- var demoData = [
|
|
|
- {
|
|
|
- name: "平均温度",
|
|
|
- value: temperature,
|
|
|
- unit: "°",
|
|
|
- pos: ["25%", "40%"],
|
|
|
- range: [-40, 100],
|
|
|
- YS: [
|
|
|
- [0.4, "#119eff"],
|
|
|
- [0.5, "#30da74"],
|
|
|
- [1, "#f3390d"],
|
|
|
- ],
|
|
|
- },
|
|
|
- {
|
|
|
- name: "平均温度",
|
|
|
- value: humidity,
|
|
|
- unit: "°",
|
|
|
- pos: ["75%", "40%"],
|
|
|
- range: [0, 100],
|
|
|
- splitNum: 10,
|
|
|
- YS: [
|
|
|
- [0.3, "#f3390d"],
|
|
|
- [0.8, "#30da74"],
|
|
|
- [1, "#119eff"],
|
|
|
- ],
|
|
|
- },
|
|
|
- ];
|
|
|
-
|
|
|
- option = {
|
|
|
- series: (function () {
|
|
|
- var result = [];
|
|
|
-
|
|
|
- demoData.forEach(function (item) {
|
|
|
- result.push(
|
|
|
- // 外围刻度
|
|
|
- {
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- radius: "50%", // 1行2个
|
|
|
- splitNumber: item.splitNum || 10,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- startAngle: 225,
|
|
|
- endAngle: -45,
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- width: 2,
|
|
|
- shadowBlur: 0,
|
|
|
- color: [[1, highlight]],
|
|
|
- },
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- color: highlight,
|
|
|
- width: 1,
|
|
|
- },
|
|
|
- length: -5,
|
|
|
- splitNumber: 10,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: true,
|
|
|
- length: -10,
|
|
|
- lineStyle: {
|
|
|
- color: highlight,
|
|
|
- },
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- distance: -18,
|
|
|
- textStyle: {
|
|
|
- color: highlight,
|
|
|
- fontSize: "100",
|
|
|
- },
|
|
|
- },
|
|
|
- pointer: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- name: "速度",
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- splitNumber: item.splitNum || 10,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- radius: "45%",
|
|
|
- axisLine: {
|
|
|
- // 坐标轴线
|
|
|
- show: false,
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle控制线条样式
|
|
|
- color: item.YS,
|
|
|
- shadowColor: "#ccc",
|
|
|
- shadowBlur: 25,
|
|
|
- width: 0,
|
|
|
- },
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- // 坐标轴小标记
|
|
|
- // show: false,
|
|
|
- length: 20, // 属性length控制线长
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle控制线条样式
|
|
|
- color: "auto",
|
|
|
- width: 2,
|
|
|
- },
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- // 分隔线
|
|
|
- show: false,
|
|
|
- length: 20, // 属性length控制线长
|
|
|
- lineStyle: {
|
|
|
- // 属性lineStyle(详见lineStyle)控制线条样式
|
|
|
- color: "auto",
|
|
|
- },
|
|
|
- },
|
|
|
- title: {
|
|
|
- textStyle: {
|
|
|
- // 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
|
- fontWeight: "bolder",
|
|
|
- fontSize: 100,
|
|
|
- fontStyle: "italic",
|
|
|
- },
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: true,
|
|
|
- offsetCenter: [0, "100%"],
|
|
|
- textStyle: {
|
|
|
- fontSize: 25,
|
|
|
- },
|
|
|
- formatter: [
|
|
|
- "{value} " + (item.unit || ""),
|
|
|
- "{name|" + item.name + "}",
|
|
|
- ].join("\n"),
|
|
|
- rich: {
|
|
|
- name: {
|
|
|
- fontSize: 16,
|
|
|
- lineHeight: 30,
|
|
|
- color: "#4be4de",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- data: [
|
|
|
- {
|
|
|
- value: item.value,
|
|
|
- },
|
|
|
- ],
|
|
|
- pointer: {
|
|
|
- width: 5,
|
|
|
- },
|
|
|
- },
|
|
|
- // 内侧指针、数值显示
|
|
|
- {
|
|
|
- name: item.name,
|
|
|
- type: "gauge",
|
|
|
- center: item.pos,
|
|
|
- radius: "40%",
|
|
|
- startAngle: 225,
|
|
|
- endAngle: -45,
|
|
|
- min: item.range[0],
|
|
|
- max: item.range[1],
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- width: 16,
|
|
|
- color: [[1, "rgba(75,228,255,.1)"]],
|
|
|
- },
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- axisLabel: {
|
|
|
- show: 0,
|
|
|
- },
|
|
|
- pointer: {
|
|
|
- show: true,
|
|
|
- length: "90%",
|
|
|
- width: 3,
|
|
|
- },
|
|
|
- itemStyle: {
|
|
|
- //表盘指针的颜色
|
|
|
- color: "rgba(255, 153, 0, 0.31)",
|
|
|
- borderColor: "#ff9900",
|
|
|
- borderWidth: 1,
|
|
|
- },
|
|
|
- detail: {
|
|
|
- show: false,
|
|
|
- offsetCenter: [0, "100%"],
|
|
|
- textStyle: {
|
|
|
- fontSize: 20,
|
|
|
- color: "#00eff2",
|
|
|
- },
|
|
|
- formatter: [
|
|
|
- "{value} " + (item.unit || ""),
|
|
|
- "{name|" + item.name + "}",
|
|
|
- ].join("\n"),
|
|
|
- rich: {
|
|
|
- name: {
|
|
|
- fontSize: 14,
|
|
|
- lineHeight: 30,
|
|
|
- color: "#00eff2",
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
-
|
|
|
- data: [
|
|
|
- {
|
|
|
- value: item.value,
|
|
|
- },
|
|
|
- ],
|
|
|
- }
|
|
|
- );
|
|
|
- });
|
|
|
- return result;
|
|
|
- })(),
|
|
|
- };
|
|
|
- if (option) {
|
|
|
- myChart.setOption(option);
|
|
|
- }
|
|
|
-
|
|
|
- if (!testDom) {
|
|
|
- testDom = document.querySelectorAll(".test59 .box");
|
|
|
- }
|
|
|
- obsDom(testDom, myChart);
|
|
|
-}
|
|
|
+/**
|
|
|
+ * 健康状态charts
|
|
|
+ */
|
|
|
+
|
|
|
+// setTimeout(() => {
|
|
|
+// setChartsDom(document.querySelector('.charts1'))
|
|
|
+// }, 500);
|
|
|
+
|
|
|
+// setTimeout(() => {
|
|
|
+// setChartsDom(document.querySelector('.charts2'))
|
|
|
+// }, 1000);
|
|
|
+
|
|
|
+// setTimeout(() => {
|
|
|
+// setChartsDom(document.querySelector('.charts3'))
|
|
|
+// }, 1500);
|
|
|
+
|
|
|
+function setChartsDom(echartDom) {
|
|
|
+ const myChart = echarts.init(echartDom);
|
|
|
+ const option = {
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: "gauge",
|
|
|
+ z: 100,
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ width: 5,
|
|
|
+ color: [
|
|
|
+ [
|
|
|
+ 0.3,
|
|
|
+ new echarts.graphic.LinearGradient(0, 1, 1, 0, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "rgba(0, 237, 3,0.1)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.5,
|
|
|
+ color: "rgba(0, 237, 3,0.6)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "rgba(0, 237, 3,1)",
|
|
|
+ },
|
|
|
+ ]),
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 0.7,
|
|
|
+ new echarts.graphic.LinearGradient(0, 1, 1, 0, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "rgba(255, 184, 0,0.1)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.5,
|
|
|
+ color: "rgba(255, 184, 0,0.6)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "rgba(255, 184, 0,1)",
|
|
|
+ },
|
|
|
+ ]),
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ 1,
|
|
|
+ new echarts.graphic.LinearGradient(0, 1, 1, 0, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "rgba(175, 36, 74,0.1)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 0.5,
|
|
|
+ color: "rgba(255, 36, 74,0.6)",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "rgba(255, 36, 74,1)",
|
|
|
+ },
|
|
|
+ ]),
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // radius: '50%',
|
|
|
+ pointer: {
|
|
|
+ itemStyle: {
|
|
|
+ color: "auto",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ distance: 0,
|
|
|
+ length: 8,
|
|
|
+ lineStyle: {
|
|
|
+ color: "auto",
|
|
|
+ width: 2,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ distance: 0,
|
|
|
+ length: 20,
|
|
|
+ lineStyle: {
|
|
|
+ color: "auto",
|
|
|
+ width: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ color: "white",
|
|
|
+ distance: 30,
|
|
|
+ fontSize: 130,
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ valueAnimation: true,
|
|
|
+ formatter: "{value} %",
|
|
|
+ color: "white",
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: 70,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+
|
|
|
+ if (option) {
|
|
|
+ myChart.setOption(option);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function setCharts52(echartDom, testDom, temperature, humidity) {
|
|
|
+ let timer = null;
|
|
|
+
|
|
|
+ var myChart = echarts.init(echartDom);
|
|
|
+ // 地图背景颜色
|
|
|
+
|
|
|
+ var highlight = "#03b7c9";
|
|
|
+
|
|
|
+ var demoData = [
|
|
|
+ {
|
|
|
+ name: "温度",
|
|
|
+ value: 22,
|
|
|
+ unit: "℃",
|
|
|
+ pos: ["25%", "40%"],
|
|
|
+ range: [-40, 100],
|
|
|
+ YS: [
|
|
|
+ [0.4, "#119eff"],
|
|
|
+ [0.5, "#30da74"],
|
|
|
+ [1, "#f3390d"],
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "湿度",
|
|
|
+ value: 90,
|
|
|
+ unit: "%",
|
|
|
+ pos: ["75%", "40%"],
|
|
|
+ range: [0, 100],
|
|
|
+ splitNum: 10,
|
|
|
+ YS: [
|
|
|
+ [0.3, "#f3390d"],
|
|
|
+ [0.8, "#30da74"],
|
|
|
+ [1, "#119eff"],
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ option = {
|
|
|
+ backgroundColor: "#00162d",
|
|
|
+ series: (function () {
|
|
|
+ var result = [];
|
|
|
+
|
|
|
+ demoData.forEach(function (item) {
|
|
|
+ result.push(
|
|
|
+ // 外围刻度
|
|
|
+ {
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ radius: "50%", // 1行2个
|
|
|
+ splitNumber: item.splitNum || 10,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ startAngle: 225,
|
|
|
+ endAngle: -45,
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ shadowBlur: 0,
|
|
|
+ color: [[1, highlight]],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ color: highlight,
|
|
|
+ width: 1,
|
|
|
+ },
|
|
|
+ length: -5,
|
|
|
+ splitNumber: 10,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: true,
|
|
|
+ length: -10,
|
|
|
+ lineStyle: {
|
|
|
+ color: highlight,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ distance: -18,
|
|
|
+ textStyle: {
|
|
|
+ color: highlight,
|
|
|
+ fontSize: "10",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ pointer: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "速度",
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ splitNumber: item.splitNum || 10,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ radius: "45%",
|
|
|
+ axisLine: {
|
|
|
+ // 坐标轴线
|
|
|
+ show: false,
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle控制线条样式
|
|
|
+ color: item.YS,
|
|
|
+ shadowColor: "#ccc",
|
|
|
+ shadowBlur: 25,
|
|
|
+ width: 0,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 坐标轴小标记
|
|
|
+ // show: false,
|
|
|
+ length: 20, // 属性length控制线长
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle控制线条样式
|
|
|
+ color: "auto",
|
|
|
+ width: 2,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ // 分隔线
|
|
|
+ show: false,
|
|
|
+ length: 20, // 属性length控制线长
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle(详见lineStyle)控制线条样式
|
|
|
+ color: "auto",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ textStyle: {
|
|
|
+ // 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
|
+ fontWeight: "bolder",
|
|
|
+ fontSize: 20,
|
|
|
+ fontStyle: "italic",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: true,
|
|
|
+ offsetCenter: [0, "100%"],
|
|
|
+ textStyle: {
|
|
|
+ fontSize: 25,
|
|
|
+ },
|
|
|
+ formatter: [
|
|
|
+ "{value} " + (item.unit || ""),
|
|
|
+ "{name|" + item.name + "}",
|
|
|
+ ].join("\n"),
|
|
|
+ rich: {
|
|
|
+ name: {
|
|
|
+ fontSize: 16,
|
|
|
+ lineHeight: 30,
|
|
|
+ color: "#4be4de",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: item.value,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ pointer: {
|
|
|
+ width: 5,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // 内侧指针、数值显示
|
|
|
+ {
|
|
|
+ name: item.name,
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ radius: "40%",
|
|
|
+ startAngle: 225,
|
|
|
+ endAngle: -45,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 16,
|
|
|
+ color: [[1, "rgba(75,228,255,.1)"]],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ pointer: {
|
|
|
+ show: true,
|
|
|
+ length: "90%",
|
|
|
+ width: 3,
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ //表盘指针的颜色
|
|
|
+ color: "rgba(255, 153, 0, 0.31)",
|
|
|
+ borderColor: "#ff9900",
|
|
|
+ borderWidth: 1,
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: false,
|
|
|
+ offsetCenter: [0, "100%"],
|
|
|
+ textStyle: {
|
|
|
+ fontSize: 20,
|
|
|
+ color: "#00eff2",
|
|
|
+ },
|
|
|
+ formatter: [
|
|
|
+ "{value} " + (item.unit || ""),
|
|
|
+ "{name|" + item.name + "}",
|
|
|
+ ].join("\n"),
|
|
|
+ rich: {
|
|
|
+ name: {
|
|
|
+ fontSize: 14,
|
|
|
+ lineHeight: 30,
|
|
|
+ color: "#00eff2",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: item.value,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ })(),
|
|
|
+ };
|
|
|
+
|
|
|
+ if (option) {
|
|
|
+ myChart.setOption(option);
|
|
|
+ }
|
|
|
+
|
|
|
+ window.addEventListener("resize", function () {
|
|
|
+ if (timer) {
|
|
|
+ clearTimeout(timer);
|
|
|
+ timer = null;
|
|
|
+ }
|
|
|
+ timer = setTimeout(() => {
|
|
|
+ move2(".test52 .test-box");
|
|
|
+ myChart.resize();
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+ if (!testDom) {
|
|
|
+ testDom = document.querySelectorAll(".test52 .box");
|
|
|
+ }
|
|
|
+ obsDom(testDom, myChart);
|
|
|
+}
|
|
|
+
|
|
|
+function setCharts53(echartDom, testDom) {
|
|
|
+ let timer = null;
|
|
|
+
|
|
|
+ var myChart = echarts.init(echartDom);
|
|
|
+ // 地图背景颜色
|
|
|
+ data = [
|
|
|
+ {
|
|
|
+ name: "空调",
|
|
|
+ value: (Math.random() * 10).toFixed(0),
|
|
|
+ sum: 10,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "配电",
|
|
|
+ value: (Math.random() * 10).toFixed(0),
|
|
|
+ sum: 10,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "UPS",
|
|
|
+ value: (Math.random() * 10).toFixed(0),
|
|
|
+ sum: 10,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "温湿度",
|
|
|
+ value: (Math.random() * 10).toFixed(0),
|
|
|
+ sum: 10,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "烟感",
|
|
|
+ value: (Math.random() * 10).toFixed(0),
|
|
|
+ sum: 10,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "漏水",
|
|
|
+ value: (Math.random() * 10).toFixed(0),
|
|
|
+ sum: 10,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ getArrByKey = (data, k) => {
|
|
|
+ let key = k || "value";
|
|
|
+ let res = [];
|
|
|
+ if (data) {
|
|
|
+ data.forEach(function (t) {
|
|
|
+ res.push(t[key]);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ };
|
|
|
+ opt = {
|
|
|
+ index: 0,
|
|
|
+ };
|
|
|
+ color = ["#f85e35", "#d68f52", "#3fa4a9"];
|
|
|
+ data = data.sort((a, b) => {
|
|
|
+ return b.value - a.value;
|
|
|
+ });
|
|
|
+ option = {
|
|
|
+ grid: {
|
|
|
+ top: "2%",
|
|
|
+ bottom: -15,
|
|
|
+ right: 30,
|
|
|
+ left: -30,
|
|
|
+ containLabel: true,
|
|
|
+ },
|
|
|
+ xAxis: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ yAxis: [
|
|
|
+ {
|
|
|
+ triggerEvent: true,
|
|
|
+ show: true,
|
|
|
+ inverse: true,
|
|
|
+ data: getArrByKey(data, "name"),
|
|
|
+ axisLine: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ interval: 0,
|
|
|
+ color: "#fff",
|
|
|
+ align: "left",
|
|
|
+ margin: 450,
|
|
|
+ fontSize: 130,
|
|
|
+ // formatter: function (value, index) {
|
|
|
+ // if (opt.index === 0 && index < 3) {
|
|
|
+ // return (
|
|
|
+ // "{idx" + index + "|" + (1 + index) + "} {title|" + value + "}"
|
|
|
+ // );
|
|
|
+ // } else if (opt.index !== 0 && index + opt.index < 9) {
|
|
|
+ // return (
|
|
|
+ // "{idx|0" + (1 + index + opt.index) + "} {title|" + value + "}"
|
|
|
+ // );
|
|
|
+ // } else {
|
|
|
+ // return (
|
|
|
+ // "{idx|" + (1 + index + opt.index) + "} {title|" + value + "}"
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ rich: {
|
|
|
+ idx0: {
|
|
|
+ color: "#FB375E",
|
|
|
+ backgroundColor: "#FFE8EC",
|
|
|
+ borderRadius: 100,
|
|
|
+ padding: [5, 8],
|
|
|
+ fontSize: 100,
|
|
|
+ },
|
|
|
+ idx1: {
|
|
|
+ color: "#FF9023",
|
|
|
+ backgroundColor: "#FFEACF",
|
|
|
+ borderRadius: 100,
|
|
|
+ padding: [5, 8],
|
|
|
+ fontSize: 100,
|
|
|
+ },
|
|
|
+ idx2: {
|
|
|
+ color: "#01B599",
|
|
|
+ backgroundColor: "#E1F7F3",
|
|
|
+ borderRadius: 100,
|
|
|
+ padding: [5, 8],
|
|
|
+ fontSize: 100,
|
|
|
+ },
|
|
|
+ idx: {
|
|
|
+ color: "#fff",
|
|
|
+ borderRadius: 100,
|
|
|
+ padding: [5, 8],
|
|
|
+ fontSize: 100,
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ width: 165,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ triggerEvent: true,
|
|
|
+ show: true,
|
|
|
+ inverse: true,
|
|
|
+ data: getArrByKey(data, "name"),
|
|
|
+ axisLine: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ interval: 0,
|
|
|
+ color: "#fff",
|
|
|
+ align: "left",
|
|
|
+ margin: 20,
|
|
|
+ fontSize: 130,
|
|
|
+ formatter: function (value, index) {
|
|
|
+ return data[index].value + "条";
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: "条",
|
|
|
+ type: "bar",
|
|
|
+ yAxisIndex: 0,
|
|
|
+ data: data,
|
|
|
+ fontSize: 100,
|
|
|
+ barWidth: 50,
|
|
|
+ itemStyle: {
|
|
|
+ color: (val) => {
|
|
|
+ if (val.dataIndex < 3 && opt.index === 0) {
|
|
|
+ return color[val.dataIndex];
|
|
|
+ } else {
|
|
|
+ return "#1990FF";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ barBorderRadius: 30,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+
|
|
|
+ if (option) {
|
|
|
+ myChart.setOption(option);
|
|
|
+ }
|
|
|
+
|
|
|
+ window.addEventListener("resize", function () {
|
|
|
+ if (timer) {
|
|
|
+ clearTimeout(timer);
|
|
|
+ timer = null;
|
|
|
+ }
|
|
|
+ timer = setTimeout(() => {
|
|
|
+ move3(".test53 .test-box");
|
|
|
+
|
|
|
+ myChart.resize();
|
|
|
+ }, 500);
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!testDom) {
|
|
|
+ testDom = document.querySelectorAll(".test53 .box");
|
|
|
+ }
|
|
|
+ obsDom(testDom, myChart);
|
|
|
+}
|
|
|
+
|
|
|
+function setCharts54(echartDom, testDom) {
|
|
|
+ var myChart = echarts.init(echartDom);
|
|
|
+ // 地图背景颜色
|
|
|
+ option = {
|
|
|
+ color: [
|
|
|
+ "#F86464",
|
|
|
+ "#19DC7C",
|
|
|
+ "#34A6FE",
|
|
|
+ "#FA9022",
|
|
|
+ "#DCDB01",
|
|
|
+ "#8C70F8",
|
|
|
+ "#2A4AD1",
|
|
|
+ "#E76FE3",
|
|
|
+ "#5032C0",
|
|
|
+ "#168FB2",
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ left: "2%",
|
|
|
+ top: "1%",
|
|
|
+ bottom: 10,
|
|
|
+ right: "1%",
|
|
|
+ containLabel: true,
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: "item",
|
|
|
+ textStyle: {
|
|
|
+ fontSize: 130,
|
|
|
+ },
|
|
|
+ formatter: "{b} : {c} ({d}%)",
|
|
|
+ },
|
|
|
+ calculable: true,
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ stack: "a",
|
|
|
+ type: "pie",
|
|
|
+ radius: ["60%", "90%"],
|
|
|
+ center: ["50%", "55%"],
|
|
|
+ roseType: "area",
|
|
|
+ zlevel: 10,
|
|
|
+ label: {
|
|
|
+ normal: {
|
|
|
+ formatter: "{b} {d}%",
|
|
|
+ borderWidth: 0,
|
|
|
+ borderRadius: 4,
|
|
|
+ height: 40,
|
|
|
+ fontSize: 130,
|
|
|
+ align: "center",
|
|
|
+ rich: {
|
|
|
+ b: {
|
|
|
+ fontSize: 130,
|
|
|
+ lineHeight: 5,
|
|
|
+ color: "#41B3DC",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ labelLine: {
|
|
|
+ normal: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 10, // 线条的宽度
|
|
|
+ color: "#3f8ac9", //线的颜色设置, 如没有设置颜色则线条的颜色跟随饼状图的颜色
|
|
|
+ },
|
|
|
+ length: 100,
|
|
|
+ length2: 155,
|
|
|
+ },
|
|
|
+ emphasis: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: 5,
|
|
|
+ name: "机柜",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 15,
|
|
|
+ name: "服务器",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 25,
|
|
|
+ name: "交换机",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 20,
|
|
|
+ name: "路由器",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 35,
|
|
|
+ name: "PDU",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+
|
|
|
+ if (option) {
|
|
|
+ myChart.setOption(option);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!testDom) {
|
|
|
+ testDom = document.querySelectorAll(".test54 .box");
|
|
|
+ }
|
|
|
+ obsDom(testDom, myChart);
|
|
|
+}
|
|
|
+
|
|
|
+function setCharts58(echartDom, testDom, leackgePosition, eleRes) {
|
|
|
+ var myChart = echarts.init(echartDom);
|
|
|
+ // 地图背景颜色
|
|
|
+ var highlight = "#03b7c9";
|
|
|
+
|
|
|
+ var demoData = [
|
|
|
+ {
|
|
|
+ name: "漏水位置",
|
|
|
+ value: leackgePosition,
|
|
|
+ unit: "/米",
|
|
|
+ pos: ["25%", "40%"],
|
|
|
+ range: [-40, 100],
|
|
|
+ YS: [
|
|
|
+ [0.4, "#119eff"],
|
|
|
+ [0.5, "#30da74"],
|
|
|
+ [1, "#f3390d"],
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "电阻率",
|
|
|
+ value: eleRes,
|
|
|
+ unit: "",
|
|
|
+ pos: ["75%", "40%"],
|
|
|
+ range: [0, 100],
|
|
|
+ splitNum: 10,
|
|
|
+ YS: [
|
|
|
+ [0.3, "#f3390d"],
|
|
|
+ [0.8, "#30da74"],
|
|
|
+ [1, "#119eff"],
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ option = {
|
|
|
+ series: (function () {
|
|
|
+ var result = [];
|
|
|
+
|
|
|
+ demoData.forEach(function (item) {
|
|
|
+ result.push(
|
|
|
+ // 外围刻度
|
|
|
+ {
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ radius: "50%", // 1行2个
|
|
|
+ splitNumber: item.splitNum || 10,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ startAngle: 225,
|
|
|
+ endAngle: -45,
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ shadowBlur: 0,
|
|
|
+ color: [[1, highlight]],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ color: highlight,
|
|
|
+ width: 1,
|
|
|
+ },
|
|
|
+ length: -5,
|
|
|
+ splitNumber: 10,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: true,
|
|
|
+ length: -10,
|
|
|
+ lineStyle: {
|
|
|
+ color: highlight,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ distance: -18,
|
|
|
+ textStyle: {
|
|
|
+ color: highlight,
|
|
|
+ fontSize: "130",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ pointer: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "速度",
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ splitNumber: item.splitNum || 10,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ radius: "45%",
|
|
|
+ axisLine: {
|
|
|
+ // 坐标轴线
|
|
|
+ show: false,
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle控制线条样式
|
|
|
+ color: item.YS,
|
|
|
+ shadowColor: "#ccc",
|
|
|
+ shadowBlur: 25,
|
|
|
+ width: 0,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 坐标轴小标记
|
|
|
+ // show: false,
|
|
|
+ length: 20, // 属性length控制线长
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle控制线条样式
|
|
|
+ color: "auto",
|
|
|
+ width: 2,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ // 分隔线
|
|
|
+ show: false,
|
|
|
+ length: 20, // 属性length控制线长
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle(详见lineStyle)控制线条样式
|
|
|
+ color: "auto",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ textStyle: {
|
|
|
+ // 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
|
+ fontWeight: "bolder",
|
|
|
+ fontSize: 130,
|
|
|
+ fontStyle: "italic",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: true,
|
|
|
+ offsetCenter: [0, "100%"],
|
|
|
+ textStyle: {
|
|
|
+ fontSize: 130,
|
|
|
+ },
|
|
|
+ formatter: [
|
|
|
+ "{value} " + (item.unit || ""),
|
|
|
+ "{name|" + item.name + "}",
|
|
|
+ ].join("\n"),
|
|
|
+ rich: {
|
|
|
+ name: {
|
|
|
+ fontSize: 130,
|
|
|
+ lineHeight: 30,
|
|
|
+ color: "#4be4de",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: item.value,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ pointer: {
|
|
|
+ width: 5,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // 内侧指针、数值显示
|
|
|
+ {
|
|
|
+ name: item.name,
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ radius: "40%",
|
|
|
+ startAngle: 225,
|
|
|
+ endAngle: -45,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 16,
|
|
|
+ color: [[1, "rgba(75,228,255,.1)"]],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ pointer: {
|
|
|
+ show: true,
|
|
|
+ length: "90%",
|
|
|
+ width: 3,
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ //表盘指针的颜色
|
|
|
+ color: "rgba(255, 153, 0, 0.31)",
|
|
|
+ borderColor: "#ff9900",
|
|
|
+ borderWidth: 1,
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: false,
|
|
|
+ offsetCenter: [0, "100%"],
|
|
|
+ textStyle: {
|
|
|
+ fontSize: 130,
|
|
|
+ color: "#00eff2",
|
|
|
+ },
|
|
|
+ formatter: [
|
|
|
+ "{value} " + (item.unit || ""),
|
|
|
+ "{name|" + item.name + "}",
|
|
|
+ ].join("\n"),
|
|
|
+ rich: {
|
|
|
+ name: {
|
|
|
+ fontSize: 130,
|
|
|
+ lineHeight: 30,
|
|
|
+ color: "#00eff2",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: item.value,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ })(),
|
|
|
+ };
|
|
|
+ if (option) {
|
|
|
+ myChart.setOption(option);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!testDom) {
|
|
|
+ testDom = document.querySelectorAll(".test58 .box");
|
|
|
+ }
|
|
|
+ obsDom(testDom, myChart);
|
|
|
+}
|
|
|
+
|
|
|
+function setCharts59(echartDom, testDom, temperature, humidity) {
|
|
|
+ var myChart = echarts.init(echartDom);
|
|
|
+ // 地图背景颜色
|
|
|
+ var highlight = "#03b7c9";
|
|
|
+
|
|
|
+ var demoData = [
|
|
|
+ {
|
|
|
+ name: "平均温度",
|
|
|
+ value: temperature,
|
|
|
+ unit: "°",
|
|
|
+ pos: ["25%", "40%"],
|
|
|
+ range: [-40, 100],
|
|
|
+ YS: [
|
|
|
+ [0.4, "#119eff"],
|
|
|
+ [0.5, "#30da74"],
|
|
|
+ [1, "#f3390d"],
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "平均温度",
|
|
|
+ value: humidity,
|
|
|
+ unit: "°",
|
|
|
+ pos: ["75%", "40%"],
|
|
|
+ range: [0, 100],
|
|
|
+ splitNum: 10,
|
|
|
+ YS: [
|
|
|
+ [0.3, "#f3390d"],
|
|
|
+ [0.8, "#30da74"],
|
|
|
+ [1, "#119eff"],
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ option = {
|
|
|
+ series: (function () {
|
|
|
+ var result = [];
|
|
|
+
|
|
|
+ demoData.forEach(function (item) {
|
|
|
+ result.push(
|
|
|
+ // 外围刻度
|
|
|
+ {
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ radius: "50%", // 1行2个
|
|
|
+ splitNumber: item.splitNum || 10,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ startAngle: 225,
|
|
|
+ endAngle: -45,
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 2,
|
|
|
+ shadowBlur: 0,
|
|
|
+ color: [[1, highlight]],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ color: highlight,
|
|
|
+ width: 1,
|
|
|
+ },
|
|
|
+ length: -5,
|
|
|
+ splitNumber: 10,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: true,
|
|
|
+ length: -10,
|
|
|
+ lineStyle: {
|
|
|
+ color: highlight,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ distance: -18,
|
|
|
+ textStyle: {
|
|
|
+ color: highlight,
|
|
|
+ fontSize: "130",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ pointer: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "速度",
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ splitNumber: item.splitNum || 10,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ radius: "45%",
|
|
|
+ axisLine: {
|
|
|
+ // 坐标轴线
|
|
|
+ show: false,
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle控制线条样式
|
|
|
+ color: item.YS,
|
|
|
+ shadowColor: "#ccc",
|
|
|
+ shadowBlur: 25,
|
|
|
+ width: 0,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ // 坐标轴小标记
|
|
|
+ // show: false,
|
|
|
+ length: 20, // 属性length控制线长
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle控制线条样式
|
|
|
+ color: "auto",
|
|
|
+ width: 2,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ // 分隔线
|
|
|
+ show: false,
|
|
|
+ length: 20, // 属性length控制线长
|
|
|
+ lineStyle: {
|
|
|
+ // 属性lineStyle(详见lineStyle)控制线条样式
|
|
|
+ color: "auto",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ title: {
|
|
|
+ textStyle: {
|
|
|
+ // 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
|
+ fontWeight: "bolder",
|
|
|
+ fontSize: 130,
|
|
|
+ fontStyle: "italic",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: true,
|
|
|
+ offsetCenter: [0, "100%"],
|
|
|
+ textStyle: {
|
|
|
+ fontSize: 100,
|
|
|
+ },
|
|
|
+ formatter: [
|
|
|
+ "{value} " + (item.unit || ""),
|
|
|
+ "{name|" + item.name + "}",
|
|
|
+ ].join("\n"),
|
|
|
+ rich: {
|
|
|
+ name: {
|
|
|
+ fontSize: 130,
|
|
|
+ lineHeight: 30,
|
|
|
+ color: "#4be4de",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: item.value,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ pointer: {
|
|
|
+ width: 5,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // 内侧指针、数值显示
|
|
|
+ {
|
|
|
+ name: item.name,
|
|
|
+ type: "gauge",
|
|
|
+ center: item.pos,
|
|
|
+ radius: "40%",
|
|
|
+ startAngle: 225,
|
|
|
+ endAngle: -45,
|
|
|
+ min: item.range[0],
|
|
|
+ max: item.range[1],
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ width: 16,
|
|
|
+ color: [[1, "rgba(75,228,255,.1)"]],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ axisLabel: {
|
|
|
+ show: 0,
|
|
|
+ },
|
|
|
+ pointer: {
|
|
|
+ show: true,
|
|
|
+ length: "90%",
|
|
|
+ width: 3,
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ //表盘指针的颜色
|
|
|
+ color: "rgba(255, 153, 0, 0.31)",
|
|
|
+ borderColor: "#ff9900",
|
|
|
+ borderWidth: 1,
|
|
|
+ },
|
|
|
+ detail: {
|
|
|
+ show: false,
|
|
|
+ offsetCenter: [0, "100%"],
|
|
|
+ textStyle: {
|
|
|
+ fontSize: 100,
|
|
|
+ color: "#00eff2",
|
|
|
+ },
|
|
|
+ formatter: [
|
|
|
+ "{value} " + (item.unit || ""),
|
|
|
+ "{name|" + item.name + "}",
|
|
|
+ ].join("\n"),
|
|
|
+ rich: {
|
|
|
+ name: {
|
|
|
+ fontSize: 100,
|
|
|
+ lineHeight: 30,
|
|
|
+ color: "#00eff2",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ value: item.value,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ })(),
|
|
|
+ };
|
|
|
+ if (option) {
|
|
|
+ myChart.setOption(option);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!testDom) {
|
|
|
+ testDom = document.querySelectorAll(".test59 .box");
|
|
|
+ }
|
|
|
+ obsDom(testDom, myChart);
|
|
|
+}
|