Hi,
In our application, user has an option to switch between different highcharts types and I was able to achieve that using FlexmonsterHighcharts.getData.
However, I'm having a performance issue because not just the latest but all the previous updatehandlers are being called.
Basically if user sees, Line, Area, Column and Scatter in this order and then modifies Fields, updateHandler will be called for all chart types.
Is there a way to unregister updatehandler after I'm done with the chart type?
Best,
Yusuf
Hello,
Thank you for writing to us.
We want to ask you for some details about the problem you are facing:
If the chart does not need to be updated after changes in Flexmonster configuration, we recommend not to specify the updateHandler
parameter of the getData
API call. In such a case, the data from Flexmonster will be passed to the chart once after the getData
execution.
Next, if the specific chart instance needs to be synchronized with Flexmonster, subscribe to the reportchange event. Execute the getData
method each time the event is triggered. The updateHandler
should not be specified as well. If synchronization is not required anymore, unsubscribe from the event using the off API call.
Our team is looking forward to hearing details from you.
Best regards,
Illia
Hi Illia,
My answers
ONE CHART AT A TIME
YES
It sounds like I may still need the updateHandler
. Because if user changes the pivot configuration through flex monster menus, I need to be updating the chart which is already in display.
I do this often currently. I open my Highcharts and then modify fields, column order etc. The chart reacts to those changes since updateHandler is registered.
Does reportchange event get triggered when configuration changes? Or in other words, can I get away without having updateHandler for my scenario?
I'm gonna give it a try in the meantime but an answer would be appreciated.
Best,
Yusuf
Hello, Yusuf,
Thank you for your feedback and for providing additional details.
You are right about the fact that the reportchange
event is triggered every time the configuration of the pivot is changed. It means the updateHandler
function can be replaced with a corresponding handler bounded on the reportchange
event.
We have prepared a sample demonstrating the described approach.
Please let us know if it works well for your case.
Do not hesitate to contact us in case any further questions arise.
Best regards,
Illia
Thanks, Illia. I verified that this approach works.
Just one question:
pivot.off("reportcomplete");
What's the benefit of unregistering reportcomplete event?
Hello,
Thank you for your feedback.
We want to explain that it is considered a good practice to unsubscribe from the reportcomplete
event after it is triggered. It allows avoiding unexpected behavior after loading new reports or changing the current one.
Please let us know if other questions arise.
Best regards,
Illia