I need to show my own format for category axis with the Date values.
i able to do that by specifying format:
categoryAxis: { labels: { rotation: -90, format:
'dd MM yyyy'
} }
but i also have allowed user to change baseUnit property for the chart interactively, like it represented in the example http://demos.kendoui.com/dataviz/line-charts/date-axis.html
by default i have baseUnit value set to "months". anyway, on the category axis label i have always the same format as it was given
(dd MM yyyy).
how can i provide format depending on the baseUnit value (e.g. for "months" i need format: "MM yyyy", for "days" - "dd MM", etc)?
p.s. the globalisation as a possible solution did not work for me. based on this: http://docs.kendoui.com/getting-started/framework/globalization/definecultureinfo i was not able to change formatting on the chart (and chart is not depending on that for some reasons: http://docs.kendoui.com/getting-started/framework/globalization/overview#widgets-that-depend-on-culture-info). so #2 questions is: how to apply globalisation for charts?
7 Answers, 1 is accepted

i still unable to solve it :(

categoryAxis: {
labels:
{
rotation: -90,
dateFormats:
{
minutes:
"HH:mm"
,
hours:
"HH:mm"
,
days:
"dd/MM"
,
months:
"MMM 'yy"
,
years:
"yyyy"
}
}, type:
"Date"
, field:
"Date"
, baseUnit:
"months"
}

series: [{
name:"a",
type: "line",
data: [0.12762026843613,0.074445799930289,0.051466313585417,0.017728479526192,0.0011143506621862,0.0082959602505941,0.026745267782156,0.019458825291431,0.017666868863876,0.017092082111437,0.011608384149052,0.0065201835176499,0.004421453538218,0.010505036630037,0.012308118592408,0.010346048650291] },{
name:"b",
type: "line",
data: [0.3090348363746,0.19095852213315,0.075481586402266,0.010372204635964,0.00088406799762799,0.0048533160509829,0.011445506815686,0.0084266493597264,0.0069378355912022,0.006063734115347,0.0049154651638251,0.0028565070017462,0.0024460858669129,0.0050479242979243,0.0053070102521474,0.005090310902052] }];


Thanks, this was helpful. Using widget looks like this for me:
.CategoryAxis(axis => axis.Date().BaseUnit(ChartAxisBaseUnit.Days).Labels(x => x.DateFormats(d => d.Days("MMM. dd")))

>>>.CategoryAxis(axis => axis.Date().BaseUnit(ChartAxisBaseUnit.Days).Labels(x => x.DateFormats(d => d.Days("MMM. dd")))
How this could be converted in format for PHP widget?
Hi, Dimo,
The equivalent for the PHP Chart wrapper is available in the API reference with a example here:
https://docs.telerik.com/kendo-ui/api/php/Kendo/Dataviz/UI/ChartCategoryAxisItemLabels#dateformats
Kind
Regards,
Alex Hajigeorgieva
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.