Seconds not taken into account in datetime

2 posts, 0 answers
  1. Sylvain
    Sylvain avatar
    3 posts
    Member since:
    Apr 2012

    Posted 26 Mar 2013 Link to this post

    Hello,
    I have a chart filled by a JSON remote data.

    Here is the result of the JSON :
    [{"Id":0,"Date":"2013-03-22 11:59:25","Value":"250"},{"Id":1,"Date":"2013-03-22 11:59:27","Value":"250"},{"Id":2,"Date":"2013-03-22 11:59:29","Value":"250"},{"Id":3,"Date":"2013-03-22 11:59:31","Value":"250"},{"Id":4,"Date":"2013-03-22 11:59:33","Value":"250"},{"Id":5,"Date":"2013-03-22 11:59:35","Value":"250"},{"Id":6,"Date":"2013-03-22 11:59:37","Value":"260"},{"Id":7,"Date":"2013-03-22 11:59:39","Value":"250"},{"Id":8,"Date":"2013-03-22 11:59:41","Value":"250"},{"Id":9,"Date":"2013-03-22 11:59:43","Value":"250"}]

    The problem is that I only have 1 value appearing on the graph with the time to 11:59:00
    I guess it's because seconds are not taken  into account, so all values are "viewed" at the same time so it's only 1 point.

    Below my code for the chart :
    $("#example").kendoChart({
                theme: "default",
                dataSource: {
                    transport: {
                        read: {
                            url: '@Url.Action("GetHydrogen", new { Area = "Plugins", Controller = "Temperature" })
                            contentType: "application/json",
                            dataType: "json"
                        }
                    },
                    sort: {
                        field: "Date",
                        dir:"asc"
                    }
                },
                title: {
                    text: "Hydrogen"
                },
                seriesDefaults: {
                    type: "line",
                    missingValues: "gap"
                },
                series:
                    [{ field: "Value", name: "Value" }],
                categoryAxis: {
                    field: "Date",
                    type: "date",
                    labels : { step: 5, font: "8px Arial, Helvetica, sans-serif", template: "#=kendo.toString(new Date(value), 'dd/MM HH:mm:ss')#"},
                    maxDateGroups: 100,
                    baseUnit: "fit",
                    baseUnitStep: "auto",
                    majorGridLines: "none",
                    crosshair: {
                        visible: true,
                        tooltip: {
                            visible: true,
                            template: "|#= value #|"
                        }
                    }
                    
                },
                valueAxis: {
                    labels: {
                        format: "{0}"
                    }
                },
                tooltip: {
                    visible: true,
                    template: "${category} - ${value}"
                }
            });

    Thanks for your help
    Sylvain
  2. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 28 Mar 2013 Link to this post

    Hello Sylvain,

    The chart doesn't support base unit seconds. We will definitely consider to add this i our future releases so stay tuned.

    Greetings,
    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!
Back to Top