Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
categoryDateTimeX in DataCharts
posted

Environment: Ignite UI 2013.2 ASP.Net MVC

We use igDataCharts with not equidistant date values on the x axis, which looks kind of odd, as the distance
between the tickmarks and the date values seem disproportional.

I tried to use the categoryDateTimeX axis, which seems to not work.

The item contains a c# DateTime value, which gets converted correctly to a JSON '/Date(xxx)/' value (I can see that in Chromes' debugging console),
but rendering that data point results in an JavaScript exception: 
h.getTime() is not a function, where h is the JSON date object.

On stackoverflow is mentioned 
Date.getTime() fails, while new Date.getTime() doesn't.

Is this a known bug?
If not, is there any working example using ASP.Net MVC helpers to render igDataCharts? 
Or at least a way to integrate a function call to correctly convert the date values (like it is possible to use formatters for the labels)?

There seem to be lots of examples using jquery on the client side (using new Date() to create dates and thus not failing),
but the documentation seems to be quite sparse on ASP.Net MVC topics.

 Thanks and kind regards,

Nils

 

  • 16310
    Offline posted

    Hi Nils,

    Please have a look at the following sample: http://www.igniteui.com/data-chart/aspnet-mvc-helper

    As you can see date values are created as c# DateTime and you don't need any custom approaches to convert them to json. You just need to have properly build your model and pass it to the view. Everything works fine as you can see.

    Please review it and let me know if you need any further assistance on the matter.