Stacked Bar Chart - Order By not working as expected

1 Answer 95 Views
Charts Data Query
Karthik
Top achievements
Rank 1
Karthik asked on 12 Dec 2022, 03:09 PM | edited on 12 Dec 2022, 03:13 PM

hi,

I am trying to sort and display Stacked Bar chart where by the the chart should display in descending order of USD (US Dollars) with 'Others' displayed at the rightmost. Please see the StackBlitz example below.

https://stackblitz.com/edit/angular-10-thmpbt-onpvwr?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.html

But it is not working as expected as I see 'Others' and few other items with Zero values displayed in the middle of the chart. Any thoughts on whats wrong here. Please note, the 'chartDataSource' has data sorted and fed to chart.

 

Yanmario
Telerik team
commented on 15 Dec 2022, 02:46 PM

Hi Karthik,

Thank you for the provided details.

I will need some additional time to check the implementation of the Chart and I will get back to you later today or by tomorrow with additional details.

Regards,
Yanmario
Progress Telerik     

1 Answer, 1 is accepted

Sort by
1
Accepted
Yanmario
Telerik team
answered on 15 Dec 2022, 03:19 PM

Hi Karthik,

The issue seems to be that one of the groups 'Receiver' has only parts of the categories and the rest of the groups add the others. The developer would need to adjust the sorting aggregation:

https://stackblitz.com/edit/angular-10-thmpbt-htitkd?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.html

There are comments in the code where there are changes and some additional sorting might be required depending on the full implementation on your side.

I hope this helps.

Regards,
Yanmario
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Karthik
Top achievements
Rank 1
commented on 20 Dec 2022, 11:43 AM | edited

hi Yanmario,

Implemented the aggregate.items.unshift change as in your stackblitz and added additional sorting and it worked. Thanks!

Here's mine USD sorted - https://stackblitz.com/edit/angular-10-thmpbt-onpvwr

Regards
Karthik

Tags
Charts Data Query
Asked by
Karthik
Top achievements
Rank 1
Answers by
Yanmario
Telerik team
Share this question
or