Grid + filter -> chart does not show expected results

I attached a header with filter to a grid, and trying to render a grouped bar chart based on the filtered grid data.

Also put event handler to refresh the chart after filtering;

mygrid.attachEvent("onFilterEnd",function(elements){
	refresh_chart();
	return true;
});

When selection is performed, the chart refreshes somehow, but not correctly.
Please refer to the attached sample.

In this sample, “Author” is filtered, and the chart is grouped by “Auther”.
So that the expected result is that only one bar labelled “Stephen King” shows up.
As this sample is only for showing the problem, the grouping has no practical meaning.

Any helpful suggestion is appreciated.

Thank you.


Could you attach completed demo (withot pro files) or share with us a direct link - we need to inspect it.
docs.dhtmlx.com/doku.php?id=othe … leted_demo

Thank you for your response.
I attached the complete demo here.
CompleteDemo.zip (191 KB)

You need to rebuild chart every time you need to detail your authore statistics.
Recommend you to use group and sort functions separatelly from main chart init.
And to get detailed author satistics you need to filter your chart data and draw only sales of this author.
To get you author from grig filter event you can the next way:

mygrid.attachEvent("onFilterEnd",function(elements){ var author = elements[0][0].value; ...

Thank you for your suggestion.
I understand that synchronization between grid and chart is not
automatic when used with filtering.

I tried a tricky chart filtering like:

function refresh_chart(){
	barChart.clearAll();
	barChart.filter("Author","");  // this is the trick filtering without specifying filter value
	barChart.parse(mygrid,"dhtmlxgrid");
};

and found that it gives an expected result for me.
Surprisingly, filtering value in grid is automatically reflected to chart.
Do you think this is another possible resolution ?

You can try to use it, BUT…
After inspection your demo one more time we found that your demo would be ok if you would upgrage your files till the latest 3.6 version.