XAxis with fix label distance

3 posts, 1 answers
  1. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 04 Sep 2009 Link to this post

    Hi,

    I have a simple (I guessed) problem.
    I use a linechart which displays datapoints with a DateTime for the XAxis.
    It has between 20 and 100 datapoints. (the point distance is between 0.1 and 0.8 seconds).

    All I want are labels on the XAxis which show every second a tick and an alternate view which shows all 2 seconds a tick.

    I guess I do something completely wrong :)
    To find the value I display the label in the format "ss.f"
    I messed around with the two seconds an reached now at this point:
    rcData.DefaultView.ChartArea.AxisX.Step = 0.000022890946517388024;
    But still I have some "drift" - this means I get:
    17.3, 19.4, 21.5...and it ends in 37.9, 40.0 instead of 39...

    Since I can't imagine that it is that difficult to have a XAxis with labels for one second or 2 seconds it stop playing around and ask for a solution here; because I think what I try it totally wrong.

    So the simple question:
    a.) how to have a XAxis with labels every second
    b.) how to have a XAxis with labels every 2 seconds

    Regards

    Manfred
  2. Answer
    Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 09 Sep 2009 Link to this post

    Hi Manfred,

    To get the right step, use:
    double oneSecond = 1.0d / (24 * 60 * 60);
    rcData.DefaultView.ChartArea.AxisX.Step = oneSecond;

    Best,
    Evtim
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WPF is Visual Studio 2017 Ready
  4. ManniAT
    ManniAT avatar
    877 posts
    Member since:
    Nov 2003

    Posted 09 Sep 2009 Link to this post

    Thank you for this :)

    Great Telerik support as usual!

    Manfred
Back to Top