Hi,
In my chart, I have the chart axis labels and chart datapoint labels as DateTime objects. I've been browsing around for a solution to this for quite some time now but I was unable to find a solution to this problem. My DateTime values from the MVC application are of Kind Utc. I'd like the kendo UI chart to automatically convert it to the user's browser's timezone. It currently is showing the chart in UTC.
I tried this hoping it would work for Chart as well, but the rendering didn't display the updated Date values:
http://www.kendoui.com/code-library/mvc/grid/using-utc-time-on-both-client-and-server-sides.aspx
Other users have mentioned that their Chart automatically converted the DateTime but I'm not seeing that behavior:
http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/grid/kendo-grid-automatically-converting-timezone.aspx
http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/chart/chart-is-converting-my-dates.aspx
I am using version '2013.1.514'
My definition of the chart is: (The bolded properties are DateTime objects of Kind Utc)
@(Html.Kendo().Chart(Model.DataPoints)
.Name("chart")
.Title("Unique User, Page View, and Session Counts")
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.ChartArea(chartArea => chartArea
.Background("transparent")
)
.Series(series =>
{
series.Line(model => model.UniqueUsers).Name("Unique Users");
series.Line(model => model.Sessions).Name("Sessions");
series.Line(model => model.PageViews).Name("Page Views");
})
.CategoryAxis(axis => axis
.Date()
.BaseUnit(axisBaseUnit)
.Min(Model.View.Min)
.Max(Model.View.Max)
.Categories(model => model.DateTimeBucket)
.MajorGridLines(lines => lines.Visible(true))
.Labels(lbls => lbls
.DateFormats(df => df.Hours(Model.View.AxisDateLabelFormat))
.DateFormats(df => df.Days(Model.View.AxisDateLabelFormat))
.DateFormats(df => df.Weeks(Model.View.AxisDateLabelFormat))
.DateFormats(df => df.Months(Model.View.AxisDateLabelFormat))
.DateFormats(df => df.Years(Model.View.AxisDateLabelFormat)))
)
.ValueAxis(axis => axis
.Numeric().Labels(labels => labels.Format("{0:N0}"))
.Line(line => line.Visible(false))
.AxisCrossingValue(-10)
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Format("{0:N0}")
)
)
Thanks,
In my chart, I have the chart axis labels and chart datapoint labels as DateTime objects. I've been browsing around for a solution to this for quite some time now but I was unable to find a solution to this problem. My DateTime values from the MVC application are of Kind Utc. I'd like the kendo UI chart to automatically convert it to the user's browser's timezone. It currently is showing the chart in UTC.
I tried this hoping it would work for Chart as well, but the rendering didn't display the updated Date values:
http://www.kendoui.com/code-library/mvc/grid/using-utc-time-on-both-client-and-server-sides.aspx
Other users have mentioned that their Chart automatically converted the DateTime but I'm not seeing that behavior:
http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/grid/kendo-grid-automatically-converting-timezone.aspx
http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/chart/chart-is-converting-my-dates.aspx
I am using version '2013.1.514'
My definition of the chart is: (The bolded properties are DateTime objects of Kind Utc)
@(Html.Kendo().Chart(Model.DataPoints)
.Name("chart")
.Title("Unique User, Page View, and Session Counts")
.Legend(legend => legend
.Position(ChartLegendPosition.Bottom)
)
.ChartArea(chartArea => chartArea
.Background("transparent")
)
.Series(series =>
{
series.Line(model => model.UniqueUsers).Name("Unique Users");
series.Line(model => model.Sessions).Name("Sessions");
series.Line(model => model.PageViews).Name("Page Views");
})
.CategoryAxis(axis => axis
.Date()
.BaseUnit(axisBaseUnit)
.Min(Model.View.Min)
.Max(Model.View.Max)
.Categories(model => model.DateTimeBucket)
.MajorGridLines(lines => lines.Visible(true))
.Labels(lbls => lbls
.DateFormats(df => df.Hours(Model.View.AxisDateLabelFormat))
.DateFormats(df => df.Days(Model.View.AxisDateLabelFormat))
.DateFormats(df => df.Weeks(Model.View.AxisDateLabelFormat))
.DateFormats(df => df.Months(Model.View.AxisDateLabelFormat))
.DateFormats(df => df.Years(Model.View.AxisDateLabelFormat)))
)
.ValueAxis(axis => axis
.Numeric().Labels(labels => labels.Format("{0:N0}"))
.Line(line => line.Visible(false))
.AxisCrossingValue(-10)
)
.Tooltip(tooltip => tooltip
.Visible(true)
.Format("{0:N0}")
)
)
Thanks,