var quxianChart = function(options){ var series0data = options.series[0].data || []; var yAxisData = options.xAxis[0].data; var option = { "title": { "text": "区县分布", "x": "center", "textStyle": { color: ['#b5e1fc'] }, "padding": [10, 0, 0, 0] }, "tooltip": { "trigger": "axis" }, grid: { top: 80, bottom: 30, left: 80 }, "yAxis": [{ "type": "category", "name": "人次", "data": yAxisData, axisPointer: { type: 'shadow' }, axisTick: { show: false }, axisLine: { lineStyle: { color: '#095f8e' } }, axisLabel: { color: '#b5e1fc' }, nameTextStyle: { color: '#b5e1fc' } }], "xAxis": [{ "type": "value", axisPointer: { type: 'shadow' }, axisTick: { show: false }, axisLine: { lineStyle: { color: '#095f8e' } }, axisLabel: { color: '#fff' }, splitLine: { show: false // 不显示坐标轴刻度 } }], "series": [{ "smooth": true, "name": "区县分布", "type": "bar", barWidth: 20, "label": { show: false, position: "right" }, "itemStyle": { "normal": { "lineStyle": { "shadowColor": "rgba(0,0,0,0.4)" }, barBorderRadius: [0, 8, 8, 0], color: '#00e6f3' } }, "data": series0data }, ] } return option }, xingbieChart = function(options){ console.log(options) var title = options.title.text; var data = options.series[0].data; var legend = data.map(function(item){ return item.name; }) var option = { "title": { "text": title, "x": "center", "textStyle": { color: ['#b5e1fc'] }, "padding": [10, 0, 0, 0] }, "tooltip": { "trigger": "item" }, legend: { orient: 'vertical', // x: 'right', data: legend, right: '25%', top: '40%', textStyle: { color: ['#b5e1fc'] } }, "series": [{ "center": [ "35%", "50%" ], radius: ['30%', '40%'], "name": "", "type": "pie", "itemStyle": { "normal": { "label": { "show": false }, "labelLine": { "show": false } } }, "data": data }] } return option }, jibingTopChart = function(options){ debugger var title = options.title.text; var yAxisData = (options.xAxis[0].data && options.xAxis[0].data.reverse()) || []; var xAxisData = (options.series[0].data && options.series[0].data.reverse()) || []; var option = { "title": { "text": title, "x": "center", "textStyle": { color: ['#b5e1fc'] }, "padding": [10, 0, 0, 0] }, "tooltip": { "trigger": "axis" }, grid: { top: 40, bottom: 30, left: 80, right:20 }, "yAxis": [{ "type": "category", "name": "", "data": yAxisData, axisPointer: { type: 'shadow' }, axisTick: { show: false }, axisLine: { lineStyle: { color: '#095f8e' } }, axisLabel: { color: '#b5e1fc', formatter(v){ return getBrStr(v,5,true); } }, nameTextStyle: { color: '#b5e1fc' }, }], "xAxis": [{ "type": "value", axisPointer: { type: 'shadow' }, axisTick: { show: false }, axisLine: { lineStyle: { color: '#095f8e' } }, axisLabel: { color: '#fff' }, splitLine: { show: false // 不显示坐标轴刻度 } }], "series": [{ "smooth": true, "name": "并发症排行", "type": "bar", barWidth: 20, "label": { show: false, position: "right" }, "itemStyle": { "normal": { "lineStyle": { "shadowColor": "rgba(0,0,0,0.4)" }, barBorderRadius: [0, 8, 8, 0], color: '#00e6f3' } }, "data": xAxisData }, ] } return option }, qushiChart = function(options){ debugger console.log(options); var title = options.title.text; var xAxisData = options.xAxis[0].data; var series0data = options.series[0].data || []; var series1data = options.series[1].data || []; var option = { "title": { "text": title, "x": "center", textStyle: { color: '#b5e1fc', fontSize: 16, fontWeight: 'bold' }, "padding": [10, 0, 0, 0] }, tooltip: { trigger: 'axis', axisPointer: { type: 'cross', crossStyle: { color: '#fff' } } }, "grid": { top: '90', left: '60', bottom:'25', right:'60' }, legend: { data: ['新增人数', '环比'], textStyle: { color: '#b5e1fc' }, top: '45' }, xAxis: [{ type: 'category', "data": xAxisData, axisPointer: { type: 'shadow' }, axisTick: { show: false }, axisLine: { lineStyle: { color: '#095f8e' } }, axisLabel: { color: '#b5e1fc' } }], yAxis: [{ type: 'value', name: '新增人数', nameTextStyle: { color: '#b5e1fc' // 坐标轴名称颜色 }, splitLine: { show: false }, axisLine: { lineStyle: { color: '#095f8e' } }, axisLabel: { color: '#b5e1fc' } }, { type: 'value', name: '环比', nameTextStyle: { color: '#b5e1fc' // 坐标轴名称颜色 }, splitLine: { show: false // 不显示坐标轴刻度 }, axisLine: { lineStyle: { color: '#095f8e' // 坐标轴轴线颜色 } }, axisLabel: { color: '#b5e1fc' // 坐标轴刻度标签文本颜色 } } ], series: [{ name: '新增人数', type: 'bar', "data":series0data, barWidth: 20, label: { normal: { show: true, position: 'top', // 在柱状图上方显示 color: '#fff' // 柱状图上方显示的数值颜色 } }, itemStyle: { barBorderRadius: [8, 8, 0, 0], color: '#00e6f3' } }, { name: '环比', type: 'line', yAxisIndex: 1, "data": series1data, itemStyle: { color: '#03fa6d' } } ] } return option }, nianlingChart = function(options){ var title = options.title.text; var data = options.series[0].data var legend = data.map(function(item){ return item.name; }) var option = { "title": { "text": title, "x": "center", "textStyle": { color: ['#b5e1fc'] }, "padding": [10, 0, 0, 0] }, "tooltip": { "trigger": "item" }, legend: { orient: 'vertical', data: legend, right: '15%', top: '25%', textStyle: { color: ['#b5e1fc'] } }, "series": [{ "center": [ "35%", "50%" ], radius: ['30%', '40%'], "name": "", "type": "pie", "itemStyle": { "normal": { "label": { "show": false }, "labelLine": { "show": false } } }, "data": data }] } return option } function getBrStr(str,num,yRoute2){ if(!str)return '' var newParamsName = "";// 最终拼接成的字符串 var provideNumber = num || 10;// 每行能显示的字的个数 var strArr=str.split(''); if(strArr.length>15 && num && !yRoute2) { //如果是Y轴 TOP5的 最多显示两行 然后用省略号 strArr = strArr.slice(0,9) strArr.push('...') } else if(yRoute2 && strArr.length >5){ strArr = strArr.slice(0,4) strArr.push('...'); } strArr.map((v,i)=>{ var str =v; if(i!=0 && (i+1)%provideNumber == 0 && !yRoute2){ str+='\n'; num++; } newParamsName+=str }) return newParamsName }