DateTime In X-Axis of ScatterLine

2 posts, 0 answers
  1. Robert
    Robert avatar
    2 posts
    Member since:
    Mar 2013

    Posted 25 Apr 2013 Link to this post

    Is it possible to have a DateTime on the x-axis of a Scatter Line chart in the RadHTMLChart? I converted the field in the datatable using ToOADate() but it then shows this converted number on the x-axis instead of the actual date. I then created a new column in the datatable that had the datetime converted to a string and tried to use that as the DataLabelsField in the PlotArea.XAxis to no avail. Is it possible to loop through the xaxis items or add a custom x-axis for a ScatterLine?

  2. Danail Vasilev
    Danail Vasilev avatar
    1502 posts

    Posted 26 Apr 2013 Link to this post

    Hi Bob,

    I am sorry to say that in the current version of RadControls datetime formats are not supported by the RadHtmlChart yet. However, our developers are currently working on handling DateTime objects as a datasource to the RadHtmlChart but I cannot guarantee any time bounds for its implementation due to the:

    • Specifics of this feature request - .NET DateTime objects are different than JavaScript Date objects which requires additional conversion
    • The control should not modify the datasource the developer passes. We are still trying to find a way around this obvious contradiction of concepts

    If you use, however, Series that have a categorical X-Axis (i.e. LineSeries, AreaSeries, BarSeries or ColumnSeries) then you can follow your current approach by inserting formatted date strings items on the XAxis. This help article will shed more light on how to do that.

    Another approach could be to hide the XAxis labels and create your own styled div/span element that wraps the date labels and then align it below the XAxis.

    All the best,
    Danail Vasilev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top