This is a migrated thread and some comments may be shown as answers.

Baseunitstep in MVC

1 Answer 89 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Mattias Hermansson
Top achievements
Rank 1
Mattias Hermansson asked on 05 Feb 2014, 02:45 PM
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

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 07 Feb 2014, 08:50 AM
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!
Tags
Chart
Asked by
Mattias Hermansson
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or