Simple Windows Form Application
C# sample solution.
Visual Basic .NET sample solution.

Creation of the simple windows forms application that uses Manco.Chart for .NET (Manco.Chart control for .NET) as easy as 1-2-3. Probably you will spend more time on customizing chart XML theme then on coding application itself.

Let see how it could be done in practice. At the first we should create simple chart desktop application.

  1. Create new windows application.
  2. Open Windows Form, where you would like to add control.
  3. Drag and drop control from the toolbar to your form.
  4. Position and size control according to your needs.

Choose data source that will provide data for charting. We will use array of doubles as source of the data in this sample.

  1. Create 2-dimensional array of doubles with desirable length.
  2. Fill it with data (random numbers will be used in this sample).
  3. Create IChartDataSource object using ArrayDataSource class.
  4. Load data to the chart.

The code that implements this sequence could looks like the following:

int liCategoryCount = 3; //
    Set desirable number of the categories
int liSeriesCount = 3; //
    Set desirable number of the series

// Declare array of doubles double[,] ldaData = new double[liCategoryCount, liSeriesCount];
double ldMin = 5; double ldMax = 30;
// Fill array with data here Random rnd = new Random(); for( int i = 0; i < liCategoryCount; i++) { for( int j = 0; j < liSeriesCount; j++) { ldaData[i,j] = ldMin + (ldMax - ldMin) * rnd.NextDouble(); } }
// Create IChartDataSource object IChartDataSource loDataSource = new ArrayDataSource(ldaData, DataOrientation.CategoryInRow);
// Load data to the chart m_ChartControl.Charts[0].LoadData(loDataSource, false, true);

Prepare XML chart theme document or customize existing one and put it to the folder near the application executable (bin\Debug or bin\Release). You can find ready to use chart themes in the Art\Theme subdirectory of the chart control installation folder. You can use all provided arts with your application, so just copy it to the desirable location (bin\Debug or bin\Release).

Now you can load chart theme or use chart API to decorate chart.

// Load theme to decorate chart 
m_ChartControl.LoadTheme(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "IntroChart.xml"));

Run your application. You will see the chart that looks as it was specified in the chart XML theme.