0

I have one chart in my form. I use windows forms application. The zoom in the chart work perfectly, but when I want to scroll on axis X I receive the message:

The method or operation is not implemented.

My code is:

        chart1.ChartAreas[0].AxisX.Minimum = double.NaN;
        chart1.ChartAreas[0].AxisX.Maximum = double.NaN;
        chart1.ChartAreas[0].RecalculateAxesScale();

        chart1.Series["Min"].BorderWidth = 3;
        chart1.Series["Avg"].BorderWidth = 3;
        chart1.Series["Max"].BorderWidth = 3;


        int i = 1;

        foreach (DataRow row in dt3.Rows)
        {

            chart1.Series["Min"].Points.AddXY(i, row.ItemArray[0]);
            chart1.Series["Avg"].Points.AddXY(i, row.ItemArray[1]);
            chart1.Series["Max"].Points.AddXY(i, row.ItemArray[2]);
            i++;

            string rowz = string.Format("Min Q - {0}" + Environment.NewLine + "Avg Q - {1}"
               + Environment.NewLine + "Max Q - {2}" + Environment.NewLine + "Year - {3}" + Environment.NewLine
               + Environment.NewLine,
               row.ItemArray[0], row.ItemArray[1], row.ItemArray[2],
               row.ItemArray[3]);
            s1 += "" + rowz;

        }

And I want to show the values on the chart ? How can I do this.

  • This one might helps you. http://stackoverflow.com/questions/5141126/adding-a-scroll-bar-to-ms-chart-control-c-sharp – M. Adeel Khalid Jan 23 '17 at 10:47
  • Everything may be will work but I have one problem. When I Write: var chartArea = chart1.ChartAreas[Series.chartArea]; I have error message: "Series" does not contain a definition for 'chartArea' – Blagovest Pizhev Jan 23 '17 at 11:06
  • Have you used the namespace using System.Windows.Forms.DataVisualization.Charting;? – M. Adeel Khalid Jan 23 '17 at 11:14
  • In the bottom on Library line I have: using System.Windows.Forms.DataVisualization.Charting; – Blagovest Pizhev Jan 23 '17 at 11:22
  • CA.AxisX.ScaleView.Zoom(row.ItemArray[0], row.ItemArray[3]); I have error: Cannot convert from object to double. – Blagovest Pizhev Jan 23 '17 at 11:33
  • a) is Series really the name of a Series your have? b) Did you explictily set the ChartArea string of that Series? c) note the spelling!! d) you will need to cast the cell value to double. – TaW Jan 23 '17 at 11:38

0 Answers0