/*柱状*/ var myChart = echarts.init(document.getElementById('zhuzhuang')); var dataAxis = ['领养', '击', '柱', '子', '或', '者', '两', '指', '在', '触', '屏', '上', '滑', '动', '能', '够', '自', '动', '缩', '放']; var data = [12000, '', 5000, '', 700, '', 210, '', 532, '', 115, '']; var yMax = 500; var dataShadow = []; for (var i = 0; i < data.length; i++) { dataShadow.push(yMax); } option = { title: { text: '三江源物种组成统计图', x: 'center' }, xAxis: { type: 'category', data: ['其他', '', '维管植物', '', '真菌', '', '哺乳动物', '', '鸟类', '', '鱼类'] }, yAxis: { axisLine: { show: false }, axisTick: { show: false }, axisLabel: { textStyle: { color: '#999' } } }, dataZoom: [ { type: 'inside' } ], series: [ { // For shadow type: 'bar', itemStyle: { normal: {color: 'rgba(0,0,0,0.05)'} }, barGap: '-100%', barCategoryGap: '40%', data: dataShadow, animation: false }, { type: 'bar', itemStyle: { normal: { color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ {offset: 0, color: '#83bff6'}, {offset: 0.5, color: '#188df0'}, {offset: 1, color: '#188df0'} ] ) }, emphasis: { color: new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ {offset: 0, color: '#2378f7'}, {offset: 0.7, color: '#2378f7'}, {offset: 1, color: '#83bff6'} ] ) } }, data: data } ] }; myChart.setOption(option); /*饼图*/ var myChart1 = echarts.init(document.getElementById('bingtu')); option1 = { title: { text: '三江源区产汇流贡献图', subtext: '数据统计', x: 'center' }, tooltip: { trigger: 'item', formatter: "{a}
{b} : {c} ({d}%)" }, color: ['#a3ccf8', '#5156b8', '#69d4db', '#f88d48'], legend: { orient: 'vertical', left: 'left', data: ['黄河干流总流量', '澜沧江总流量', '长江干流总流量', '其他'] }, series: [ { name: '', type: 'pie', radius: '55%', center: ['50%', '60%'], data: [ {value: 4900, name: '黄河干流总流量'}, {value: 1500, name: '澜沧江总流量'}, {value: 2500, name: '长江干流总流量'}, {value: 1100, name: '其他'} ], itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] }; myChart1.setOption(option1);