0
我想在瓦丹做this。添加多个系列,深入到Vaadin中的多个系列
$(function() {
// Create the chart
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Highcharts multi-series drilldown'
},
subtitle: {
text: 'Click columns to drill down to single series. Click categories to drill down both.'
},
xAxis: {
type: 'category'
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
},
series: [{
name: '2010',
data: [{
name: 'Republican',
y: 5,
drilldown: 'republican-2010'
}, {
name: 'Democrats',
y: 2,
drilldown: 'democrats-2010'
}, {
name: 'Other',
y: 4,
drilldown: 'other-2010'
}]
}, {
name: '2014',
data: [{
name: 'Republican',
y: 4,
drilldown: 'republican-2014'
}, {
name: 'Democrats',
y: 4,
drilldown: 'democrats-2014'
}, {
name: 'Other',
y: 4,
drilldown: 'other-2014'
}]
}],
drilldown: {
series: [{
id: 'republican-2010',
data: [
['East', 4],
['West', 2],
['North', 1],
['South', 4]
]
}, {
id: 'democrats-2010',
data: [
['East', 6],
['West', 2],
['North', 2],
['South', 4]
]
}, {
id: 'other-2010',
data: [
['East', 2],
['West', 7],
['North', 3],
['South', 2]
]
}, {
id: 'republican-2014',
data: [
['East', 2],
['West', 4],
['North', 1],
['South', 7]
]
}, {
id: 'democrats-2014',
data: [
['East', 4],
['West', 2],
['North', 5],
['South', 3]
]
}, {
id: 'other-2014',
data: [
['East', 7],
['West', 8],
['North', 2],
['South', 2]
]
}]
}
});
});
我使用异步追溯生成系列:
chart.setDrilldownCallback(new DrilldownCallback() {
private static final long serialVersionUID = 6274915467357292767L;
@Override
public DataSeries handleDrilldown(DrilldownEvent event) {
i++;
return buildDataSeries(event.getItem());
}
});
正如你可以看到handleDrilldown(DrilldownEvent event)
返回一个DataSeries,我需要一个列表。
有没有什么办法可以在Vaadin中添加多个钻取系列?
这是一个DataSeries,我需要不止一个。我的问题不是如何构建DataSeries,我的问题是如何在'handleDrilldown()'方法中传递多个数据。 –
您无法使用Highcharts完成此任务,因此您无法使用Vaadin图表完成此任务。在Highcharts API中,您会看到'series.data'中的每个项目只能有一个'drilldown' id。这就是为什么'handleDrilldown()'只返回一个'DataSeries'而不是它的一个列表。你可以编辑你的文章来更详细地解释为什么你需要一个'DataSeries'列表,以及为什么单个'DataSeries'不够? – nyg
在示例中,如果您点击共和党标签,例如,您可以看到东,西,南,北两个值。每个值(或列)都是一个DataSeries,我不知道如何在向下钻取时添加多个DataSeries。 –