This is a migrated thread and some comments may be shown as answers.

TOP N grouped Bar Chart

1 Answer 91 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Fabio
Top achievements
Rank 1
Fabio asked on 19 Jul 2016, 02:45 PM

Hi, I would like to do a "Top 4" ordered Bar Chart but I cannot sort the grouped value results and include only the best 4 values

(I do not sum values but I just count the items in each group)

see the Dojo Code

 

 

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 21 Jul 2016, 03:53 PM
Hi Fabrizio,

To achieve the desired functionality, get the data in the desired format beforehand. Such functionality is not built-in; the Kendo UI Data Source only uses what is available in its data() collection:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-data 

Below are some suggested steps:

- Use the fetch() Kendo UI Data Source method and map the current view in a callback function:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-view

- To be able to sort the Kendo UI Data Source by the length of the groups, save the length in a property. ("GroupSize" in our case).

- Assign the colour to another new property otherwise, only the first colour will be used.

With the above steps complete, the data array can be used to achieve the requirement.

- Sort by GroupSize
- Apply pageSize : 4

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-pageSize

For your convenience, I am including a Dojo sample completing the above. It is available at:

http://dojo.telerik.com/UrAME

Regards,
Alex
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Charts
Asked by
Fabio
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or