Using Graphics Server NET PDF
Using Graphics Server NET PDF
NET
Contents
Graphics Server .NET setup and configuration
Designing Charts
Programmatically using the Chart control in a Windows Form application
References and additional resources
Screenshot - The Registration Benefits Portal site lists your benefits and provides download links
After installation, follow the instructions in the Add Controls to Toolbox text file to
add the chart and graph controls to your VS Express design toolbox. You can find these
instructions by selecting Start | All Programs | Graphics Server Technologies |
Graphics Server .NET 3.0 for Express. If you use Visual Web Developer you should
see the GSNetWebChart and GSNetWebWidget controls in the Toolbox. For Visual
Basic, C#, and the other Express products you should now have the GSNetWinChart
and GSNetWinWidget controls in your Toolbox.
Note: The Toolbox will only list controls when a designer view is open.
Designing Charts
Graphics Server .NET includes a wizard to help with the rapid creation of charts and
graphs. It can be used in a standalone fashion or within the Visual Studio development
environment. The wizard allows you to modify chart properties such as type, axis,
legend, titles, backgrounds, and so on.
There are some slight differences between the wizard that runs stand alone and the one
that runs as part of Express. The stand alone version is used to design chart templates and
experiment with available properties. If you click the Template button you can load a
number of pre-defined templates that change the properties of the currently displayed
chart.
The stand alone Chart Wizard does not have the ability to bind to different data sources
other than the simple test data that can be modified by clicking on the Data button. Keep
in mind that the Graphics Server .NET software package is meant to be used by software
developers, not end users.
Working with the Chart Wizard and other tools in the Express development environment
provides developers with fine-grained control over Chart and Widget controls. In the
following screenshot, an instance of the GSNetWinChart control has been added to a
new Windows Form by dragging it from the toolbox. Some default test data is also
applied to the chart to make the design process easier.
To access the Chart Designer or one of the other designers within Visual Studio, rightclick on the chart control instance within the Windows Form. This will show a context
menu as shown below.
If you select the Chart Wizard and then click on the Data button within the Express
development environment, you can setup a database connection and select statement in
order to get data for the chart.
The GS .NET charting engine is entirely contained within the Chart class, which can be
accessed through the GSNetWinChart.Chart property in code. For example, to change the
chart type to a two-dimensional bar we can use the following C# code:
this.gsNetWinChart1.Chart.ChartType = ChartType.Bar2D;
As we saw earlier, it is possible to save and load template files containing chart
properties. This provides a built-in and convenient method by which you can adjust the
charts that are produced. The chart properties can be saved to an XML file using the
Chart.WriteChartProperties method. Other capabilities include data binding, creating
arbitrarily high resolution charts, printing, scrolling, and more.
Here is some example code that shows how to work with a GSNetWinChart control in
C#:
this.gsNetWinChart1.Chart.ChartType = ChartType.Bar2D;
this.gsNetWinChart1.Chart.ChartTitle.Text = "Hello Charting World!";
int[] myArrayData = {1, 16, 5, 9, 12};
ArrayDataProvider dataProvider = new ArrayDataProvider(myArrayData);
Note: charts controls can be used with Visual Web Developer Express as well.