Skip to content
kevinruder edited this page Apr 28, 2014 · 10 revisions

Graph Class

The graph class contains methods for drawing graphs

#Properties

double _minValue A property that stores the minimum data value.

double _maxValue A property that stores the maximum data value.

double[] p1Xcoordinates Stores the X coordinate of each point on the graph.

double[] p1Ycoordinates Stores the Y coordinate of each point on the graph.

double x_scale_ratio Defines the range of the graph along the x-axis.

int _totalDataPoints Stores the total number of dataPoints within the datastream.

double y_scale_ratio Defines the range of the graph along the y-axis

string DataStreamId defines which stream will be displayed

int Id Assigns an ID to the graph which is used in the GraphContainer and BaseObject classes

int GraphLineWidth Assigns the line width of the graph

Constructor

Constructor will by default setup following properties:

GraphLineWidth = 1;

Methods

The class contains the following methods

Draw

Draw(Content surface, double x, double y)

An override function of the baseObject class which is used to draw the graph.

FindSmallestValue

FindSmallestValue(double[] value)

The function is used to find the minimum value within the array passed to it.

FindMaxValue

FindMaxValue(double[] value)

The function is used to find the highest value within the array passed to it

RetrieveData

RetrieveData()

The function is used to retrieve data from the CurrentData class and store it in an array. The total number of data points is also stored.

RetrieveData

DrawGraphDots(Context surface)

The function is used to draw a dot pertaining to each data point in the graph.

DrawYScale

DrawYScale(Context surface)

The function is used to draw a scale in which to look up the numerical value of each data point in the graph.