Пример #1
0
        private void initDate()
        {
            int date;

            if (wheatePeatsZongQunHeader.predictIndex == 0)
            {
                return;
            }

            if (!this.IsLoaded)
            {
                return;
            }
            DateTime dateTime = (DateTime)dateSelect.SelectedDate;
            TimeSpan time     = dateTime - (new DateTime(2015, 7, 17));

            date = time.Days;

            try
            {
                List <DataValue> Axis   = SelectData.getPredictData("000051", date);
                DataSource       yData  = new DataSource("000051");
                DataSource       y1Data = new DataSource("000052");
                DataSource       y2Data = new DataSource("000053");
                DataSource       y3Data = new DataSource("000054");

                List <DataValue> predictYData  = SelectData.getPredictData("000051", date);
                List <DataValue> predictY1Data = SelectData.getPredictData("000052", date);
                List <DataValue> predictY2Data = SelectData.getPredictData("000053", date);
                List <DataValue> predictY3Data = SelectData.getPredictData("000054", date);



                colGrainPredict.MarkerType      = MarkerType.None;
                colGrainPredict.Thickness       = 5;
                colGrainPredict.ItemsSource     = predictYData;
                colGrainPredict.ValueMemberPath = "PredictData";
                colGrainPredict.XAxis           = categoryDateAxis;
                colGrainPredict.YAxis           = numericYAxis;
                colGrainPredict.Opacity         = 0.5;
                colGrainPredict.Visibility      = Visibility.Hidden;
                colGrainPredict.Brush           = new SolidColorBrush(Colors.Green);

                colGrainPredict.ToolTip = colGrain.ToolTip;
                this.CategoryChart.Series.Add(colGrainPredict);


                colCornPredict.MarkerType      = MarkerType.None;
                colCornPredict.Thickness       = 5;
                colCornPredict.ItemsSource     = predictY1Data;
                colCornPredict.ValueMemberPath = "PredictData";
                colCornPredict.XAxis           = categoryDateAxis;
                colCornPredict.YAxis           = numericYAxis;
                colCornPredict.Opacity         = 0.5;
                colCornPredict.Visibility      = Visibility.Hidden;
                colCornPredict.Brush           = new SolidColorBrush(Colors.Black);

                colCornPredict.ToolTip = colCorn.ToolTip;
                this.CategoryChart.Series.Add(colCornPredict);



                colRicePredict.MarkerType      = MarkerType.None;
                colRicePredict.Thickness       = 5;
                colRicePredict.ItemsSource     = predictY2Data;
                colRicePredict.ValueMemberPath = "PredictData";
                colRicePredict.XAxis           = categoryDateAxis;
                colRicePredict.YAxis           = numericYAxis;
                colRicePredict.Opacity         = 0.5;
                colRicePredict.Visibility      = Visibility.Hidden;
                colRicePredict.Brush           = new SolidColorBrush(Colors.Chocolate);

                colRicePredict.ToolTip = colRice.ToolTip;
                this.CategoryChart.Series.Add(colRicePredict);


                colTCCPredict.MarkerType      = MarkerType.None;
                colTCCPredict.Thickness       = 5;
                colTCCPredict.ItemsSource     = predictY3Data;
                colTCCPredict.ValueMemberPath = "PredictData";
                colTCCPredict.XAxis           = categoryDateAxis;
                colTCCPredict.YAxis           = numericYAxis;
                colTCCPredict.Opacity         = 0.5;
                colTCCPredict.Visibility      = Visibility.Hidden;
                colTCCPredict.Brush           = new SolidColorBrush(Colors.Blue);

                colTCCPredict.ToolTip = colTCC.ToolTip;
                this.CategoryChart.Series.Add(colTCCPredict);


                categoryDateAxis.ItemsSource = Axis;
                colCorn.ItemsSource          = y1Data;
                colRice.ItemsSource          = y2Data;
                colGrain.ItemsSource         = yData;
                colTCC.ItemsSource           = y3Data;


                numericXAxis.MinimumValue = Convert.ToDouble(Axis[0].date.Ticks);
                numericXAxis.MaximumValue = Convert.ToDouble(Axis[Axis.Count - 1].date.Ticks);

                double[] high = new double[8];
                high[0] = getMax(predictYData);
                high[1] = getMax(predictY1Data);
                high[2] = getMax(predictY2Data);
                high[3] = getMax(predictY3Data);


                numericYAxis.MaximumValue = SelectData.getHigh(high) + 5;

                //ClipLine.Value = yData.Count;
                ClipLine.Value = Convert.ToDouble((new DateTime(2015, 7, 17)).Ticks);
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
            }

            if (butCorn.IsChecked == true)
            {
                ClickPredict(butCorn);
            }
            else if (butGrain.IsChecked == true)
            {
                ClickPredict(butGrain);
            }
            else if (butRice.IsChecked == true)
            {
                ClickPredict(butRice);
            }
            else if (butTcc.IsChecked == true)
            {
                ClickPredict(butTcc);
            }
        }
Пример #2
0
 public List <DataValue> getPredictData(String shiYanNumber, int date)
 {
     return(SelectData.getPredictData(shiYanNumber, date));
 }