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

Hourly line chart across daylight savings

7 Answers 158 Views
Charts
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 09 Mar 2013, 08:20 PM
Using the Q3 2012 version of Kendo, I'm failing to get an hourly line chart to work if the data spans when daylight savings takes affect. The browser locks up when the time value goes from, say, time zone offset -06:00 to -05:00. Please see the following example:

var data = [
        {
          time: new Date(2013, 2, 9, 22, 0, 0),
          value: 100
        },
        {
          time: new Date(2013, 2, 9, 23, 0, 0),
          value: 200
        },
        {
          time: new Date(2013, 2, 10, 0, 0, 0),
          value: 300
        },
        {
          time: new Date(2013, 2, 10, 1, 0, 0),
          value: 400
        },
        {
          time: new Date(2013, 2, 10, 2, 0, 0),
          value: 500
        },
        {
          time: new Date(2013, 2, 10, 3, 0, 0),
          value: 600
        }
      ];
 
      $("#chart").kendoChart({
        dataSource: {
            data: data
        },
        seriesDefaults: {
            type: 'line'
        },
        series: [{
            field: 'value'
        }],
        categoryAxis: {
            type: 'Date',
            baseUnit: 'hours',
            field: 'time'
        }
      });
    }
It'll render a chart if the last data record at Date(2013, 2, 10, 3, 0, 0) is left out, but fails when it's included. I've tried some other tests where all of the times are before daylight savings takes affect, and other tests where all of the times are after daylight savings takes affect, and they work. But it does not work if the time values cross from standard time into daylight savings.

I guess I'm missing something, but don't see what.

7 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 10 Mar 2013, 12:13 AM
I'll add that it looks like an issue with the "for (date = range.min; date < end; date = nextDate)" loop inside the DateCategoryAxis.groupCategories method as it's looping forever in this case. It calls the addDuration method to get the value for nextDate. When baseUnit = "hours" and the current value of date is 3/10/2013 01:00, this loop gets stuck because addDuration returns 3/10/2013 01:00. It turns out addDuration tries to generate a new Date of 3/10/2013 02:00, which isn't valid and gets automatically converted back to 3/10/2013 01:00.
0
T. Tsonev
Telerik team
answered on 11 Mar 2013, 08:29 AM
Hello,

Thanks for taking the time to investigate this problem. This problem was originally reported about a month ago and is already fixed in the internal builds.

You can download the latest internal build from your account. Apologies for the caused inconvenience.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ron DeFreitas
Top achievements
Rank 2
answered on 11 Mar 2013, 01:56 PM
Do you have an ETA as to when this will be available on the Telerik CDN?  We can put our own CDN up for now, but as for myself and my higher-ups, we are very disappointed that if this has been a known issue for a month, you failed to release this as an actual, fully-tested patch prior to Daylight Savings Time.

A large portion of our customer-facing applications have hourly charts, and this has made our entire site near-unusable right now.

That's not the type of customer service I've grown to expect from Telerik, and has shaken faith among our business unit as to our vendor relationship with Telerik in the future.
0
Thomas
Top achievements
Rank 1
answered on 11 Mar 2013, 04:46 PM
Wow, that really is awful.  Also affects daily charts as well.  I found this out when *all* of my customers contacted me today that their charts were broken and their browsers were locking up.  I hope whoever allowed this to remain unreleased across the US daylight savings time change is getting an earfull right now.
0
T. Tsonev
Telerik team
answered on 12 Mar 2013, 12:13 PM
Hi,

Please accept my apologies for failing to communicate this update before the actual DST change occurs. We failed to recognize its impact at the time and its now too late.

We have uploaded an internal build (v. 2012.3.1512) that contains all fixes since the SP1 release. It contains no API changes, only hotfixes. Please see the detailed release log. This version is published on our CDN as well.

All the best,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Patrice
Top achievements
Rank 1
answered on 19 Mar 2013, 01:53 PM
The new internal build (v. 2012.3.1512) doesn't correct the issue for me.
I had to modify source code of groupCategories function like following to resolve the browser hang :

        groupCategories: function(options) {
            var axis = this,
                categories = toDate(options.categories),
                baseUnit = options.baseUnit,
                min = toTime(options.min),
                max = toTime(options.max),
                minCategory = toTime(sparseArrayMin(categories)),
                maxCategory = toTime(sparseArrayMax(categories)),
                start = floorDate(min || minCategory, baseUnit),
                end = ceilDate((max || maxCategory) + 1, baseUnit),
                date,
                nextDate,
                oldDate,
                groups = [],
                categoryMap = [],
                categoryIndicies,
                categoryIx,
                categoryDate;

            for (date = start; date < end; date = nextDate) {
                groups.push(date);

                // Save the last nextDate
                oldDate = nextDate;

                nextDate = addDuration(date, 1, baseUnit);

                // If daylight savings, nextDate is now <= to previous nextDate (infinite loop)
                // Solution : add 2 hours to nextDate
                if (nextDate <= oldDate) {
                        nextDate = addDuration(nextDate, 2, 'hours');
                }

                categoryIndicies = [];
                for (categoryIx = 0; categoryIx < categories.length; categoryIx++) {
                    categoryDate = toDate(categories[categoryIx]);
                    if (categoryDate && categoryDate >= date && categoryDate < nextDate) {
                        categoryIndicies.push(categoryIx);
                    }
                }

                categoryMap.push(categoryIndicies);
            }

            options.min = groups[0];
            options.max = last(groups);
            options.categories = groups;
            axis.categoryMap = categoryMap;
        },
0
T. Tsonev
Telerik team
answered on 19 Mar 2013, 02:23 PM
Hi,

I'm sorry, but the implementation does not look like the latest version. It's probably Q2'2012 or thereabouts.

Please check that you've updated all files and links the new version.

Regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
T. Tsonev
Telerik team
Ron DeFreitas
Top achievements
Rank 2
Thomas
Top achievements
Rank 1
Patrice
Top achievements
Rank 1
Share this question
or