C# Charts, Visual Studio.Net WinForm example and source-code in C# language.

[C Sharp .Net Client-Side EXE Development ]

ProEssentials WinForm interfaces are used when creating stand-alone client-side EXEs to be distributed and ran on an end-users machine. This C#.NET Charting Walk-through includes instructions for Visual Studio VS2012. VB.NET developers click here: VB.NET Charting. or Click here for VS2010

  • See the new v8 demo (only 17 meg and uninstalls no problem.)
  • Includes a Winform C# Chart Demo plus WPF and 100% native.
  • Size, Shape, Right Click, Export, Zoom (especially date and log scales), Pan, and Rotate.
  • Study the code to discover the ease of use.
  • Your company, team, vendors, and end-users deserve the best.
See the demo...
.Net Chart in c# for finance and more .Net Charts c sharp 3d surface

It is recommended that the namespace: Gigasoft.ProEssentials.Enums be included at the top of your source code files utilizing ProEssentials. In C#, use the using keyword. For example:

using Gigasoft.ProEssentials.Enums;

The WinForm interfaces support adapting to changes in the parent form's font and background color. They are designed so that the grid number text size matches that of the other standard controls such as TextBox, Radio Button, and Labels. As long as you don't explicitly change the font and background color, you will be able to change the form's font size and backcolor and all controls on the form will adapt to match. Note that the default form text size of 8 points is fairly small. You may want to increase it to 9 or 10 points depending on your needs. This feature results in a clean looking user interface where the charting control appears to be a true sibling of the other standard controls.

You will have to write a little code (see below) to develop your graphing solutions. In the end, you'll prefer our .NET (property, method, event) interface. 99% of your code will set simple properties.

Walk-Through:

The following information demonstrates how to create your first .NET ProEssentials implementation using the C# language. It discusses using the WinForm .NET interfaces to add interactive charting content to your EXEs. Other examples are provided within the product/evaluation.

1) Start Visual Studio.NET and create a new project targeting a [Windows Application] using C# as your language. Accept the default name of [WindowsFormsApplication1].

Net charting new project C#

Note: Under the Project menu, select "Project Properties". From the Build tab, adjust the Platform Target setting to x86. This is necessary as the following ProEssentials assembly links to a native 32 bit DLL. This setting will allow the resulting exe to run on both 32 and 64 bit systems and provide the easiest deployment. For native 64 bit, see our ReadMe.txt files in the ProEssentials8/DotNetAnyCpu.
net chart project properties vs2012

2) When the new project opens, you will be presented the design view of "Form1.cs".

Customize Toolbox... Dialog Adding ProEssentials to Visual Studio.NET...

3) Installing WinForm interfaces into Visual Studio.NET

VS2008 / VS2010 / VS2012 / VS2013 Instructions

  • Under the Tools menu, select [Choose Items...],
  • If not selected, left click the [.NET Framework Components] tab,
  • Left click the [Browse...] button and find the file "Gigasoft.ProEssentials.dll" found in the DotNet32 subdirectory where you installed ProEssentials. By default, this should be located at "C:\ProEssentials8\DotNet32\",
  • Select the file "Gigasoft.ProEssentials.dll" and close the [Open File] dialog,
  • The [Choose Toolbox Items] dialog should now show 5 highlighted controls: Pe3do, Pego, Pepco, Pepso, and Pesgo.
  • Close the dialog and the 5 new ProEssentials components will be at the bottom of the toolbox.

  • net charting components in vs2012 toolbar
Form1.cs [Design]... Adding ProEssentials to a Form...
C#.net Chart control in Visual Studio vs2012

4) Double click the [Pego] tool within the toolbox. This places an instance of the Pego component within "Form1.cs". Left click bottom-right corner of control and drag down-right to fill up client area of Form1. The adjacent image shows what you see.

This represents the default state of a ProEssentials Graph. The default state has one subset with four data points. In the course of constructing your own charts, you'll set the properties PeData.Subsets and PeData.Points which define the quantity of data your chart will hold. You'll then pass data via the PeData.Y[subset, point] two dimensional property array. The following section shows example code of passing data.

ProEssentials uses the terms Subsets and Points but you can think of these as Rows and Columns. Passing data is as simple as filling each Subset with Points worth of data.

Adjusting design time settings...
C#.Net Chart property Window in VS2012

5) We recommend setting the parent Form's versions of back color, font, etc properties as ProEssentials will use the parent form's settings to help facilitate a uniform look among sibling controls.

If new to C#, the (Name) property is probably the most fundamental property as its name is reflected in all code. For example,   Pego1.PeData.Subsets = 1; is a line of code, and it shows how the (Name) property (Pego1) starts the line.

Form1.cs [Code]...

6) Double click Form1's Title/Caption Bar to open the code view for "Form1.cs" with default Form1_Load event initialized.

The cursor will be within the Form1_Load code section, enter the following code into this section.

You can copy and paste if you must, but hand-typing at least some of this code will really help familiarize yourself with the Gigasoft.ProEssentials namespace.  

Note: adding the following using declaration at the top of "Form1.cs" will shorten enumeration syntax.
using Gigasoft.ProEssentials.Enums;

pego1.PeString.MainTitle = "Hello World";
pego1.PeString.SubTitle = "";

pego1.PeData.Subsets = 2;
pego1.PeData.Points = 6;
pego1.PeData.Y[0, 0] = 10; pego1.PeData.Y[0, 1] = 30;
pego1.PeData.Y[0, 2] = 20; pego1.PeData.Y[0, 3] = 40;
pego1.PeData.Y[0, 4] = 30; pego1.PeData.Y[0, 5] = 50;
pego1.PeData.Y[1, 0] = 15; pego1.PeData.Y[1, 1] = 63;
pego1.PeData.Y[1, 2] = 74; pego1.PeData.Y[1, 3] = 54;
pego1.PeData.Y[1, 4] = 25; pego1.PeData.Y[1, 5] = 34;

pego1.PeString.PointLabels[0] = "Jan";
pego1.PeString.PointLabels[1] = "Feb";
pego1.PeString.PointLabels[2] = "Mar";
pego1.PeString.PointLabels[3] = "Apr";
pego1.PeString.PointLabels[4] = "May";
pego1.PeString.PointLabels[5] = "June";

pego1.PeString.SubsetLabels[0] = "For .Net Framework";
pego1.PeString.SubsetLabels[1] = "or MFC, ActiveX, VCL";
pego1.PeString.YAxisLabel = "Simple Quality Rendering";

pego1.PeColor.SubsetColors[0] = System.Drawing.Color.FromArgb(60, 0, 180, 0);
pego1.PeColor.SubsetColors[1] = System.Drawing.Color.FromArgb(180, 0, 0, 130);

pego1.PeColor.BitmapGradientMode = false;
pego1.PeColor.QuickStyle = Gigasoft.ProEssentials.Enums.QuickStyle.LightShadow;
pego1.PeTable.Show = Gigasoft.ProEssentials.Enums.GraphPlusTable.Both;
pego1.PeData.Precision = Gigasoft.ProEssentials.Enums.DataPrecision.NoDecimals;
pego1.PeFont.Label.Bold = true;
pego1.PePlot.Method = Gigasoft.ProEssentials.Enums.GraphPlottingMethod.Bar;
pego1.PePlot.Option.GradientBars = 8;
pego1.PePlot.Option.BarGlassEffect = true;
pego1.PeLegend.Location = Gigasoft.ProEssentials.Enums.LegendLocation.Left;
pego1.PePlot.DataShadows = Gigasoft.ProEssentials.Enums.DataShadows.ThreeDimensional;
pego1.PeFont.FontSize = Gigasoft.ProEssentials.Enums.FontSize.Large;

pego1.PeConfigure.RenderEngine = Gigasoft.ProEssentials.Enums.RenderEngine.Direct2D;
pego1.PeConfigure.AntiAliasGraphics = true;
pego1.PeConfigure.AntiAliasText = true;
pego1.PeUserInterface.HotSpot.Data = true;
pego1.PeFunction.ReinitializeResetImage();

pego1.Refresh(); // call standard .NET Refresh method to force paint

Your project code should look similar to...

C#.NET Chart code window for form load event vs2012

Form1.cs [Design]... Adding a DataHotSpot event...
C#.NET Chart event window for HotSpot event vs2012

7) The code above enabled the DataHotSpot event, so we should place some appropriate code in the DataHotSpot event.

Left click the pego control within Form1 to give it the focus.

From the main menu select [View] and [Properties Window]

Within the [Properties Window], click the event icon.

Within the available events, double-click PeDataHotSpot

This opens the code view of "Form1.cs" with cursor within the pego1_PeDataHotSpot event handler.

Add the following code to the pego1_PeDataHotSpot event.

System.Windows.Forms.MessageBox.Show("Subset " + e.SubsetIndex.ToString() +
", Point " + e.PointIndex.ToString() + " with a value of " +
pego1.PeData.Y[e.SubsetIndex, e.PointIndex].ToString());

8) Save and run the project. Your project will show an image as follows. Move the mouse over a bar and click to trigger the DataHotSpot event.

Congratulations... Success!!!

C#.Net chart within your software!

This completes this walkthrough.

Please read the remaining sections within Chapter 2 and review the demo code and documentation that's installed with the eval/product.

Once installed, the demo program can be accessed via shortcut...

Start / All Programs / ProEssentials v8 / PeDemo

Note that our main charting demo is replicated in WPF and Winform C#.NET,  VB.NET, VC++ MFC, Delphi, Builder, and VB6 projects all accessible from where you installed ProEssentials.   These are great for modifying an existing demo to test potential modifications before implementing within your applications.

 

 


Online developer reference

Complete online technical reference to the ProEssentials product. Chapter 2's .NET Reference is the best mechanism to navigate the large quantity of properties and features.  Walk-Throughs of .NET charting in VB.NET, C#.NET, ASP, VC, VB6, and Delphi get you started quickly.

learn more about c# charting, see Chapter 2

Online interactive demo

Financial, Engineering, Scientific, and Business examples give you an instant taste of ProEssentials' power.

view our .Net Charting Demo

Letter from the President

Thank you for researching. Call, email and let's talk charting.

Thank you.