Exemplo n.º 1
0
        public MainWindow(double[] data1, double[] data2)
        {
            InitializeComponent();
            double[] result = new double[data1.Length];
            for (int ind = 0; ind < result.Length; ind++)
            {
                result[ind] = Transformations.Crosscorrelation(data1, data2, ind);
            }


            chart.MouseWheel += chData_MouseWheel;
            validateSetings();



            Control.ControlCollection controls = panelFunctionParams.Controls;
            double[] args = new double[controls.Count / 2 + 1];
            int      i    = controls.Count / 2;

            foreach (Control item in controls)
            {
                if (item.GetType() == (typeof(TextBox)))
                {
                    args[i] = Double.Parse(item.Text);
                    i--;
                }
            }
            string chartAreaNum = cbArea.Text;

            chart.Series.Remove(chart.Series.FindByName(chartAreaNum));

            Series series = chart.Series.Add(chartAreaNum);

            functionName = chartAreaNum;
            if (chart.ChartAreas.FindByName(chartAreaNum) == null)
            {
                chart.ChartAreas.Add(chartAreaNum);
                cbArea.Items.Add(chartAreaNum);
                validateSetings();
            }
            series.ChartArea = chartAreaNum;
            series.ChartType = SeriesChartType.Line;
            double funValue = 0;

            for (int j = 0; j < result.Length; j++)
            {
                funValue = result[j];
                if (!Double.IsInfinity(funValue) && !Double.IsNaN(funValue))
                {
                    series.Points.AddXY(j, funValue);
                }
            }

            validateSetings();
        }