public static void OnLoad() { foreach (RenderableBuilding b in Buildings.Values) { b.Dispose(); } Buildings.Clear(); foreach (RenderablePlot p in Plots.Values) { p.Dispose(); } Plots.Clear(); foreach (Plot p in Haswell.Controller.City.Grid) { if (p.Building != null) { if (p.Building is Road) { Buildings[p.Building] = new RenderableRoad((Road)p.Building); } else { Buildings[p.Building] = new RenderableBuilding(p.Building); } } Plots[p] = new RenderablePlot(p); Plots[p].Create(SceneMgr, cityNode); } GameConsole.ActiveInstance.WriteLine("Game Loaded."); GuiMgr.AddInfoPopup("Game Loaded."); }
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); } }
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); } }
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); }