Skip to main content

How to: Use the Chart Palette for Painting Series and their Points

This example demonstrates how you can specify a palette whose colors are used to paint series (or their points), via the ChartControlBase.Palette property.

View Example

<Window x:Class="UsePalettes.MainWindow"
        Title="MainWindow" Height="350" Width="525" >
            <!--Define a palette for your chart.-->
                <dxc:PastelKitPalette />
            <!-- / -->
                        <!--Since the ColorEach property is enabled for the first series,
                        the ChartControl.Palette propery affects its points.-->
                        <dxc:BarSideBySideSeries2D DisplayName="Series 1" ColorEach="True">
                                <dxc:SeriesPoint Argument="A" Value="20" />
                                <dxc:SeriesPoint Argument="B" Value="8" />
                                <dxc:SeriesPoint Argument="C" Value="9" />
                                <dxc:SeriesPoint Argument="D" Value="16" />
                                <dxc:PointOptions PointView="ArgumentAndValues"/>
                        <!--The second series' color is defined by the ChartControl.Palette property.-->
                        <dxc:LineSeries2D DisplayName="Series 2" MarkerVisible="True">
                                <dxc:SeriesPoint Argument="A" Value="2" />
                                <dxc:SeriesPoint Argument="B" Value="3" />
                                <dxc:SeriesPoint Argument="C" Value="6" />
                                <dxc:SeriesPoint Argument="D" Value="13" />
            <!--The legend lists the points of the first series 
            (based on its ColorEach and LegendPointOptions settings), 
            and the name of the second series.-->
                <dxc:Legend />
                <dxc:Title Content="How to Use the Chart Palettes" />