GetSelectedPosition (Dundas Chart Server Control 1.0)
From Dundas
GetSelectedPosition
Overview | Properties | Methods
Use this method to determine which data element the user selected (zero-based).
Syntax
long = PieChartObject.GetSelectedPosition()
Remarks
Call this method ONLY WHEN you have successfully called the Select method inside the page which is handling the item selection, specified by the SRC attribute of the <A> tag immediately preceding the server-side chart image tag (e.g. <A HREF SRC="PageToHandleSelectedItem.asp"><IMG IsMap SRC="MakeJpeg.asp"></A>). The return value will be the data element that the user clicked on.
This is useful in drilldown scenarios where you can take appropriate action (e.g show another chart image) based on the pie slice the user selected.
GetSelectedPosition is zero-based, so a return of zero (0) indicates that the user selected the first element added to the chart with the AddData method.
You should first call GetSelectedSeries to make sure that the user clicked on a pie slice or a legend item.
If the user clicks on a legend item then the corresponding pie slice's position is returned.
IMPORTANT: The return number represents the selected element as per the order that the data elements were added via the AddData method. This has certain ramifications since a pie chart types can be set up to use a "collected" element. If an element is collected it will still be counted as a position. For example, if the first element is collected (and therefore only visible as the collected element) then GetSelectedPosition will return one (as opposed to zero) if the user clicks on the first visible pie slice.
NOTE: Even though the page which handles the selection does not output a jpeg we MUST reproduce the exact same chart which is created by the page within the <IMG> tag (the page which outputs the jpeg via SendJPEG). In order to guarantee that the exact same chart is reproduced we highly recommend using a server-side include for the code which creates the chart (starting from the CreateObject call all the way to setting the Chart object to Nothing).
For sample source on this refer to the Tutorial: Drilldown and Selection of Data Elements. You can also examine the Selection, Grand Prix or Gross Domestic Product (Drilldown) samples which are distributed with the Chart Server Control for sample source code about the Select, GetSelectedPosition and GetSelectedSeries methods.
See Also: GetSelectedSeries | Select