How do I hide the item label?

Thread is closed for posting
6 posts, 0 answers
  1. louis chan
    louis chan avatar
    50 posts
    Member since:
    Feb 2010

    Posted 12 Mar 2010 Link to this post

    Hello all,
    I have spent a couple hours to find out how to hide the item label, but I am keeping fail. I think this is a simple property but I dun know which belongs to. So does anyone know?

    thx
  2. louis chan
    louis chan avatar
    50 posts
    Member since:
    Feb 2010

    Posted 14 Mar 2010 Link to this post

    Waiting for this answer for a couple days but no reply...here is the solution
    Chart1.Series(0).Appearance.ShowLabels = False
  3. Maciej Pilichowski
    Maciej Pilichowski avatar
    8 posts
    Member since:
    May 2010

    Posted 29 Sep 2010 Link to this post

    Thank you very much. It is totally crazy, that the same code, but put in ASP (I mean I used tags, not C# code) does not work.
  4. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 01 Oct 2010 Link to this post

    Hello Maciej,

    The reason for this behavior is in the way RadChart databinding works. You have two options:
    • Create the series you need -- in this case you have to set their DataYColumn property with the name of the column/field you need to plot.
    • Let the chart create the series for you - it will create series for every numeric column/field in the underlying datasource.
    In this case, you have created the series, but their DataYColumn property is not set. So, RadChart will clear them and it will create new ones. That is why the ShowLabels setting is lost. You will need to either set the DataYColumn for each series or remove them completely and wire DataBound event. There you will be able to loop through the actual series in RadChart and hide their labels like this:

    radChart.Series[i].Appearance.LabelAppearance.Visible = false;

    Hope this helps.


    Regards,
    Evgenia
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. prayag ganoje
    prayag ganoje avatar
    127 posts
    Member since:
    Feb 2010

    Posted 28 Jun 2011 Link to this post

    Hello,

    I have few queries on the similar line.

    1. I wish to hide few label in itemdatabound event of radchart. I added itemdatabound event but it does not called. does it require to enable any specific property of radchart ?

    <telerik:RadChart ID="rc_CSCO_Case_Source_Trend" runat="server"
    OnItemDataBound="rc_CSCO_Case_Source_Trend_ItemDataBound">
    </telerik:RadChart>


    Protected Sub rc_CSCO_Case_Source_Trend_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Charting.ChartItemDataBoundEventArgs) Handles rc_CSCO_Case_Source_Trend.ItemDataBound
     
            End If
        End Sub


    2. How to get and hide a specific series item label value in itemdatabound event runtime ?

    please see attached image, where i wish to hide label values less than 6 since these are overlapping with other label values.
     
  6. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 01 Jul 2011 Link to this post

    Hello Prayag,

    What I can suggest is that you handle the BeforeLayout event of the Chart and hide those Series Items labels that have YValue < 6 for example. Here is how to hide those labels that have Value < 6 handling the event:

    Private MilestoneChart.BeforeLayout += New EventHandler(Of EventArgs)(AddressOf MilestoneChart_BeforeLayout)
      
    Private Sub MilestoneChart_BeforeLayout(ByVal sender As Object, ByVal e As EventArgs)
            For i As Integer = 0 To MilestoneChart.Series(0).Items.Count - 1
                If Double.Parse(MilestoneChart.Series(0).Items(i).Label.TextBlock.Text) < 20 Then
                    MilestoneChart.Series(0).Items(i).Label.Visible = False
                End If
            Next i
    End Sub

    Have in mind that the above code snippet is set to loop through Series[0] only and you should modify it to check for all other series.

    Kind regards,
    Evgenia
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top