How to customize legends in livecharts in winforms?

好久不见. 提交于 2021-02-20 02:45:30

问题


How to customize legends in livecharts in winforms ? I was trying to get some thing like this.

In live chart winforms, I can only see these two options

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

But this wont help me to achieve a legend as I shown in the link. Would like to know some solutions. Thanks in advance.


回答1:


We can create a DefaultLegend and add our properties into it and assign to chart's DefaultLegend as follows :

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

cartesianChart1.DefaultLegend = customLegend;



回答2:


This perfectly works .Thanks

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


来源:https://stackoverflow.com/questions/53499556/how-to-customize-legends-in-livecharts-in-winforms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!