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

Second series summed and template dataItem

3 Answers 283 Views
Charts
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 23 May 2016, 10:50 PM

First thank you Veselin Tsvetanov for your help in my previous questions. I did not expect the api would return a long as a string instead of a number so your help was greatly appreciated. 

To increase the size of the graph we have to just go with the Code instead of the CodeDesc. However, we would like for the CodeDesc to still appear when the user does a mouseover in the template. I have <div>dataItem.CodeDesc</div><br/> where it would be. I tried #: dataItem.CodeDesc # but it did not recognize dataItem. So I was wondering if I can still grab dataItems from the DataSource in the template. 

The next item is concerning the column of CountReqs. Currently the TotalValue column is grouped, is it possible to also group CountReqs at the same time? It appears that if I do a label of CountReqs it grabs the first CountReqs it finds and displays that when the label should be a summation of CountReqs. The second item is in relation to grabbing the CountReqs in the template to also display the number next to the TotalValue. I have the placeholder as \\#\\# Opportunities.

My sample is at http://dojo.telerik.com/@dhighfield/EfuVA. Please update at will.

Thank you in advance for your assistance.

 

v/r,

Dave Highfield

3 Answers, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 25 May 2016, 03:44 PM
Hi David,

Please see my answers below:

1.) Accessing dataItem ​in the Kendo UI Chart template
 
There are two separate Kendo UI Chart Tooltip template configurations - template and sharedTemplate which reveal different fields.

- Shared template - to access points and category. This is why you cannot display dataItem in your Dojo example

http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-tooltip.sharedTemplate

- Template - to access category, dataItem, series, value, runningTotal, total

http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-tooltip.template

2.) I am not sure whether I fully understand the specifics of the scenario, and the desired functionality of the Kendo UI Chart. If you would like to group and stack the data, a demo showing how to use stacked and grouped bars can be found here:

http://demos.telerik.com/kendo-ui/bar-charts/grouped-stacked-bar

Should this not suffice, please provide a more detailed explanation so I can assist you further.

Kind Regards,
Alex
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
David
Top achievements
Rank 1
answered on 13 Jun 2016, 01:53 PM

I've updated the example with your suggestions and it can be found at http://dojo.telerik.com/@dhighfield/EfuVA/2. The popup is not displaying the content as desired. The attached images hopefully give a clearer picture as to what I am trying to achieve. 

With regards to the second question, if you mouseover on the first column in aforementioned example it will display only 332 opportunities. This should be 336 opportunities based on the column CountReqs in the sample data. The control appears to grab the first record. I am attempting to sum two columns though - CountReqs and TotalValue. So far I am able to only sum the one - TotalValue.

v/r,
Dave Highfield

0
Accepted
Alex Hajigeorgieva
Telerik team
answered on 15 Jun 2016, 03:59 PM
Hi David,

The Kendo UI Chart calculates aggregates by only one value field out of the box. TotalValue is the respective value field in the provided configuration, that is why it gets calculated correctly. To calculate aggregates by other value fields simultaneously, some custom coding will be required.

I have updated the Dojo example to show you how to calculate CountReqs. I used the Kendo UI DataSource group aggregate configuration but the data can come from anywhere - remote service, dynamic calculation, etc. - whatever suits the scenario.

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

For your convenience, please find a proof of concept example below:

http://dojo.telerik.com/ARasE

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