Welcome to the Xceed Community | Help
Community Search  

Removing NaN and 0% DataLabels

Sort Posts: Previous Next
  •  01-21-2008, 5:29 AM Post no. 6570

    Removing NaN and 0% DataLabels

    Hi!

    I'm making a StackedBar chart where I want to be able to have some stacked bars that won't be visible and also some completely empty intervalls where I want to remove the datalabels for these particular values. Is this possible? What I want to remove are data labels that display 0% or NaN.

    Thanks!
  •  01-22-2008, 3:03 PM Post no. 6571 in reply to 6570

    Re: Removing NaN and 0% DataLabels

    You have two choices. First, you can provide your own labels, using empty strings in the case of 0% and NaN.

    e.g.:
    <code>
    //Make the series use the custom label
    bar1.DataLabels.Format = "<label>";

    //provide the labels
    bar1.Labels.Add( "20" );
    bar1.Labels.Add( "" );
    bar1.Labels.Add( "40" );
    bar1.Labels.Add( "50" );
    </code>.

    Second, you can use a subset of the labels, by indicating to the chart the index of the points you want to use.

    e.g.:
    <code>
    //create the subset and provide the indexes
    DataSeriesSubset subset = new DataSeriesSubset();
    subset.AddIndex( 0 );
    subset.AddIndex( 2 );

    //set the series appropriately
    bar.DataLabels.Mode = DataLabelsMode.Subset;
    bar.DataLabels.Subset = subset;
    </code>

    André
    Software Developer and Tech Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.