hiding dataSeries label

6 posts, 0 answers
  1. Greg Sipes
    Greg Sipes avatar
    24 posts
    Member since:
    Apr 2010

    Posted 23 Mar 2011 Link to this post

    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!

  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 28 Mar 2011 Link to this post

    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
  3. Greg Sipes
    Greg Sipes avatar
    24 posts
    Member since:
    Apr 2010

    Posted 28 Mar 2011 Link to this post

    Evgenia,
          Ah, thank you!


  4. Rob
    Rob avatar
    1 posts
    Member since:
    Mar 2011

    Posted 07 Apr 2011 Link to this post

    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;

     

     

    }

     

     

     

    }

     

     


  5. Greg Sipes
    Greg Sipes avatar
    24 posts
    Member since:
    Apr 2010

    Posted 08 Apr 2011 Link to this post

    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)

     

     

     

     

  6. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 12 Apr 2011 Link to this post

    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
Back to Top