Dundas Chart for ASP.NET
Indexing Data Point X Values
See Also Send comments on this topic.
Working with Data > Indexing Data Point X Values

Glossary Item Box

Overview

Each data point in a series has X and Y values that determine its position in the plotting area. With some charts, the X value of points is not important, and does not have to be provided. In this case, the point positions in the plotting area are determined only by their point index (i.e. their location in the Points collection) and their Y values.

When X values are "indexed", the data point index, not a point's X value, is used to determine the position of points along the categorical (X) axis. For example in Figure 1 below, two charts are shown displaying the same data. However, the first chart uses non-indexed X values, therefore the X values of those points determine their location along the x-axis. The second chart is indexed, therefore its point indices are used to determine their position along the x-axis. In this case the X values are only used for the axis labels, and nothing more.

 

Figure 1: Two charts, one with non-indexed x-values (shown left), and the other with indexed x-values (shown right).

 

How to Index X Values

There are several ways to index data point X values :

 

Example

This example demonstrates how to display data using data point indexes. This code was used to generate the chart in Figure 1 above. The chart to the right has one extra line of code that sets the XValueIndexed property of the series to true.

Visual Basic Copy Code
Imports Dundas.Charting.WebControl
  ...
  
' Create new series and add data.
Dim mySeries As New Series("MySeries")
mySeries.Points().AddXY(10.0, 589.0)
mySeries.Points().AddXY(20.0, 921.0)
mySeries.Points().AddXY(40.0, 764.0)
mySeries.Points().AddXY(50.0, 282.0)
mySeries.Points().AddXY(60.0, 346.0)
mySeries.Points().AddXY(80.0, 411.0)

' Add series into the series collection.
Chart1.Series().Add(mySeries)

' Use point indexes instead of X values.
mySeries.XValueIndexed = True


C# Copy Code
using Dundas.Charting.WebControl;
  ...
  
// Create new series and add data.
Series mySeries = new Series("MySeries");
mySeries.Points().AddXY(10, 589);
mySeries.Points().AddXY(20, 921);
mySeries.Points().AddXY(40, 764);
mySeries.Points().AddXY(50, 282);
mySeries.Points().AddXY(60, 346);
mySeries.Points().AddXY(80, 411);

// Add series into the series collection.
Chart1.Series().Add(mySeries);

// Use point indexes instead of X values.
mySeries.XValueIndexed = true;

 


See Also

Copyright © 2001 - 2009 Dundas Data Visualization, Inc. and others.