Your search did not match any results.


The PieChart, like other DevExtreme Data Visualization components, allows you to apply multiple predefined palettes. In this demo, you can use two drop-down menus under the PieChart to choose a palette and change the way it is extended when the number of colors is insufficient to paint each series point differently.

Specify a Palette

A palette is a set of colors that mix well with each other. To apply the needed color scheme, you can assign it to the palette property. It accepts either the name of a predefined palette or an array of colors. In this demo, you can use the "Palette" selector to apply a new set of colors.

Extend a Palette

When the number of palette colors is less than the number of series points, you can use the paletteExtensionMode property to specify how to extend the palette. This property can accept one of the following values:

  • "blend"
    Create a blend of two neighboring colors and insert it between these colors in the palette.

  • "alternate"
    Repeat the full set of palette colors, alternating their normal, lightened, and darkened shades in that order.

  • "extrapolate"
    Repeat the full set of palette colors, changing their shade gradually from dark to light.

In this demo, you can use the "Palette Extension Mode" selector to apply one of these modes.

Backend API
<div class="flex-container"> @(Html.DevExtreme().PieChart() .ID("pie") .ElementAttr("class", "flex-block") .Palette(VizPalette.Material) .PaletteExtensionMode(VizPaletteExtensionMode.Blend) .Series(s => s.Add()) .Legend(l => l.Visible(false)) .DataSource(Enumerable.Repeat(1, 20).Select((val, index) => new { val = val, arg = String.Format("Item{0}", index) })) .OnDrawn(@<text> function(e) { var paletteName = e.component.option("palette"), palette = DevExpress.viz.getPalette(paletteName).simpleSet, paletteContainer = $(".palette-container"); paletteContainer.html(""); palette.forEach(function(color) { $("<div>").css({ backgroundColor: color }) .addClass("palette-item") .appendTo(paletteContainer); }); } </text>) ) <div class="palette-container flex-block"></div> </div> <div class="options"> <div class="caption">Options</div> <div class="options-container"> <div class="option"> <span>Palette</span> @(Html.DevExtreme().SelectBox() .Value("Material") .Items(new[] { "Material", "Soft Pastel", "Harmony Light", "Pastel", "Bright", "Soft", "Ocean", "Office", "Vintage", "Violet", "Carmine", "Dark Moon", "Soft Blue", "Dark Violet", "Green Mist" }) .InputAttr("aria-label", "Palette") .OnValueChanged(@<text> function(e) { $("#pie").dxPieChart({ palette: e.value }); } </text>) ) </div> <div class="option"> <span>Palette Extension Mode</span> @(Html.DevExtreme() .SelectBox() .Value("Blend") .InputAttr("aria-label", "Pelette Extension Mode") .Items(Enum.GetNames(typeof(VizPaletteExtensionMode))) .OnValueChanged(@<text> function(e) { $("#pie").dxPieChart({ paletteExtensionMode: e.value.toLowerCase() }); } </text>) ) </div> </div> </div>
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.MVC.Demos.Models.SampleData; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class ChartsController : Controller { public ActionResult Palette() { return View(); } } }
.flex-container { display: flex; justify-content: center; align-items: center; flex-direction: row; } #pie { height: 350px; width: 500px; margin: 20px; } .palette-container { float: left; } .palette-item { width: 40px; height: 40px; } .options { padding: 20px; background-color: rgba(191, 191, 191, 0.15); margin-top: 20px; } .caption { font-size: 18px; font-weight: 500; } .option { display: inline-block; min-width: 320px; margin-top: 5px; } .option > span { margin: 0 10px 0 0; } .option > .dx-widget { display: inline-block; vertical-align: middle; } .options-container { display: flex; align-items: center; } .options-container > .option { display: flex; align-items: baseline; }