Conversation
demonstrates solution for #3830
Contributor
|
Hi @swharden! I'm sorry, but a similar result can be achieved using existing functionality, in particular using [Test]
public void Test_CustomTypeface_InLegend()
{
string ttfFilePath = Paths.GetTtfFilePaths().First();
Fonts.AddFontFile("Font Name", ttfFilePath, bold: false, italic: false);
// create a plot with data
Plot plot = new();
var sig = plot.Add.Signal(Generate.Sin());
sig.LegendText = "Sine Wave";
// axis label custom typeface
plot.XLabel("Horizontal Axis Label");
plot.Axes.Bottom.Label.ForeColor = Colors.Red;
plot.Axes.Bottom.Label.FontSize = 26;
plot.Axes.Bottom.Label.FontName = "Font Name";
// manual legend items custom typeface
plot.Legend.ManualItems.Add(new LegendItem()
{
LabelText = "Manual Item",
LabelFontColor = Colors.Blue,
LabelFontSize = 26,
LabelFontName = "Font Name"
});
plot.SaveTestImage();
} |
Member
Author
Hi @kebox7, thanks for pointing this out! I'll create a new issue to see about rolling back this change and creating a test or cookbook recipe that demonstrates how to achieve this functionality with the original feature set #4057 |
kebox7
added a commit
to kebox7/ScottPlot
that referenced
this pull request
Jul 9, 2024
swharden
added a commit
that referenced
this pull request
Jul 21, 2024
#4060) * rollback #4043 * Tests * Cookbook recipe * Artifacts in Cookbook * Fixed an issue with incorrect font file paths in Cookbook * Normalize line breaks * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: Scott W Harden <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
SKTypeface? Typefaceproperty toLabel,LabelStyle, andLegendallowing objects with text to be supplied a custom typeface. This strategy works for automatically generated and manually added legend items too.