您好,帮您查了下,有两种方案,一种是内置的主题和Palette,一种是需要设置Palette,然后在定义画刷,进行修改, this.c1Chart1.Palette = ColorGeneration.Default;
Brush[] customBrushes = new Brush[5] { Brushes.Blue, Brushes.Orange, Brushes.Yellow, Brushes.Red,Brushes.Purple };
this.c1Chart1.CustomPalette = customBrushes;
这个有问题就是如果您的series比brushes多,将会重复按brushes展示。
如果您对原有的某个Palette不满意,就在PlotElementLoaded事件中进行修改
PieSlice pieSlice = (sender as PieSlice);
switch (pieSlice.DataPoint.Name)
{
case "P1":
pieSlice.Fill = Brushes.SeaGreen;
pieSlice.Offset = 10;
break;
default:
break;
}
总之还是定义您的颜色还是要定义到Paltte统一取。 |