支持的字体检测
ScottPlot 附带字体检测方法,可帮助识别用于显示可能包含国际字符的文本的最佳安装字体。
string chinese = "测试";
WpfPlot1.Plot.Axes.Title.Label.Text = chinese;
WpfPlot1.Plot.Axes.Title.Label.FontName = Fonts.Detect(chinese);
string japanese = "試験";
WpfPlot1.Plot.Axes.Left.Label.Text = japanese;
WpfPlot1.Plot.Axes.Left.Label.FontName = Fonts.Detect(japanese);
string korean = "테스트";
WpfPlot1.Plot.Axes.Bottom.Label.Text = korean;
WpfPlot1.Plot.Axes.Bottom.Label.FontName = Fonts.Detect(korean);
WpfPlot1.Refresh();
自动字体检测
Plot 的 Style 类包含一个方法,该方法会自动将常见绘图对象的字体设置为最有可能显示它们所包含的字符的字体。
var sig1 = WpfPlot1.Plot.Add.Signal(Generate.Sin(phase: .1));
var sig2 = WpfPlot1.Plot.Add.Signal(Generate.Sin(phase: .2));
var sig3 = WpfPlot1.Plot.Add.Signal(Generate.Sin(phase: .3));
sig1.LegendText = "测试"; // Chinese
sig2.LegendText = "試験"; // Japanese
sig3.LegendText = "테스트"; // Korean
WpfPlot1.Plot.ShowLegend();
WpfPlot1.Plot.Title("测试"); // Chinese
WpfPlot1.Plot.YLabel("試験"); // Japanese
WpfPlot1.Plot.XLabel("테스트"); // Korean
WpfPlot1.Plot.Font.Automatic(); // set font for each item based on its content
WpfPlot1.Refresh();