Search code examples
c#scrollbarmschart

c# MS chart get scrollbar value


It is possible to get value of X scrollbar from zoomed Chart? Anybody can help me? In Datagrdiview I hande with it by using dataGridView1.FirstDisplayedCell.RowIndex;


Solution

  • I found the solution after few days and nights. I used these functions before, but I can't connect them. This solution show which number of point is shown as a first and number of end point from collection.

    private void chart1_AxisViewChanged(object sender, ViewEventArgs e)
        {
            if (!allowReadData)
                allowReadData = true;
        }
    
    private void timer4_Tick(object sender, EventArgs e)
        {
            if (allowReadData && MouseButtons != MouseButtons.Left)
            {
                allowReadData = false;
                double xMin = chart1.ChartAreas[0].AxisX.ScaleView.ViewMinimum;
                double xMax = chart1.ChartAreas[0].AxisX.ScaleView.ViewMaximum;
                MessageBox.Show("Minimum: " + xMin+"\nMaximum: "+xMax);
            }
        }