配置项如下
setTimeout(function() {
option = {
legend: {},
tooltip: {
trigger: 'axis',
showContent: false
},
dataset: {
source: [
['product', '2013', '2014', '2015', '2016', '2017'],
['Eastern Europe', 0, 0, 0, 2, 2],
['Western Europe', 0, 1, 9, 3, 2],
['Middle East & North Africa', 373, 1248, 1211, 1438, 1292],
['Southeast Asia', 0, 0, 0, 10, 18],
['Central Asia', 0, 0, 0, 1, 0],
['Sub-Saharan Africa', 0, 0, 1, 0, 0],
['Australasia & Oceania', 0, 0, 0, 0, 1]
]
},
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: 'pie',
id: 'pie',
radius: '30%',
center: ['50%', '30%'],
label: {
formatter: '{b}: {@2012} ({d}%)'
},
encode: {
itemName: 'product',
value: '2012',
tooltip: '2012'
}
}
]
};
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);
});