Hi
I have tried to follow the examples on demo.vaadin.com/charts but I can’t make the drilldown work. I have also tried switching to column chart but it still doesn’t work. Nothing happens when I click the bars (no exceptions either)
Here is my code (the drilldown series is hard coded just to try to make it work):
Chart chart = new Chart(ChartType.BAR);
chart.getConfiguration().disableCredits();
PlotOptionsBar plotOptionsBar = new PlotOptionsBar();
plotOptionsBar.setCursor(Cursor.POINTER);
chart.getConfiguration().setPlotOptions(plotOptionsBar);
YAxis yAxis = new YAxis(); yAxis.setType(AxisType.CATEGORY);
yAxis.setTickmarkPlacement(TickmarkPlacement.ON);
yAxis.setMin(0);
yAxis.setFloor(0);
yAxis.setStartOnTick(true);
yAxis.setEndOnTick(true);
yAxis.setCategories(optimalPathCodes.toArray(new String[optimalPathCodes.size()]
));
yAxis.setTitle("");
Tooltip tooltip = new Tooltip();
tooltip.setAnimation(true);
tooltip.setUseHTML(true);
tooltip.setHeaderFormat("<strong>{point.key}</strong>");
tooltip.setPointFormat("");
tooltip.setFooterFormat("");
chart.getConfiguration().setTooltip(tooltip);
chart.getConfiguration().getLegend().setEnabled(false);
DataSeries series = new DataSeries();
for (InitiativePerformanceDPO dpo : activeInitiativesAtTime) {
String initiativeCaption = dpo.getProcessSubject() + " (" + dpo.getStatusAtTime().value() + ") - " + dpo.getLastOptimalPathStatusAtTime().value();
DataSeriesItem dataSeriesItem = new DataSeriesItem(initiativeCaption, dpo.getOptimalPathStatusIndex());
Color barColor;
if (dpo.getStatusAtTime().incident()) {
barColor = new SolidColor(FasthiStyle.RED_COLOR);
} else if (dpo.getStatusAtTime().equals(dpo.getLastOptimalPathStatusAtTime())) {
barColor = new SolidColor(FasthiStyle.GREEN_COLOR);
} else {
barColor = new SolidColor(FasthiStyle.YELLOW_COLOR);
}
dataSeriesItem.setColor(barColor);
DataSeries drillSeries = new DataSeries("Swarco details");
String[] categories = new String[]
{"2016-11-01", "2016-11-16", "2016-12-04", "2016-12-16"};
Number[] data = new Number[]
{1, 0, 2, 0};
drillSeries.setId(initiativeCaption);
drillSeries.setData(categories, data);
series.addItemWithDrilldown(dataSeriesItem, drillSeries);
chart.getConfiguration().getxAxis().addCategory(dpo.getProcessSubject() + " (" + dpo.getStatusAtTime().value() + ")");
}
chart.getConfiguration().addSeries(series);
chart.setHeight(30 * activeInitiativesAtTime.size(), Sizeable.Unit.PIXELS);
return chart;