问题
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