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

Seconds not taken into account in datetime

1 Answer 120 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Sylvain
Top achievements
Rank 1
Sylvain asked on 26 Mar 2013, 09:09 PM
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

1 Answer, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 28 Mar 2013, 08:34 AM
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!
Tags
Charts
Asked by
Sylvain
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Share this question
or