Vaadin Charts drilldown event

Hi everyone!
There are two way to implement the drill-down functionality in vaadin charts - synchronous and asynchronous(
https://vaadin.com/book/-/page/charts.data.html#charts.data.drilldown
).
Unfortunately, only one way is described in the demo…
Nevertheless, i have a question about the traditional, synchronous way of implementing drill-down:
Is there any possibility to retrieve an information when some one clicks a series that is not the “lowest-level” series?
I tried the PointClickListener, but it reacts only on the last attached series in the “drilldown-hierarchy”.

Hi,

Demo includes both drilldown options:

Regarding the click event I tried using PointClickListener and got the event for the click in both general and detail chart. In case it still doesn’t work for you, could you attach a simple example of how you’re creating the chart and adding the listener?

Hi, I have the same issue with events in my project.

I have a mixed series chart with 3 levels of drill down to it. I create the Chart and then add series to it in a loop using the addItemWithDrillDown(item, series) method to build up the data.
I’ve added a PointClickListener to the chart to try and grab the events, but this listener is never fired. I just add the listener at the end of my method with chart.addPointClickListener, and just defining the listener inline.

My intention is to try and use the event to sync up a table to what’s displayed in the chart (as mentioned my other post https://vaadin.com/forum/#!/thread/10193952).

Would you mind showing me how you tried to reproduce this issue so I can see if there’s something stupid I’m doing wrong?

Cheers,

Sam

Ok, so in an attempt to get around this issue, I used the multi-level drilldown demo code and tweaked it to use a DrillDownCallback. This results in bizarre issues when trying to drilldown past the Countries level, the Chart seems to be just using the index of the point in the series I click on and executing the drilldown on the top level series (in this case Regions).

This would possibly explain the IndexOutOfBounds exceptions I was getting in my code when using the DrillDownCallback across 3 levels.

I’ve attached the modified demo method in case it’s useful to someone.

Sam.
19932.txt (12.5 KB)

Hi Sam,

Thanks for the example. I’m going to take a deeper look ASAP. But there seems to be some issues with PointClickEvent with sync drilldown and with async multilevel drilldown as you noticed with last example.

I’ll keep you posted

Just in case it’s helpful to anyone else, my workaround was to take out the drill down and set chart series manually and redraw.

I build the series as normal and then at the point when you would normally do an addItemWithDrillDown, I store the series in a map with the DataSeriesItem’s ID as the key, similar to the way the async tutorial works.
On the chart I set up a PointClickListener and use this to get the clicked item’s ID and find this in the map. Then just add the series to the chart and redraw. You lose some of the nice animation, but it allows you to use the PointClickEvent to trigger any other stuff you want to use.

I keep an array of series which has an element for each “level” of my data. As I drill down I set the corresponding element and keep track of where I am with the index.
Then the drill up is just a button which nulls the current array element, decrements the counter and returns the element at the new position in the array.

Not sure how well that explains what I mean…

Cheers,

Sam

Hi Sam,

Basically what you’re doing is what was done in the
old drilldown demo source
. It will still work, with the drawback that there’s a serverside roundtrip for each drilldown, and the animations are not done from old series to new one.

Regarding the events issues on previous posts, for the lazy loading example (using DrillDownCallback) it should work now in latest 2.1.rc1 release, you can check
this example
. Unluckily in the eager loading version the DrillDownCallback is not called and there is a known issue with PointClickEvent.

Cheers,

Guille