Search Locate Previous Next Contents

PostScrp.FindSeries – detect data series

This function is designed to allow the user to interact directly with chart data, for example by clicking on data points to have them excluded from a regression analysis; clicking on pie sectors to drill-down to detailed figures and so on. The sample function Drill (in the RainPro workspace) illustrates several of the possibilities.

PostScrp.FindSeries takes the name of the APL Gui object on the left and the mouse position on the right, and reports the data point (if any) which the mouse location falls within or beside (within 4 pixels of a marker). Bars have a 4-pixel headspace so that you can drag a zero-length bar out of the x-axis.

xy„²2†2‡msg     © mouse position (x,y)
info„'#.pgi'#.PostScrp.FindSeries xy

It returns null if there are no qualifying data points, otherwise an 11-element vector giving chart name, series name, row, column, type and 6 elements of extra information (see below). All data is treated as 2­dimensional, so pie charts report (1 1), (1 2) and so on for the sectors, taken clockwise from midnight. Barcharts and linecharts report the (row,column) index in the original data matrix, with simple vectors treated as 1-column matrices. If there is more than one qualifying data point, the last one plotted is returned.

The extra details returned are for use by graphical editing tools and will vary by chart type:

  1. Line Chart – the x,y position of the target data point, and the x,y positions of its immediate neighbours in the series
  2. Barchart – the bounding box of the bar (x1,y1,x2,y2)
  3. Piechart – the x,y position of the sector origin, the radius, and start and end angles of the sector

These details are always padded with trailing zeros to 6 elements. All details are returned in device co-ordinate space.

Note that linecharts only hold this hotspot information if they have markers. If you want drill-down from a chart with no markers, use marker type=8 (invisible).

RainPro is shipped with support for series hotspots enabled by default. To save on processing time and workspace, you might like to disable these with:

ch.SetDefault 'HO' 0  © no hotspot support

This is only likely to make a significant economy for a heavy scatterplot, as the Chart Viewer will build an internal array with one row per data-point to allow the markers to be detected. Reset this to 1 (series tracking only) or 2 (series and text object tracking) as required.



Continue to: PostScrp.FindPoints – multiple data points
© Copyright Causeway Graphical Systems Ltd 2003