C# Class LitDev.LDGraph

Show file Open project: litdev1/LitDev

Public Methods

Method Description
AddGraph ( Primitive xpos, Primitive ypos, Primitive width, Primitive height, Primitive title, Primitive labelX, Primitive labelY ) : Primitive

Create a graph.

AddSeriesHistogram ( Primitive graphName, Primitive seriesLabel, Primitive data, Primitive colour ) : void

Add a new data series to an existing graph as a histogram.

AddSeriesLine ( Primitive graphName, Primitive seriesLabel, Primitive data, Primitive colour ) : void

Add a new data series to an existing graph as a line graph.

AddSeriesPoints ( Primitive graphName, Primitive seriesLabel, Primitive data, Primitive colour ) : void

Add a new data series to an existing graph as points.

CreateTrend ( Primitive data, Primitive order ) : Primitive

Create a trend from data.

DeleteSeries ( Primitive graphName, Primitive seriesLabel ) : void

Delete an existing series on existing graph.

ExportCSV ( Primitive data, Primitive fileName ) : void

Export data series directly to CSV file (no graphing).

Help ( ) : void

This function is just to display this help. Graphs of data can be plotted as lines, points or histograms. Each series of data is a SmallBasic array with the array index reprenting the (unique) X value and the array value representing the Y value. For example: data[1] = 5 data[2] = 8 data[3] = 3 First create a graph object with AddGraph, then add series with AddSeriesLine, AddSeriesHistogram or AddSeriesPoints. Once a graph is created and plotted, the axes can be grabbed and scrolled where the hand cursor appears. The legend can also be moved. The graph can be rescaled by using the left mouse button to select a region to zoom, or the mouse wheel can be used to zoom the display. A double click will reset the scaling to the original default. A right click will bring up a menu with other features like export of image or data, displaying the cursor coordinates, hiding the legend etc. Finally the various parmeters for this method give further control of the plotting colours and behaviour.

RestartEvents ( ) : void

Restart all the graph left click mouse events.

ScaleAxisX ( Primitive graphName, Primitive min, Primitive interval, Primitive max ) : void

Set the X axis scaling. This over-rides any automatic methods.

ScaleAxisY ( Primitive graphName, Primitive min, Primitive interval, Primitive max ) : void

Set the Y axis scaling. This over-rides any automatic methods.

StopEvents ( ) : void

Stop all the graph left click mouse events.

TrendCoef ( ) : Primitive

Get the polynomial trend line coefficients for the last calculated trend using CreateTrend.

Private Methods

Method Description
AddSeriesHitogram ( Primitive graphName, Primitive seriesLabel, Primitive data, Primitive colour ) : void

Method Details

AddGraph() public static method

Create a graph.
public static AddGraph ( Primitive xpos, Primitive ypos, Primitive width, Primitive height, Primitive title, Primitive labelX, Primitive labelY ) : Primitive
xpos Primitive /// The graph left position. ///
ypos Primitive /// The graph right position. ///
width Primitive /// The graph width. ///
height Primitive /// The graph height. ///
title Primitive /// The graph title. ///
labelX Primitive /// The X axis label. ///
labelY Primitive /// The Y axis label. ///
return Primitive

AddSeriesHistogram() public static method

Add a new data series to an existing graph as a histogram.
public static AddSeriesHistogram ( Primitive graphName, Primitive seriesLabel, Primitive data, Primitive colour ) : void
graphName Primitive /// The graph name. ///
seriesLabel Primitive /// The series label. /// If a series with this label already exists then it is replaced with this series. ///
data Primitive /// An array holding the X and Y coordinate data. /// /// For example, a line with points (0,1) and (2,3) would have /// data[0] = 1 /// data[2] = 3 /// /// More generally data[x] = y. ///
colour Primitive /// The colour of the series data. ///
return void

AddSeriesLine() public static method

Add a new data series to an existing graph as a line graph.
public static AddSeriesLine ( Primitive graphName, Primitive seriesLabel, Primitive data, Primitive colour ) : void
graphName Primitive /// The graph name. ///
seriesLabel Primitive /// The series label. /// If a series with this label already exists then it is replaced with this series. ///
data Primitive /// An array holding the X and Y coordinate data. /// /// For example, a line with points (0,1) and (2,3) would have /// data[0] = 1 /// data[2] = 3 /// /// More generally data[x] = y. ///
colour Primitive /// The colour of the series data. ///
return void

AddSeriesPoints() public static method

Add a new data series to an existing graph as points.
public static AddSeriesPoints ( Primitive graphName, Primitive seriesLabel, Primitive data, Primitive colour ) : void
graphName Primitive /// The graph name. ///
seriesLabel Primitive /// The series label. /// If a series with this label already exists then it is replaced with this series. ///
data Primitive /// An array holding the X and Y coordinate data. /// /// For example, a line with points (0,1) and (2,3) would have /// data[0] = 1 /// data[2] = 3 /// /// More generally data[x] = y. ///
colour Primitive /// The colour of the series data. ///
return void

CreateTrend() public static method

Create a trend from data.
public static CreateTrend ( Primitive data, Primitive order ) : Primitive
data Primitive /// An array holding the X and Y coordinate data. /// /// For example, a line with points (0,1) and (2,3) would have /// data[0] = 1 /// data[2] = 3 /// /// More generally data[x] = y. ///
order Primitive The polynomial order for the trend line. /// 1 is linear. /// 2 is quadratic. ///
return Primitive

DeleteSeries() public static method

Delete an existing series on existing graph.
public static DeleteSeries ( Primitive graphName, Primitive seriesLabel ) : void
graphName Primitive /// The graph name. ///
seriesLabel Primitive /// The series label name to delete. ///
return void

ExportCSV() public static method

Export data series directly to CSV file (no graphing).
public static ExportCSV ( Primitive data, Primitive fileName ) : void
data Primitive /// An array holding the X and Y coordinate data. ///
fileName Primitive /// The CSV output file name. ///
return void

Help() public static method

This function is just to display this help. Graphs of data can be plotted as lines, points or histograms. Each series of data is a SmallBasic array with the array index reprenting the (unique) X value and the array value representing the Y value. For example: data[1] = 5 data[2] = 8 data[3] = 3 First create a graph object with AddGraph, then add series with AddSeriesLine, AddSeriesHistogram or AddSeriesPoints. Once a graph is created and plotted, the axes can be grabbed and scrolled where the hand cursor appears. The legend can also be moved. The graph can be rescaled by using the left mouse button to select a region to zoom, or the mouse wheel can be used to zoom the display. A double click will reset the scaling to the original default. A right click will bring up a menu with other features like export of image or data, displaying the cursor coordinates, hiding the legend etc. Finally the various parmeters for this method give further control of the plotting colours and behaviour.
public static Help ( ) : void
return void

RestartEvents() public static method

Restart all the graph left click mouse events.
public static RestartEvents ( ) : void
return void

ScaleAxisX() public static method

Set the X axis scaling. This over-rides any automatic methods.
public static ScaleAxisX ( Primitive graphName, Primitive min, Primitive interval, Primitive max ) : void
graphName Primitive The graph name.
min Primitive The X axis minimum value.
interval Primitive The grid spacing interval. /// If this value is 0 then the interval is calculated from the data.
max Primitive The X axis maximum value. /// If this value is equal to min, then the maximum is calculated from the data. /// If this value is less than min, then both the minimum and maximum are calculated from the data.
return void

ScaleAxisY() public static method

Set the Y axis scaling. This over-rides any automatic methods.
public static ScaleAxisY ( Primitive graphName, Primitive min, Primitive interval, Primitive max ) : void
graphName Primitive The graph name.
min Primitive The Y axis minimum value.
interval Primitive The grid spacing interval. /// If this value is 0 then the interval is calculated from the data.
max Primitive The Y axis maximum value. /// If this value is equal to min, then the maximum is calculated from the data. /// If this value is less than min, then both the minimum and maximum are calculated from the data.
return void

StopEvents() public static method

Stop all the graph left click mouse events.
public static StopEvents ( ) : void
return void

TrendCoef() public static method

Get the polynomial trend line coefficients for the last calculated trend using CreateTrend.
public static TrendCoef ( ) : Primitive
return Primitive