Sample Applications Written in C#
See :
Samples in VB .NET
Samples can be written in any language that supports the CLR (Common Language
Runtime) of the .NET Compact Framework
BarGraph Sample in C#
/***************************************
*
* This program demonstrates the use of BarGraph component of the MicroGraphs
*
* Product Of : MakeLogic
* URL : http://www.makelogic.com
* Author : Madanu Ujjwal Kumar
* Date : 10 November, 2002
* Last Modified : 15 October, 2007
* email : madanuuk@makelogic.com AND madanuuk2@yahoo.com
*
*
*****************************************/
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using MakeLogic.MG;
namespace BarGraphDemo
{
public class BarGraphDemo : System.Windows.Forms.Form
{
private BarGraph barGraph;
double[] xValues;
double[] yValues;
public BarGraphDemo()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
/*******************************************
*
* MAKELOGIC code
* 1. Define size
* 2. Define the x and y values
* 3. Assign some random data set to be plot on the BarGraph
* 4. Add BarGraph to the Form
*
* ******************************************/
int size = 6;
xValues = new double[size];
yValues = new double[size];
Random random = new Random();
for(int i=0;i<size;i++)
{
xValues[i] = i;//(random.NextDouble()*30);
yValues[i] = 30 + (random.NextDouble()*(30));
}
try
{
barGraph = new BarGraph(this.Width,this.Height);
//barGraph = new BarGraph(xValues,yValues,this.Width,this.Height);
barGraph.XValues = xValues;
barGraph.YValues = yValues;
}
catch(IncompatibleDataException e)
{
MessageBox.Show(e.Message,"MicroGraphs");
Application.Exit();
}
catch(Exception e)
{
MessageBox.Show(e.Message,"MicroGraphs");
Application.Exit();
}
/********************************************
*
* Method - Testing
* 1. Following code tests the various functions in BarGraph component
*
* ********************************************/
//Target Lines
//barGraph.addTargetLineAt(40);
//barGraph.TargetLinesColor = Color.Red;
//barGraph.TargetLinesOn = false;
//Compare Bars
int compareSets = 1;
int j=0;
while(j++<compareSets)
{
double[] compareValues = new double[size];
for(int i=0;i<size;i++)
{
compareValues[i] = 5*j +30+ (int)(random.NextDouble()*(30));
}
barGraph.CompareBars(compareValues,"DataSet:"+j);
}
/***********************************************
*
* Properties - Testing
* 1. The following code helps in testing the various properties supported by the
BarGraph
* 2. Uncomment one line at a time, recompile and run it to see the results
*
*
************************************************/
//barGraph.AxesColor = Color.Red;
//barGraph.BackgroundColor = Color.Red;
//barGraph.BarBorderColor = Color.Red;
//barGraph.BarBordersOn = false;
//barGraph.BarColor = Color.Red;
//barGraph.BorderColor = Color.Red;
//barGraph.BorderOn = false;
//..barGraph.DropLinesColor = Color.Red;
//barGraph.EventsButtonSize = 10;
//barGraph.EventsEnabled = false;
//barGraph.GraphBgColor = Color.Red;
//barGraph.InitialSpace = 40;
//barGraph.Insets = 50;
//barGraph.LabelColor = Color.Red;
//barGraph.LabelsFontSize = 12;
//barGraph.MainBarLabel = "MakeLogic";
//barGraph.NodalValuesFont = new Font("Verdana",16,FontStyle.Bold);
//barGraph.SelectedNodalValueColor = Color.Red;
//barGraph.ShowDropLineForTheSelectedBar = false;
//barGraph.ShowLabelForTheSelectedBar = false;
//barGraph.ShowYValueOnlyForTheSelectedBar = false;
//..barGraph.TargetLinesColor = Color.Sienna;
//..barGraph.TargetLinesOn = false;
//barGraph.Title = "MakeLogic";
//barGraph.TitleColor = Color.Red;
//barGraph.TitleFontSize = 16;
//barGraph.TitleOn = false;
//barGraph.ValuesFontSize = 12;
//barGraph.XAxisOn = false;
//..barGraph.XGridColor = Color.Red;
//barGraph.XGridOn = false;
//barGraph.XLabelOn = false;
//barGraph.XShift = 25;
//barGraph.XValuesOn = false;
//barGraph.YGrid = 10;
//barGraph.YGridColor = Color.Red;
//barGraph.YGridOn = false;
//barGraph.YLabelOn = false;
//barGraph.YShift = 25;
//barGraph.YValuesOn = false;
this.Controls.Add(barGraph);
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Text = "BarGraph";
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
Application.Run(new BarGraphDemo());
}
}
}


