I want to change color of smart label.
but I don't find example...
please help me...
but I don't find example...
please help me...
7 Answers, 1 is accepted
0
Klemens
Top achievements
Rank 1
answered on 24 Apr 2014, 01:40 PM
0
Lee
Top achievements
Rank 1
answered on 25 Apr 2014, 12:00 AM
Thank you for reply.
This example is automatic form.
My 'RadCartesianChart' is created in 'Black Label Color'
I want to change this color.
This example is automatic form.
My 'RadCartesianChart' is created in 'Black Label Color'
I want to change this color.
0
Hello Lee,
Keep in mind that the smart labels are actually normal labels with a positioning strategy applied. The SmartLabels strategy is positioning the labels in such a way so they do not overlap one another. In order to customize the appearance of the labels of the chart's series you can define a LabelDefinition. Then you can change the color of the labels by setting the Foreground property of the element inside the template of the definition.
Regards,
Martin
Telerik
Keep in mind that the smart labels are actually normal labels with a positioning strategy applied. The SmartLabels strategy is positioning the labels in such a way so they do not overlap one another. In order to customize the appearance of the labels of the chart's series you can define a LabelDefinition. Then you can change the color of the labels by setting the Foreground property of the element inside the template of the definition.
<
telerik:LineSeries
ShowLabels
=
"True"
>
<
telerik:LineSeries.LabelDefinitions
>
<
telerik:ChartSeriesLabelDefinition
>
<
telerik:ChartSeriesLabelDefinition.Template
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Value}"
Foreground
=
"White"
/>
</
DataTemplate
>
</
telerik:ChartSeriesLabelDefinition.Template
>
</
telerik:ChartSeriesLabelDefinition
>
</
telerik:LineSeries.LabelDefinitions
>
</
telerik:LineSeries
>
Regards,
Martin
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Lee
Top achievements
Rank 1
answered on 29 Apr 2014, 10:38 AM
Thank you for your reply.
Additionally, I want to work in code-behind(Converter Class).
My converter is below that.
NumericalAxis verticalAxis = null;
LinearAxis axis = new LinearAxis();
axis.Foreground = new SolidColorBrush(Colors.White);
axis.FontSize = 11;
verticalAxis = axis;
return verticalAxis;
Additionally, I want to work in code-behind(Converter Class).
My converter is below that.
NumericalAxis verticalAxis = null;
LinearAxis axis = new LinearAxis();
axis.Foreground = new SolidColorBrush(Colors.White);
axis.FontSize = 11;
verticalAxis = axis;
return verticalAxis;
0
Hi Lee,
In order to set the color of the labels of the axis you can use the LabelStyle property of the axis. As for the changing of the foreground color of the series labels there is another approach slightly different than this I suggested in my last reply. Instead of defining template for the LabelDefinition you can set its DefaultVisualStyle property. You can use the following style (or similar) for both properties (LabelStyle and DefaultVisualStyle):
To create a definition and set the styles in code-behind you can use the following code:
Please let me know if this information helps.
Regards,
Martin
Telerik
In order to set the color of the labels of the axis you can use the LabelStyle property of the axis. As for the changing of the foreground color of the series labels there is another approach slightly different than this I suggested in my last reply. Instead of defining template for the LabelDefinition you can set its DefaultVisualStyle property. You can use the following style (or similar) for both properties (LabelStyle and DefaultVisualStyle):
<
Window.Resources
>
<
Style
x:Key
=
"labelStyle"
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"Foreground"
Value
=
"Green"
/>
</
Style
>
</
Window.Resources
>
// Get the style
Style labelStyle = (Style)
this
.Resources[
"labelStyle"
];
// Create new labelDefinition and set its DefaultVisualStyle property
ChartSeriesLabelDefinition labelDefinition =
new
ChartSeriesLabelDefinition() { DefaultVisualStyle = labelStyle };
// add the label definition in the LabelDefinitions collection of your series
myLineSeries.LabelDefinitions.Add(labelDefinition);
// set the style for the labels of the axis
axis.LabelStyle = labelStyle;
Please let me know if this information helps.
Regards,
Martin
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
karthikeyan
Top achievements
Rank 1
answered on 02 Mar 2017, 01:11 PM
Hi Lee,
I want to add labelformat to vertical axis with display value as percentages can you help me out
Thanks,
Karthik
0
Hello Karthik,
You can try the LabelFormat or LabelTemplate properties of the axis.
Regards,
Martin
Telerik by Progress
You can try the LabelFormat or LabelTemplate properties of the axis.
Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.