Chart Control for C# Windows Forms Quick and easily customize Chart skin with Palettes. Chart Palettes for WinForms C# Tutorial
The WinForms Chart control provides pre-defined color palettes for users to fast and easily customize skins for the chart view. The palette of Chart control offers a few color palette entries and a color palette entry contains up to four colors.
The Palettes provided in the Chart control allows users easily and quickly customize skin for Chart View. The Palettes is a collection of a few palette entries, each of which contains up to four colors, two fills and two strokes. The Palettes only use the Fill and Stroke properties now.
The following C# code shows how to apply one of these predefined palettes to the Chart control. this.chart1.Area.View.Palette = KnownPalette.Metro;
In the Windows Forms Chart Control, the predefined palettes contain eight palette entries that can be applied to the series in a cyclic order. Each palette entry is used to draw colors for the series in a sequence. Developers can apply a particular palette entry to a series by using the following C# code. lineSeria.Palette = KnownPalette.Flower.GlobalEntries[0]; lineSeria.Palette = new PaletteEntry(Color.Blue, Color.Gray);
In the Windows Forms Chart Control, it is not able to edit the Predefined palettes. If developers need customize the Palette, you need to create a collection of palette entries and inherit from ChartPalette. The following are the C# code for achieving this. public class CustomPalette : ChartPalette { public CustomPalette() { this.GlobalEntries.Add(Color.Blue, Color.Gray); this.GlobalEntries.Add(Color.Blue, Color.Gray); } }
If we want to customize the palette, we can use the below C# code, this.chart1.Area.View.Palette = new CustomPalette();
|