From 8647d86ea253b4a451df9620224d21bd72697299 Mon Sep 17 00:00:00 2001 From: Sean Date: Fri, 20 Jun 2025 20:13:27 -0400 Subject: [PATCH] Commit Latest --- .../ViewModels/BollingerBandViewModel.cs | 16 ++++++++++++---- .../ViewModels/ScottPlotViewModel.cs | 11 ++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/PortfolioManager/ViewModels/BollingerBandViewModel.cs b/PortfolioManager/ViewModels/BollingerBandViewModel.cs index 24ac178..84dea98 100644 --- a/PortfolioManager/ViewModels/BollingerBandViewModel.cs +++ b/PortfolioManager/ViewModels/BollingerBandViewModel.cs @@ -32,13 +32,21 @@ namespace PortfolioManager.ViewModels public static Image GenerateImage(String text) { ImageHelper imageHelper = new ImageHelper(); - int fontSize = 36; + int fontSize = 12; int width = 130; - imageHelper.CreateImage(width, fontSize); + int height = 24; + imageHelper.CreateImage(width, height); //, new PointMapping(width,height,width,0,height,0)); imageHelper.Fill(SKColors.White); SKTextAlign align = SKTextAlign.Center; - SKFont font = new SKFont(SKTypeface.FromFamilyName("Helvetica"), fontSize); - imageHelper.DrawText(text, new SKPoint(width / 2, fontSize - 2), SKColors.Black, align, font); +// SKFont font = new SKFont(SKTypeface.FromFamilyName("Arial",SKFontStyle.Normal), fontSize); + SKFont font = new SKFont(SKTypeface.FromFamilyName("Arial",500,5,SKFontStyleSlant.Upright), fontSize); +// SKFont font = new SKFont(SKTypeface.Default, fontSize); + imageHelper.DrawLine(SKColors.Black,1, new SKPoint(0,0), new SKPoint(width-1,0)); // bottom left to right + imageHelper.DrawLine(SKColors.Black,1, new SKPoint(width-1,0), new SKPoint(width-1,height-1)); // up lefthand side + imageHelper.DrawLine(SKColors.Black,1, new SKPoint(0,height-1), new SKPoint(width-1,height-1)); // top left to right + imageHelper.DrawLine(SKColors.Black,1, new SKPoint(0,height-1), new SKPoint(0,0)); // left hand side top to bottom + imageHelper.DrawText(text, new SKPoint(width / 2, height-8), SKColors.Black, align, font); + using MemoryStream memoryStream = new MemoryStream(); imageHelper.ToStream().CopyTo(memoryStream); return new ScottPlot.Image(memoryStream.ToArray()); diff --git a/PortfolioManager/ViewModels/ScottPlotViewModel.cs b/PortfolioManager/ViewModels/ScottPlotViewModel.cs index e5e0858..ccb7e6c 100644 --- a/PortfolioManager/ViewModels/ScottPlotViewModel.cs +++ b/PortfolioManager/ViewModels/ScottPlotViewModel.cs @@ -23,6 +23,7 @@ namespace PortfolioManager.ViewModels public void Render(AvaPlot plotter) { plotter.Plot.Axes.AutoScale(); + plotter.Plot.HideLegend(); plotter.Refresh(); } @@ -52,10 +53,10 @@ namespace PortfolioManager.ViewModels // marker.MarkerStyle.Shape = MarkerShape.TriUp; // marker.MarkerStyle.Size = 15; - IImage image = TextMarkerImageGenerator.GenerateImage("Even $52.14 (+.25%"); - Coordinates coordinates = new Coordinates(dates[0].ToOADate(), values[0] / 1.025); - Marker marker = plotter.Plot.Add.ImageMarker(coordinates, image); - Image image = default; + Image image = TextMarkerImageGenerator.GenerateImage("Even $52.14 (+.25%)"); + Coordinates coordinates = new Coordinates(dates[0].ToOADate(), values[0] / 1.0125); + ImageMarker marker = plotter.Plot.Add.ImageMarker(coordinates, image); + @@ -176,7 +177,7 @@ namespace PortfolioManager.ViewModels public void PlotterLoadedEvent(object sender, PlotterLoadedEventArgs e) { - String selectedSymbol = "SPY"; + String selectedSymbol = "CRS"; int selectedDayCount = 180; plotter = e.AvaPlot; // we should store this somewhere