Chart Scrollbar machen

  • VB.NET

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von RodFromGermany.

    Probier einmal

    VB.NET-Quellcode

    1. Chart1.ChartAreas(0).AxisX.ScrollBar.Visible = True


    Bedenke aber das du die Scrollbar vorher Definieren musst.

    Spoiler anzeigen

    VB.NET-Quellcode

    1. chart1.ChartAreas["Area1"].AxisY.ScrollBar.Size = 10;
    2. chart1.ChartAreas["Area1"].AxisY.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;
    3. chart1.ChartAreas["Area1"].AxisY.ScrollBar.IsPositionedInside = true;
    4. chart1.ChartAreas["Area1"].AxisY.ScrollBar.Enabled = true;
    5. 'and then when you add the new data set the axis scaleview.zoom to the
    6. 'existing axis min and max, again this example with just the y axis and
    7. 'assuming the existing minimum is 0.
    8. //get the current maximum of the axis
    9. double ymax = chart1.ChartAreas["Area1"].AxisY.Maximum;
    10. //Add the new data
    11. chart1.Series["Test1"].Points.AddY(50);
    12. //set the zoom size to the exisiting scale values other wise nothing happens
    13. chart1.ChartAreas["Area1"].AxisY.ScaleView.Zoom(0, ymax);


    LG

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Naoki Daisuke“ ()

    @vico255 Für die X-Achse geht das so:

    VB.NET-Quellcode

    1. Me.Chart1.ChartAreas(0).AxisX.ScrollBar.Size = 15
    2. Me.Chart1.ChartAreas(0).AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll
    3. Me.Chart1.ChartAreas(0).AxisX.ScrollBar.IsPositionedInside = True
    4. Me.Chart1.ChartAreas(0).AxisX.ScrollBar.Enabled = True
    5. 'and then when you add the new data set the axis scaleview.zoom to the
    6. 'existing axis min and max, again this example with just the y axis and
    7. 'assuming the existing minimum is 0.
    8. 'get the current maximum of the axis
    9. Dim xmax As Double = Me.Chart1.ChartAreas(0).AxisX.Maximum
    10. 'set the zoom size to the exisiting scale values other wise nothing happens
    11. Me.Chart1.ChartAreas(0).AxisX.ScaleView.Zoom(0, xmax / 10) ' Das hier ist der angezeigte Bereich
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!