Is it possible to set the sorting of WPF toolkit System.Windows.Controls.DataVisualization.Charting.BarSeries
? I have following bar chart:
<dvc:Chart x:Name="BarChart">
<dvc:Chart.Axes>
<dvc:CategoryAxis Orientation="X">
<dvc:CategoryAxis.Style>
<Style TargetType="{x:Type dvc:CategoryAxis}" >
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-180" />
</Setter.Value>
</Setter>
</Style>
</dvc:CategoryAxis.Style>
<dvc:CategoryAxis.AxisLabelStyle>
<Style x:Name="labelStyleX1" TargetType="Control">
<Setter Property="FontSize" Value="15"/>
<Setter Property="LayoutTransform" >
<Setter.Value>
<RotateTransform Angle="-45" />
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value="Black"/>
</Style>
</dvc:CategoryAxis.AxisLabelStyle>
</dvc:CategoryAxis>
</dvc:Chart.Axes>
<dvc:Chart.Series>
<dvc:BarSeries ItemsSource="{Binding Overall}"
DependentValueBinding="{Binding Path=Value}"
IndependentValuePath="Key"
Title="Overall"
x:Name="overBar">
<dvc:BarSeries.Style>
<Style TargetType="{x:Type dvc:BarSeries}" >
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-180" />
</Setter.Value>
</Setter>
</Style>
</dvc:BarSeries.Style>
</dvc:BarSeries>
</dvc:Chart.Series>
</dvc:Chart>
Since CategoryAxis.SortOrder
doesn't affect anything, I tried to manually rotate it by 180 degrees, but axis doesn't rotate, leaving labels on the wrong places. The binded dictinary is definitely sorted, but this sorting is ignored by control:
Antecedent = new Dictionary<string, int>(Antecedent.OrderByDescending(x => x.Value).Take(MaxStats));
I also tried this solution, but it doesn't help. Though values are negated, sort order doesn't change:
How can I flip this series upside down, to have the most values at the top of the plot?
question from:
https://stackoverflow.com/questions/65872006/wpf-toolkit-barseries-descending-order 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…