Remove value 0 on XAxis

2 posts, 0 answers
  1. Paulo
    Paulo avatar
    56 posts
    Member since:
    Apr 2012

    Posted 16 Apr 2013 Link to this post

    I have a chart with Date series. When I don't have a value, on the xaxis ploat a value 0. How can i do to remove when the value = 0?

     
  2. Missing user
    Missing user avatar

    Posted 19 Apr 2013 Link to this post

    Hi Paulo,

    I assume when you say that you don't have a value, you mean that the property of the business object is nullable and returns null instead of a valid value such as 0.

    In this case, you can hide each item that corresponds to an empty value after the chart has been data bound:
    void RadChart_DataBound(object sender, EventArgs e)
    {
        foreach (var item in this.RadChart.Series[0].Items)
        {
            item.Label.Visible = !item.Empty;
        }
    }

    If you want to hide items that actually correspond to 0 rather than null, you should, naturally, set the labels' visibility depending on whether the item.YValue property is 0.

    All the best,
    Ivan N.
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top