Hiding line on graph if value is 0

4 posts, 0 answers
  1. Chris
    Chris avatar
    3 posts
    Member since:
    Apr 2015

    Posted 22 Apr 2015 Link to this post

    I've tried everything I can come up with to do this simple task:

    Basic line graph with one category and 2 line series.  One line shows a sales value and the other shows budgeted sales.  Budgeted sales goes to the end of the year and the sales line becomes 0 after the current date.  I've tried to use conditional formatting on the line series to hide the line on 0 values but it doesn't work. How do I make the line stop and hide the rest instead of showing a drop down to 0?





  2. Chris
    Chris avatar
    3 posts
    Member since:
    Apr 2015

    Posted 22 Apr 2015 in reply to Chris Link to this post

    New Information:

    Looks like conditional formatting works (sort of).  It appears to apply the formatting from that point forward and not the line leading from the previous point to the current point.  So the line is hidden but you can't really see it because its on the x-axis when it's 0 but the line that drops down to 0 is still showing.

  3. Chris
    Chris avatar
    3 posts
    Member since:
    Apr 2015

    Posted 23 Apr 2015 Link to this post

    I'm still unable to hide the line with a 0 value, I was able to accomplish this by changing my business object to have nullable values.  Changing the 0's to nulls caused the line to end where it should.
  4. Ivan Hristov
    Ivan Hristov avatar
    214 posts

    Posted 27 Apr 2015 Link to this post

    Hi Chris,

    We're glad that you managed to resolve your issue. Actually we were about to advise you the same thing - replace the values that shouldn't be shown with nulls. However, if in other scenarios you can't change your business object, you can apply a simple IIF expression to the values on the Y axis, replacing the actual value with NULL like this:
    [Series.Y] = IIF(Fields.Y = 0, null, Fields.Y);

    Please keep in mind that if your data contains points with valid Y values after the ones with NULL Y values, the graph processing engine will skip the NULL ones and just connect the two valid points. In this case we suggest you to prepare your data in advance, creating groups for non-null chunks of data and then create series group by that field. The idea is to divide the "valid" portions of your data and assign to each one of them a value that could be used to distinguish them later. 

    Hope it helps.

    Ivan Hristov

    See What's Next in App Development. Register for TelerikNEXT.

Back to Top