Hourly line chart across daylight savings

8 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Apr 2011

    Posted 09 Mar 2013 Link to this post

    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.
  2. David
    David avatar
    2 posts
    Member since:
    Apr 2011

    Posted 09 Mar 2013 Link to this post

    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.
  3. Kendo UI is VS 2017 Ready
  4. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 11 Mar 2013 Link to this post

    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!
  5. Ron DeFreitas
    Ron DeFreitas avatar
    26 posts
    Member since:
    Apr 2010

    Posted 11 Mar 2013 Link to this post

    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.
  6. Thomas
    Thomas avatar
    3 posts
    Member since:
    Jul 2012

    Posted 11 Mar 2013 Link to this post

    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.
  7. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 12 Mar 2013 Link to this post

    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!
  8. Patrice
    Patrice avatar
    1 posts
    Member since:
    Mar 2013

    Posted 19 Mar 2013 Link to this post

    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;
            },
  9. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 19 Mar 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready