Beispiel #1
0
        private void LoadSelectedForecasts()
        {
            try
            {
                var collection = WeatherDataSelecter.GetGroupedByParameterForecastPlots(new ForecastViewerRequest(
                                                                                            _settings.CurrentStation,
                                                                                            SelectedDate.AddHours(SelectedTime == allDayString ? 0 : int.Parse(SelectedTime)),
                                                                                            GivenTimeKind,
                                                                                            SelectedTime == allDayString ? RequestTimeDeterminateness.AllDay : RequestTimeDeterminateness.DateAndHour,
                                                                                            SourceParamPicker.CheckedSources,
                                                                                            SourceParamPicker.CheckedParameters.Select(p => p.ShortTypeName)));

                foreach (var plot in Plots)
                {
                    plot.Dispose();
                }
                Plots.Clear();
                foreach (var parameter in collection.Keys)
                {
                    var plot = new PlotViewModel(collection[parameter]);
                    Plots.Add(plot);
                }
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.Message);
            }
        }
Beispiel #2
0
        private void LoadSelected()
        {
            try
            {
                var plotDatas = WeatherDataSelecter.GetGroupedByParameterAccuracyPlots(new AccuracyRequest(
                                                                                           _settings.CurrentStation,
                                                                                           SelectedDate,
                                                                                           SelectedComparisonMode,
                                                                                           SourceParamPicker.CheckedSources,
                                                                                           SourceParamPicker.CheckedParameters.Select(p => p.ShortTypeName)));

                foreach (var plot in Plots)
                {
                    plot.Dispose();
                }
                Plots.Clear();

                AccuracyPlots.Clear();

                foreach (var parameter in plotDatas.Keys)
                {
                    var plot   = new PlotViewModel(plotDatas[parameter]);
                    var acPlot = new AccuracyPlotViewModel(AccuracyMeter.CalcAccuracy(plotDatas[parameter], StatisticMethods.All));
                    Plots.Add(plot);
                    AccuracyPlots.Add(acPlot);
                }
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.Message);
            }
        }
Beispiel #3
0
        internal void Add(Plot plot)
        {
            Plots.Add(new GamePlot
            {
                GameObject = plot.Target,
                Plot       = plot
            });

            GamePlots = Plots.ToLookup(p => p.GameObject, p => p.Plot);
        }
Beispiel #4
0
 /// <summary>
 /// プロットを設定
 /// </summary>
 /// <param name="user"></param>
 /// <param name="plots"></param>
 public void SetPlot(UserOrNpcInfo user, List <int> plots)
 {
     if (Plots.Keys.Contains(user))
     {
         Plots[user] = plots;
     }
     else
     {
         Plots.Add(user, plots);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Method to invoke when the NewPlotCommand command is executed.
 /// </summary>
 private async Task OnNewPlotCommandExecuteAsync()
 {
     try
     {
         var plotmodel = new Models.PlotModel();
         Plots.Add(plotmodel);
         var viewModel = new PlotViewModel(plotmodel);
         viewModel.ClosedAsync += PlotViewModel_ClosedAsync;
         ServiceLocator.Default.ResolveType <IUIVisualizerService>().Show(viewModel);
     }
     catch (Exception ex)
     {
         string errmsg = string.Format("Error creating new plot: {0}", ex.Message);
         LogTo.Error(errmsg);
         await Shared.Utility.ShowErrorMsgAsync(this, errmsg);
     }
 }
Beispiel #6
0
        private void UpdatePlot(DurationEnum duration)
        {
            Plots.Clear();

            if (Ticks == null || !Ticks.Any())
            {
                return;
            }

            var candles = CreatePlot(Name, CreateCandleStickSeries(Name + " " + duration, Ticks));

            var dateValues = Ticks.ToDateValuePoints(x => x.Close).ToList();

            var ema          = MovingAverage.CalculateEma(Ticks, 22);
            var channels     = MovingAverage.CalculateEmaChannels(Ticks, 22, 60);
            var lowerChannel = channels.Select(x => new DateValue {
                Date = x.Date, Value = x.LowerValue
            }).ToList();
            var upperChannel = channels.Select(x => new DateValue {
                Date = x.Date, Value = x.UpperValue
            }).ToList();

            var plotChannels = CreatePlot("Channels",
                                          CreateLineSeries("Close Price", OxyColor.FromUInt32(0xCCF0A30A), dateValues),
                                          CreateLineSeries("EMA 22", OxyColor.FromUInt32(0xCCFA6800), ema),
                                          CreateLineSeries("Lower Channel", OxyColor.FromUInt32(0xCCA4C400), lowerChannel),
                                          CreateLineSeries("Upper Channel", OxyColor.FromUInt32(0xCC60A917), upperChannel));

            var plotMa = CreatePlot("Moving Average",
                                    CreateLineSeries("Close Price", OxyColor.FromUInt32(0xCCF0A30A), dateValues),
                                    CreateLineSeries("MA 10", OxyColor.FromUInt32(0xCCA4C400), BasicAnalysis.CalculateMovingAverage(Ticks, 10)),
                                    CreateLineSeries("MA 100", OxyColor.FromUInt32(0xCC60A917), BasicAnalysis.CalculateMovingAverage(Ticks, 100)));

            var plotMinMax = CreatePlot("Min max",
                                        CreateLineSeries("Close Price", OxyColor.FromUInt32(0xCCF0A30A), dateValues),
                                        CreateLineSeries("Max 50", OxyColor.FromUInt32(0xCCA4C400), BasicAnalysis.CalculateMax(Ticks, 50)),
                                        CreateLineSeries("Min 50", OxyColor.FromUInt32(0xCC60A917), BasicAnalysis.CalculateMin(Ticks, 50)));

            var returns = CreatePlot("Returns", "P4",
                                     CreateTwoColorLineSeries("Annualized Returns", OxyColor.FromUInt32(0xCC60A917), OxyColor.FromUInt32(0xCCFA6800), CalculateReturns(dateValues)));

            Plots.Add(new PlotViewModel(candles));
            Plots.Add(new PlotViewModel(plotChannels));
            Plots.Add(new PlotViewModel(plotMa));
            Plots.Add(new PlotViewModel(plotMinMax));
            Plots.Add(new PlotViewModel(returns));

            //analysisPlotModel.Series.Add(closePrices);

            //analysisPlotModel.Series.Add(CreateLineSeries("MA 10", OxyColor.FromUInt32(0xCCA4C400), BasicAnalysis.CalculateMovingAverage(Ticks, 10)));
            //analysisPlotModel.Series.Add(CreateLineSeries("MA 100", OxyColor.FromUInt32(0xCC60A917), BasicAnalysis.CalculateMovingAverage(Ticks, 100)));

            //analysisPlotModel.Series.Add(CreateLineSeries("Max 10", OxyColor.FromUInt32(0xCC911A0E), BasicAnalysis.CalculateMax(Ticks, 10)));
            //analysisPlotModel.Series.Add(CreateLineSeries("Max 100", OxyColor.FromUInt32(0xCC1569CE), BasicAnalysis.CalculateMax(Ticks, 100)));

            //if (dateValues.Count > 30)
            //{
            //    var anno1 = new TextAnnotation();
            //    anno1.Text = "sdkjfhsdjkfhsd";
            //    anno1.TextPosition = DateTimeAxis.CreateDataPoint(dateValues[10].Date, dateValues[10].Value);
            //    analysisPlotModel.Annotations.Add(anno1);

            //    var anno2 = new ArrowAnnotation();
            //    anno2.Text = "bla blas bla";
            //    anno2.EndPoint = DateTimeAxis.CreateDataPoint(dateValues[30].Date, dateValues[30].Value);
            //    anno2.ArrowDirection = new ScreenVector(50, anno2.EndPoint.Y * 0.3);
            //    analysisPlotModel.Annotations.Add(anno2);
            //}

            //Plots.Add(new PlotViewModel(analysisPlotModel));

            var clenow = new SimpleClenow(Ticks);
        }
Beispiel #7
0
 internal void Add(GamePlot gamePlot)
 {
     Plots.Add(gamePlot);
 }