Create a Custom Palette

  • 2 minutes to read

Palettes are used to paint chart series. You can use the predefined palettes that ship with the Chart Control or create a custom palette.

Create and Apply a Palette at Design Time

Click the chart’s smart tag and select the Palettes… link.

Select the Palettes link in the Chart Control's smart tag menu

This invokes the Palettes dialog that you can use to change the collection of predefined palettes and create new palettes.

Click the Add button.

Click the Add button.

Rename the newly created palette.

Rename the palette.

Click the plus button to add new colors to the palette. Double-click a color to change it.

Add colors to the palette.

Click OK to save the palette and apply it to the chart. This registers the palette in the Chart Control’s palette repository and adds the palette to the chart toolbar‘s Palette menu.

Save the newly created palette.

Create and Apply a Palette at Runtime

The following example shows how to create a palette, register and apply it to a chart:

// Create a palette.
Palette palette = new Palette("Custom Palette");
palette.Add(Color.Yellow);
palette.Add(Color.Red);
palette.Add(Color.Green);
// Register the palette.
chartControl1.PaletteRepository.RegisterPalette(palette);
// Assign the palette to the chart.
chartControl1.PaletteName = "Custom Palette";
See Also