# OnGraphDrawItem

This system index is used by the local variable info in the OnGraphDraw and OnGraphClick attributes.

The GraphToCanvasCoord function knows how to use information contained in «info».

## System Index OnGraphDrawItem

This index identifies these fields of the local variable «info» available in OnGraphDraw and OnGraphClick attributes:

• "Width": The total width of the graph drawing area in pixels. It includes the plot area, areas used for axis titles, labels, and for keys.
• "Height": The total height of the graph drawing area in pixels.
• "PlotAreaLeft", "PlotAreaTop", "PlotAreaWidth", "PlotAreaHeight": The rectangle in which the graph displays data -- points, lines, symbols, bars, and so on.
• "ChartType": The line type selected in graph setup. One of:
• "Line"
• "Symbol"
• "Dot"
• "LineSymbol"
• "Step"
• "Bar"
• "ViewMode": The selected uncertainty view. One of:
• "Mid"
• "Mean"
• "Sample"
• "PDF"
• "CDF"
• "Statistics"
• "Bands"
• "Result": A Handle to the variable whose result is being depicted. (revisit: This might not be correct.)
• "Phase": Same as the local Phase variable.
• 1 = before layout (opportunity to suppress default graph)
• 2 = before drawing (opportunity to rescale axes)
• 4 = after axes, before data (opportunity to replace plot using same axis scaling)
• 8 = after fully drawn (opportunity to annotate over a graph)
• "DepictedIndexes": A reference to a list of handles to the indexes that vary on the graph. This includes indexes assigned to graphing roles and slicers set to All.
• "SlicerPositions": A reference to a 1-D array. The index of the array is a local index named Slicer, whose elements are handles to the indexes that are slicers for the graph and are set to a specific value (i.e., those set to «Totals» or «All» are not in this list). The value in the array is the 1-based integer position of the selected value. The index might have length zero.
• "SlicersAtTotal": A reference to a list of handles to the slicer indexes that are set to «Totals».
• "SlicersAtAll": A reference to a list of handles to the slicer indexes that are set to «All».
• "SwapXY": Boolean, true when the vertical axis is the independent axis (i.e., X).
• "BarOverlap": The bar overlap (specified in Graph Setup). 0% is usual, Tornados often use 100% overlap, and stacked bar charts have 100% overlap.

These bar graph metrics are only available in «info» after the bars have rendered -- i.e., only in phase=8. Before that they are null.

• "BarWidth":
• "BarWidthPix": Bar width in pixels
• "CategoryGap":
• "CategoryGapPix": The gap between bars in pixels.

These fields are filled in only when the OnGraphClick attribute is evaluated. They are always Null when OnGraphDraw is evaluating. The information in these fields is available in OnGraphClick in special local variables, but also is included in info to simplify passing them as parameters to User-Defined Functions.

• "Click_where": The part of the graph that was clicked on, the same as the local where. It contains one of the values: "plotArea", "point" (on a single point or bar in the plot area), "segment" (on a line segment or filled area), "key", "axisTitle", "axisLabels" and "background".
• "Click_x" and "Click_y": The pixel location of the mouse click. Same as locals click_x and click_y.
• "Click_coord": The same as the local coord, containing the index coordinates of the data point clicked on.
• "Click_coordPos":The same as the local coordPos containing the 1-based index positions for the data point clicked on.
• "Click_isInRole": The same as the local isInRole. A 1-D boolean array indexed by GraphingRole indicating which role(s) was clicked.

## Uses

You might want your custom OnGraphDraw to run when viewing a Bands graph. Then your OnGraphDraw expression might have this:

If info[OnGraphDrawItem='ViewMode'] = "Bands" Then DoMyDrawing(canv, info, roles);

where DoMyDrawing is your UDF that draws something.