ChartDirector 6.2 (.NET Edition)

Using Multiple Click Handlers

In the clickable chart examples in the documentation, all data objects in a chart invoke the same handler, but with different query parameters. In some cases, it may be desirable to go to different handler for different data objects. The followings are some of the methods on how this can be done:

Use Extra Fields

You can prepared an array of text strings containing the URLs you would like to use, and add this array to the chart using Layer.addExtraField or BaseChart.addExtraField, depending on the chart type. You can then use the extra field as the first argument to BaseChart.getHTMLImageMap or Layer.setHTMLImageMap.

Please refer to !;paramsub.htm for the different ways of binding the extra field to the data objects (the {fieldN}, {dsFieldN} and {dsdiFieldN} parameter). You may also use "{noescape_url}" to ensure URL reserved characters are not escaped. (By default, all {....} fields are treated as data and URL reserved characters are escaped. For example "?xxx=123" will become "%3fxxx=%3d123", which is not what we want.)

Use Forwarding or Redirection

You may use the same handler for all data objects. In the handler, you can forward or redirect to different URLs based on the query parameter.

Use ClickHotSpot event

For ASP.NET Web Forms, by using a special URL generated by WebChartViewer.GetPostBackURL as the image map handler, the WebChartViewer will fire a WebChartViewer.ClickHotSpot event when a hot spot is clicked. In the event handler, you can forward or redirect to different URLs based which object is clicked.

Use Javascript

You can use a client side Javascript function as the handler. In the Javascript function, you can go to different URLs depending on which data object is clicked.