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


Gets the ChartArea object that the scrollbar 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 ScrollBarEventArgs
Dim value As ChartArea
 
value = instance.ChartArea
C#  
public ChartArea ChartArea {get;}

Example

In this example we override the default behavior when the user clicks on the reset button.  Normally clicking on the reset button will result in the previous view being displayed, but using the AxisScrollBarClicked event we reset the view to its original state (i.e. no zooming).  We only do this for the X axis of a chart area named "Default".
C# Copy Code
// 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_AxisScrollBarClicked(object sender, Dundas.Charting.WinControl.ScrollBarEventArgs e)
{

   
// First check for zoom/reset button being clicked for X axis in chart area named "Default"
   
if(e.ChartArea.Name == "Default")
   {
       
if(e.Axis.Type == AxisName.X)
       {
           
if(e.ButtonType == ScrollBarButtonType.ZoomReset)
           {
               
// Reset view to original view (no zooming)
               
e.Axis.View.ZoomReset(0);
               
               
// further handling of event is not required
               
e.Handled = true;
           }
       }
   }
}
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

Private Sub chart1_AxisScrollBarClicked(ByVal sender As Object, _
ByVal e As Dundas.Charting.WinControl.ScrollBarEventArgs) Handles chart1.AxisScrollBarClicked

    'first check for zoom/reset button being clicked for X axis in chart area named "Default"
    If e.ChartArea.Name = "Default" Then

        If e.Axis.Type = AxisName.X Then

            If e.ButtonType = ScrollBarButtonType.ZoomReset Then

                ' Reset view to original view (no zooming)
                e.Axis.View.ZoomReset(0)

                ' further handling of event is not required
                e.Handled = True
            End If
        End If
    End If
End Sub

Remarks

This property is exposed in the AxisScrollBarClicked event of the root Chart object.

ChartArea can be used to:

  • determine the chart area that the scrollbar belongs to via the ChartArea.Name property.
  • get and set chart area properties.

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.