【问题标题】:How to customize legends in livecharts in winforms?如何在winforms的实时图表中自定义图例?
【发布时间】:2018-11-27 12:19:29
【问题描述】:
如何在 winforms 的 livecharts 中自定义图例?我试图得到像this 这样的东西。
在实时图表winforms中,我只能看到这两个选项
scatterChart.LegendLocation = LegendLocation.Right;
scatterChart.DefaultLegend.Visibility = Visibility.Visible;
但这不会帮助我实现我在链接中显示的传奇。想知道一些解决方案。提前致谢。
【问题讨论】:
标签:
c#
.net
winforms
livecharts
【解决方案1】:
我们可以创建一个 DefaultLegend 并将我们的属性添加到其中并分配给图表的 DefaultLegend,如下所示:
DefaultLegend customLegend = new DefaultLegend();
customLegend.BulletSize = 15;
customLegend.Foreground = Brushes.White;
customLegend.Orientation = System.Windows.Controls.Orientation.Horizontal;
cartesianChart1.DefaultLegend = customLegend;
【解决方案2】:
这非常有效。谢谢
DefaultLegend customLegend = new DefaultLegend();
customLegend.BulletSize = 15;
customLegend.Foreground = Brushes.White;
customLegend.Orientation = System.Windows.Controls.Orientation.Horizontal;
customLegend.FontSize = 9;
cartesianChart1.DefaultLegend = customLegend;