Using a dynamic date value on x-axis

5 posts, 1 answers
  1. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 17 Oct 2008 Link to this post

    Is it possible to create the x-axis labels from a date column in my dataset? I have a date set where I want to return a series of dates, and some associated values, i.e.a structure such as;

    Selecteddate (date)
    Somevalue1 (int)
    Somevalue2 (int)

    What I'd like to show is the series of dates along the x-axis, and my values plotted above those. Although I can sort them, I won't know how many value sets (rows) I will have in advance, or if the dates are evenly spaced (i.e. there might be gaps in dates).

    Is this possible? Thanks in advance for any assistance.
  2. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 20 Oct 2008 Link to this post

    Hi Derek,

    You can set the data column that is to be used as source for the labels on the X axis. The property you are looking for is RadChart.PlotArea.XAxis.DataLabelsColumn

    Let me know if this solution does not cover your use case.

    Regards,
    Evtim
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Derek
    Derek avatar
    118 posts
    Member since:
    Oct 2008

    Posted 20 Oct 2008 Link to this post

    I tried that, but for some reason the values are being replaced with a generic sequence of dates at runtime (12/31/1899, 1/1/1900,...,1/6/1900) rather than the actual data. The column being returned is a sql server datetime value.
  5. erwin
    erwin avatar
    358 posts
    Member since:
    Dec 2006

    Posted 20 Oct 2008 Link to this post

    Did you set

    myChart.PlotArea.XAxis.IsZeroBased = false;

    otherwise the Chart begins at Date 0, see telerik's answer to my prior post in this forum.

    regards
    erwin

  6. Answer
    Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 21 Oct 2008 Link to this post

    Hi erwin,

    Sorry for missing those details. Two properties should be set to false:
    1 radChart1.PlotArea.XAxis.AutoScale = false
    2 radChart1.PlotArea.XAxis.IsZeroBased = false

    Regards,
    Evtim
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for WinForms is Visual Studio 2017 Ready