westdc-zf1/htdocs/static-sanjy-np/js/mychart.js

121 lines
3.3 KiB
JavaScript
Raw Normal View History

2018-06-22 08:59:07 +00:00
/*柱状*/
var myChart = echarts.init(document.getElementById('zhuzhuang'));
var dataAxis = ['领养', '击', '柱', '子', '或', '者', '两', '指', '在', '触', '屏', '上', '滑', '动', '能', '够', '自', '动', '缩', '放'];
var data = [12000, '', 5000, '', 700, '', 210, '', 532, '', 115, ''];
2018-06-22 08:59:07 +00:00
var yMax = 500;
var dataShadow = [];
for (var i = 0; i < data.length; i++) {
dataShadow.push(yMax);
}
option = {
2018-06-24 09:27:01 +00:00
title: {
text: '三江源物种组成统计图',
2018-06-24 09:27:01 +00:00
x: 'center'
},
xAxis: {
type: 'category',
data: ['其他', '', '维管植物', '', '真菌', '', '哺乳动物', '', '鸟类', '', '鱼类']
2018-06-22 08:59:07 +00:00
},
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)'}
},
2018-06-24 09:27:01 +00:00
barGap: '-100%',
barCategoryGap: '40%',
2018-06-22 08:59:07 +00:00
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 = {
2018-06-24 09:27:01 +00:00
title: {
text: '三江源区产汇流贡献图',
2018-06-24 09:27:01 +00:00
subtext: '数据统计',
x: 'center'
2018-06-22 08:59:07 +00:00
},
2018-06-24 09:27:01 +00:00
tooltip: {
2018-06-22 08:59:07 +00:00
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
2018-06-24 09:27:01 +00:00
color: ['#a3ccf8', '#5156b8', '#69d4db', '#f88d48'],
2018-06-22 08:59:07 +00:00
legend: {
orient: 'vertical',
left: 'left',
2018-06-26 03:13:28 +00:00
data: ['黄河干流总流量', '澜沧江总流量', '长江干流总流量', '其他']
2018-06-22 08:59:07 +00:00
},
2018-06-24 09:27:01 +00:00
series: [
2018-06-22 08:59:07 +00:00
{
2018-06-26 03:13:28 +00:00
name: '',
2018-06-22 08:59:07 +00:00
type: 'pie',
2018-06-24 09:27:01 +00:00
radius: '55%',
2018-06-22 08:59:07 +00:00
center: ['50%', '60%'],
2018-06-24 09:27:01 +00:00
data: [
{value: 4900, name: '黄河干流总流量'},
{value: 1500, name: '澜沧江总流量'},
2018-06-24 09:44:47 +00:00
{value: 2500, name: '长江干流总流量'},
2018-06-24 09:27:01 +00:00
{value: 1100, name: '其他'}
2018-06-22 08:59:07 +00:00
],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
myChart1.setOption(option1);