How to sort bar chart categories?

1 Answer 223 Views
Chart ChartView
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Psyduck asked on 12 Oct 2021, 05:23 AM | edited on 12 Oct 2021, 05:25 AM

Hello.

I created a bar chart similar to the link below.

The chart is successful, but there is a problem with sorting in categories.

https://docs.telerik.com/devtools/universal-windows-platform/controls/radchart/how-to/howto-display-horizontal-bar-chart

 


<telerik:RadCartesianChart>
    <telerik:RadCartesianChart.HorizontalAxis>
        <telerik:LinearAxis/>
    </telerik:RadCartesianChart.HorizontalAxis>
    <telerik:RadCartesianChart.VerticalAxis>
        <telerik:CategoricalAxis/>
    </telerik:RadCartesianChart.VerticalAxis>

    <telerik:RadCartesianChart.Series>
        <telerik:BarSeries	ItemsSource="{Binding ResultChart}"
							CategoryBinding="Title"
                            ValueBinding="Value" 
							ShowLabels="True">

            <telerik:BarSeries.DefaultVisualStyle>
                <Style TargetType="Border">
                    <Setter Property="Background" Value="{Binding DataItem.Color}" />
                </Style>
            </telerik:BarSeries.DefaultVisualStyle>
        </telerik:BarSeries>
    </telerik:RadCartesianChart.Series>
</telerik:RadCartesianChart>

<telerik:GridView ItemSource="{Binding ResultChart}" /> 

As you can see, Category 0 is the first value, and you can see that it is below.

I want to reverse this.

Is there another way other than to sort the Itemsource binding values ​​in reverse?

I want to avoid sorting because the results are also displayed in the GridView.

 

Thanks.

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Ivanov
Telerik team
answered on 13 Oct 2021, 12:30 PM

Hi KIM,

To achieve your requirement, you can set the IsInverse property of the axis to True.

 <telerik:CategoricalAxis IsInverse="True" />

I hope that helps.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Chart ChartView
Asked by
Psyduck
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Martin Ivanov
Telerik team
Share this question
or