Baseunitstep in MVC

2 posts, 0 answers
  1. Mattias Hermansson
    Mattias Hermansson avatar
    24 posts
    Member since:
    May 2010

    Posted 05 Feb 2014 Link to this post

    Hello,

    I'm trying to get the baseunitstep to only be used while showing days, and or if the days exceed more then 100 or if you get to many charts to fit, is this possible with the razor extension?

    Thanks in advance
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 07 Feb 2014 Link to this post

    Hi Mattias,

    In order to achieve this I can suggest the following: 
    • In the chart dataBound event check what the categoryAxis.baseUnit is (or any other condition you need);
    • If it is days set categoryAxis.baseUnitStep through the setOptions() method.
    @(Html.Kendo().Chart(Model)
      //....
      .Events(ev=>ev.DataBound("onDB"))
    )
    <script>
    function onDB(e) {
        if (e.sender.options.categoryAxis.baseUnit == "days") {
           e.sender.setOptions({
              categoryAxis: {
                 baseUnitStep: 4 // specify the baseUnitStep
               }
           })
       }
    }
    </script>

    Regards,
    Iliana Nikolova
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top