Commit Latest
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user