Chart date formats depending on baseUnit and Globalisation?

8 posts, 1 answers
  1. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 24 Oct 2012 Link to this post

    Hi!
    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?
  2. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 26 Oct 2012 Link to this post

    anyone please??
    i still unable to solve it :(
  3. Answer
    Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 27 Oct 2012 Link to this post

    finally i solved it by using this code:

    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"
                  }
  4. osman
    osman avatar
    19 posts
    Member since:
    May 2013

    Posted 04 Jun 2013 Link to this post

    how can i put different plot bands for each series ? a and b 

    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] }];
  5. Robert
    Robert avatar
    5 posts
    Member since:
    Jun 2013

    Posted 13 Feb 2014 in reply to Igor Link to this post

    Thank you this post was very helpful.
  6. Attila
    Attila avatar
    22 posts
    Member since:
    Oct 2016

    Posted 01 Mar 2018 in reply to Igor Link to this post

    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")))

  7. Dimo
    Dimo avatar
    26 posts
    Member since:
    Nov 2008

    Posted 18 Oct in reply to Attila Link to this post

    >>>.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?

  8. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1054 posts

    Posted 21 Oct Link to this post

    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/.

Back to Top