首页 > 解决方案 > 如何在winforms的实时图表中自定义图例?

问题描述

如何在winforms的实时图表中自定义图例?我试图得到这样的东西

在实时图表winforms中,我只能看到这两个选项

scatterChart.LegendLocation = LegendLocation.Right;
scatterChart.DefaultLegend.Visibility = Visibility.Visible;

但这不会帮助我实现我在链接中显示的传奇。想知道一些解决方案。提前致谢。

标签: c#.netwinformslivecharts

解决方案


我们可以创建一个 DefaultLegend 并将我们的属性添加到其中并分配给图表的 DefaultLegend,如下所示:

DefaultLegend customLegend = new DefaultLegend();
customLegend.BulletSize = 15;
customLegend.Foreground = Brushes.White;
customLegend.Orientation = System.Windows.Controls.Orientation.Horizontal;

cartesianChart1.DefaultLegend = customLegend;

推荐阅读