首页 > 代码库 > DevExpress ChartControl Pie 颜色设置
DevExpress ChartControl Pie 颜色设置
<Grid>
<dxc:ChartControl Grid.Row="1" Grid.Column="1" Width="40" Height="40" x:Name="_chartCtrl" EnableAnimation="True" Visibility="Visible" BorderThickness="0" Background="White">
<dxc:ChartControl.Palette>
<dxc:CustomPalette>
<dxc:CustomPalette.Colors>
<Color>#FF00CCFF</Color>
<Color>#FFD7D7D7</Color>
</dxc:CustomPalette.Colors>
</dxc:CustomPalette>
</dxc:ChartControl.Palette>
<dxc:ChartControl.Titles>
<dxc:Title Dock="Top" HorizontalAlignment="Center" FontSize="1"/>
<dxc:Title Dock="Bottom" HorizontalAlignment="Right" FontSize="1" Foreground="Silver" />
</dxc:ChartControl.Titles>
<dxc:SimpleDiagram2D >
<dxc:PieSeries2D x:Name="Series" ArgumentScaleType="Qualitative" HoleRadiusPercent="75" Rotation="0" SweepDirection="Clockwise" Margin="-15,-32,-15,-25">
<dxc:PieSeries2D.Model>
<dxc:BorderlessFlatPie2DModel/>
</dxc:PieSeries2D.Model>
<dxc:PieSeries2D.PointOptions>
<dxc:PointOptions PointView="ArgumentAndValues">
<dxc:PointOptions.ValueNumericOptions>
<dxc:NumericOptions Format="Percent" Precision="0" />
</dxc:PointOptions.ValueNumericOptions>
</dxc:PointOptions>
</dxc:PieSeries2D.PointOptions>
<dxc:PieSeries2D.Label>
<dxc:SeriesLabel dxc:PieSeries.LabelPosition="Inside" RenderMode="RectangleConnectedToCenter" />
</dxc:PieSeries2D.Label>
<dxc:SeriesPoint Argument="占用数" Value="27" x:Name="_spUsageCount" />
<dxc:SeriesPoint Argument="总数量" Value="81" x:Name="_spFreeCount" />
</dxc:PieSeries2D>
</dxc:SimpleDiagram2D>
</dxc:ChartControl>
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="_tbUsageCount" Text="27" Foreground="#FF00CCFF" FontSize="11" FontFamily="Arial" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="_tbFreeCount" Text="81" Foreground="Black" FontSize="11" FontFamily="Arial" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
运行效果如下:
DevExpress ChartControl Pie 颜色设置