|
Is that the proper use of initDynamicLayer? |
Posted by Daniel on Nov-20-2012 23:19 |
|
We have an application where the main graph tends to be relative heavy, cpu-wise. Not that heavy but long enough that when a user ticks a label on and off, that delay becomes noticeable.
Can one consider a partial rewrite of the application logic in which:
1- initial plot delivery and massive changes are handled by a build from scratch,
2- a pointer is persistently kept to the chartobject used for this delivery,
3- mouse-driven changes that are highly interactive and require limited functionality (adding labels or even possibly Y-grey-banding) are handled as a successsion of initDynamicLayer, actions on the drawarea, bitmap output and removeDynamicLayer.
Should that be a correct understanding of the framework, is the plotting functionality is then reduced to the drawarea primitives?
I have not used this drawarea stuff extensively at this stage and do not know what kind of limitation that would bring (they would replace axis.addmark and other kinds of labelling). |
Re: Is that the proper use of initDynamicLayer? |
Posted by Peter Kwan on Nov-21-2012 01:34 |
|
Hi Daniel,
Your understanding of initDynamicLayer is absolutely correct (assuming a desktop application, as opposed to a web based application). We use this feature extensively to create "Programmable Track Cursors".
The dynamic layer can only be draw to using "DrawArea", which only provides basic graphics primitive. It can draw lines, rectangles, polygons, circles and text based on pixel coordinates. There are also APIs that can translate from data coordinates (the coordinates on the axes) to pixel coordinates.
For you case, you may consider to check if the chart is really that intensive. Unless the chart is very large in pixel size and very complicated, creating a chart usually takes less than 100ms. This level of delay may not be significant for handling "user ticks a label on and off". (Note: I assume your data are stored in memory, so you do not need to reload the data from the database to redraw the chart.)
For charts with a lot of data points and with tooltips or hot spots, the main delay can be the image map (which defines the tooltips and hot spots). Luckily, often, you do not need to update the image map immediately after updating the chart. For example, if the mouse is not on the chart (eg. the user is clicking on a "checkbox" which is outside the chart), there is no need to update the image map immediately. You can delay the update until the mouse moves over the chart. Also, if you are updating the chart in a way that does not affect the tooltips (eg. changing the colors, enabling/disabling data labels, etc), there is no need to update the image map. This keeps the screen update responsive.
Regards
Peter Kwan |
Re: Is that the proper use of initDynamicLayer? |
Posted by Daniel on Nov-21-2012 02:49 |
|
Hi Peter,
Thanks for your fast and documented answer:)
Daniel |
|