Dundas Chart for Windows Forms
ChartArea Property
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > ViewEventArgs Class : ChartArea Property


Gets the ChartArea object that a view belongs to.
Chart area of the event.

Syntax

Visual Basic (Declaration)  
Public ReadOnly Property ChartArea As ChartArea
Visual Basic (Usage) Copy Code
Dim instance As ViewEventArgs
Dim value As ChartArea
 
value = instance.ChartArea
C#  
public ChartArea ChartArea {get;}

Return Value

An object of type ChartArea that represents the chart area that the view belongs to.

Example

In this example we limit the view along the Y axis for a chart area named "Chart Area 1".  We assume that the Y axis values are 1, 2, 3, etc., and the user isn't allowed to view any data that has a Y value that is greater than 15.
C# Copy Code
using Dundas.Charting.WinControl;
...

// Note that events In C# should be added via the Events button In the Properties window, so
//   that the necessary code Is added To InitializeComponent()
Private void chart1_AxisViewChanging(Object sender, Dundas.Charting.WinControl.CursorEventArgs e){

   If(e.ChartArea.Name ==
"Chart Area 1")
   {

       If(e.Axis.Type == AxisName.Y)
       {

           If(e.NewPosition + e.NewSize > 15)
               e.NewSize = 15 - e.NewPosition;
       }
   }
}
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

Private Sub chart1_AxisViewChanging(ByVal sender As Object, _
ByVal e As Dundas.Charting.WinControl.CursorEventArgs) Handles chart1.AxisViewChanging

    If e.ChartArea.Name = "Chart Area 1" Then

        If e.Axis.Type = AxisName.Y Then

            If e.NewPosition + e.NewSize > 15 Then
                e.NewSize = 15 - e.NewPosition
        End If
    End If
End Sub

Remarks

This property is exposed in the AxisViewChanged and AxisViewChanging events of the root Chart object.

ChartArea can be used to:

  • determine the chart area that the view belongs to via the ChartArea.Name property.
  • get and set chart area properties (e.g. background color, etc.).

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.