|
Scatter Layer update and image map |
Posted by James on Apr-26-2011 18:30 |
|
Hi
Working on a scatter layer graph.
The graph is to be a year view, displaying a quarter at a time with a track bar allowing the graph to be scrolled to display year dates.
The graph displayed can take anything up to 255/96 = 24480 scatter points at a time.
My draw function only adds scatter layer points that are in the displayable date range.
When the track bar is moved im calling the function
this.graph.updateViewPort(true, false);
And in the view port changed function im simply calling the draw function of the graph.
This method gives excellent update times for a bar graph but im finding with a scatter layer the updates become extremely slow. Obviously moving from 96 viewable bits of data in a bar graph to 24480 for a scatter layer is a massive leap but is there any fast way of allowing scrolling of this scatter data?
Also is there a limit on the number of clickable hot spots on any graph?
Thanks
James |
Re: Scatter Layer update and image map |
Posted by Peter Kwan on Apr-27-2011 00:42 |
|
Hi James,
Would you mind to clarify the programming framework you using? (Is it a web application, or a desktop application? Is it in C# or Java?) I will try myself to test the speed.
To see if it is the "hot spots" that slow down the chart, please comment out all "getHTMLImageMap" lines to see if there are any difference.
To limit the clickable hot spots, you would need to create a chart without using getHTMLImageMap, or you may disable certain layers from generating hot spots (using Layer.setHTMLImageMap). For a web application, we usually suggest people not to use hot spots if there are too many points (like thousands of points).
Regards
Peter Kwan |
Re: Scatter Layer update and image map |
Posted by James on Apr-27-2011 15:51 |
|
Hi Peter
Its a C# application. I have disabled the image map by commenting out the last 2 lines in my draw function
//this.ImageMap = chart.getHTMLImageMap("clickable", "", "");
//this.ParseCoordinates();
That seems to speed up the scrolling to acceptable levels, but obviously i lose the information i need for my custom mouseover tooltips. Ill look into your suggestions and try an acceptable workaround.
Thanks
James |
Re: Scatter Layer update and image map |
Posted by Peter Kwan on Apr-28-2011 01:32 |
|
Hi James,
From your coding style, I assume it is a Windows Forms application (as opposed to an ASP.NET application). For a Windows Forms application, there are several techniques:
(a) Your code does not need to create an image map during scrolling. It is because the image map is only used when the user actually moves the mouse over the chart. The image map is never needed when the mouse is dragging the "track bar". You may therefore delay image map generation until the mouse is actually over the image (eg. in the mousemove handler of the image).
(b) In addition to (a), you code may generate the image map in another thread to avoid slowing down the GUI.
Hope this can help.
Regards
Peter Kwan |
Re: Scatter Layer update and image map |
Posted by James on Apr-28-2011 23:09 |
|
Thanks for the response Peter. Changed the code around so the image map is created when the scrolling ends.
Have noticed one thing. If i am scrolling the graph via a track bar by using the arrow key presses with the mouse stationary over the graph. The mouse move handler of the graph fires. I would only expect this to fire if the mouse was moved by the user and not if the underlying graph changed.
Is this expected?
Working round this for building the image map for now.
James |
Re: Scatter Layer update and image map |
Posted by Peter Kwan on Apr-28-2011 23:58 |
|
Hi James,
From my experience, exactly when the mouse move event fires may differ for different GUI frameworks (for desktop applications) and different brands and versions of browsers (for web applications). There is no standard on when the mouse move event fires. It is common that the mouse move event of an object can fire even if the mouse does not move at all.
For example, in some systems, the mouse move event can fire if the object moves (instead of the mouse moves), or if the mouse leaves and enters the object without moving. The latter can happen if the object is reloading or changing (disappear and then reappear), or another object is sliding or popping up under the mouse. Somtimes even the pop up tooltip box can cause this effect by popping up under the mouse.
So for your case, to reliably determine if the mouse has really moved, I suggest your code to save the mouse coordinates in the mouse move event handler. When the mouse move event handler fires again, it can check the current mouse coordinates with the previous mouse coordinates to see if the mouse has really moved.
Hope this can help.
Regards
Peter Kwan |
|