1

この奇妙な問題の解決策が見つからないようです。すべての列が表示されない Silverlight 3 ツールキットの列グラフがあります。10列のデータセットがあり、7つしか表示されません。

グラフの画像:

<UserControl x:Class="graph.bd" 
xmlns:DV="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
xmlns:DVC="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">
<UserControl.Resources>
    <Style x:Key="ColorByGradeColumn" TargetType="DVC:ColumnDataPoint">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="DVC:ColumnDataPoint">
                    <Border  Background="{Binding ColColor}" 

                     BorderBrush="{Binding ColColor}" 

                     BorderThickness="0.5">

                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</UserControl.Resources>
<!-- canvases and other code goes here... -->
<DVC:Chart x:Name="Graphic" Width="350" Height="250" Background="Transparent">

                        <DVC:Chart.Series>
                            <DVC:ColumnSeries Title="Fras"
                            IndependentValueBinding="{Binding ColName}"
                            DependentValueBinding="{Binding ColValue}"                                             
                            DataPointStyle="{StaticResource ColorByGradeColumn}"
                                              >
                                <DVC:ColumnSeries.IndependentAxis>
                                    <DVC:CategoryAxis Orientation="X">
                                        <DVC:CategoryAxis.AxisLabelStyle>
                                            <Style TargetType="DVC:AxisLabel">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="DVC:AxisLabel">
                                                            <Grid Width="70" ShowGridLines="True"  Height="8" Background="Transparent" 

                                                         HorizontalAlignment="Left"  VerticalAlignment="Bottom">
                                                                <TextBlock x:Name="YAxisTitle" HorizontalAlignment="Center" VerticalAlignment="Center"  Text="{Binding}" RenderTransformOrigin="0.5,0.5" FontSize="8">
                                                            <TextBlock.RenderTransform>                
                                                            <RotateTransform Angle="270" CenterX="5"/>
                                                             </TextBlock.RenderTransform>
                                                                </TextBlock>
                                                                <Grid.RenderTransform>
                                                                    <RotateTransform Angle="60" ></RotateTransform>
                                                                </Grid.RenderTransform>
                                                            </Grid>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </DVC:CategoryAxis.AxisLabelStyle>
                                    </DVC:CategoryAxis>
                                </DVC:ColumnSeries.IndependentAxis>
                            </DVC:ColumnSeries>
                        </DVC:Chart.Series>
                        <DVC:Chart.PlotAreaStyle>
                            <Style TargetType="Grid">
                                <Setter Property="Background" Value="Black" />
                            </Style>
                        </DVC:Chart.PlotAreaStyle>
                        <DVC:Chart.LegendStyle>
                            <Style TargetType="DV:Legend">
                                <Setter Property="Width" Value="0"/>
                                <Setter Property="Height" Value="0"/>
                            </Style>
                        </DVC:Chart.LegendStyle>
                        <DVC:Chart.Foreground>
                            <SolidColorBrush Color="White"></SolidColorBrush>
                        </DVC:Chart.Foreground>

                    </DVC:Chart>

私のデータセットは、3 つの値だけで構成されています: 整数で列の高さを表す主な数値と、列の名前である文字列であり、画像には表示できません。また、色も含まれています。スタイルにバインドし、コードビハインドで変更できる列の場合。

また、Silverlight 4 以降にアップグレードできません。これは、列のあるこのページが、Silverlight 3 でのみ実行される別のページに埋め込まれているためです。

編集: 私は実際にページに問題なく動作する別の 3 つのグラフを持っていますが、この 1 つだけに問題があります。4 つすべてが .xaml にまったく同じコードを持ち (明らかに x:name が異なります)、4 つすべてが xaml.cs に非常によく似たコードを持っています。誰か助けてください、私は本当にこの問題を解決する必要があります. 必要に応じて、さらにコードを提供できます。

EDIT2:

何が起こっているのか、列の 1 つが他の列よりも遅れているか、または上になっていると思いますが、その理由はわかりません。他のグラフにはこの問題はありません。

4

1 に答える 1