Hide those darn labels

Thread is closed for posting
8 posts, 0 answers
  1. Marcus Kellermann
    Marcus Kellermann avatar
    56 posts
    Member since:
    Jul 2004

    Posted 05 Mar 2010 Link to this post

    How do I hide the data labels in a line chart.  I have a simple databound chart and I can't turn of the data labels on either series.
    I have the ShowLabels value set to False...   I'm using the Q1-2010 beta

         <telerik:RadChart ID="RadChart3" runat="server" Width="800" Height="600px" DataSourceID="ssDatasource"  
                DefaultType="Line" SeriesOrientation="Vertical" Skin="Office2007" > 
                    <Appearance Position-AlignedPosition="Top"
                        <FillStyle MainColor=""></FillStyle> 
                    <TextBlock Text="Application Usage"
                        <Appearance TextProperties-Font="Tahoma, 13pt" TextProperties-Color="Black"></Appearance> 
                    <telerik:ChartSeries Name="PeakUsages" Type="Line"
                        <Appearance ShowLabels="False"
                            <LabelAppearance Visible="false"></LabelAppearance> 
                    <telerik:ChartSeries Name="LicenseCount" Type="Line"
                        <Appearance ShowLabels="False"
                <Appearance TextQuality="AntiAlias"
                <Legend Visible="False">  
                    <Appearance Dimensions-Margins="18%, 5%, 25%, 5%"
                        <FillStyle MainColor="White" FillType="Solid"></FillStyle> 
                        <Border Color="134, 134, 134"></Border> 
                    <XAxis LayoutMode="Inside" AutoScale="false" DataLabelsColumn="UsageDate"
                        <Appearance ValueFormat="ShortDate" MajorGridLines-Visible="false"
                            <MajorGridLines PenStyle="Solid" Color="209, 222, 227" Visible="False" Width="0"></MajorGridLines> 
                            <LabelAppearance RotationAngle="300" Position-AlignedPosition="Top"
                            <TextAppearance TextProperties-Color="51, 51, 51"></TextAppearance> 
                    <YAxis AutoScale="false" IsZeroBased="true" AxisMode="Normal" MinValue="0" MaxValue="35"
                        <Appearance Color="134, 134, 134" MinorTick-Color="134, 134, 134" MinorTick-Width="0" MajorTick-Color="134, 134, 134"
                            <MajorGridLines Color="209, 222, 227"></MajorGridLines> 
                            <MinorGridLines Color="233, 239, 241"></MinorGridLines> 
                            <TextAppearance TextProperties-Color="51, 51, 51"></TextAppearance> 
            <br /> 

  2. Ves
    Ves avatar
    2927 posts

    Posted 10 Mar 2010 Link to this post

    Hi Marcus,

    The reason for this behavior is in the ways 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.

    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.
  3. J2K
    J2K avatar
    34 posts
    Member since:
    Sep 2005

    Posted 04 Mar 2012 Link to this post

    Are you kidding?  You can't simply set the stupid, idiotic labels that completely destroy the appearance of the chart to invisible?  What were you thinking?  Is there any fix for this other than the convoluted explanation provided here?  We try to use these controls to save time, not add unnecessary time.
  4. Cartoon Head
    Cartoon Head avatar
    21 posts
    Member since:
    Apr 2010

    Posted 06 Mar 2012 Link to this post

    I am struggling just to understand the basics of how RadChart works with SQL data... but I stumbled across Marcus's example and it helped a LOT!  I'm about 80% of the way there already, vs maybe 15% before I saw your example.

    I got the labels to go away following the advice given. 
    J2R, I don't think it's as bad as you think.

    If you just add a property for DataYColumn to each of the ChartSeries definitions... with the same name as the field name... the labels go away.

    I'm completely with you on tools making less work, not more... but this isn't too bad...

        <telerik:ChartSeries Name="PeakUsages" Type="Line" DataYColumn="PeakUsages">  
            <Appearance ShowLabels="False">  
                <LabelAppearance Visible="false"></LabelAppearance>  
        <telerik:ChartSeries Name="LicenseCount" Type="Line" DataYColumn="LicenseCount">  
            <Appearance ShowLabels="False">  

  5. Gary
    Gary avatar
    4 posts
    Member since:
    Mar 2012

    Posted 28 Mar 2012 Link to this post

    I was having the same problem with the labels on the RadChart, a simple solution is to run the following code after calling the databind of the RadChart control:

    foreach (Telerik.Charting.ChartSeries series in rcDs3.Series)
    series.Appearance.LabelAppearance.Visible = false;
  6. gonewalkabout
    gonewalkabout avatar
    12 posts
    Member since:
    Oct 2006

    Posted 09 Nov 2012 Link to this post

    I'm with J2K.
    I've been using Telerik controls for .NET for years. There has always been a learning curve. 
    But Reporting has some misses that are inexcusable. This is one.
    EVER single person who views the line charts I'm producing first words are 'can you hide the values'. And yes, I can get it working building the series dynamically, which took days to puzzle out.

    The fact that this thread started 2 years ago and is still not on Telerik's radar suggests that who ever is building the tools doesn't actually build real graphs. This issue of labels making the chart virtually unreadable is pretty easy to see if you actually build one.
  7. Henry
    Henry avatar
    20 posts
    Member since:
    Aug 2013

    Posted 12 Jan 2015 in reply to gonewalkabout Link to this post

    OK, here is another 2 years later on this post.
    Is this still an issue?  I know I have spent the last 2 hours trying to find out how to --hide those darn labels-- as stated before.  I need to perform this via code behind (the above samples do not work).  I am using the last "Q" of 2014 version.
  8. Danail Vasilev
    Danail Vasilev avatar
    1502 posts

    Posted 13 Jan 2015 Link to this post

    Hello Henry,

    The RadChart control has already been obsoleted as of Q1 2014 and we strongly suggest to use the newer RadHtmlChart controls which renders entirely on the client-side and has many features. More information on the matter is available in this blog post. You may also find useful the following articles on the matter:

    Danail Vasilev

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top