HPlot2D

class HPlot2D

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

Inherits from: HBaseGraph

Index

Methods

Variables

Methods

HPlot2D::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()

virtual

~HPlot2D Destructor

void HPlot2D::SetPlotTitle(char const *title)

virtual

Adds a plot title or replaces the existing one.

Parameters

title: The title of the plot.
void HPlot2D::SetPlotUnicodeTitle(unsigned short *title)

virtual

Adds a unicode plot title or replaces the existing one.

Parameters

title: The title of the plot.
HGraphPlotType HPlot2D::GetPlotType()

Retrieves the type of plot specified when creating the graph.

Returns

The type of plot specified when creating the graph.
void HPlot2D::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 HPlot2D::GetGridType()

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

Returns

The type of grid.
void HPlot2D::SetGridType(HGraphGridType gtype)

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

Parameters

gtype: The type of grid.
bool HPlot2D::GetGridVisibility()

Retrieves the visibility state of the grid.

Returns

True if the grid is visible and false if otherwise.
void HPlot2D::SetGridVisibility(bool value)

Sets the visibility for the grid.

Parameters

value: The grid visibility flag: true sets visibility on, false to off.
void HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::SetGridColor(char const *color)

Sets the color used for the grid.

Parameters

color: The color used for the grid. Passed by reference always.
HGraphAxisScale HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::GetAxisVisibility(HGraphAxisSelection axis)

Parameters

axis: The axis.

Returns

True if the given axis is visible and false if otherwise.
void HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::GetAxisWeight(HGraphAxisSelection axis)

Retrieves the line weight of an axis.

Parameters

axis: The axis.

Returns

The line weight.
void HPlot2D::SetAxisWeight(HGraphAxisSelection axis, float weight)

Sets the line weight of an axis.

Parameters

axis: The axis.

weight: The line weight.

double HPlot2D::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 HPlot2D::SetAxisTickFrequency(HGraphAxisSelection axis, double freq)

Sets how frequently regularly spaced ticks occur on the axis.

Parameters

axis: The axis.

freq: The tick frequency.

int HPlot2D::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 HPlot2D::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 HPlot2D::GetAxisTickSize(HGraphAxisSelection axis)

Retrieves the size of tick marks along the axis.

Parameters

axis: The axis.

Returns

The tick size.
void HPlot2D::SetAxisTickSize(HGraphAxisSelection axis, double size)

Sets the size of tick marks along the axis.

Parameters

axis: The axis.

size: The tick size.

double HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::GetAxisLabelVisibility(HGraphAxisSelection axis)

Parameters

axis: The axis.

Returns

True if the axis labels are visible and false if otherwise.
void HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::RemoveDataSet(int data_set)

Removes a data set from the plot.

Parameters

data_set: The ID of the data set to be removed.
int HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::GetPointVisibility(int data_set)

Parameters

data_set: The ID of the data set.

Returns

True if points are drawn and false if otherwise.
void HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::GetLineWeight(int data_set)

Retrieves the line weight of a data set.

Parameters

axis: The data set.

Returns

The line weight.
void HPlot2D::SetLineWeight(int data_set, float weight)

Sets the line weight of a data set.

Parameters

axis: The data set.

weight: The line weight.

bool HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::GetBarEdgeVisibility(int data_set)

Parameters

data_set: The ID of the data set.

Returns

True if bar edges are drawn.
void HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::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 HPlot2D::Update()

virtual

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

double HPlot2D::GetAspectRatio()

Get the forced aspect ratio.

void HPlot2D::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 HPlot2D::UnSetAspectRatio()

Remove the forced aspect ratio.

virtual void HPlot2D::DrawAxes()

protected virtual

Draw the graph axes.

virtual void HPlot2D::DrawGrid()

protected virtual

Draw the grid overlay for the graph.

virtual void HPlot2D::DrawFrame()

protected virtual

Draw a frame around the graph.

virtual void HPlot2D::DrawData(int data_set)

protected virtual

Draw a data set.

Parameters

data_set: the data set to be drawn or updated.

Variables

HGraphPlotType HPlot2D::m_plot_type

protected

HGraphPlotType
HGraphGridType HPlot2D::m_grid_type

protected

HGraphGridType
HGraphAxis HPlot2D::m_x_axis

protected

HGraphAxis HPlot2D::m_y_axis

protected

double HPlot2D::m_aspect_ratio

protected

double
VArray<HGraphDataSetNode*> HPlot2D::m_points

protected

VArray<*