import * as echarts from 'echarts' const iuCharts = { drawBar:function(chart,params){ var color = ['#4379EE','#FEC53D','#65789B','#F6BD16']; let series = params.yData.map((m,i)=>{ let obj = { name: m.title, type: 'bar', barWidth: '16%', barGap: '30%', itemStyle: { normal: { color: color[i], barBorderRadius: [50, 50, 0, 0] } }, data: m.data }; return obj }) var option = { backgroundColor: '#fff', tooltip: { trigger: 'axis', axisPointer: { lineStyle: { color: '#4379EE' }, }, }, grid: { top: '5%', left: '7%', right: '3%', bottom: '5%', // containLabel: true }, legend: { show: true, orient: 'horizontal', y:-5, right:15, itemWidth: 12, itemHeight: 12, itemGap: 24, textStyle: { color: 'rgba(43,48,52)', fontSize:'14px' } }, xAxis: [{ type: 'category', axisLine: { show: false, }, axisLabel: { color: 'rgba(43,48,52, 0.4)', }, axisTick: { show: false }, splitLine: { show: false }, boundaryGap: false, data: params.xData }], yAxis: [{ type: 'value', min: 0, splitNumber: 4, splitLine: { show: true, lineStyle: { color: 'rgba(43,48,52, 0.1)', } }, axisLine: { show: false, }, axisLabel: { color: 'rgba(43,48,52, 0.4)', margin: 30 }, axisTick: { show: false, }, }], series: series }; chart.setOption(option); }, drawLine:function(chart,params){ let series = []; params.yData.forEach(m=>{ series.push( { name:m.title, type: 'line', showAllSymbol: true, symbol: 'circle', symbolSize: 10, lineStyle: { normal: { color: "#4379EE", width:3 }, }, areaStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, color: 'rgba(67,121,238,0.3)' }, { offset: 1, color: 'rgba(67,121,238,0)' } ], false), } }, data: m.data } ) }) let option = { backgroundColor:'#fff', tooltip: { trigger: 'axis', axisPointer: { lineStyle: { color: '#4379EE' }, }, }, grid: { top: '5%', left: '7%', right: '2%', bottom: '5%', // containLabel: true }, xAxis: [{ type: 'category', axisLine: { show: false, }, axisLabel: { color: 'rgba(43,48,52, 0.4)', }, axisTick: { show: false }, splitLine: { show: false }, boundaryGap: false, data: params.xData }], yAxis: [{ type: 'value', min: 0, splitNumber: 4, splitLine: { show: true, lineStyle: { color: 'rgba(43,48,52, 0.1)', } }, axisLine: { show: false, }, axisLabel: { color: 'rgba(43,48,52, 0.4)', margin: 30 }, axisTick: { show: false, }, }], series: series }; chart.setOption(option); } } export { iuCharts }