Hide zero points and XAxis alignment issue.

2 posts, 0 answers
  1. Scott
    Scott avatar
    4 posts
    Member since:
    Aug 2010

    Posted 11 Jan 2011 Link to this post

    Is there a way to hide the zero points of a series?

    I have 2 series on the chart being populated from a single data object (which can be changed). It is showing current "production" and forcasted. Obviously current production ends "today" and I need to hide the rest of the points.  I have attached a screenshot of the current chart, everything on the red spline past the red arrow should not be displayed.

    Also in the screenshot, the data label runs out of the chart area, is there a way to fix this?


    Thanks for any help in advance.
  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 14 Jan 2011 Link to this post

    Hello Scott,

    To hide points with YValue = 0 from your Line Series you can use one of these approaches:
    1) If your chart is databound using Manual Series Mappings you can programmatically filter its data using the Filtering feature of the chart.

    2) You can subscribe to ItemDataBound event of the RadChart and remove each point which has YValue = 0:
    private void radChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
    {
     if (e.DataPoint.YValue == 0)
     {
       radChart1.DefaultView.ChartArea.DataSeries[0].Remove(e.DataPoint);
     }


    Regards,
    Evgenia
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top