配置项如下
setTimeout(function() {
option = {
legend: {},
tooltip: {
trigger: 'axis',
showContent: false
},
dataset: {
source: [
['year', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017'],
['生物武器', 0, 0, 1, 17, 0, 2, 1, 1, 0, 0, 0, 0, 1, 1, 0, 3, 0, 0, 0, 0],
['化学武器', 14, 9, 7, 10, 10, 16, 2, 1, 0, 9, 9, 8, 7, 1, 15, 14, 18, 23, 29, 27],
['放射性武器', 0, 0, 10, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
['核武器', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
['轻武器', 245, 436, 550, 707, 419, 389, 379, 737, 941, 1105, 1309, 1231, 1339, 1630, 2493, 3660, 5040, 3953, 3481, 3146],
['爆炸物/炸弹/炸药', 527, 639, 942, 765, 724, 701, 685, 1074, 1467, 1875, 2755, 2624, 2661, 2754, 5412, 7266, 9521, 8380, 7603, 5465],
['假武器', 1, 0, 1, 0, 0, 2, 0, 1, 0, 0, 1, 0, 2, 1, 0, 0, 2, 0, 0, 1],
['燃烧武器', 63, 147, 135, 131, 83, 89, 30, 72, 92, 87, 262, 337, 266, 211, 264, 504, 640, 703, 630, 656],
['致乱武器', 44, 50, 55, 56, 35, 29, 15, 35, 53, 58, 104, 72, 98, 123, 55, 99, 214, 388, 333, 307],
['交通工具', 0, 1, 0, 5, 1, 2, 1, 0, 2, 0, 1, 2, 3, 4, 4, 2, 10, 34, 13, 23],
['破坏设备', 2, 1, 2, 4, 0, 2, 0, 1, 1, 11, 10, 8, 6, 18, 4, 5, 1, 10, 8, 11],
['其他', 0, 13, 1, 1, 2, 1, 0, 0, 1, 2, 4, 5, 0, 2, 2, 7, 14, 8, 10, 10],
['未知', 38, 99, 110, 110, 59, 45, 53, 95, 101, 94, 350, 334, 343, 331, 273, 475, 1443, 1466, 1480, 1254]
]
},
xAxis: {
type: 'category'
},
yAxis: {
gridIndex: 0
},
grid: {
top: '55%'
},
series: [{
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
}, {
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
}, {
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
}, {
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
}, {
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
}, {
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
}, {
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
}, {
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
}, {
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
},
{
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
},
{
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
},
{
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
},
{
type: 'line',
smooth: true,
seriesLayoutBy: 'row'
},
{
type: 'pie',
id: 'pie',
radius: '30%',
center: ['50%', '25%'],
label: {
formatter: '{b}: {@2012} ({d}%)'
},
encode: {
itemName: 'year',
value: '1998',
tooltip: '1998'
}
}
]
};
myChart.on('updateAxisPointer', function(event) {
var xAxisInfo = event.axesInfo[0];
if (xAxisInfo) {
var dimension = xAxisInfo.value + 1;
myChart.setOption({
series: {
id: 'pie',
label: {
formatter: '{b}: {@[' + dimension + ']} ({d}%)'
},
encode: {
value: dimension,
tooltip: dimension
}
}
});
}
});
myChart.setOption(option);
});