Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 8 Graphing and Trending

8.13 Graph variables and functions (advanced)

Scroll Prev Top Next More

Please see the section on Component Names for a description on how to use these.

Like all the other components, graphs have variables and functions that allow you to adjust the graph's properties without using the properties window, usually from a sequence or component action.  Because graphs are a more complicated component, there are many more variables and functions available:

General:

pauseDataUpdate: a variable that defaults to 0.  If 0, the graph draws as normal.  If 1, the graph does not recalculate the traces, but draws with whatever has already been calculated.  If 2, the graph recalculates the trace data once, then sets pauseDataUpdate to 1.  This variable is used for graphs that are used to display non-realtime data that doesn't need to be updated with every screen refresh.  One can set the graph scaling, then set this variable to 2 and the graph will calculate once and draw, but then won't waste CPU time redrawing with each refresh.

PixelToGraph(axis, loc) / GraphToPixel(axis, loc):  these two functions allow you to convert from a screen position (in pixels) to graph units for a particular axes and back.  Axis is a string containing the name of the axis you want to use for the coordinate system.  Loc is an array with X,Y coordinates.  Loc is in screen coordinates, and matches with the loc parameter provided to the OnClick and other component events.  This would allow you, for example, to take a click on the graph and display the graph coordinates for the position clicked.

Traces:

AddTrace(tracename): adds a blank trace to the graph with the given name.  Use the trace name to set the new trace's properties.

DeleteTrace(tracename): removes the given trace from the graph

DeleteAllTraces(): removes all the traces from the graph

All the trace properties require providing a unique name to your traces.  The graph properties window has a name property for this purpose, or use the name you provided when using the AddTrace() function.  The format would be: Component.graphname.tracename.property

AddColor(threshold, color): adds a color to the color table with the given threshold.  Usually used with ClearColors()

ClearColors(): removes all colors from the color table for the trace.  Usually used before using AddColor() to build a fresh table

Color: setting this variable will reset the color table to a single value

strLabel

LineType: 0 = thin solid, 1 = dash, 2 = dot, 3 = dash-dot, 4 = dash-dot-dot, 5 = medium solid, 6 = thick solid, 9 = medium thin solid, 10 = medium thick solid, 11 = extra thick solid

PointType: 0 = plus, 1 = cross, 2 = dot, 3 = dot solid, 4 = square, 5 = square solid, 6 = diamond, 7 = diamond solid, 8 = up triangle, 9 = up triangle solid, 10 = down triangle, 11 = down triangle solid

strYAxis: the name of the Y axis as displayed in the properties window.  This is not the same as the name used to programmatically access the axis as described below.  For example, by default, traces are put on the YAxis "Left Axis 1".

strXExpression

strYExpression

Visible: 0 = don't draw the trace, 1 (default) = draw the trace.  This parameter can, for example, be connected to a checkbox to allow traces to be added / removed from the display by the end user.

Axes:

There are 13 axes in every graph.  To programmatically access their properties you have to reference their internal name which is fixed.  This is different from their displayed name in the graph properties which is variable.  The fixed names are LeftAxis1 through LeftAxis6, RightAxis1 through RightAxis6 and BottomAxis.  To change an axis property, use the following notation: Component.graphname.axisname.propertyl

Alignment

AutoGrid

strAutoScaleFrom

AxisColor

AxisTick

GridDensity

Inverted: this property is not available from the properties window.  It inverts the scaling too, so it may take some fiddling with Scale From and Scale To to get the graph to display the way you want.

strLabel

LongTick

NegativeFromX

PlottingMethod: 0 = line, 1 = bar, 2 = stick, 3 = point, 4 = area, 8 = point + best fit line, 10 = histogram, 12 = bubble, 13 = point + best fit curve, 15 = point + best fit spline, 16 = spline, 17 = point + line, 21 = step, 22 = ribbon.  Many of these are not available from the properties box.  Other valid values exist up to 29, but may cause unpredictable results.

PlottingStyle: 0 = linear, 1 = log, 2 = date/time

Proportion: for stacked axes

Row: for stacked axes

strScaleFrom

strScaleTo

The bottom axis also has:

strTimeWidth

UseTimeWidth

General Settings:

BarWidth: for bar graphs

DataPrecision

DataShadows

GraphDataLabels

LegendLocation: 0 = top, 1 = bottom, 2 = left, 3 = right

LineGapThreshold

LogScaleExpLabels

LogTickThreshold

strMainTitle

NULLGaps

PointSize

strSubTitle

Grids:

GridInFront

GridLineControl

GridStyle: 0 = thin solid line, 1 = thick solid line, 2 = dotted line, 3 = dashed line

NoGridLineMultiples

General Colors:

DeskColor

GraphBackColor

GraphForeColor

ShadowColor

TextColor

Font Sizes:

AxesAnnotSize

FontSize

FontSizeGlobal

FontSizeTitle

Bounds:

strLowerBoundText

LowerBoundValue

strUpperBoundText

UpperBoundValue

Markers and user interaction:

BoxTracking: true when the zoom box is being dragged

BoxX1, BoxX2, BoxY1, BoxY2: if a scale box is being displayed, these variables contain the coordinates of that box.

BoxValid

MarkerA_Valid

MarkerA_X

MarkerA_Y

MarkerB_Valid

MarkerB_X

MarkerB_Y

PeakArea: this is read only and is the calculated peak area as determined by the peak markers

PeakLocation: this is read only and is the calculated value of the peak location as determined by the peak markers

PeakMarkerA_Valid

PeakMarkerA_X

PeakMarkerA_Y

PeakMarkerB_Valid

PeakMarkerB_X

PeakMarkerB_Y

XAxisFrozen

YAxisFrozen