示例#1
0
        private void buttonAdd_Click(object sender, System.EventArgs e)
        {
            UserControlFunction new_chart = new UserControlFunction();

            new_chart.Width            = flowLayoutPanel1.Width;
            new_chart.FunctionChanged += RedrawSeries;
            new_chart.RemoveUcf       += removeSeries;
            flowLayoutPanel1.Controls.Add(new_chart);
            RedrawSeries(new_chart);
        }
示例#2
0
        private void RedrawSeries(UserControlFunction o)
        {
            chart1.Series.Remove(o.S);
            o.S.Points.Clear();
            foreach (int x in Enumerable.Range(-10, 21).ToArray())
            {
                o.S.Points.AddXY(x, o.calculateValue(x));
            }
            chart1.Series.Add(o.S);

            chart1.ChartAreas.First().RecalculateAxesScale();
        }
示例#3
0
 private void removeSeries(UserControlFunction ucf)
 {
     chart1.Series.Remove(ucf.S);
     chart1.ChartAreas.First().RecalculateAxesScale();
     flowLayoutPanel1.Controls.Remove(ucf);
 }