none
WPFToolkit Chart Style ändern RRS feed

  • Frage

  • Guten Morgen zusammen,

    ich nutze das WPFToolkit und würde gerne die ChartArea größer aufbauen. Leider habe ich keine Idee wie ich das umsetzen kann.

    Mein bisheriger Code sieht wie folgt aus:

    <chartingToolkit:Chart DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}},Path=DataContext}" >
             
            <chartingToolkit:Chart.Axes>
                <chartingToolkit:LinearAxis Orientation="Y" ShowGridLines="False" HorizontalAlignment="Left">
                    <chartingToolkit:LinearAxis.AxisLabelStyle>
                        <Style TargetType="chartingToolkit:AxisLabel">
                            <Setter Property="StringFormat" Value="{}{0:N0}"/>
                        </Style>
                    </chartingToolkit:LinearAxis.AxisLabelStyle>
                </chartingToolkit:LinearAxis>
            </chartingToolkit:Chart.Axes>
    
            <chartingToolkit:Chart.LegendStyle>
                <Style TargetType="datavis:Legend">
                    <Setter Property="Width" Value="0" />
                </Style>
            </chartingToolkit:Chart.LegendStyle>
    
            <chartingToolkit:ColumnSeries DependentValuePath="Value"                               			
                                          IndependentValuePath="Key" 			
                                          ItemsSource="{Binding}" 
                                          IsSelectionEnabled="True"
                                          Title="Nutzentakt">
    
                <chartingToolkit:ColumnSeries.DataPointStyle>
                    <Style TargetType="chartingToolkit:DataPoint">
                        <Setter Property="Background" Value="Red" />
                        <Setter Property="BorderBrush" Value="Black"/>
                        <Setter Property="BorderThickness" Value="1"/>
                        <Setter Property="IsTabStop" Value="False"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="chartingToolkit:ColumnDataPoint">
                                    <Grid x:Name="Root" Opacity="1">
                                        <ToolTipService.ToolTip>
                                            <StackPanel Margin="2,2,2,2">
                                                <ContentControl Content="{TemplateBinding DependentValue}" ContentStringFormat="Takt {0:N0}"/>
                                                <ContentControl Content="{TemplateBinding IndependentValue}" ContentStringFormat="Zeitstempel {0}"/>
                                            </StackPanel>
                                        </ToolTipService.ToolTip>
                                        <Rectangle StrokeThickness="{TemplateBinding BorderThickness}" Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}"/>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </chartingToolkit:ColumnSeries.DataPointStyle>
                <chartingToolkit:ColumnSeries.IndependentAxis>
                    <chartingToolkit:DateTimeAxis Orientation="X" />
                </chartingToolkit:ColumnSeries.IndependentAxis>
            </chartingToolkit:ColumnSeries>
    
        </chartingToolkit:Chart>

    Besten Dank!

    Mittwoch, 18. November 2015 07:44

Antworten

  • Hallo David Stania,

    Im folgenden Thread wird ein geeigneter Style beschrieben. Hoffentlich wird dieses Beispiel auch Dir von Nutzen sein:
    I want to increase plot area size in WPFToolkit Charting Control

    Gruß,
    Dimitar


    Bitte haben Sie Verständnis dafür, dass im Rahmen dieses Forums, welches auf dem Community-Prinzip „IT-Pros helfen IT-Pros“ beruht, kein technischer Support geleistet werden kann oder sonst welche garantierten Maßnahmen seitens Microsoft zugesichert werden können.

    • Als Antwort markiert David Stania Montag, 23. November 2015 07:41
    Donnerstag, 19. November 2015 07:40
    Administrator