У меня странная проблема с библиотекой графиков WPF, т. Е.
System.Windows.Controls.DataVisualization.Charting
Диаграмма, похоже, корректно отображается для некоторых данных, но для суммируемых данных строки оси x поочередно располагаются вверх и вниз.ниже стиль оси X.и стиль области построения диаграмм.Ниже приведен код диаграммы, а также метка для оси X.
Однако иногда это происходит правильно.когда разные данные отображаются. Я не делаю никаких изменений в XAML.
<charting:Chart x:Name="mcChart" Width="660" HorizontalAlignment="Stretch" Padding="0"
Background="White" FontFamily="Lato" BorderBrush="White" BorderThickness="0">
<charting:Chart.LegendStyle>
<Style TargetType="{x:Type datavis:Legend}">
<Setter Property="Width" Value="0" />
</Style>
</charting:Chart.LegendStyle>
<charting:Chart.PlotAreaStyle>
<Style TargetType="Grid">
<Setter Property="Background" Value="White" />
</Style>
</charting:Chart.PlotAreaStyle>
<charting:Chart.Style>
<Style TargetType="charting:Chart">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="charting:Chart">
<Border Background="{TemplateBinding Background}" BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!--<datavis:Title Content="{TemplateBinding Title}" Style="{TemplateBinding TitleStyle}" />-->
<!-- Use a nested Grid to avoid possible clipping behavior resulting from ColumnSpan+Width=Auto -->
<Grid Grid.Row="1" Margin="0,15,0,15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<datavis:Legend x:Name="Legend" Style="{TemplateBinding LegendStyle}" Grid.Column="1" />
<chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
<Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" />
<Border Canvas.ZIndex="10" BorderBrush="White" BorderThickness="0" />
</chartingprimitives:EdgePanel>
</Grid>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</charting:Chart.Style>
<charting:LineSeries Title="" IsSelectionEnabled="True"
IndependentValueBinding="{Binding Key}"
DependentValueBinding="{Binding Value}" Background="White"
PolylineStyle="{StaticResource GooglePolylineStyle}"
DataPointStyle="{StaticResource GoogleLineDataPointStyle}" Margin="0,0,0,10">
<charting:LineSeries.DependentRangeAxis>
<charting:LinearAxis
x:Name="systolic_chart_yaxis"
Orientation="Y" MajorTickMarkStyle="{StaticResource ChartMajorTickMarkStyle}"
ShowGridLines="True"/>
</charting:LineSeries.DependentRangeAxis>
<!--<charting:LineSeries.IndependentAxis>
<charting:DateTimeAxis
Orientation="X" MajorTickMarkStyle="{StaticResource ChartMajorTickMarkStyle}"
Name="mainchart_timeaxis"
ShowGridLines="False"
>
</charting:DateTimeAxis>
</charting:LineSeries.IndependentAxis>-->
<!-- Shared horizontal axis -->
</charting:LineSeries>
<charting:Chart.Axes>
<charting:DateTimeAxis Orientation="X" Location="Bottom" Margin="0 10 0 0"
ShowGridLines="False"
MajorTickMarkStyle="{StaticResource ChartMajorTickMarkStyle}"
AxisLabelStyle="{StaticResource DateTimeAxisLabelStyle1}"/>
</charting:Chart.Axes>
</charting:Chart>
<style x:Key="DateTimeAxisLabelStyle1" TargetType="charting:DateTimeAxisLabel">
<Setter Property="YearsIntervalStringFormat"
Value="{}{0:MM/yy}"/>
<Setter Property="MonthsIntervalStringFormat"
Value="{}{0:MM/yy}"/>
<Setter Property="DaysIntervalStringFormat"
Value="{}{0:MM/dd}"/>
<Setter Property="HoursIntervalStringFormat"
Value="{}{0:hh:mm}"/>
<Setter Property="RenderTransform">
<Setter.Value>
<RotateTransform Angle="270"></RotateTransform>
</Setter.Value>
</Setter>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter>
<Setter Property="Width" Value="40"/>
</Style>