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

ChartTitle background gradient

1 Answer 65 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Chris Thierry
Top achievements
Rank 1
Chris Thierry asked on 25 Jun 2010, 07:39 PM
Hi,
I need to reproduce the background (Service Category) that shows sample.jpg, by default is black but I need to use that background. Can I put an image as background? if not, Can I use gradient in the background chartTitle?
Thank you.

1 Answer, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 28 Jun 2010, 12:47 PM
Hello Chris Thierry,

You can set whatever you want as ChartTitle's background.
Just add the following style in your resources:
xmlns:charting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
xmlns:mscorlib="clr-namespace:System;assembly=mscorlib">
<UserControl.Resources>
    <Style x:Key="TitleStyle" TargetType="charting:ChartTitle">
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Background" Value="Red" />
        <Setter Property="BorderBrush" Value="#FFB5B5B5" />
        <Setter Property="OuterBorderBrush" Value="Black" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="OuterBorderThickness" Value="1" />
        <Setter Property="Padding" Value="7" />
        <Setter Property="Foreground" Value="White" />
        <Setter Property="FontSize" Value="11" />
        <Setter Property="FontWeight" Value="Bold" />
    </Style>
</UserControl.Resources>
and modify the background property. I am sending you all properties that can be set to something different.

The default value for the ChartTitle's background in the "Office Black" theme is:
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
    <GradientStop Color="#FF5B5B5B" Offset="1"/>
    <GradientStop Color="#FF868686"/>
    <GradientStop Color="#FF4F4F4F" Offset="0.42"/>
    <GradientStop Color="#FF0E0E0E" Offset="0.43"/>
</LinearGradientBrush>

You need to set your custom style in your code-behind:
RadChart1.DefaultView.ChartTitle.Content = "Service Category";
RadChart1.DefaultView.ChartTitle.Style = this.Resources["TitleStyle"] as Style;

I hope this helps.

Regards,
Sia
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
Tags
Chart
Asked by
Chris Thierry
Top achievements
Rank 1
Answers by
Sia
Telerik team
Share this question
or