Histogram Control


Add a New Series

This page describes how to add a histogram series. The histogram chart/control of the .Net Analytics package are of the following types:

The series class of the histogram chart/control is:

The first step is to include the necessary namespace and add a new chart/control.

Add a Single Series

Below, we will add a new series to a Histogram control (named hcControl in the examples below). After the series has been added, samples may then be added to the series. Adding samples is discussed here

[Visual Basic]
' Create a new series
Dim hsSeries As New HistogramSeries("Series 1")
' Add the series to the collection
hcControl.SeriesCollection.Add(hsSeries)

' An alternative is to add the series directly to the collection
hcControl.SeriesCollection.Add("Series 1")

[Visual C#]
// Create a new series
HistogramSeries hsSeries = new HistogramSeries("Series 1");
// Add the series to the collection
hcControl.SeriesCollection.Add(hsSeries);

// An alternative is to add the series directly to the collection
hcControl.SeriesCollection.Add("Series 1");

Add More than One Series

The histogram control supports multiple series. Just add more series to the series collection.

[Visual Basic]
' Create a new series
hsSeries = New HistogramSeries("Series 2")
' Add the series to the collection
hcControl.SeriesCollection.Add(hsSeries)

' An alternative is to add the series directly to the collection
hcControl.SeriesCollection.Add("Series 2")

[Visual C#]
// Create a new series
hsSeries = new HistogramSeries("Series 2");
// Add the series to the collection
hcControl.SeriesCollection.Add(hsSeries);

// An alternative is to add the series directly to the collection
hcControl.SeriesCollection.Add("Series 2");

In the chart below, you can test the code to see what the result will look like:

Get Microsoft Silverlight