How to change the palette colors of WinRT XAML Toolkit Chart controls?
如何在WinRT XAML工具包图表控件中更改图表控件的调色板颜色?
例如,我想更改饼图切片的颜色。
如果您在工具箱的源代码中搜索"调色板",您将看到图表控件的默认样式如何具有
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | <charting:Chart x:Name="PieChartWithCustomPalette" Title="Pie Chart with Custom Palette" Margin="70,0"> <charting:Chart.Palette> <charting:ResourceDictionaryCollection> <!-- Blue --> <ResourceDictionary> <SolidColorBrush x:Key="Background" Color="#4586d8" /> <Style x:Key="DataPointStyle" TargetType="Control"> <Setter Property="Background" Value="{StaticResource Background}" /> </Style> <Style x:Key="DataShapeStyle" TargetType="Shape"> <Setter Property="Stroke" Value="{StaticResource Background}" /> <Setter Property="StrokeThickness" Value="2" /> <Setter Property="StrokeMiterLimit" Value="1" /> <Setter Property="Fill" Value="{StaticResource Background}" /> </Style> </ResourceDictionary> <!-- Red --> <ResourceDictionary> <SolidColorBrush x:Key="Background" Color="#dc443f" /> <Style x:Key="DataPointStyle" TargetType="Control"> <Setter Property="Background" Value="{StaticResource Background}" /> </Style> <Style x:Key="DataShapeStyle" TargetType="Shape"> <Setter Property="Stroke" Value="{StaticResource Background}" /> <Setter Property="StrokeThickness" Value="2" /> <Setter Property="StrokeMiterLimit" Value="1" /> <Setter Property="Fill" Value="{StaticResource Background}" /> </Style> </ResourceDictionary> </charting:ResourceDictionaryCollection> </charting:Chart.Palette> <charting:Chart.Series> <Series:PieSeries Title="Population" ItemsSource="{Binding Items}" IndependentValueBinding="{Binding Name}" DependentValueBinding="{Binding Value}" IsSelectionEnabled="True" /> </charting:Chart.Series> </charting:Chart> |
我正在将此添加到示例项目中,以供将来参考。