Tableau de boîte à outils Silverlight: axes ne présentent pas toujours 0 et la valeur maximale

StackOverflow https://stackoverflow.com/questions/2284154

Question

J'utilise le contrôle graphique fourni dans la boîte à outils silverlight.

I ai défini 3 axes (code ci-dessous). Maintenant, la série dans le changement de tableau à la commande d'un utilisateur. Parfois, la valeur 0 de l'origine et la valeur maximale de l'axe ne soit pas affiché. Ils ne manquent pas nécessairement en même temps. Je suis hors idée pourquoi ce qui se passe. Les valeurs dans la série se situent dans la même plage que ils sont liés à (0, 1000). Est-ce normal?

      <chartingToolkit:Chart.Axes>
            <chartingToolkit:LinearAxis x:Name="LeftYAxis"
                                        Orientation="Y"
                                        Location="Left"
                                        BorderThickness="0.5"
                                        >

                <chartingToolkit:LinearAxis.AxisLabelStyle>
                    <Style TargetType="chartingToolkit:AxisLabel" >
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="chartingToolkit:AxisLabel">
                                    <Grid Background="Transparent">
                                        <Border x:Name="AxisLabelMarker"
                                                Background="Transparent"
                                                BorderBrush="Blue"
                                                BorderThickness="0"
                                                >

                                            <TextBlock Text="{Binding}"
                                                       Grid.Column="0"
                                                       />
                                        </Border>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </chartingToolkit:LinearAxis.AxisLabelStyle>
            </chartingToolkit:LinearAxis>
            <chartingToolkit:CategoryAxis Orientation="X"
                                        Title="Percentage Increase in Bid Value"
                                        Location="Bottom"
                                        BorderThickness="0.5" 
                                       >

                <chartingToolkit:CategoryAxis.AxisLabelStyle>
                    <Style TargetType="chartingToolkit:AxisLabel" >
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="chartingToolkit:AxisLabel">
                                    <Grid Background="Transparent">
                                        <Border x:Name="AxisLabelMarker"
                                                Background="Transparent"
                                                BorderBrush="Blue"
                                                BorderThickness="0"
                                                >
                                            <TextBlock Text="{Binding}"
                                                       Grid.Column="0"
                                                       />
                                        </Border>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </chartingToolkit:CategoryAxis.AxisLabelStyle>
            </chartingToolkit:CategoryAxis>
            <chartingToolkit:LinearAxis x:Name="RightYAxis"
                                        Orientation="Y"
                                        Location="Right"
                                        BorderThickness="0.5"
                                        >
                <chartingToolkit:LinearAxis.AxisLabelStyle>
                    <Style TargetType="chartingToolkit:AxisLabel">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="chartingToolkit:AxisLabel">
                                    <TextBlock Text="{Binding}"
                                               />
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </chartingToolkit:LinearAxis.AxisLabelStyle>
            </chartingToolkit:LinearAxis>
        </chartingToolkit:Chart.Axes>
Était-ce utile?

La solution

Sauf si vous spécifiez le minimum et les valeurs maximales sur l'axe de la boîte à outils automaticaly calculer les valeurs pour eux. Si je me souviens bien de la dernière fois que je regardais Teh code source, il tente de centrer les valeurs de consigne dans un 80% central de la zone de graphique, il ajuste l'axe minimum et les valeurs maximales pour acheive cela.

Puisque vous savez que la plage est (0, 1000) ajoutez simplement les propriétés de Minimum et Maximum appropriées au LinearAxis.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top