2

WPF の chartingToolkit:AreaSeries で奇妙な問題が発生しています。

チャートを作成するために使用しているコードは次のとおりです。

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:chartingprimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    x:Class="leartWPF.ButtonTest"
    x:Name="Window"
    Title="ButtonTest"
    Width="640" Height="480">

    <Grid x:Name="LayoutRoot">
        <chartingToolkit:Chart Margin="56,91,50,72" Title="Chart Title" DataContext="{Binding ElementName=Window, Mode=OneWay}">
                <chartingToolkit:Chart.Template>
                    <ControlTemplate TargetType="{x:Type chartingToolkit:Chart}">
                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                            <Grid>
                                <chartingprimitives:EdgePanel Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" Grid.Row="1" Margin="0">
                                    <Grid Panel.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
                                    <Border Panel.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" />
                                </chartingprimitives:EdgePanel>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </chartingToolkit:Chart.Template>

                <chartingToolkit:LineSeries
                    ItemsSource="{Binding Path=Data}"
                    IndependentValuePath="Date"
                    DependentValuePath="Value"/>
                <chartingToolkit:AreaSeries
                    ItemsSource="{Binding Path=Data}"
                    IndependentValueBinding="{Binding Date}"
                    DependentValueBinding="{Binding Value}">
                    <chartingToolkit:AreaSeries.Background>
                        <RadialGradientBrush Center="0.075,0.015" GradientOrigin="-0.1,-0.1" RadiusY="0.9" RadiusX="1.05">
                        <GradientStop Color="#FFB5D2ED" Offset="1"/>
                        <GradientStop Color="#FF1E4C78"/>
                    </RadialGradientBrush>
                    </chartingToolkit:AreaSeries.Background>
                </chartingToolkit:AreaSeries>
        </chartingToolkit:Chart>
    </Grid>
</Window>

#FFB5D2ED も #FF1E4C78 も青色です。

#FFB5D2ED も #FF1E4C78 も青色

実際のチャートはこんな感じ。

間違った色のチャート

なぜこれが発生するのですか?どうすれば色を変更できますか?

4

1 に答える 1

0

これがお役に立てば幸いです:

   <ch:Chart Margin="56,21,50,72" Title="MyChart" DataContext="{Binding ElementName=Window, Mode=OneWay}" >
                    <ch:Chart.Palette>
                        <datavis:ResourceDictionaryCollection>
                            <ResourceDictionary>
                                <Style x:Key="DataPointStyle" TargetType="Control">
                                    <Setter Property="Background" Value="Blue"/>
                                </Style>
                            </ResourceDictionary>
                            <ResourceDictionary>
                                <Style x:Key="DataPointStyle" TargetType="Control">
                                    <Setter Property="Background" Value="Green"/>
                                </Style>
                            </ResourceDictionary>
                            <ResourceDictionary>
                                <Style x:Key="DataPointStyle" TargetType="Control">
                                    <Setter Property="Background" Value="Red"/>
                                </Style>
                            </ResourceDictionary>
                        </datavis:ResourceDictionaryCollection>
                    </ch:Chart.Palette>

                    <ch:AreaSeries Name="PersonnelArea" ItemsSource="{Binding Path=Key}" IndependentValueBinding="{Binding Key}" DependentValueBinding="{Binding Value}"/>

                    <ch:AreaSeries Name="DefaultArea" ItemsSource="{Binding Path=Key}" IndependentValueBinding="{Binding Key}" DependentValueBinding="{Binding Value}" />
                </ch:Chart>
于 2013-07-08T05:05:18.143 に答える