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

Hide those darn labels

7 Answers 353 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Marcus Kellermann
Top achievements
Rank 1
Marcus Kellermann asked on 05 Mar 2010, 04:08 PM
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" > 
            <ChartTitle> 
                <Appearance Position-AlignedPosition="Top"
                    <FillStyle MainColor=""></FillStyle> 
                </Appearance> 
                <TextBlock Text="Application Usage"
                    <Appearance TextProperties-Font="Tahoma, 13pt" TextProperties-Color="Black"></Appearance> 
                </TextBlock> 
            </ChartTitle> 
            <Series> 
                <telerik:ChartSeries Name="PeakUsages" Type="Line"
                    <Appearance ShowLabels="False"
                        <LabelAppearance Visible="false"></LabelAppearance> 
                    </Appearance> 
                </telerik:ChartSeries> 
                <telerik:ChartSeries Name="LicenseCount" Type="Line"
                    <Appearance ShowLabels="False"
                    </Appearance> 
                </telerik:ChartSeries> 
            </Series> 
            <Appearance TextQuality="AntiAlias"
            </Appearance> 
            <Legend Visible="False">  
            </Legend> 
            <PlotArea> 
                <Appearance Dimensions-Margins="18%, 5%, 25%, 5%"
                    <FillStyle MainColor="White" FillType="Solid"></FillStyle> 
                    <Border Color="134, 134, 134"></Border> 
                </Appearance> 
                <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"
                        </LabelAppearance> 
                        <TextAppearance TextProperties-Color="51, 51, 51"></TextAppearance> 
                    </Appearance> 
                </XAxis> 
                <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> 
                    </Appearance> 
                  </YAxis> 
            </PlotArea> 
        </telerik:RadChart> 
        <br /> 

7 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 10 Mar 2010, 09:31 AM
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.


Regards,
Ves
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
J2K
Top achievements
Rank 1
answered on 04 Mar 2012, 02:05 PM
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.
0
Cartoon Head
Top achievements
Rank 1
answered on 06 Mar 2012, 10:35 PM
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...

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


0
Gary
Top achievements
Rank 1
answered on 28 Mar 2012, 10:15 AM
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;
}
0
gonewalkabout
Top achievements
Rank 1
answered on 09 Nov 2012, 04:32 PM
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.
0
Henry
Top achievements
Rank 1
answered on 12 Jan 2015, 05:57 PM
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.
Thanks,
​
0
Danail Vasilev
Telerik team
answered on 13 Jan 2015, 09:30 AM
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:

Regards,
Danail Vasilev
Telerik
 

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.

 
Tags
Chart (Obsolete)
Asked by
Marcus Kellermann
Top achievements
Rank 1
Answers by
Ves
Telerik team
J2K
Top achievements
Rank 1
Cartoon Head
Top achievements
Rank 1
Gary
Top achievements
Rank 1
gonewalkabout
Top achievements
Rank 1
Henry
Top achievements
Rank 1
Danail Vasilev
Telerik team
Share this question
or