如何使用C#删除Windows窗体中的选定图表区域?

时间:2017-06-26 05:24:44

标签: c# winforms mschart

我绘制了一个图表(mschart),现在我的问题是单击放弃按钮应该删除所选区域并用剩余部分刷新图形。在这里用户可以选择多个图表区域。我还添加了多个选择代码。但是我做了不知道是不是正确。我的界面如下。 Selection chart area data

我绘制的图表代码如下;

this.handleFormSubmit = this.handleFormSubmit.bind(this);

以下代码用于我的图表区域的多重选择。

private void Output_Load(object sender, EventArgs e)
        {

            List<Graph> ObservingData = new List<Graph>(); // List to store all available Graph objects from the CSV

            // Loops through each lines in the CSV
            foreach (string line in System.IO.File.ReadAllLines(pathToCsv).Skip(1)) // .Skip(1) is for skipping header
            {
                // here line stands for each line in the csv file

                string[] InCsvLine = line.Split(',');

                // creating an object of type Graph based on the each csv line

                Graph Inst1 = new Graph();


                Inst1.Date = DateTime.ParseExact(InCsvLine[0], dateFormatString, CultureInfo.InvariantCulture); 

                Inst1.AvE = double.Parse(InCsvLine[15]);
                Inst1.AvI = double.Parse(InCsvLine[16]);

                chart1.Series["Current"].YAxisType = AxisType.Primary;
                chart1.Series["Current"].Points.AddXY(Inst1.AvI, Inst1.AvE);
                chart1.Series["Current"].ChartType = SeriesChartType.FastLine;

                ChartArea CA = chart1.ChartAreas[0];
                CA.AxisX.ScaleView.Zoomable = false;
                CA.AxisY.ScaleView.Zoomable = false;
                CA.CursorX.AutoScroll = true;
                CA.CursorX.IsUserSelectionEnabled = true;

            }
        }

请帮助您解决我的问题。

0 个答案:

没有答案