Custom text above horizontal bars!

Thread is closed for posting
5 posts, 0 answers
  1. Nadeem
    Nadeem avatar
    4 posts
    Member since:
    May 2008

    Posted 26 Dec 2008 Link to this post

    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!
  2. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 29 Dec 2008 Link to this post

    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.
  3. Nadeem
    Nadeem avatar
    4 posts
    Member since:
    May 2008

    Posted 29 Dec 2008 Link to this post

    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?
  4. Nadeem
    Nadeem avatar
    4 posts
    Member since:
    May 2008

    Posted 03 Jan 2009 Link to this post

    Is not there a work-around for that?
  5. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 05 Jan 2009 Link to this post

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