Class NMathStatsChart provides static methods for plotting NMath Stats types using the Microsoft Chart Controls for .NET.

Namespace:  CenterSpace.NMath.Charting.Microsoft
Assembly:  NMathStatsChartMicrosoft (in NMathStatsChartMicrosoft.dll) Version: 3.4.0.0

Syntax

C#
public class NMathStatsChart : NMathChart
Visual Basic (Declaration)
Public Class NMathStatsChart _
	Inherits NMathChart
Visual C++
public ref class NMathStatsChart : public NMathChart

Remarks

Overloads of the ToChart() function are provided for common NMath Stats types. ToChart() returns an instance of System.Windows.Forms.DataVisualization.Charting.Chart, which can be customized as desired.
CopyC#
Double Matrix data = new DoubleMatrix( 100, 10, rnd );
DoublePCA pca = new DoublePCA( data );
Chart chart = NMathStatsChart.ToChart( pca );
chart.Titles.Add("Hello World");
The default look of the chart is governed by static properties on this class: DefaultSize, DefaultTitleFont, DefaultAxisTitleFont, DefaultMajorGridLineColor, and DefaultMarker.
For prototyping and debugging, the Show() function shows a given chart in a default form.
CopyC#
NMathStatsChart.Show( chart );
Note that when the window is closed, the chart is disposed.
If you do not need to customize the chart, overloads of Show() are also provided for common NMath Stats types.
CopyC#
NMathStatsChart.Show( pca );
This is equivalent to calling:
CopyC#
NMathStatsChart.Show( NMathStatsChart.ToChart( pca ) );
The Save() function saves a chart to a file or stream.
CopyC#
NMathStatsChart.Save( chart, "chart.png", ChartImageFormat.Png );
If you are developing a Windows Forms application using the Designer, add a Microsoft Chart control to your form, then update it with an NMath Stats object using the appropriate Update() function after initialization.
CopyC#
public Form1()
{
  InitializeComponent();

  Double Matrix data = new DoubleMatrix( 100, 10, rnd );
  DoublePCA pca = new DoublePCA( data );
  NMathStatsChart.Update( ref this.chart1, pca );
}
This has the following effect on your existing chart object: a new, default ChartArea is added if one does not exist, otherwise chart.ChartAreas[0] is used; axis titles, and DefaultAxisTitleFont and DefaultMajorGridLineColor, only have an effect if a new ChartArea is added; titles are added only if the given chart does not currently contain any titles; chart.Series[0] is replaced, or added if necessary.

Inheritance Hierarchy

System..::.Object
  CenterSpace.NMath.Charting.Microsoft..::.NMathChart
    CenterSpace.NMath.Charting.Microsoft..::.NMathStatsChart

See Also