/* * @Description: * @Version: 1.0 * @Author: yangsx * @Date: 2019-11-29 09:42:21 * @LastEditors: yangsx * @LastEditTime: 2019-12-10 14:47:11 */ var seChart = { echartsTEMP: echarts.init(document.getElementById("echartsTEMP")), echartsCOND: echarts.init(document.getElementById("echartsCOND")), echartsPH: echarts.init(document.getElementById("echartsPH")), echartsVWC: echarts.init(document.getElementById("echartsVWC")) }; /** * @description: * @param {type} * @return: * @author: yangsx */ function getOption(echartsX, echartsY, code, unit, minthreshold, maxthreshold) { var option = { // backgroundColor: "#050d1999", tooltip: { //鼠标悬浮弹出提示框 trigger: "axis", //提示框弹出的触发时间,折线图和柱状图为axis formatter: "{a}
{b}
{c} " + unit //提示框提示的信息,{a}series内的名字,{b}为块状的名字,{c}为数值 }, grid: { //统计图距离边缘的距离 top: "8%", left: "10%", right: "10%", bottom: "18%" }, xAxis: [ { //x轴 type: "category", //数据类型为不连续数据 boundaryGap: false, //坐标轴两边是否留白 axisLine: { //坐标轴轴线相关设置。数学上的x轴 show: true, lineStyle: { color: "#233e64" //x轴颜色 } }, axisLabel: { //坐标轴刻度标签的相关设置 textStyle: { color: "#6a9cd5" } }, axisTick: { show: true }, //刻度点数轴 data: echartsX } ], yAxis: [ { //y轴的相关设置 type: "value", //y轴数据类型为连续的数据 // min: 0,//y轴上的刻度最小值 // max:140,//y轴上的刻度最大值 splitNumber: 7, //y轴上的刻度段数 splitLine: { //y轴上的y轴线条相关设置 show: true, lineStyle: { color: "#233e64" } }, axisLine: { //y轴的相关设置 show: true, lineStyle: { color: "#233e64" //y轴颜色 } }, axisLabel: { //y轴的标签相关设置 formatter: "{value}", textStyle: { color: "#6a9cd5" } }, axisTick: { show: true } //刻度点数轴 } ], visualMap: { top: 0, right: 15, show: false, pieces: [ { max: Number(minthreshold), color: "rgba(236,19,21, 0.6)" }, { min: Number(maxthreshold), color: "rgba(236,19,21, 0.6)" } ], outOfRange: { color: "rgba(61,234,255, 0.6)" } }, series: [ { name: code, type: "line", //统计图类型为折线图 smooth: true, //是否平滑曲线显示 symbolSize: 0, //数据点的大小,[0,0]//b表示宽度和高度 // lineStyle: { // //线条的相关设置 // normal: { // color: "#3deaff" // 线条颜色 // } // }, // areaStyle: { // //区域填充样式 // normal: { // //线性渐变,前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’,则该四个值是绝对像素位置。 // shadowColor: "rgba(53,142,215, 0.9)", //阴影颜色 // shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。 // } // }, data: echartsY } ] }; return option; }