Dundas Chart for ASP.NET
Plotting Against Secondary Axis
See Also Send comments on this topic.
Using Dundas Chart > Axis > Plotting Against Secondary Axis



Glossary Item Box

Overview

To plot a series against a secondary axis, the YAxisType or XAxisType property of the Series object must be set to AxisType.Secondary. The YAxisType property must be set if the y-axis being plotted is the secondary y-axis. The XAxisType property is set if the x-axis being plotted is the secondary x-axis.

If there are more than one series in a chart area, then each series may be plotted using different axes, and each axis can use a different scale.

 

For information on axis scales, refer to the topic on Axis Scale.

 

For a description of primary and secondary axes, refer to the topic on Axis Types.

 

Code Examples

The following code examples demonstrate many aspects of working with secondary axes.

Example

This example demonstrates how to plot a column chart against the primary X axis, and the secondary Y axis. We assume that a column chart series named "Series1" was added at design-time along with 5 data points. We then plot it against the secondary Y axis.  A Dundas template has been applied to the chart.  Further, we assume that the DundasBlue template has been applied to the original chart for appearance purposes.

 

 

Figure 1: Secondary Axis enabled.

 

Visual Basic Copy Code
Imports Dundas.Charting.WebControl
  ...
  
' The following can be accomplished at design-time using 
' the Properties window. Set Y axis type of series.
Chart1.Series("Series1").YAxisType = AxisType.Secondary


                    
C# Copy Code
using Dundas.Charting.WebControl;
  ...
  
// The following can be accomplished at design-time using
// the Properties window. Set Y axis type of series.
Chart1.Series("Series1").YAxisType = AxisType.Secondary;


                    

Example

This example demonstrates how to use all four axes to plot two data series. The first series will use the primary axes and the second series will use the secondary axes. Note that we use the default automatic axes scales. We assume that two column chart series named "Series1" and "Series2" were added at design-time along with 5 data points. We will also set titles for both Y axes.  Further, we assume that the DundasBlue template has been applied to the original chart for appearance purposes.

 

 

Figure 2: All Axes are enabled.

 

Visual Basic Copy Code
Imports Dundas.Charting.WebControl
  ...
  
' The following can be accomplished at design-time using 
' the Properties window.
' Set Y and X axis types of Series2 (by default the "Series1"
' series uses the primary axes).
Chart1.Series("Series2").YAxisType = AxisType.Secondary
Chart1.Series("Series2").XAxisType = AxisType.Secondary

' Set titles
Chart1.ChartAreas("Chart Area 1").AxisY.Title = "Series1 Axis"
Chart1.ChartAreas("Chart Area 1").AxisY2.Title = "Series2 Axis"


                    
C# Copy Code
using Dundas.Charting.WebControl;
   ...

// The following can be accomplished at design-time using
// the Properties window.
// Set Y and X axis types of Series2 (by default the "Series1"
// series uses the primary axes).
Chart1.Series("Series2").YAxisType = AxisType.Secondary;
Chart1.Series("Series2").XAxisType = AxisType.Secondary;

// Set titles
Chart1.ChartAreas("Chart Area 1").AxisY.Title = "Series1 Axis";
Chart1.ChartAreas("Chart Area 1").AxisY2.Title = "Series2 Axis";



                    
    

See Also

How To
Axis Types

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