Skip to content

Commit

Permalink
Update Plot.cs
Browse files Browse the repository at this point in the history
Issue #370 Fix positioning of text at extreme right end of plot.
  • Loading branch information
towsey authored and atruskie committed Oct 14, 2020
1 parent 5958a59 commit 9df9bf5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/TowseyLibrary/Plot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace TowseyLibrary
using System;
using System.Collections.Generic;
using Acoustics.Shared.ImageSharp;
using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
Expand Down Expand Up @@ -253,7 +254,8 @@ public Image<Rgb24> DrawAnnotatedPlot(int height)

if (this.data.Length > 500)
{
g.DrawTextSafe(this.title, font, Color.Red, new PointF(length - 80, 0));
var size = TextMeasurer.Measure(this.title, new RendererOptions(font));
g.DrawTextSafe(this.title, font, Color.Red, new PointF(length - size.Width - 2, 0));
}

if (this.data.Length > 1200)
Expand Down

0 comments on commit 9df9bf5

Please sign in to comment.