Hello
I have a XamDataChart with a OlapXAxis set to a FlatDataSource.
I've made som logic in the FlatDataSource.ResultChanged (aggregators and auto expand). This is done after following suggestions on this Forum. However it is nessesarry to call RefreshGrid in the event, which causes the graph to draw multiple times. This looks wierd and the graphs flickers. This is because I attach the datasource which causes the graph to draw, then I call RefreshGrid in the result changed, which causes the graph to redraw.
I have different thoughts on how to fix this, but I struggle with finding a suitable event. I need a way to suspend the layout and then resume it after drawing is done.
Any ideas?
I am using 16.1.
But after I changed the code so I set the Measures, Rows and Columns manually and not depending on LoadCustomazations(), everything is working much better.
I am able to set the DataSource after the Load statement which (almost) removes all the flicker.
Thanks for your help on this matter.
Hello logimatic,
Thank you for following up. I wasn't able to reproduce the behavior following your steps. First I had to uncomment line 63 where SetMeasureAggregator was being called because the application will fail if the FlatDataSource has no measures assigned. Repositioning when the datasource is set to line 38 doesn't cause the graph to show data nor any flickering when loading the chart.
I've attached a video of my steps demonstrating this. I'm using the version 16.2 build 2045. Please clarify your steps to reproduce this behavior.
Let me know if you have any questions.
Nice example - and it looks pretty much like my code.
Except from the GenerateInitialItems() part. My data is very dynamic and I expect the Measures, Rows and Column to be set by the LoadCustomizations().
To reproduce my issues in your example do the following:
1. Run the code as it is, show some data, and click save
2. Verify when you start the program it shows the graph by default
3. Now comment these lines:
//fds.Rows = XmlaDataSource.GenerateInitialItems("[Date].[Date]"); //fds.Measures = XmlaDataSource.GenerateInitialItems("AmountOfSale, NumberOfUnits");
4a. Run the example and the graph shows nothing
4b. Move the setting of datasource to before result change and you will se a lot of flicker, but the graph shows data.
Any suggestions?
You are correct that the second line in your code-snippet would trigger the drawing of the XamDataChart, as once the data source of the OlapXAxis is set, it will try to resolve the series type and NunericYAxis and draw the chart based on that. One thing I am unsure of in this case, though, is why calling the LoadCustomizations method first is not working for you on this matter, and is only showing a blank chart. One thing I have noticed, is that the chart does not appear to honor the call to LoadCustomizations if the data source has not been set or used anywhere, though, but this may be a timing or redrawing issue with the chart. I will be continuing to investigate this, as it is possible that this could be a bug.
I am rather curious as to the structure of your ResultChanged event handler, to be honest, as I am unable to reproduce a flicker in the XamDataChart with an OlapXAxis unless I force the call to RefreshGrid on button click when the chart is fully expanded. I am attaching the sample project I have used to test this. Would it be possible for you to please look it over, and if it does not represent what is happening on your end, could you please modify it and send it back?
It would also be very helpful if you could please provide an isolated version of your sample project where this issue is reproduced so that I may be able to reproduce it on my end as well.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Thanks for your answer.
An example:
See picture.
It should be used in a dashboard and I only want to draw it when init (at least this will be ok, I am not wirried about the flickering while designing)
I have saved the layout and my code to init the graph looks like this:
_dataSource.ResultChanged += _dataSource_ResultChanged;
olapXAxis.DataSource = _dataSource;
_dataSource.LoadCustomizations(_graphSettings.PivotSettings);
As far as I can tell the second line triggers the first drawing of the graf. If I set the datasource after the LoadCustomizations method, the graph just shows up empty for some reason. I cannot not set any aggreator in this method because _dataSource.Measures is empty and not yet initialized, and therefor I figured to do it in the ResultChanged event. The ResultChangedEvent fires ~8 times in my case (I assume it has something to do with the expand set in the PivotSettings).
Of course I can make some code in the ResultChange event to check if the aggregators already has been set, but since I have to call RefreshGrid after it will still flicker slightly because I have to do at leat one call to RefreshGrid (both the settings of the datasource and RefreshGrid will trigger a redraw).
This is a simplification of my project, I also do other things in the ResultChanged, like expand all not expanded levels and set default sorting. But I don’t think that is relevant for the example.