Skip to content

Commit

Permalink
Fixed the issue where ScottPlot could not display CJK (and possibly o…
Browse files Browse the repository at this point in the history
…ther) characters by default
  • Loading branch information
YexuanXiao committed Jun 17, 2024
1 parent 8ac42b6 commit 3808f6e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using ScottPlot.AxisRules;
using ScottPlot.Plottables;
using ScottPlot.TickGenerators;
using SkiaSharp;

namespace GalaxyBudsClient.Interface.ViewModels.Pages;

Expand Down Expand Up @@ -157,7 +158,9 @@ private async Task UpdatePlotAsync()
}

overlay?.AddNullFrame(DateTimeOffset.Now.DateTime.ToOADate());

var font = SKFontManager.Default.MatchCharacter(Strings.Left[0]).FamilyName;
Plot.Legend.FontName = font;

var plotBatteryL = Plot.Add.Scatter(timestamp, batteryL);
plotBatteryL.MarkerShape = MarkerShape.None;
plotBatteryL.LineWidth = 2;
Expand All @@ -181,7 +184,8 @@ private async Task UpdatePlotAsync()
{
LabelFormatter = value => value is < 0 or > 100 ? string.Empty : NumericAutomatic.DefaultLabelFormatter(value)
};


Plot.Font.Set(font);
Plot.YLabel(Strings.BattHistYAxis);
UpdateLegendVisibility();

Expand Down

0 comments on commit 3808f6e

Please sign in to comment.