Entering non-contiguous values in Axis

8 posts, 0 answers
  1. Michel
    Michel avatar
    39 posts
    Member since:
    Jul 2011

    Posted 11 Nov 2011 Link to this post

    Hi,

    When I have non-contiguous values for X axis, the chart fills in the gaps.

    ie: 2011.50, 2011.51, 2011.52, 2012,01, 2012.02...

    The Chart adds values for : 2011.53, 2011.54, 2011.55, etc...

    Is it possible to tell the Chart NOT to fill those gaps ?

    Thanks !

    Michel

  2. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 14 Nov 2011 Link to this post

    Hello Michel,

    You can achieve the desired behavior using the empty values feature. Choosing EmptyPointBehavior.Gap would clip the sections of the chart, corresponding to a set of empty values.

    You can find an example of how the chart would appear in our demo, simply navigate to Chart -> Empty Values. Hope this helps.

    Kind regards,
    Nikolay
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Michel
    Michel avatar
    39 posts
    Member since:
    Jul 2011

    Posted 14 Nov 2011 Link to this post

    Hello and thank you again for your help.

    I have seen the demo with the 3 options Gap, Zero and Drop.

    Unfortunately, the dates with empty values in the X axis still appear...

    I do not wish for the "empty" dates to appear in the labels of the x axis.

    The reason is I display Week Numbers in the bottom. I do not want the Chart to display Weeks 54 - 99 in the bottom when I display values for 2 years...

    Thanks,

    Michel

  5. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 15 Nov 2011 Link to this post

    Hello Michel,

    Presently, the way to solve this issue would be to remove the entries with no data from the underlying data source, so that the data the chart is bound to is continuous. You can do this manually or try creating an if statement, which would remove all entries that have a value of null, for example.

    Greetings,
    Nikolay
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  6. Michel
    Michel avatar
    39 posts
    Member since:
    Jul 2011

    Posted 15 Nov 2011 Link to this post

    Hi,

    Maybe I did not explain the problem properly...

    Here is the data I am sending where the Period is a double representing the Year.Week :

    Period   Quantity
    2011.50  100
    2011.51  200
    2011.52  300
    2012,01  400
    2012.02  500

    The Chart adds XAxis labels for Periods : 2011.53, 2011.54, 2011.55, which I am NOT sending...

    Thanks,

    Michel


  7. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 16 Nov 2011 Link to this post

    Hi Michel,

    In this case the best approach would be to map to XCategory, instead of XValue. This way the chart is able to plot not only values(e.g. number of sales, etc.), but also categories (e.g. months of the year, units, people, etc.) and the it treats the data as a sequence of non-numerical text labels. In this manner there would be no data for periods such as 2011.53, 2011.54, etc. and you would only get the data points which represent each period.

    Kind regards,
    Nikolay
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  8. Michel
    Michel avatar
    39 posts
    Member since:
    Jul 2011

    Posted 17 Nov 2011 Link to this post

    Thanks !

    Works perfectly !

    Now I need to tell the Chart not to round-off values like week number 50. I need "2011.50" and the Chart displays "2011.5"...

    Thanks again !

    Michel
  9. Nikolay
    Admin
    Nikolay avatar
    385 posts

    Posted 21 Nov 2011 Link to this post

    Hi Michel,

    There are two ways to handle this issue - the first would be to parse the doubles to strings ( or alternatively use DateTime values if applicable ), the other possibility would be to assign a label format expression , that would display the values 2 or 3 digits after the decimal point.

    Generally, in case you need to use these types of values ( 2011.50, 2011.51, etc. ) as categories , we would recommend using string or parsing them to a string and mapping to XCategory.

    All the best,
    Nikolay
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top
UI for WPF is Visual Studio 2017 Ready