This is a migrated thread and some comments may be shown as answers.

How do I hide the item label?

5 Answers 673 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
louis chan
Top achievements
Rank 1
Iron
louis chan asked on 12 Mar 2010, 03:25 PM
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

5 Answers, 1 is accepted

Sort by
0
louis chan
Top achievements
Rank 1
Iron
answered on 15 Mar 2010, 04:11 AM
Waiting for this answer for a couple days but no reply...here is the solution
Chart1.Series(0).Appearance.ShowLabels = False
0
Maciej Pilichowski
Top achievements
Rank 1
answered on 29 Sep 2010, 12:55 PM
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.
0
Evgenia
Telerik team
answered on 01 Oct 2010, 11:18 AM
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
0
prayag ganoje
Top achievements
Rank 1
answered on 28 Jun 2011, 09:30 AM
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.
 
0
Evgenia
Telerik team
answered on 01 Jul 2011, 08:33 AM
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.

Tags
Chart (Obsolete)
Asked by
louis chan
Top achievements
Rank 1
Iron
Answers by
louis chan
Top achievements
Rank 1
Iron
Maciej Pilichowski
Top achievements
Rank 1
Evgenia
Telerik team
prayag ganoje
Top achievements
Rank 1
Share this question
or