Main   Class List   Namespace List   Wiki

GuiGraphCtrl Class Reference
[Value Controls]

A control that plots one or more curves in a chart. More...

Inheritance diagram for GuiGraphCtrl:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void addAutoPlot (int plotId, string variable, int updateFrequency)
 Sets up the given plotting curve to automatically plot the value of the variable with a frequency of updateFrequency.
void addDatum (int plotId, float value)
 Add a data point to the plot's curve.
float getDatum (int plotId, int index)
 Get a data point on the given plotting curve.
void matchScale (int plotID1, int plotID2,...)
 Set the scale of all specified plots to the maximum scale among them.
void removeAutoPlot (int plotId)
 Stop automatic variable plotting for the given curve.
void setGraphType (int plotId, GuiGraphType graphType)
 Change the charting type of the given plotting curve.

Public Attributes

Graph

float centerY
 Ratio of where to place the center coordinate of the graph on the Y axis. 0.5=middle height of control.
ColorF plotColor [6]
 Color to use for the plotting curves in the graph.
int plotInterval [6]
 Interval between auto-plots of plotVariable for the respective curve (in milliseconds).
GuiGraphType plotType [6]
 Charting type of the plotting curves.
string plotVariable [6]
 Name of the variable to automatically plot on the curves. If empty, auto-plotting is disabled for the respective curve.

Detailed Description

A control that plots one or more curves in a chart.

Up to 6 individual curves can be plotted in the graph. Each plotted curve can have its own display style including its own charting style (plotType) and color (plotColor).

The data points on each curve can be added in one of two ways:

Example:
// Create a graph that plots a red polyline graph of the FPS counter in a 1 second (1000 milliseconds) interval.
new GuiGraphCtrl( FPSGraph )
{
   plotType[ 0 ] = "PolyLine";
   plotColor[ 0 ] = "1 0 0";
   plotVariable[ 0 ] = "fps::real";
   plotInterval[ 0 ] = 1000;
};
Note:
Each curve has a maximum number of 200 data points it can have at any one time. Adding more data points to a curve will cause older data points to be removed.

Member Function Documentation

void GuiGraphCtrl::addAutoPlot ( int  plotId,
string  variable,
int  updateFrequency 
)

Sets up the given plotting curve to automatically plot the value of the variable with a frequency of updateFrequency.

Parameters:
plotId Index of the plotting curve. Must be 0<=plotId<6.
variable Name of the global variable.
updateFrequency Frequency with which to add new data points to the plotting curve (in milliseconds).
Example:
// Plot FPS counter at 1 second intervals.
%graph.addAutoPlot( 0, "fps::real", 1000 );
void GuiGraphCtrl::addDatum ( int  plotId,
float  value 
)

Add a data point to the plot's curve.

Parameters:
plotId Index of the plotting curve to which to add the data point. Must be 0<=plotId<6.
value Value of the data point to add to the curve.
Note:
Data values are added to the left end of the plotting curve.
A maximum number of 200 data points can be added to any single plotting curve at any one time. If this limit is exceeded, data points on the right end of the curve are culled.
float GuiGraphCtrl::getDatum ( int  plotId,
int  index 
)

Get a data point on the given plotting curve.

Parameters:
plotId Index of the plotting curve from which to fetch the data point. Must be 0<=plotId<6.
index Index of the data point on the curve.
Returns:
The value of the data point or -1 if plotId or index are out of range.
void GuiGraphCtrl::matchScale ( int  plotID1,
int  plotID2,
  ... 
)

Set the scale of all specified plots to the maximum scale among them.

Parameters:
plotID1 Index of plotting curve.
plotID2 Index of plotting curve.
void GuiGraphCtrl::removeAutoPlot ( int  plotId  ) 

Stop automatic variable plotting for the given curve.

Parameters:
plotId Index of the plotting curve. Must be 0<=plotId<6.
void GuiGraphCtrl::setGraphType ( int  plotId,
GuiGraphType  graphType 
)

Change the charting type of the given plotting curve.

Parameters:
plotId Index of the plotting curve. Must be 0<=plotId<6.
graphType Charting type to use for the curve.
Note:
Instead of calling this method, you can directly assign to plotType.

Member Data Documentation

Ratio of where to place the center coordinate of the graph on the Y axis. 0.5=middle height of control.

This allows to account for graphs that have only positive or only negative data points, for example.

Color to use for the plotting curves in the graph.

Interval between auto-plots of plotVariable for the respective curve (in milliseconds).

Charting type of the plotting curves.

Name of the variable to automatically plot on the curves. If empty, auto-plotting is disabled for the respective curve.



Copyright © GarageGames, LLC. All Rights Reserved.