ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  XYChart update responsivness
Posted by James on Mar-23-2011 01:25
Hi

resend as the first post seemed lost.

I have been using addbarlayer3 in mousemove handler to add colors for a single highlighted bar on a bar chart.  Im disappointed by the update rate.  I would want the highlighted bar to stay with the mouse but it lags behind considerably.

I have stripped the code down and found the culprit to be the draw function which we use.  Its basically taken from demo with a little added.

Is it possible to add a bar layer to an pre existing XYchart or must a new XY chart be created for each new bar layer?

You also suggested to use a resized textbox to act as a highlighted bar.  Is this indeed the most responsive method?

Thanks James

  Re: XYChart update responsivness
Posted by Peter Kwan on Mar-23-2011 19:04
Hi James,

I would think using a moving separate control (like a textbox control) over a chart is the fastest method.

Creating a bar chart object takes negligible time, but updating the screen takes sometime (around 30ms to 200ms depending on the CPU speed, size and complexity of the chart). If you are using an image map, updating the image map may take negligible time or considerable time.

Even if it is allowed, adding an extra layer on a pre-existing XYChart object will not help much, because you would still need to update the screen.

If you have tried the zooming and scrolling sample code that comes with ChartDirector, you may have noticed that you can drag to scroll the chart, and ChartDirector scrolls that chart by redrawing the entire chart repeatedly as the mouse moves. Personally, I think the tracking of the mouse is not too bad.

Some techniques used in the zooming and scrolling sample code to ensure fast mouse tracking are:

(1) Image map is not used when the mouse is still moving. For your case, you can set the image map only when the mouse is not moving for around 500 ms.

(2) Do not redraw the chart directly in the mouse move handler. Instead, called WinChartViewer.updateViewPort to trigger the WebChartViewer.ViewPortChanged event, and redraw the chart in the WebChartViewer.ViewPortChanged event handler. The advantage of this method is that it can merge multiple chart updates into one update to improve the mouse tracking (see the documentation on WinChartViewer.UpdateInterval for a more detail explanation).

Hope this can help.

Regards
Peter Kwan

  Re: XYChart update responsivness
Posted by James on Mar-23-2011 22:12
Thanks for the response.

For now i have created my own HighlightBar control which is basically a resized cut down form.  Rendering this through the MouseEnterHotSpot seems to give a high degree of responsivness but it has thrown up some related issues.

When the highlightbar is drawn the mouse is now over my custom control instead of the hot spot on the graph.  This disables the tooltip, makes capturing the ClickHotSpot impossible and also fires off a mouseleavehotspot event.

Do you know of any way of setting my control to simply pass through these events so it doesnt interfere with the underlying graph?

Thanks

James

  Re: XYChart update responsivness
Posted by Peter Kwan on Mar-24-2011 01:41
Hi James,

I know that if you disable a control (by setting the Control.Enabled properties to false), all mouse events will pass to the underlying control.

I have just experiment with this by intentionally blocking half of a bar with a disabled TextBox. All mouse events are handled by the underlying WinChartViewer as expected.

However, I found that tooltips will not show if the mouse is over the disabled TextBox. The Windows Form will not show the tooltip of the disabled control, and it will not show the tooltip of the underlying control either.

I searched the Internet and found that there are quite a number of postings that mentioned how to show tooltips for a disabled control. So I think the followings may work:

(A) Since the WinChartViewer receives all mouose events if the TextBox is disabled, it can trigger the "MouseEnterHotSpot" event. In the event handler, one may set the tooltip of the disabled TextBox to the tooltip of the hot spot (the "title" property).

(B) One can then use a method to make the tooltip of the disabled control appear, like the one described in:

http://stackoverflow.com/questions/1732140/c-problem-displaying-tooltip-over-a-disabled-control

Hope this can help.

Regards
Peter Kwan

  Re: XYChart update responsivness
Posted by James on Mar-24-2011 17:16
Thanks Peter ill take a look at that and get back to you.

James