Chart控件Legend自定义
作者:互联网
//将自动生成Legend项隐藏
chart.Series[0].IsVisibleInLegend = false;
//新增自定义Legend项
var lgd = chart.Legends[0];
var legendItem = new LegendItem
{
MarkerStyle = MarkerStyle.Circle,
MarkerSize = 20,
ImageStyle = LegendImageStyle.Marker,
Color = Color.Red,
BorderColor = Color.White
};
legendItem.Cells.Add(new LegendCell()
{
CellType = LegendCellType.SeriesSymbol,
Alignment = ContentAlignment.MiddleLeft
});
legendItem.Cells.Add(new LegendCell()
{
CellType = LegendCellType.Text,
Text = string.Concat(item.AxisLabel, " ", item.YValues[0].ToString("N0")),
Alignment = ContentAlignment.MiddleLeft
});
lgd.CustomItems.Add(legendItem);
标签:控件,自定义,Color,Chart,Add,legendItem,new,Legend 来源: https://www.cnblogs.com/sanjiaolong/p/15654524.html