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

Title with start and end data values

2 Answers 149 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Cyndie
Top achievements
Rank 1
Cyndie asked on 29 Feb 2012, 03:31 PM
I have a line chart (hourly data) that is generated by user selected criteria.  Because the user can select a large time range and IE8 gives a slow script error when too much data is queried, I've configured the web service to only return a maximum of one-week worth of hourly data at a time.  I have next and previous buttons to allow the user to page through the data and update the graph accordingly.  Currently, categoryAxis doesn't support step, resulting in overlapping labels, so I have visible set to false and it is difficult to tell the time range of the chart.  I have the date and value set to show as a tool tip, but would like to show the start date/time and end date/time as a subtitle, so the user can quickly see what week they are viewing as they page back and forth. 

Is it possble to show the first and last categoryAxis data value in the Title, so I have something like this for the chart title that will update when the dataSource is read:

Main Title of Chart
Start Date - End Date

2 Answers, 1 is accepted

Sort by
0
Accepted
Hristo Germanov
Telerik team
answered on 01 Mar 2012, 09:22 AM
Hello Cyndle Enfinger,

Thank you for contacting us.

You can try to hook up to onDataBound client event and in this event you can get the axis categories from the chart.

function onDataBound(e) {                                                            
    var chart = $("#chart").data("kendoChart"),                                  
       categories = chart.options.categoryAxis.categories,                          
       categoriesLength = categories.length;                                        
                                                                                       
    chart.options.title.text = categories[0] + " " + categories[categoriesLength - 1];
    chart.options.title.visible = true;
}

Regards,
Hristo Germanov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Cyndie
Top achievements
Rank 1
answered on 01 Mar 2012, 03:46 PM
Thank you!  That is just what I needed.
Tags
Charts
Asked by
Cyndie
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Cyndie
Top achievements
Rank 1
Share this question
or