|
Support for custom zoom function? |
Posted by Nick Visser on Feb-10-2011 05:41 |
|
We have used ChartDirector (.Net) for over ten years in various projects. It has always been a great plaform for us. I think I know the answer to my question, but I will ask anyway...
We are developing some new charting that operates via javascript/AJAX with a handler doing all the charting/data work (server-sde). This is inconsistent with the ChartDirector model for zoom/scroll: javascript/IFRAME/custom-control. I want full control on the server side (no "postback"), no use of IFRAME, and I have a lot of other charting features to support client-side. So I want to customize things.
Basically, all I need is support in ChartDirector for zooming on the chart-image, not the whole package. Any plans to provide zoom capabilities as stripped-down versions of the zooming framework? It would be great to simply have a javascript that supports the zoom on a chartdirector image, and provides an event that includes the zoom "window", and finally some support on the server ("chart" object) to turn that window into axis-ranges on the chart. I am working with an XYChart specifically on this project.
Just wondering. I will pick through the zoom/scroll demo more carefully. Thanks in advance!
Nick |
Re: Support for custom zoom function? |
Posted by Peter Kwan on Feb-10-2011 17:55 |
|
Hi Nick,
The ChartDirector Zooming and Scrolling framework (available since ChartDirector Ver 4.1) uses Javascript/AJAX. It does not use IFRAME. All chart rendering is done on the server side. It does not use "custom controls" on the browser side. It does not use "postback". It only uses a server side WebForm control, which is similar to other standard controls in ASP.NET. It is very customizable. Does this already meet your requirements?
Basically, the client side of the "ChartDirector Zooming and Scrolling framework" performs 2 functions:
(a) A user interface to allow the user to control the zoom/scroll range (eg. such as to allow the user to "drag a rectangle").
(b) Send the user selection to the server, and to receive the updated chart image and image map from the server and update the display. AJAX methods are used, so that only the chart is updated. The web page does not need to reload.
On the server side, the server side code (the code written by you) will interpret what the user selection means, and create an updated chart and image map, and send back to the browser.
The sample code included in ChartDirector interprets the user selection to mean a change in axis range, so it sets the axis range based on the user selection. You are free to interpret the user selection is any other way you like.
So I think the current ChartDirector Zooming and Scrolling framework has already met your requirements. If you need some other features, would you mind to clarify the features you need?
Regards
Peter Kwan |
Re: Support for custom zoom function? |
Posted by Nick Visser on Feb-12-2011 06:04 |
|
Peter,
Thank you for the speedy reply. The ChartDirector Zooming and Scrolling framework does not exactly fit our needs. In our applications we have common framework for handling AJAX on both the client and server. For the most part this provides session/state management and error-handling. It also lets us switch to use JSONP, allowing things to operate in a third-party (cross-domain) context.
The ChartDirector Zooming and Scrolling framework is aimed at a more "standard" .net model (aspx page with a control that calls-back to that page). That is fine, but it doesn't fit neatly into our model. Most of our upcoming code (including this project) operates with javascript that is paired (via AJAX) to an IHttpHandler on the server. It would have been nice to have a simple script to zoom the image, providing axis-values.
It is no big deal. I worked it out, and I have click-and-drag zooming up and running. It works great. Thanks again for a nice product.
Nick
PS: I mentioned "iframe" because I see it in "cdjcv.js". |
Re: Support for custom zoom function? |
Posted by Peter Kwan on Feb-12-2011 06:20 |
|
Hi Nick,
In the "ChartDirector Zooming and Scrolling Framework", when the user drags a selection rectangle, a "ViewPortChanged" event will be fired. In the same code, the "ViewPortChanged" event is connect to the AJAX chart update by the line of Javascript code:
viewer.attachHandler("ViewPortChanged", viewer.partialUpdate);
If you do not want to use the ChartDirector AJAX method to update the chart, you can free connect the "ViewPortChanged" event to your own function.
The "IFRMAE' in "cdjcv.js" is a backup method for AJAX communications. In IE 6 or before, to use AJAX, one has to use the Microsoft ActiveX component Msxml2.XMLHTTP or Microsoft.XMLHTTP. However, in some cases, people may disable ActiveX support in the browser. In this case, a work around is to load the AJAX response to a hidden IFRAME, and then read the content of that IFRAME.
Because IE 6 is seldom used now, and most people would enable ActiveX anyway (to see Flash content, etc), so the IFRAME AJAX method is rarely needed now.
Hope this can help.
Regards
Peter Kwan |
|