none
Scrollbars for Both Primary and Secondary Y-Axis in Chart

    Question

  • Hi,

    I'm trying to get simultaneously functioning scrollbars for both my primary y-axis and secondary y-axis in a chart. The primary y-axis scrollbar appears when i zoom-in, but not the secondary one. I can shift the primary-axis scroll bar from the left side to the right side, using the following code:

    Chart1.ChartAreas(0).CursorY.AxisType = AxisType.Secondary

    But it still controls the series pegged to my primary axis.

    Each time I'm stepping through my code the read-only property "Chart1.ChartAreas(0).AxisY2.ScrollBar.IsVisible" is always set to false, even when I enable the scrollbar. I have all of the following lines in my code relevant to the secondary y-axis.

            Chart1.ChartAreas(0).CursorY.IsUserSelectionEnabled = True
            Chart1.ChartAreas(0).CursorY.AutoScroll = True
            Chart1.ChartAreas(0).AxisY2.Enabled = AxisEnabled.True
            Chart1.ChartAreas(0).AxisY.ScaleView.Zoomable = True
            Chart1.ChartAreas(0).AxisY2.ScaleView.Zoomable = True
            Chart1.ChartAreas(0).AxisY.ScrollBar.Enabled = True
            Chart1.ChartAreas(0).AxisY2.ScrollBar.Enabled = True
            Chart1.ChartAreas(0).CursorY.IsUserEnabled = True

    Does anyone have any ideas about other things I can try? Or know of anywhere my question is already answered?

    Thursday, December 21, 2017 3:02 PM

Answers

  • Hi JohannesC123,

    I guess that you don't set Chart1.ChartAreas("ChartArea1").AxisY2.ScaleView.Size, like the following code:

    Chart1.ChartAreas("ChartArea1").AxisY.ScrollBar.Enabled = True
            Chart1.ChartAreas("ChartArea1").CursorY.IsUserEnabled = True
            Chart1.ChartAreas("ChartArea1").CursorY.IsUserSelectionEnabled = True
            Chart1.ChartAreas("ChartArea1").AxisY.ScaleView.Zoomable = True
            Chart1.ChartAreas("ChartArea1").AxisY.IsLabelAutoFit = False
            Chart1.ChartAreas("ChartArea1").AxisY.ScaleView.Position = 0
            Chart1.ChartAreas("ChartArea1").AxisY.ScaleView.Size = 23
            Chart1.ChartAreas("ChartArea1").AxisY.ScrollBar.ButtonColor = System.Drawing.Color.Silver
            Chart1.ChartAreas("ChartArea1").AxisY.ScrollBar.LineColor = System.Drawing.Color.Black
    
            Chart1.ChartAreas("ChartArea1").AxisY2.ScaleView.Zoomable = True
            Chart1.ChartAreas("ChartArea1").AxisY2.ScrollBar.Enabled = True
            Chart1.ChartAreas("ChartArea1").AxisY2.ScaleView.Position = 0
            Chart1.ChartAreas("ChartArea1").AxisY2.IsLabelAutoFit = False
            Chart1.ChartAreas("ChartArea1").AxisY2.ScaleView.Size = 23
            Chart1.ChartAreas("ChartArea1").AxisY2.ScrollBar.ButtonColor = System.Drawing.Color.Silver
            Chart1.ChartAreas("ChartArea1").AxisY2.ScrollBar.LineColor = System.Drawing.Color.Black

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 22, 2017 9:54 AM
    Moderator

All replies

  • What makes you think there is a secondary axis scroll bar? Do you have a picture of one? Or what your chart looks like now and where you expect to see it?

    Seems a secondary axis is just a different set of units of the same chart as the primary axis. So it would be the same as the primary axis scrollbar?


    PS Do you mean a second chart area?
    Thursday, December 21, 2017 4:53 PM
  • Hi JohannesC123,

    I guess that you don't set Chart1.ChartAreas("ChartArea1").AxisY2.ScaleView.Size, like the following code:

    Chart1.ChartAreas("ChartArea1").AxisY.ScrollBar.Enabled = True
            Chart1.ChartAreas("ChartArea1").CursorY.IsUserEnabled = True
            Chart1.ChartAreas("ChartArea1").CursorY.IsUserSelectionEnabled = True
            Chart1.ChartAreas("ChartArea1").AxisY.ScaleView.Zoomable = True
            Chart1.ChartAreas("ChartArea1").AxisY.IsLabelAutoFit = False
            Chart1.ChartAreas("ChartArea1").AxisY.ScaleView.Position = 0
            Chart1.ChartAreas("ChartArea1").AxisY.ScaleView.Size = 23
            Chart1.ChartAreas("ChartArea1").AxisY.ScrollBar.ButtonColor = System.Drawing.Color.Silver
            Chart1.ChartAreas("ChartArea1").AxisY.ScrollBar.LineColor = System.Drawing.Color.Black
    
            Chart1.ChartAreas("ChartArea1").AxisY2.ScaleView.Zoomable = True
            Chart1.ChartAreas("ChartArea1").AxisY2.ScrollBar.Enabled = True
            Chart1.ChartAreas("ChartArea1").AxisY2.ScaleView.Position = 0
            Chart1.ChartAreas("ChartArea1").AxisY2.IsLabelAutoFit = False
            Chart1.ChartAreas("ChartArea1").AxisY2.ScaleView.Size = 23
            Chart1.ChartAreas("ChartArea1").AxisY2.ScrollBar.ButtonColor = System.Drawing.Color.Silver
            Chart1.ChartAreas("ChartArea1").AxisY2.ScrollBar.LineColor = System.Drawing.Color.Black

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 22, 2017 9:54 AM
    Moderator
  • Thanks!

    This works! The only thing is that after I zoom out, the secondary scrollbar disappears, and does not reappear again when I zoom back in (like the primary scrollbar), but I think I can fix it with an event.

    Tuesday, January 02, 2018 1:47 PM