Exemplo n.º 1
0
        private void ButtonExponentialSmoothingMethod_Click(object sender, RoutedEventArgs e)
        {
            if (AllDataTimeSeries.SelectedRow == -1)
            {
                WindowError windowError = new WindowError("Данные не выбраны");
                windowError.Show();
                return;
            }

            double a;

            try
            {
                a = Convert.ToDouble(SmoothingIntervalExp.Text);
            }
            catch
            {
                WindowError windowError = new WindowError("Некорректно задан параметр, диапазон от 0 до 1");
                windowError.Show();
                return;
            }

            if (a < 0 || a > 1)
            {
                WindowError windowError = new WindowError("Некорректно задан параметр, диапазон от 0 до 1");
                windowError.Show();
                return;
            }

            WindowGraphicView windowTest = new WindowGraphicView(AllDataTimeSeries.ExponentialSmoothingMethod(a), AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].GetColor());

            windowTest.Show();
        }
Exemplo n.º 2
0
        private void ButtonMethodLeastSquares_Click(object sender, RoutedEventArgs e)
        {
            if (AllDataTimeSeries.SelectedRow == -1 || QuantityPredictLeastSquares.Text == "")
            {
                WindowError windowError = new WindowError("Данные не выбраны");
                windowError.Show();
                return;
            }

            int m;

            try
            {
                m = Convert.ToInt32(QuantityPredictLeastSquares.Text);
            }
            catch
            {
                WindowError windowError = new WindowError("Неудалось распознать значение (требуется int)");
                windowError.Show();
                return;
            }

            if (m < 0)
            {
                WindowError windowError = new WindowError("Количество предсказываемых значений \nдолжно быть не отрицательным");
                windowError.Show();
                return;
            }
            bool flag = TypeMethodLeastSquares.IsChecked.GetValueOrDefault();
            WindowGraphicView windowTest = new WindowGraphicView(AllDataTimeSeries.LeastSquareMethod(m, flag), AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].GetColor());

            windowTest.Show();
        }
Exemplo n.º 3
0
        private void ButtonFFT_Click(object sender, RoutedEventArgs e)
        {
            if (AllDataTimeSeries.SelectedRow == -1)
            {
                WindowError windowError = new WindowError("Данные не выбраны");
                windowError.Show();
                return;
            }

            WindowGraphicView windowTest = new WindowGraphicView(AllDataTimeSeries.FFT(), AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].GetColor());

            windowTest.Show();
        }
Exemplo n.º 4
0
        private void ButtonAutocorrelation_Click(object sender, RoutedEventArgs e)
        {
            if (AllDataTimeSeries.SelectedRow == -1)
            {
                WindowError windowError = new WindowError("Данные не выбраны");
                windowError.Show();
                return;
            }
            //добавить создание нового ряда
            WindowGraphicView windowTest = new WindowGraphicView(AllDataTimeSeries.Autocorrelation(), AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].GetColor());

            windowTest.Show();
        }
Exemplo n.º 5
0
        private void ButtonMovingAverageMethod_Click(object sender, RoutedEventArgs e)
        {
            if (AllDataTimeSeries.SelectedRow == -1 || SmoothingInterval.Text == "")
            {
                WindowError windowError = new WindowError("Данные не выбраны");
                windowError.Show();
                return;
            }

            int n, m;

            try
            {
                n = Convert.ToInt32(SmoothingInterval.Text);
                m = Convert.ToInt32(QuantityPredict.Text);
            }
            catch
            {
                WindowError windowError = new WindowError("Неудалось распознать значение (требуется int)");
                windowError.Show();
                return;
            }

            if (n < 3 || n % 2 == 0)
            {
                WindowError windowError = new WindowError("Величина интервала сглаживания должна быть не меньше 3\n и нечетное");
                windowError.Show();
                return;
            }

            if (m < 0)
            {
                WindowError windowError = new WindowError("Количество предсказываемых значений \nдолжно быть не отрицательным");
                windowError.Show();
                return;
            }



            WindowGraphicView windowTest = new WindowGraphicView(AllDataTimeSeries.MovingAverageMethod(n, m), AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].GetColor());

            windowTest.Show();
        }
Exemplo n.º 6
0
        private void GraphicView_Click(object sender, RoutedEventArgs e)
        {
            if (CheckedNumberTimeSeries.IsChecked.GetValueOrDefault() == false)
            {
                if (AllDataTimeSeries.SelectedRow == -1)
                {
                    WindowError windowError = new WindowError("Данные не выбраны");
                    windowError.Show();
                    return;
                }

                TimeSeries temp = new TimeSeries();
                temp.Set_flag_sequence(AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].Get_flag_sequence());
                temp.SetNameTimeSeries(AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].GetNameTimeSeries());
                temp.SetColor(AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].GetColor());

                List <Dimension> dimensions = AllDataTimeSeries.ListTimeSeries[AllDataTimeSeries.SelectedRow].GetTimeSeries();
                for (int i = 0; i < dimensions.Count(); i++)
                {
                    temp.AddDimensionTime(dimensions[i].Time, dimensions[i].Value);
                }


                if (GivenTime.IsChecked == true)
                {
                    try
                    {
                        if (temp.Get_flag_sequence() == true)
                        {
                            temp.LimitDate(new DateTime(int.Parse(StartDate.Text), 1, 1), new DateTime(int.Parse(EndDate.Text), 1, 1));
                        }
                        else
                        {
                            temp.LimitDate(DateTime.Parse(StartDate.Text), DateTime.Parse(EndDate.Text));
                        }
                    }
                    catch
                    {
                        WindowError windowError = new WindowError("Некорректно задана дата");
                        windowError.Show();
                        return;
                    }
                }

                WindowGraphicView graphicView = new WindowGraphicView(temp.GetTimeSeries(), temp.GetColor());
                graphicView.Show();
            }
            else
            {
                if (NameSelectedTimeSeries.Text == "")
                {
                    WindowError windowError = new WindowError("Ничего не выбрано");
                    windowError.Show();
                    return;
                }

                List <string>     qqqqq        = new List <string>(System.Text.RegularExpressions.Regex.Split(NameSelectedTimeSeries.Text, ","));
                List <TimeSeries> timeSeries_s = new List <TimeSeries>();
                for (int i = 0; i < qqqqq.Count(); i++)
                {
                    for (int j = 0; j < AllDataTimeSeries.ListTimeSeries.Count(); j++)
                    {
                        if (qqqqq[i] == AllDataTimeSeries.ListTimeSeries[j].GetNameTimeSeries())
                        {
                            TimeSeries temp = new TimeSeries();
                            temp.Set_flag_sequence(AllDataTimeSeries.ListTimeSeries[j].Get_flag_sequence());
                            temp.SetNameTimeSeries(AllDataTimeSeries.ListTimeSeries[j].GetNameTimeSeries());
                            temp.SetColor(AllDataTimeSeries.ListTimeSeries[j].GetColor());

                            List <Dimension> dimensions = AllDataTimeSeries.ListTimeSeries[j].GetTimeSeries();
                            for (int k = 0; k < dimensions.Count(); k++)
                            {
                                temp.AddDimensionTime(dimensions[k].Time, dimensions[k].Value);
                            }

                            timeSeries_s.Add(temp);
                        }
                    }
                }

                if (GivenTime.IsChecked == true)
                {
                    try
                    {
                        for (int i = 0; i < timeSeries_s.Count; i++)
                        {
                            if (timeSeries_s[i].Get_flag_sequence() == true)
                            {
                                timeSeries_s[i].LimitDate(new DateTime(int.Parse(StartDate.Text), 1, 1), new DateTime(int.Parse(EndDate.Text), 1, 1));
                            }
                            else
                            {
                                timeSeries_s[i].LimitDate(DateTime.Parse(StartDate.Text), DateTime.Parse(EndDate.Text));
                            }
                        }
                    }
                    catch
                    {
                        WindowError windowError = new WindowError("Некорректно задана дата");
                        windowError.Show();
                        return;
                    }
                }

                WindowGraphicView graphicView = new WindowGraphicView(timeSeries_s);
                graphicView.Show();
            }
        }