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

hiding dataSeries label

5 Answers 124 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Greg Sipes
Top achievements
Rank 1
Greg Sipes asked on 23 Mar 2011, 06:06 PM
Hello,
    I have been struggling to find a way to hide the labels on each point mark in a dataseries on a chart. I'm working in VB and Silverlight 4. Here is basically what I'm trying to do...

Dim dataSeries as new DataSeries
For Each thisObject as Object in items
        dim dataPoint as new DataPoint
dataPoint.YValue += thisObject.Tag
dataSeries.Add(dataPoint)
Next
radChart.DefaultView.ChartArea.DataSeries.Add(dataSeries)

It seems pretty simple, but I cannot figure out how to hide the labels on each of the dataPoints. I followed some of the other forums on here and tried things like:
 radChart.DefaultView.ChartArea.SmartLabelsEnabled = False
radChart.DefaultSeriesDefinition.ShowItemLabels = False
dataPoint.Label = Nothing
dataPoint.LabelFormat = Nothing


Nothing seems to work to hide those labels. I saw in the documentation stuff about using Series and ChartSeries, but I don't seem to have either of those in my version of Telerik controls. 

Thanks in advance!

5 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 28 Mar 2011, 01:05 PM
Hello Greg Sipes,

Here is how you can turn off the Visibility for the Series Items Labels:

<control:RadChart x:Name="chart">
           <control:RadChart.DefaultView>
               <chart:ChartDefaultView>
                   <!--ChartArea-->
                   <chart:ChartDefaultView.ChartArea>
                       <chart:ChartArea LegendName="CustomLegend">
                           <chart:ChartArea.DataSeries>
                               <chart:DataSeries>
                                   <chart:DataSeries.Definition>
                                       <chart:LineSeriesDefinition ShowItemLabels="False"/>
                                   </chart:DataSeries.Definition>
                                   <chart:DataPoint YValue="15"/>
                                   <chart:DataPoint YValue="23"/>
                                   <chart:DataPoint YValue="14"/>
                               </chart:DataSeries>
                           </chart:ChartArea.DataSeries>
                             
                       </chart:ChartArea>
                   </chart:ChartDefaultView.ChartArea>
                   <!--ChartLegend-->
                   <chart:ChartDefaultView.ChartLegend>
                       <chart:ChartLegend x:Name="CustomLegend" />
                   </chart:ChartDefaultView.ChartLegend>
                   <!--ChartTitle-->
                   <chart:ChartDefaultView.ChartTitle>
                       <chart:ChartTitle Content="Sample Chart" />
                   </chart:ChartDefaultView.ChartTitle>
               </chart:ChartDefaultView>
           </control:RadChart.DefaultView>
       </control:RadChart>

Regards,
Evgenia
the Telerik team
0
Greg Sipes
Top achievements
Rank 1
answered on 28 Mar 2011, 02:42 PM
Evgenia,
      Ah, thank you!


0
Rob
Top achievements
Rank 1
answered on 07 Apr 2011, 09:28 PM
Hello Evgenia,

I am having a similar problem but I am trying to control this programitically with a button. It does not seem to do anything but seems like it should be simple.

 

 

private void showLabelsBtn_Click(object sender, RoutedEventArgs e)

 

 

{

 

 

 

if (MonthlyQueueChart.DefaultSeriesDefinition.ShowItemLabels.Equals(false))

 

 

{

 

MonthlyQueueChart.DefaultSeriesDefinition.ShowItemLabels =

 

true;

 

 

}

 

 

 

else

 

{

MonthlyQueueChart.DefaultSeriesDefinition.ShowItemLabels =

 

false;

 

 

}

 

 

 

}

 

 


0
Greg Sipes
Top achievements
Rank 1
answered on 08 Apr 2011, 04:06 PM
Alex,
     Here's the way I did it in VB, if it helps at all. The ShowItemLabel property to set is the one on the defined Series Definition.

 

 

Dim lineSeriesDefinition As New LineSeriesDefinition

 

 

 

With lineSeriesDefinition

 

 

.ShowItemLabels =

 

False

 

 

 

End With

 

 

 

Dim dataSeries As New DataSeries

 

 

 

With dataSeries

 

 

.Definition = lineSeriesDefinition

 

.LegendLabel = "Series 1"

 

 

 

End With

'Add data points to data series
 .....
'Add data series to chart

 

 

radChart.DefaultView.ChartArea.DataSeries.Add(dataSeries)

 

 

 

 

0
Evgenia
Telerik team
answered on 12 Apr 2011, 01:25 PM
Hi Alex,

Have in mind that the DefaultSeriesDefinition of the RadChart is Bar which means that if your Serie is of another type (Line for example) the code you are using to turn on/off visibility of the SeriesItemLabels won't affect it.
Here is what I'm suggesting instead (this will affect the first serie set in your code no matter of it's Chart Type):
this.RadChart1.DefaultView.ChartArea.DataSeries[0].Definition.ShowItemLabels = true;

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
Tags
Chart
Asked by
Greg Sipes
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Greg Sipes
Top achievements
Rank 1
Rob
Top achievements
Rank 1
Share this question
or