What is AJAX?
Recognizing the importance of AJAX, Microsoft recently introduced the Atlas project, an extension to ASP.NET 2.0, designed to simplify the implementation of AJAX functionality. In addition, Microsoft has already launched web sites of their own that incorporate AJAX technologies and provide end users with an enhanced, responsive user interface.
AJAX in Dundas Chart
Dundas Chart for ASP.NET uses AJAX to engineer the following built-in features:
- Internal and external toolbars.
- Context menus.
- Property dialogs.
Additionally, events have been provided to build customized chart-related functionality. This allows you to update elements on the chart or the web page without having to refresh the entire page, giving you tremendous flexibility to:
- Create real-time charts.
- Pop up windows and display detailed chart information.
- Expand and collapse legends, chart areas, labels, and more.
- Custom position an annotation.
- Show or hide chart elements.
As well as these features, you can write your own methods to handle events on the client-side without post-back, using our existing architecture. Since the interactive features are AJAX based, they are supported across a wide variety of browsers as there are no requirements on the browser.
Zooming and Scrolling
Enabling zooming and scrolling is now easier than ever with Dundas Chart for ASP.NET. For example, the following line of code enables zooming on the X-axis:
Chart1.ChartAreas.CursorX.UserEnabled = true;
The Chart automatically enables and disables AJAX as necessary. Thus, if an interactive function such as zooming is enabled, the Chart will automatically take the necessary steps to enable AJAX so that your Chart works.
Figure 1: Interactively selecting an area of the Chart
Once an area has been selected, the Chart will automatically zoom in and display this area along with an interactive scrollbar.
Figure 2: Interactive scroll bars after zooming in
The Chart's interactive scrollbar improves the user's experience by creating a much more interactive and intuitive environment.
To see online samples of Zooming and Scrolling in action, click here.
Dundas Chart for ASP.NET includes a fully customizable AJAX enabled toolbar.
Figure 3: Default Toolbar
The toolbar allows you to remove, change, and add commands to it as well as to the context menu. For example, to change the Properties command icon, the following code is used:
Command cmdProperties =
cmdProperties.ImageTranspColor = Color.White;
cmdProperties.Image = "face.bmp";
cmdProperties.Text = "Modified Properties...";
"Modified description of the Properties command.";
Which results in the following toolbar:
Figure 4: Toolbar with the Properties command icon changed
Removing items from the toolbar is easy and possible as well. For example, to remove the Pie Chart type out of both the toolbar and the context menu, you would simply write the following code:
Command command =
command.Visible = false;
If the Properties icon is clicked, an interactive dialog is displayed, allowing the user to change the properties of the chart.
Figure 5: Properties window
As well as the toolbar, the Chart also includes a context menu. The context menu is a menu which appears when the Chart is right-clicked. This menu is fully customizable, and allows for yet another way to actively interact with the Chart.
Figure 6: Context menu
Adding commands to the context menu is very similar to adding them to the toolbar, and can be done as follows:
Command userCommand = new Command();
userCommand.CommandID = 300;
userCommand.Text = "User Command Group";
userCommand.Image = "UserCommandImage.gif";
To see online samples of the interactive User Interface features in action, click here.
CallbackManager class within the Dundas Chart for ASP.NET exposes several members to make callbacks on any element within the Chart easy to implement. To setup Chart to use a callback, the
GetCallbackEventReference function and the
Callback event within the Chart are used.
protected void Page_Load(object sender, EventArgs e)
foreach (Dundas.Charting.WebControl.DataPoint p
p.MapAreaAttributes = "onclick=\"" +
"#VALY") + "\"";
protected void Chart1_Callback(object sender, CommandEventArgs e)
if (e.CommandName == "PointClick")
string argumentString = e.CommandArgument.ToString();
this.Label1.Text = "Point's Y-value: " + argumentString;
The above sample sets a callback on each
GetCallbackEventReference which returns the y-value of the point clicked (
VALY). The Chart's
Callback event is automatically setup to receive all callbacks created by the Chart. To identify which element of the Chart was clicked,
CommandName must be compared to the original string used for identification, which in this case is
PointClick. Once identified as a callback invoked by a click on a
DataPoint, the function
UpdateClientControl is then used to inform the Chart to update
Label1 on the client-side. Note that
Label1 is a standard .NET
The Dundas Chart for ASP.NET's integrated AJAX functionality allows for developers to quickly make an interactive Chart. Interactivity on the web is becoming an important feature as users expect a more fluid experience without the delay of post-backs, and Dundas Software is dedicated to making this easy to do.
*Note: AJAX functionality is only available in Dundas Chart for ASP.NET v5.5, VS2005.
**Google, Amazon, Flickr, and Microsoft are registered trademarks of their respective organizations in the United States and/or other countries.