The following steps show how to add Scrollbars to the X and Y axis of the Chart
The default AxisY scrollbar is aligned to the center of the AxisY and appears within the AxisY minimum and maximum values.
Using Code:
Add the following code to add scrollbars to the X-axis and Y-axis of your chart:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' Setup the AxisX scroll bar 'Note, that the cd variable represents the ChartData c1Chart1.ChartArea.AxisX.ScrollBar.Min = cd.MinY c1Chart1.ChartArea.AxisX.ScrollBar.Max = cd.MaxY c1Chart1.ChartArea.AxisX.ScrollBar.Appearance = ScrollBarAppearanceEnum.Normal c1Chart1.ChartArea.AxisX.ScrollBar.Visible = True c1Chart1.ChartArea.AxisX.ScrollBar.Alignment = StringAlignment.Center ' Setup the AxisY scroll bar c1Chart1.ChartArea.AxisY.ScrollBar.Min = cd.MinY c1Chart1.ChartArea.AxisY.ScrollBar.Max = cd.MaxY c1Chart1.ChartArea.AxisY.ScrollBar.Appearance = ScrollBarAppearanceEnum.Normal c1Chart1.ChartArea.AxisY.ScrollBar.Visible = True c1Chart1.ChartArea.AxisY.ScrollBar.Alignment = StringAlignment.Center |
To write code in C#
C# |
Copy Code
|
---|---|
// Setup the AxisY scroll bar //Note, that the cd variable represents the ChartData c1Chart1.ChartArea.AxisX.ScrollBar.Min = cd.MinY; c1Chart1.ChartArea.AxisX.ScrollBar.Max = cd.MaxY; c1Chart1.ChartArea.AxisX.ScrollBar.Appearance = ScrollBarAppearanceEnum.Normal; c1Chart1.ChartArea.AxisX.ScrollBar.Visible = true; c1Chart1.ChartArea.AxisX.ScrollBar.Alignment = StringAlignment.Center; // Setup the AxisY scroll bar c1Chart1.ChartArea.AxisY.ScrollBar.Min = cd.MinY; c1Chart1.ChartArea.AxisY.ScrollBar.Max = cd.MaxY; c1Chart1.ChartArea.AxisY.ScrollBar.Appearance = ScrollBarAppearanceEnum.Normal; c1Chart1.ChartArea.AxisY.ScrollBar.Visible = true; c1Chart1.ChartArea.AxisY.ScrollBar.Alignment = StringAlignment.Center; |