HPlot2D

Functions

HPlot2D

~HPlot2D

void

SetPlotTitle

void

SetPlotUnicodeTitle

HGraphPlotType

GetPlotType

void

SetPlotOrigin

HGraphGridType

GetGridType

void

SetGridType

bool

GetGridVisibility

void

SetGridVisibility

void

GetGridPattern

void

SetGridPattern

void

GetGridColor

void

SetGridColor

HGraphAxisScale

GetAxisScale

void

SetAxisScale

void

GetAxisRange

void

SetAxisRange

bool

GetAxisVisibility

void

SetAxisVisibility

void

GetAxisColor

void

SetAxisColor

float

GetAxisWeight

void

SetAxisWeight

double

GetAxisTickFrequency

void

SetAxisTickFrequency

int

GetAxisPrecision

void

SetAxisPrecision

double

GetAxisTickSize

void

SetAxisTickSize

double

GetAxisGridFrequency

void

SetAxisGridFrequency

void

GetAxisGridRange

void

SetAxisGridRange

bool

GetAxisLabelVisibility

void

SetAxisLabelVisibility

void

GetAxisLabelTextFont

void

SetAxisLabelTextFont

void

GetAxisLabelTextColor

void

SetAxisLabelTextColor

void

SetAxisLabelTextPath

void

GetAxisLabelTextPath

int

AddDataSet

void

RemoveDataSet

int

GetDataSetSize

HGraphPointFormat

GetDataSetFormat

void

GetDataSet

void

ReplaceDataSet

void

SetPointColor

void

GetPointColor

void

SetPointSymbol

void

GetPointSymbol

void

SetPointSize

float

GetPointSize

bool

GetPointVisibility

void

SetPointVisibility

bool

GetLineVisibility

void

SetLineVisibility

void

SetLinePattern

void

GetLinePattern

void

SetLineColor

void

GetLineColor

float

GetLineWeight

void

SetLineWeight

bool

GetBarVisibility

void

SetBarVisibility

void

SetBarColorMap

void

GetBarColorMap

void

SetBarColorMapByValue

void

GetBarColorMapByValue

double

GetBarWidth

void

SetBarWidth

bool

GetBarEdgeVisibility

void

SetBarEdgeVisibility

bool

GetPolygonVisibility

void

SetPolygonVisibility

void

GetPolygonColor

void

SetPolygonColor

void

Update

double

GetAspectRatio

void

SetAspectRatio

void

UnSetAspectRatio

Detailed Description

class HPlot2D : public HBaseGraph

Provides plotting capabilities for most 2d graphs including bar charts, line graphs, scatter plots, or any combination of these.

Public Functions

HPlot2D(HC_KEY plot_seg, HGraphPlotType plot_type = PlotTypeScatter)

HPlot2D Constructor.

Parameters:
  • plot_seg – The segment that all graph subsegments will be created beneath.

  • plot_type – The type of 2d plot preferred. This just affects the default visibilities for datasets created on this plot.

virtual ~HPlot2D()

~HPlot2D Destructor

virtual void SetPlotTitle(char const *title)

Adds a plot title or replaces the existing one.

Parameters:

title – The title of the plot.

virtual void SetPlotUnicodeTitle(unsigned short *title)

Adds a unicode plot title or replaces the existing one.

Parameters:

title – The title of the plot.

HGraphPlotType GetPlotType()

Retrieves the type of plot specified when creating the graph.

Returns:

The type of plot specified when creating the graph.

void SetPlotOrigin(HPoint origin)

Retrieves the location of the plot origin.

Parameters:

origin – An HPoint value representing the new location of the title of the plot.

HGraphGridType GetGridType()

Retrieves the type of grid that will be drawn over the plot.

Returns:

The type of grid.

void SetGridType(HGraphGridType gtype)

Sets the type of grid that will be drawn over the plot.

Parameters:

gtype – The type of grid.

bool GetGridVisibility()

Retrieves the visibility state of the grid.

Returns:

True if the grid is visible and false if otherwise.

void SetGridVisibility(bool value)

Sets the visibility for the grid.

Parameters:

value – The grid visibility flag: true sets visibility on, false to off.

void GetGridPattern(char *pattern)

Retrieves the line pattern used for the grid.

Parameters:

pattern – The line pattern used for the grid. Returned to user. Passed by reference always.

void SetGridPattern(char const *pattern)

Sets the line pattern used for the grid.

Parameters:

pattern – The line pattern used for the grid. Passed by reference always.

void GetGridColor(char *color)

Retrieves the color used for the grid.

Parameters:

color – The color used for the grid. Returned to user. Passed by reference always.

void SetGridColor(char const *color)

Sets the color used for the grid.

Parameters:

color – The color used for the grid. Passed by reference always.

HGraphAxisScale GetAxisScale(HGraphAxisSelection axis, double *factor = 0)

Retrieves the scale used for labeling an axis.

Parameters:
  • axis – The axis.

  • factor – Optionally the scaling factor may be retrieved. Returned to user. Passed by reference always

Returns:

The type of axis scaling performed.

void SetAxisScale(HGraphAxisSelection axis, HGraphAxisScale scale, double factor = 0.0)

Sets the scale used for labeling an axis.

Parameters:
  • axis – The axis.

  • scale – The type of axis scaling to be performed.

  • factor – Optionally the scaling factor may also be set. Default value: 1.0 for linear, 10.0 for logarithmic.

void GetAxisRange(HGraphAxisSelection axis, double *min, double *max)

Retrieves the range of an axis.

Parameters:
  • axis – The axis.

  • min – The minimal value of the axis. Returned to user. Passed by reference always

  • max – The maximal value of the axis. Returned to user. Passed by reference always

void SetAxisRange(HGraphAxisSelection axis, double min, double max)

Sets the range of an axis. The minimal value must be less than or equal the maximal value.

Parameters:
  • axis – The axis.

  • min – The minimal value of the axis.

  • max – The maximal value of the axis.

bool GetAxisVisibility(HGraphAxisSelection axis)
Parameters:

axis – The axis.

Returns:

True if the given axis is visible and false if otherwise.

void SetAxisVisibility(HGraphAxisSelection axis, bool vis)

Set whether the specified axis is visible.

Parameters:
  • axis – The axis.

  • vis – Pass true to ensure that specified axis will be drawn and false if otherwise.

void GetAxisColor(HGraphAxisSelection axis, char *color)

Retrieves the color used to draw an axis.

Parameters:
  • axis – The axis.

  • color – A string value for the color. Returned to user. Passed by reference always

void SetAxisColor(HGraphAxisSelection axis, char const *color)

Sets the color used to draw an axis.

Parameters:
  • axis – The axis.

  • color – A string value for the color. Passed by reference always

float GetAxisWeight(HGraphAxisSelection axis)

Retrieves the line weight of an axis.

Parameters:

axis – The axis.

Returns:

The line weight.

void SetAxisWeight(HGraphAxisSelection axis, float weight)

Sets the line weight of an axis.

Parameters:
  • axis – The axis.

  • weight – The line weight.

double GetAxisTickFrequency(HGraphAxisSelection axis)

Retrieves a value indicating how frequently regularly spaced ticks occur on the axis.

Parameters:

axis – The axis.

Returns:

The tick frequency.

void SetAxisTickFrequency(HGraphAxisSelection axis, double freq)

Sets how frequently regularly spaced ticks occur on the axis.

Parameters:
  • axis – The axis.

  • freq – The tick frequency.

int GetAxisPrecision(HGraphAxisSelection axis)

Gets the number of places after the decimal point that will be displayed.

Parameters:

axis – The axis.

Returns:

the number of places.

void SetAxisPrecision(HGraphAxisSelection axis, int precision)

Sets the number of places after the decimal point to display.

Parameters:
  • axis – The axis.

  • precision – the number of places to display.

double GetAxisTickSize(HGraphAxisSelection axis)

Retrieves the size of tick marks along the axis.

Parameters:

axis – The axis.

Returns:

The tick size.

void SetAxisTickSize(HGraphAxisSelection axis, double size)

Sets the size of tick marks along the axis.

Parameters:
  • axis – The axis.

  • size – The tick size.

double GetAxisGridFrequency(HGraphAxisSelection axis)

Retrieves the frequency of lines along an axis when the grid is drawn.

Parameters:

axis – The axis.

Returns:

The grid line frequency.

void SetAxisGridFrequency(HGraphAxisSelection axis, double freq)

Sets the frequency of lines along an axis when the grid is drawn.

Parameters:
  • axis – The axis.

  • freq – The grid line frequency.

void GetAxisGridRange(HGraphAxisSelection axis, double *min, double *max)

Retrieves the range of an axis.

Parameters:
  • axis – The axis.

  • min – The minimal value of the grid on the axis. Returned to user. Passed by reference always

  • max – The maximal value of the grid on the axis. Returned to user. Passed by reference always

void SetAxisGridRange(HGraphAxisSelection axis, double min, double max)

Sets the range of an axis. The minimal value must be less than or equal to the maximal value.

Parameters:
  • axis – The axis.

  • min – The minimal value of the grid on the axis.

  • max – The maximal value of the grid on the axis.

bool GetAxisLabelVisibility(HGraphAxisSelection axis)
Parameters:

axis – The axis.

Returns:

True if the axis labels are visible and false if otherwise.

void SetAxisLabelVisibility(HGraphAxisSelection axis, bool vis)

This method sets the visibilty for the labels at each tick on the given axis.

Parameters:
  • axis – The axis.

  • vis – The visibility of labels on the axis.

void GetAxisLabelTextFont(HGraphAxisSelection axis, char *font)

Retrieves the text font used for labels on an axis.

Parameters:
  • axis – The axis.

  • font – A string value for the font. Returned to user. Passed by reference always.

void SetAxisLabelTextFont(HGraphAxisSelection axis, char const *font)

Sets the text font used for labels on an axis.

Parameters:
  • axis – The axis.

  • font – A string value for the font. Passed by reference always.

void GetAxisLabelTextColor(HGraphAxisSelection axis, char *color)

Retrieves the text font used for labels on an axis.

Parameters:
  • axis – The axis.

  • color – A string value for the color. Returned to user. Passed by reference always.

void SetAxisLabelTextColor(HGraphAxisSelection axis, char const *color)

Sets the text font used for labels on an axis.

Parameters:
  • axis – The axis.

  • font – A string value for the color. Passed by reference always.

void SetAxisLabelTextPath(HGraphAxisSelection axis, float xvector, float yvector, float zvector)

Sets the text path used for labels on an axis.

Parameters:
  • axis – The axis.

  • xvector – The x component of the text path vector.

  • yvector – The y component of the text path vector.

  • zvector – The z component of the text path vector.

void GetAxisLabelTextPath(HGraphAxisSelection axis, float *xvector, float *yvector, float *zvector)

Sets the text path used for labels on an axis.

Parameters:
  • axis – The axis.

  • xvector – The x component of the text path vector. Returned to user.

  • yvector – The y component of the text path vector. Returned to user.

  • zvector – The z component of the text path vector. Returned to user.

int AddDataSet(int points_count, HPoint const points[], HGraphPointFormat format = PointFormatCartesian, HPoint const colors[] = 0)

Adds a data set to the plot.

Parameters:
  • points_count – The number of points being passed.

  • points – An array of points in the data set. Passed by reference always.

  • format – The format of the points. Default value: PointFormatCartesian.

  • colors – An array of (RGB) color values, one per point, that override the colors of the data set. If used, this should be the same size as points. Passed by reference always.

Returns:

The ID of the data set. The ID can be used later for modifying or removing the data set.

void RemoveDataSet(int data_set)

Removes a data set from the plot.

Parameters:

data_set – The ID of the data set to be removed.

int GetDataSetSize(int data_set)

Retrieves the number of points in a data set

Parameters:

data_set – The ID of the data set.

Returns:

The number of points.

HGraphPointFormat GetDataSetFormat(int data_set)

Retrieves the point format for a data set.

Parameters:

data_set – The ID of the data set.

Returns:

The point format.

void GetDataSet(int data_set, HPoint points[])

Retrieves the array of points in a data set. The points array should already be allocated and large enough to accommodate all the points in the set. Use GetDataSetSize to get the size of a data set.

Parameters:
  • data_set – The ID of the data set.

  • points – An array of the points in the data set. Returned to user. Passed by reference always.

void ReplaceDataSet(int data_set, int points_count, HPoint const points[], HGraphPointFormat format = PointFormatCartesian, HPoint const colors[] = 0)

Replaces the points in a data set.

Parameters:
  • data_set – The ID of the data set.

  • points_count – The size of the points array.

  • points – An array of the points to be put into the data set. Passed by reference always.

  • format – The point format of points. Default value: PointFormatCartesian.

  • colors – An array of (RGB) color values, one per point, that override the colors of the data set. If used, this should be the same size as points. Passed by reference always.

void SetPointColor(int data_set, char const *color)

Sets the color of points in a data set.

Parameters:
  • data_set – The ID of the data set.

  • color – A color string. Passed by reference always.

void GetPointColor(int data_set, char *color)

Retrieves the color of points in a data set.

Parameters:
  • data_set – The ID of the data set.

  • color – A color string. Returned to user. Passed by reference always.

void SetPointSymbol(int data_set, char const *symbol)

Sets the marker symbol for points in a data set.

Parameters:
  • data_set – The ID of the data set.

  • symbol – A string of special constants, see Set_Marker_Symbol(). Passed by reference always.

void GetPointSymbol(int data_set, char *symbol)

Retrieves the marker symbol for points in a data set.

Parameters:
  • data_set – The ID of the data set.

  • symbol – A string of special constants, see Set_Marker_Symbol(). Returned to user. Passed by reference always.

void SetPointSize(int data_set, double size)

Sets the size of points in a data set.

Parameters:
  • data_set – The ID of the data set.

  • size – The size of points in the data set

float GetPointSize(int data_set)

Retrieves the size of points in a data set.

Parameters:

data_set – The ID of the data set.

Returns:

The size of points in the data set.

bool GetPointVisibility(int data_set)
Parameters:

data_set – The ID of the data set.

Returns:

True if points are drawn and false if otherwise.

void SetPointVisibility(int data_set, bool vis)

Use this method to determine if points should points be drawn.

Parameters:
  • data_set – The ID of the data set.

  • vis – True if the points in the given data set should be drawn and false if otherwise.

bool GetLineVisibility(int data_set)
Parameters:

data_set – The ID of the data set.

Returns:

True if points in a data set are connected by a polyline.

void SetLineVisibility(int data_set, bool vis)

Determines if points in a data set should be connected by a polyline.

Parameters:
  • data_set – The ID of the data set.

  • vis – True if points in the given data set should be connected by a polyline.

void SetLinePattern(int data_set, char const *pattern)

Sets the line pattern used for lines in the data set.

Parameters:
  • data_set – The ID of the data set.

  • pattern – The line pattern used for the data set. Passed by reference always.

void GetLinePattern(int data_set, char *pattern)

Retrieves the line pattern used for lines in the data set.

Parameters:
  • data_set – The ID of the data set.

  • pattern – The line pattern used for the data set. Returned to user. Passed by reference always.

void SetLineColor(int data_set, char const *color)

Sets the line color used for lines in the data set.

Parameters:
  • data_set – The ID of the data set.

  • color – The line color used for the data set. Passed by reference always.

void GetLineColor(int data_set, char *color)

Retrieves the line color used for lines in the data set.

Parameters:
  • data_set – The ID of the data set.

  • color – The line color used for the data set. Returned to user. Passed by reference always.

float GetLineWeight(int data_set)

Retrieves the line weight of a data set.

Parameters:

axis – The data set.

Returns:

The line weight.

void SetLineWeight(int data_set, float weight)

Sets the line weight of a data set.

Parameters:
  • axis – The data set.

  • weight – The line weight.

bool GetBarVisibility(int data_set)
Parameters:

data_set – The ID of the data set.

Returns:

True if the data set is interpreted as data points in a bar char.

void SetBarVisibility(int data_set, bool vis)

Determines if points in a data set are interpreted as data points for a bar chart.

Parameters:
  • data_set – The ID of the data set.

  • vis – True if the data point are show in a bar chart

void SetBarColorMap(int data_set, char const *map)

Sets a color map for the bars in a data set. Bars are colored in the order they appear in the data set point list. When the color map is exhausted, colors wrap around to the beginning.

Parameters:
  • data_set – The ID of the data set.

  • map – A text string of all the colors in the color map. Passed by reference always.

void GetBarColorMap(int data_set, char *map)

Retrieves the color map for the bars in a data set. Bars are colored in the order they appear in the data set point list. When the color map is exhausted, colors wrap around to the beginning.

Parameters:
  • data_set – The ID of the data set.

  • map – A text string of all the colors in the color map. Returned to user. Passed by reference always.

void SetBarColorMapByValue(int data_set, int count, HPoint const values[], char const *color_space = 0)

Sets a color map for the bars in a data set. Bars are colored in the order they appear in the data set point list. When the color map is exhausted, colors wrap around to the beginning.

Parameters:
  • data_set – The ID of the data set.

  • count – The number of colors in the values array.

  • values – An array of HPoints containing all the colors in the color map. Passed by reference always.

  • color_space – The color space that the values are in. Default value: “RGB”

void GetBarColorMapByValue(int data_set, int *count, HPoint values[], char *color_space)

Retrieves a color map for the bars in a data set. Bars are colored in the order they appear in the data set point list. When the color map is exhausted, colors wrap around to the beginning.

Parameters:
  • data_set – The ID of the data set.

  • count – The number of colors in the values array. Returned to user. Passed by reference always.

  • values – An array of HPoints containing all the colors in the color map. Returned to user. Passed by reference always.

  • color_space – The color space that the values are in. Returned to user. Passed by reference always.

double GetBarWidth(int data_set)

Retrieves the width of bars, centered on data points.

Parameters:

data_set – The ID of the data set.

Returns:

The width of bars.

void SetBarWidth(int data_set, double width)

Sets the width of bars. The bars are centered on data points.

Parameters:
  • data_set – The ID of the data set.

  • width – The width of bars.

bool GetBarEdgeVisibility(int data_set)
Parameters:

data_set – The ID of the data set.

Returns:

True if bar edges are drawn.

void SetBarEdgeVisibility(int data_set, bool vis)

Sets a flag indicating where the bar edges will be visible.

Parameters:
  • data_set – The ID of the data set.

  • vis – Pass true for bar edge to be visibile and false if otherwise.

bool GetPolygonVisibility(int data_set)
Parameters:

data_set – The ID of the data set.

Returns:

True if the data set is considered the boundary of a colored region.

void SetPolygonVisibility(int data_set, bool vis)

Sets whether a data set should be considered the boundary of a colored region.

Parameters:
  • data_set – The ID of the data set.

  • vis – The polygon visibility.

void GetPolygonColor(int data_set, char *color)

Returns the color that a polygonal region will be drawn in if polygon visibility is on.

Parameters:
  • data_set – The ID of the data set.

  • color – The polygon color. Passed by reference always. Returned to user.

void SetPolygonColor(int data_set, char const *color)

If polygon visibility is on, this sets the color of that polygon.

Parameters:
  • data_set – The ID of the data set.

  • color – The polygon color. Passed by reference always.

virtual void Update()

Force the segment tree to reflect any queued changes in the graph.

double GetAspectRatio()

Get the forced aspect ratio.

void SetAspectRatio(double ratio)

Constrain graph to this aspect ratio given as horizontal/vertical. To get a square, pass in 1.0. Aspect ratio will be maintained in this manner while underlying graph data is changed.

Parameters:

ratio – Forced aspect ratio (double precision).

void UnSetAspectRatio()

Remove the forced aspect ratio.