Minseok Bang
Top achievements
Rank 1
Minseok Bang
asked on 18 Nov 2009, 05:59 AM
I use SeriesItemLabelStyle for changing Bar ItemLabel fontsize.
It work but that is not working for Pie Chart!
Style apply to Pie Chart
All of ItemLabel of PieChart is overlaped!
Definition.LabelOffset is not Work, like any other Properies.
Let me know Hint.
Thanks.
It work but that is not working for Pie Chart!
Style apply to Pie Chart
All of ItemLabel of PieChart is overlaped!
Definition.LabelOffset is not Work, like any other Properies.
Let me know Hint.
Thanks.
8 Answers, 1 is accepted
0
Hi Minseok,
Here is a code snippet setting the font size using SeriesItemLabelStyle:
And the code-behind:
Best,
Evtim
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Here is a code snippet setting the font size using SeriesItemLabelStyle:
<
t:RadChart
x:Name
=
"radChart1"
>
<
t:RadChart.Resources
>
<
Style
x:Key
=
"ItemLabelStyleTest"
TargetType
=
"t:SeriesItemLabel"
>
<
Setter
Property
=
"FontSize"
Value
=
"40"
/>
</
Style
>
</
t:RadChart.Resources
>
</
t:RadChart
>
And the code-behind:
public
partial
class
Page1 : UserControl
{
public
Page1()
{
InitializeComponent();
PieSeriesDefinition pieDef =
new
PieSeriesDefinition() {
SeriesItemLabelStyle =
this
.radChart1.Resources[
"ItemLabelStyleTest"
]
as
Style
};
// ...
}
}
Best,
Evtim
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Minseok Bang
Top achievements
Rank 1
answered on 21 Nov 2009, 04:09 AM
Thank you so much!!
0
Anne Lyon
Top achievements
Rank 1
answered on 01 Feb 2010, 02:22 PM
How do you do this in code-behind only? I add charts dynamically in C# and don't have an initial "radChart1" in XAML which resources I can use... I just need to change the font size for point labels in my Line CHart.
0
Hello Anne,
You can define the style in any resource dictionary you like, not just the RadChart one. I suggest using the LayoutRoot resource dictionary.
Another way is to build the whole style in the code-behind:
Regards,
Evtim
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
You can define the style in any resource dictionary you like, not just the RadChart one. I suggest using the LayoutRoot resource dictionary.
Another way is to build the whole style in the code-behind:
Style style =
new
Style(
typeof
(SeriesItemLabel));
style.Setters.Add(
new
Setter(Control.FontSizeProperty, 40d));
Regards,
Evtim
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Anne Lyon
Top achievements
Rank 1
answered on 04 Feb 2010, 09:01 AM
Thanks,
This works fine if I execute this code as I add the series to the charts (using seriesMapping.SeriesDefinition.SeriesItemLabelStyle) but it does nothing if I want to let the user set the font size himself.
I have a callback from a context menu that basically sets font large or small:
This does not at all change the font size, am I doing anything wrong?
This works fine if I execute this code as I add the series to the charts (using seriesMapping.SeriesDefinition.SeriesItemLabelStyle) but it does nothing if I want to let the user set the font size himself.
I have a callback from a context menu that basically sets font large or small:
switch (mnuText) |
{ |
case "Set font large": |
Style style = new Style(typeof(SeriesItemLabel)); |
style.Setters.Add(new Setter(Control.FontSizeProperty, 16d)); |
aChart.DefaultView.ChartArea.DataSeries[0].Definition.ShowItemLabels = true; |
aChart.DefaultView.ChartArea.DataSeries[0].Definition.SeriesItemLabelStyle = style; |
menuItem.Header = "Set font small"; |
break; |
case "Set font small": |
style = new Style(typeof(SeriesItemLabel)); |
style.Setters.Add(new Setter(Control.FontSizeProperty, 8d)); |
aChart.DefaultView.ChartArea.DataSeries[0].Definition.ShowItemLabels = true; |
aChart.DefaultView.ChartArea.DataSeries[0].Definition.SeriesItemLabelStyle = style; |
menuItem.Header = "Set font large"; |
break; |
} |
0
Hello Anne,
The style set through the definition is retrieved when the series is created, and changing it later does not affect the already created series.
There is no way to dynamically update the items style.
Kind regards,
Joshua
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
The style set through the definition is retrieved when the series is created, and changing it later does not affect the already created series.
There is no way to dynamically update the items style.
Kind regards,
Joshua
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Anne Lyon
Top achievements
Rank 1
answered on 09 Feb 2010, 09:02 AM
Thanks,
then at least I know that we cannot offer such a functionality to the users...
But it might be an idea to put on your "nice-to-have" list that ALL attributes for a chart should be possible to change dynamically? We find very often that a user would like to change the look of a chart (colors, fonts, labels), especially before exporting to presentations, reports etc.
then at least I know that we cannot offer such a functionality to the users...
But it might be an idea to put on your "nice-to-have" list that ALL attributes for a chart should be possible to change dynamically? We find very often that a user would like to change the look of a chart (colors, fonts, labels), especially before exporting to presentations, reports etc.
0
Hi Anne,
We totally agree with your point. Most issues come from legacy code written to support Silverlight 2. We have to balance between further development of the RadChart and removal of code that deals with SL2 restrictions. Since SL4 is coming, we delayed those modifications to directly target SL4.
Currently, you can overcome the issue by reloading the data series (or rebinding the chart, should you use that approach).
Regards,
Joshua
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
We totally agree with your point. Most issues come from legacy code written to support Silverlight 2. We have to balance between further development of the RadChart and removal of code that deals with SL2 restrictions. Since SL4 is coming, we delayed those modifications to directly target SL4.
Currently, you can overcome the issue by reloading the data series (or rebinding the chart, should you use that approach).
Regards,
Joshua
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.