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

Custom text above horizontal bars!

4 Answers 67 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Nadeem
Top achievements
Rank 1
Nadeem asked on 26 Dec 2008, 10:02 PM
Hi,
I have a RadChart with its SeriesOrientation="Horizontal".

Can you give me a C# code example to write a custom text above each horizontal bar?

Thanks!

4 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 29 Dec 2008, 11:41 AM
Hello Nadeem,

Unfortunately RadChart does not support such functionality (positioning custom text above each bar). However, you can achieve similar functionality by setting the ChartSeries.Appearance.LabelAppearance.LabelLocation property to "Inside" and using the series items labels instead:

<telerik:RadChart ID="RadChart1" runat="server" SeriesOrientation="Horizontal"
    <Series> 
        <telerik:ChartSeries> 
            <Appearance> 
                <LabelAppearance LabelLocation="Inside"
                </LabelAppearance> 
            </Appearance> 
            <Items> 
                <telerik:ChartSeriesItem YValue="10"
                    <Label> 
                        <TextBlock Text="Custom Text"
                        </TextBlock> 
                    </Label> 
                </telerik:ChartSeriesItem> 
                <telerik:ChartSeriesItem YValue="15"
                    <Label> 
                        <TextBlock Text="Custom Text 2"
                        </TextBlock> 
                    </Label> 
                </telerik:ChartSeriesItem> 
            </Items> 
        </telerik:ChartSeries> 
    </Series> 
</telerik:RadChart> 



Best wishes,
Manuel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nadeem
Top achievements
Rank 1
answered on 29 Dec 2008, 11:33 PM
OK. I see but there might be a problem:

What happens if the text inside a bar is too long to fit inside ? Can I make it extend outside the bar?
How can I make sure that text will always be visible over the bar color and background color?
0
Nadeem
Top achievements
Rank 1
answered on 03 Jan 2009, 11:48 PM
Is not there a work-around for that?
0
Vladimir Milev
Telerik team
answered on 05 Jan 2009, 07:28 AM
Hello Nadeem,

Labels will not be clipped if they are too big. About visibility - you will need to manually specify a color that will have enough contrast to be readable on the background you selected.

All the best,
Vladimir Milev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Chart (Obsolete)
Asked by
Nadeem
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Nadeem
Top achievements
Rank 1
Vladimir Milev
Telerik team
Share this question
or