| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754 |
- function home1Line(data, showed) {
- console.log(showed)
- return {
- title: {
- show: showed, // 是否显示title
- text: '暂无数据',
- left: 'center',
- top: 'center',
- textStyle: {
- color: '#9a9b9f',
- fontSize: 20,
- fontWeight: 400
- }
- },
- tooltip: {
- trigger: "axis",
- axisPointer: {
- lineStyle: {
- color: "#666"
- }
- },
- formatter(params) {
- var returnData = '';
- var time = '';
- for (let g in params) {
- time = params[g].axisValue;
- if (params[g].seriesIndex == 0) {
- returnData += params[g].seriesName + ':' + params[g].value + '%<br/>';
- }
- if (params[g].seriesIndex == 1) {
- returnData += params[g].seriesName + ':' + params[g].value + '°C<br/>';
- }
- }
- return time + '<br/>' + returnData;
- }
- },
- legend: {
- top: "10",
- textStyle: {
- color: "#666",
- fontSize: "12"
- }
- },
- grid: {
- left: "10",
- top: "80",
- right: "20",
- bottom: "10",
- containLabel: true
- },
- xAxis: [{
- type: "category",
- boundaryGap: false,
- axisLabel: {
- textStyle: {
- color: "#666",
- fontSize: 12
- }
- },
- axisLine: {
- lineStyle: {
- color: "#afb2c5"
- }
- },
- splitLine: {
- show: true,
- lineStyle: {
- color: '#afb2c5'
- }
- },
- data: data.time
- },
- {
- axisPointer: {
- show: false
- },
- axisLine: {
- show: false
- },
- position: "bottom",
- offset: 0
- }
- ],
- yAxis: [{
- type: "value",
- axisTick: {
- show: false
- },
- axisLine: {
- lineStyle: {
- color: "#afb2c5"
- }
- },
- axisLabel: {
- textStyle: {
- color: "#666",
- fontSize: 12
- }
- },
- splitLine: {
- show: false
- }
- }],
- series: [{
- name: "空气湿度",
- type: "line",
- smooth: true,
- symbol: "circle", //标记的 图形
- symbolSize: 5,
- showSymbol: true,
- lineStyle: {
- normal: {
- color: "#42d3ff",
- width: 4
- }
- },
- areaStyle: {
- normal: {
- color: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- colorStops: [{
- offset: 0,
- color: '#a7caff' // 0% 处的颜色
- }, {
- offset: 0.8,
- color: '#e3e8fe' // 100% 处的颜色
- }],
- global: false // 缺省为 false
- },
- shadowColor: "rgba(0, 0, 0, 0.1)"
- }
- },
- itemStyle: {
- normal: {
- color: "#62e2ff",
- borderColor: "#62e2ff",
- borderWidth: 4
- }
- },
- data: data.ah
- },
- {
- name: "空气温度",
- type: "line",
- smooth: true,
- symbol: "circle",
- symbolSize: 5,
- showSymbol: true,
- lineStyle: {
- normal: {
- color: "#fd0001",
- width: 3
- }
- },
- itemStyle: {
- normal: {
- color: "#fd0001",
- borderColor: "#fd0001",
- borderWidth: 4
- }
- },
- data: data.at
- }
- ]
- };
- }
- function home1Pie(bzy, cbd, qxz, scd, xycb, jk, tccb, xy2, wheat, sf, sycb, ndqxz) {
- var data = [];
- var colorList = [];
- if (bzy > 0) {
- data.push({
- "name": "孢子仪",
- "value": bzy
- })
- colorList.push('#00d0ae');
- }
- if (cbd > 0) {
- data.push({
- "name": "虫情测报",
- "value": cbd
- })
- colorList.push('#d70252');
- }
- if (qxz > 0) {
- data.push({
- "name": "环境监测",
- "value": qxz
- })
- colorList.push('#ffa300');
- }
- if (scd > 0) {
- data.push({
- "name": "杀虫灯",
- "value": scd
- })
- colorList.push('#1e75ff');
- }
- // 新
- if (xycb > 0) {
- data.push({
- "name": "性诱测报",
- "value": xycb
- })
- colorList.push('#00d0ae');
- }
- if (jk > 0) {
- data.push({
- "name": "监控",
- "value": jk
- })
- colorList.push('#d70252');
- }
- if (tccb > 0) {
- data.push({
- "name": "糖醋测报",
- "value": tccb
- })
- colorList.push('#ffa300');
- }
- if (xy2> 0) {
- data.push({
- "name": "性诱2.0",
- "value": xy2
- })
- colorList.push('#1e75ff');
- }
-
- if (wheat > 0) {
- data.push({
- "name": "小麦赤霉病",
- "value": wheat
- })
- colorList.push('#00d0ae');
- }
- if (sf > 0) {
- data.push({
- "name": "水肥",
- "value": sf
- })
- colorList.push('#d70252');
- }
- if (sycb > 0) {
- data.push({
- "name": "色诱测报",
- "value": sycb
- })
- colorList.push('#ffa300');
- }
- if (ndqxz> 0) {
- data.push({
- "name": "管式墒情",
- "value": ndqxz
- })
- colorList.push('#1e75ff');
- }
- let total = bzy + cbd + qxz + scd + xycb + jk + tccb + xy2 + wheat + sf + sycb + ndqxz
- return {
- "animation": true,
- "title": {
- "text": `${total}台`,
- "x": "center",
- "y": "center",
- "textStyle": {
- "color": "#1e74fd",
- "fontSize": 20,
- "fontWeight": "normal",
- "align": "center",
- "width": "100px",
- },
- "top": "56%",
- },
- grid: {
- x: '57%',
- y: '17%',
- width: '38%',
- height: '38%'
- },
- "legend": {
- "width": "90%",
- "left": "center",
- "textStyle": {
- "color": "#666",
- "fontSize": 12
- },
- "icon": "circle",
- "right": "0",
- "bottom": "0",
- "padding": [5, 10],
- "itemGap": 10,
- // "data": ["气象监测", "孢子仪设备", "杀虫灯设备", "测报设备"]
- "data": ["杀虫灯设备", "测报设备"]
- },
- "series": [{
- "type": "pie",
- // "center": ["50%", "50%"],
- "center": ["50%", "60%"],
- "radius": ['20%', "50%"],
- "color": colorList,
- "startAngle": 135,
- "labelLine": {
- "normal": {
- "length": 10,
- 'length2':5
- }
- },
- "label": {
- "normal": {
- "formatter": "{b|{b}\n}{per|{c}台}",
- "backgroundColor": "rgba(255, 147, 38, 0)",
- "borderColor": "red",
- "borderRadius": 4,
- "rich": {
- "b": {
- // "color": "red",
- "fontSize": 15,
- "lineHeight": 33
- },
- "per": {
- // "color": "#FDF44E",
- "fontSize": 16,
- "padding": [5, 6],
- "borderRadius": 2
- }
- },
- "textStyle": {
- "fontSize": 20
- }
- }
- },
- "emphasis": {
- "label": {
- "show": true,
- "formatter": "{b|{b}\n}{per|{d}%} ",
- "backgroundColor": "rgba(255, 147, 38, 0)",
- "borderColor": "transparent",
- "borderRadius": 4,
- "rich": {
- "a": {
- "color": "#999",
- "lineHeight": 22,
- "align": "center"
- },
- "b": {
- // "color": "red",
- "fontSize": 18,
- "lineHeight": 33
- },
- "per": {
- // "color": "#FDF44E",
- "fontSize": 18,
- "padding": [5, 6],
- "borderRadius": 2
- }
- }
- }
- },
- "data": data
- }]
- };
- }
- const option03 = {
- "animation": true,
- "title": {
- "text": '24台',
- "x": "center",
- "y": "center",
- "textStyle": {
- "color": "#1e74fd",
- "fontSize": 20,
- "fontWeight": "normal",
- "align": "center",
- "width": "100px"
- },
- },
- "legend": {
- "width": "90%",
- "left": "center",
- "textStyle": {
- "color": "#666",
- "fontSize": 12
- },
- "icon": "circle",
- "right": "0",
- "bottom": "0",
- "padding": [5, 10],
- "itemGap": 10,
- // "data": ["气象监测", "孢子仪设备", "杀虫灯设备", "测报设备"]
- "data": ["气象监测", "孢子仪设备", "杀虫灯设备", "测报设备", "性诱测报" , "监控", "糖醋测报", "性诱2.0", "小麦赤霉病", "水肥", "色诱测报", "管式墒情"]
- },
- "series": [{
- "type": "pie",
- "center": ["50%", "50%"],
- "radius": ["60%", "70%"],
- "color": ["#00d0ae", "#d70252", "#ffa300", "#1e75ff"],
- "startAngle": 135,
- "labelLine": {
- "normal": {
- "length": 25
- }
- },
- "label": {
- "normal": {
- "formatter": "{c}台",
- "backgroundColor": "rgba(255, 147, 38, 0)",
- "borderColor": "transparent",
- "borderRadius": 4,
- "rich": {
- "a": {
- "color": "#999",
- "lineHeight": 22,
- "align": "center"
- },
- "hr": {
- "borderColor": "#aaa",
- "width": "100%",
- "borderWidth": 1,
- "height": 0
- },
- "b": {
- "color": "#b3e5ff",
- "fontSize": 16,
- "lineHeight": 33
- },
- "c": {
- "fontSize": 90,
- "color": "red"
- },
- "per": {
- "color": "#FDF44E",
- "fontSize": 14,
- "padding": [5, 8],
- "borderRadius": 2
- }
- },
- "textStyle": {
- "fontSize": 20
- }
- }
- },
- "emphasis": {
- "label": {
- "show": true,
- "formatter": "{b|{b}:} {per|{d}%} ",
- "backgroundColor": "rgba(255, 147, 38, 0)",
- "borderColor": "transparent",
- "borderRadius": 4,
- "rich": {
- "a": {
- "color": "#999",
- "lineHeight": 22,
- "align": "center"
- },
- "hr": {
- "borderColor": "#aaa",
- "width": "100%",
- "borderWidth": 1,
- "height": 0
- },
- "b": {
- "color": "#fff",
- "fontSize": 18,
- "lineHeight": 33
- },
- "c": {
- "fontSize": 14,
- "color": "#eee"
- },
- "per": {
- "color": "#FDF44E",
- "fontSize": 25,
- "padding": [5, 6],
- "borderRadius": 2
- }
- }
- }
- },
- // "data": [{
- // "name": "气象监测",
- // "value": 3
- // }, {
- // "name": "孢子仪设备",
- // "value": 7
- // }, {
- // "name": "杀虫灯设备",
- // "value": 4
- // }, {
- // "name": "测报设备",
- // "value": 10
- // }]
- "data": [{
- "name": "气象监测",
- "value": 3
- }, {
- "name": "孢子仪设备",
- "value": 7
- }, {
- "name": "杀虫灯设备",
- "value": 4
- }, {
- "name": "测报设备",
- "value": 10
- },
- {
- "name": "性诱测报",
- "value": 3
- }, {
- "name": "监控",
- "value": 7
- }, {
- "name": "糖醋测报",
- "value": 4
- }, {
- "name": "性诱2.0",
- "value": 10
- },
- {
- "name": "小麦赤霉病",
- "value": 3
- }, {
- "name": "水肥",
- "value": 7
- }, {
- "name": "色诱测报",
- "value": 4
- }, {
- "name": "管式墒情",
- "value": 10
- },
- ]
- }]
- }
- // function myEcharts(arr,total) {
- // return {
- // "animation": true,
- // "title": {
- // "text": `${total}台`,
- // "x": "center",
- // "y": "center",
- // "textStyle": {
- // "color": "#1e74fd",
- // "fontSize": 20,
- // "fontWeight": "normal",
- // "align": "center",
- // "width": "100px"
- // },
- // },
- // "legend": {
- // "width": "90%",
- // "left": "center",
- // "textStyle": {
- // "color": "#666",
- // "fontSize": 12
- // },
- // "icon": "circle",
- // "right": "0",
- // "bottom": "0",
- // "padding": [5, 10],
- // "itemGap": 10,
- // "data": ["性诱3.0", "水电双计", "温室大棚", "水肥设备", "病虫害可视监测" , "性诱测报", "性诱2.0", "孢子仪", "环境监测", "监控设备", "水肥一体化", "小麦赤霉病","吸虫塔","玉米大斑病","测报灯","杀虫灯","管事墒情","小麦条锈病"]
- // },
- // "series": [{
- // "type": "pie",
- // "center": ["50%", "50%"],
- // // "radius": ["60%", "70%"],
- // "radius": ["30%","40%"],
- // "color": ["#00d0ae", "#d70252", "#ffa300", "#1e75ff"],
- // "startAngle": 135,
- // "labelLine": {
- // "normal": {
- // "length": 25
- // }
- // },
- // "label": {
- // "normal": {
- // "formatter": "{c}台",
- // "backgroundColor": "rgba(255, 147, 38, 0)",
- // "borderColor": "transparent",
- // "borderRadius": 4,
- // "rich": {
- // "a": {
- // "color": "#999",
- // "lineHeight": 22,
- // "align": "center"
- // },
- // "hr": {
- // "borderColor": "#aaa",
- // "width": "100%",
- // "borderWidth": 1,
- // "height": 0
- // },
- // "b": {
- // "color": "#b3e5ff",
- // "fontSize": 16,
- // "lineHeight": 33
- // },
- // "c": {
- // "fontSize": 90,
- // "color": "red"
- // },
- // "per": {
- // "color": "#FDF44E",
- // "fontSize": 14,
- // "padding": [5, 8],
- // "borderRadius": 2
- // }
- // },
- // "textStyle": {
- // "fontSize": 20
- // }
- // }
- // },
- // "emphasis": {
- // "label": {
- // "show": true,
- // "formatter": "{b|{b}:} {per|{d}%} ",
- // "backgroundColor": "rgba(255, 147, 38, 0)",
- // "borderColor": "transparent",
- // "borderRadius": 4,
- // "rich": {
- // "a": {
- // "color": "#999",
- // "lineHeight": 22,
- // "align": "center"
- // },
- // "hr": {
- // "borderColor": "#aaa",
- // "width": "100%",
- // "borderWidth": 1,
- // "height": 0
- // },
- // "b": {
- // "color": "#fff",
- // "fontSize": 18,
- // "lineHeight": 33
- // },
- // "c": {
- // "fontSize": 14,
- // "color": "#eee"
- // },
- // "per": {
- // "color": "#FDF44E",
- // "fontSize": 25,
- // "padding": [5, 6],
- // "borderRadius": 2
- // }
- // }
- // }
- // },
- // "data": arr
- // }]
- // }
- // }
- function myEcharts(arr,total) {
- return {
- title: [
- {
- // text: "标题",
- textStyle: {
- fontSize: 16,
- color: "black",
- },
- left: "2%",
- },
- {
- text: "设备数量",
- subtext: total,
- textStyle: {
- fontSize: 20,
- color: "black",
- },
- subtextStyle: {
- fontSize: 20,
- color: "black",
- },
- textAlign: "center",
- x: "34.5%",
- y: "44%",
- },
- ],
- tooltip: {
- trigger: "item",
- 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: "70%",
- align: "left",
- top: "middle",
- textStyle: {
- color: "#8C8C8C",
- },
- height: 250,
- },
- series: [
- {
- // name: "标题",
- type: "pie",
- center: ["35%", "50%"],
- radius: ["40%", "65%"],
- clockwise: false, //饼图的扇区是否是顺时针排布
- avoidLabelOverlap: false,
- label: {
- show: false
- },
- labelLine: {
- show: false
- },
-
- data: arr,
- },
- ],
- }
- }
- // option01和option02是Home页面的echarts数据
- export {
- home1Line,
- home1Pie,
- myEcharts,
- option03,
- }
|