Kiran Ghanwat
Top achievements
Rank 1
Kiran Ghanwat
asked on 30 Jun 2010, 02:34 PM
Hello Community,
I have to remove empty space between X-axis labels and Legends, where Legends are arranged at the bottom of dock.
Please find image attached.
Thanks in advance,
Kiran Ghanwat
I have to remove empty space between X-axis labels and Legends, where Legends are arranged at the bottom of dock.
Please find image attached.
Thanks in advance,
Kiran Ghanwat
4 Answers, 1 is accepted
0
Hello Kiran,
You will need to modify the ChartLegend template in order to remove the legend header ContentControl that occupies the described space like this:
XAML:
C#
Hope this helps.
Kind regards,
Freddie
the Telerik team
You will need to modify the ChartLegend template in order to remove the legend header ContentControl that occupies the described space like this:
XAML:
<
UserControl
x:Class
=
"SilverlightApplication1.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
UserControl.Resources
>
<
SolidColorBrush
x:Key
=
"LegendForeground"
Color
=
"#FF000000"
/>
<
LinearGradientBrush
x:Key
=
"LegendBackground"
EndPoint
=
"1.96,0.5"
StartPoint
=
"-0.96,0.5"
>
<
GradientStop
Color
=
"#FFB5B5B5"
/>
<
GradientStop
Color
=
"#FFF0F0F0"
Offset
=
"0.5"
/>
</
LinearGradientBrush
>
<
SolidColorBrush
x:Key
=
"LegendBorderBrush"
Color
=
"#FF848484"
/>
<
Style
x:Key
=
"CustomLegendStyle"
TargetType
=
"telerik:ChartLegend"
>
<
Setter
Property
=
"Foreground"
Value
=
"{StaticResource LegendForeground}"
/>
<
Setter
Property
=
"Background"
Value
=
"{StaticResource LegendBackground}"
/>
<
Setter
Property
=
"Padding"
Value
=
"10,10,10,5"
/>
<
Setter
Property
=
"Margin"
Value
=
"0,0,0,0"
/>
<
Setter
Property
=
"BorderBrush"
Value
=
"{StaticResource LegendBorderBrush}"
/>
<
Setter
Property
=
"BorderThickness"
Value
=
"1,1,1,1"
/>
<
Setter
Property
=
"TitleFontWeight"
Value
=
"Bold"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:ChartLegend"
>
<
Border
Background
=
"{TemplateBinding Background}"
BorderBrush
=
"{TemplateBinding BorderBrush}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
>
<
Grid
Margin
=
"{TemplateBinding Padding}"
>
<!--<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
ContentControl
Foreground
=
"{TemplateBinding Foreground}"
FontWeight
=
"{TemplateBinding TitleFontWeight}"
Content
=
"{TemplateBinding Header}"
ContentTemplate
=
"{TemplateBinding HeaderTemplate}"
/>-->
<
ItemsPresenter
Grid.Row
=
"1"
/>
</
Grid
>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"ItemsPanel"
>
<
Setter.Value
>
<
ItemsPanelTemplate
>
<
telerik:RadWrapPanel
Orientation
=
"{Binding ItemsPanelOrientation}"
/>
</
ItemsPanelTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadChart
x:Name
=
"RadChart1"
/>
</
Grid
>
</
UserControl
>
C#
namespace
SilverlightApplication1
{
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
List<ChartData> data =
new
List<ChartData>();
data.Add(
new
ChartData() { YValue = 7});
data.Add(
new
ChartData() { YValue = 4});
data.Add(
new
ChartData() { YValue = 1});
RadChart1.ItemsSource = data;
RadChart1.DefaultView.ChartLegend.Style =
this
.Resources[
"CustomLegendStyle"
]
as
Style;
RadChart1.DefaultView.ChartLegendPosition = Dock.Bottom;
}
}
public
class
ChartData
{
public
double
YValue
{
get
;
set
;
}
}
}
Hope this helps.
Kind regards,
Freddie
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
Kiran Ghanwat
Top achievements
Rank 1
answered on 01 Jul 2010, 11:29 AM
Hey Freddie,
Thanks for your reply.
I am getting error as unknown attribute at TargetType
Thanks for your reply.
I am getting error as unknown attribute at TargetType
=
"telerik:ChartLegend"
>
Thanks,
Kiran Ghanwat
0
Hello Kiran Ghanwat,
Have you registered the telerik xml namespace as shown in the code we sent you in our previous reply?
Best wishes,
Freddie
the Telerik team
Have you registered the telerik xml namespace as shown in the code we sent you in our previous reply?
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Best wishes,
Freddie
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
Donna
Top achievements
Rank 1
answered on 05 Jul 2010, 02:51 AM
Hello !
I am also a new member. Would a newcomer be warmly welcome here? Good day you guy !
__________________
[url=http://moviesonlinefree.biz]Watch Predators Online Free[/url]