Strange results with baseUnit fit

2 posts, 1 answers
  1. Michaël
    Michaël avatar
    44 posts
    Member since:
    Feb 2014

    Posted 30 Dec 2014 Link to this post

    Hi,

    I'm trying to take advantage of the "baseUnit" property, but while it works as expected in many cases, it fails in some other, and I can't explain myself why. I have an interval selector that allows to select hour, day, week, month or year interval. In some cases, if my date are 1st January, 1st February, 1st March, 1st April, 1st May, and select baseUnit=fit with a maxDateGroup of 24, then it will decide to render as week, hence rendering some dates with a value of 0 (as I don't have data in those points).

    How does the algorithm work exactly? For now, I'm forced to explicitly pass the selected interval to kendo, but the problem is that when the interval is explictly set, maxDateGroups no longer work! Is there a way to use maxDateGroups with other step than fit?

    Thanks!
  2. Answer
    T. Tsonev
    Admin
    T. Tsonev avatar
    2817 posts

    Posted 01 Jan 2015 Link to this post

    Hello,

    The automatic base unit selection uses the autoBaseUnitSteps values as a guideline.

    The chart will try to divide the active period into successively larger intervals.
    It will start from x-second intervals, where x is picked from the autoBaseUnitSteps.seconds array.

    If that results in less than maxDateGroups intervals then we're done, otherwise it'll move to minutes, hours and so on.

    You can change the default arrays to fine tune this behavior.
    For example, you can disable weeks entirely:
    autoBaseUnitSteps: {
      weeks: []
    }


    Happy New Year!

    Regards,
    T. Tsonev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top