Hi,
I'm using ItemLabel,but when the ItemLabel string is very long ,it can't display completely as the image attached。I try to reduce the size of the PieChart by setting the padding property, in order to leave more space to the itemlabel ,
but the boundary of the chartarea is reduced too.Is there any good suggestion?
Thanks~
6 Answers, 1 is accepted
By default the ChartLegend takes all the space that it needs for the LegendLabel-s, so it seams very strange that you have managed to override this behaviour.
Can you provide some code so we can have have a look?
Petar Kirov
the Telerik team
ISeriesDefinition sd;
InteractivitySettings inter = new InteractivitySettings()
{
HoverScope = InteractivityScope.Item,
SelectionMode = ChartSelectionMode.Single,
SelectionScope = InteractivityScope.Item
};
sd = new PieSeriesDefinition()
{
LabelSettings = new RadialLabelSettings()
{
SpiderModeEnabled = true,
ShowConnectors = true
}
};
sd.ShowItemLabels = true;
sd.LegendDisplayMode = LegendDisplayMode.DataPointLabel;
sd.SeriesItemLabelStyle = this.Resources["SeriesItemLabelStyle"] as Style;
this.RadChart2.DefaultSeriesDefinition = sd;
this.RadChart2.DefaultView.ChartLegend.Header = "";
this.RadChart2.DefaultView.ChartArea.SmartLabelsEnabled = true;
this.RadChart2.DefaultView.ChartArea.Extensions.Add(new CameraExtension());
this.RadChart2.DefaultView.ChartLegendPosition = Telerik.Windows.Controls.Dock.Bottom;
this.RadChart2.ItemsSource = Convert2ChartItemssource();
}
SeriesItemLabelStyle :
<
Style
x:Key
=
"SeriesItemLabelStyle"
TargetType
=
"telerik:SeriesItemLabel"
>
<
Setter
Property
=
"ContentTemplate"
>
<
Setter.Value
>
<
DataTemplate
>
<
TextBlock
TextAlignment
=
"Left"
MaxWidth
=
"100"
TextWrapping
=
"Wrap"
Text
=
"{Binding Content, RelativeSource={RelativeSource TemplatedParent}}"
/>
</
DataTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
Hi,
there is another problem.When there is only one bar in BarSeriesDefinition,how can I set the length of the bar?
thanks!
The length of the bar items in the bar-like series is proportional to the range of the series ( the difference between the highest and the lowest value). So this length will be different depending on what items a series has.
The only way to override this is to explicitly set the RadChartX.DefaultView.ChartArea.AxisY.AutoRange property to "false" and then set the
RadChartX.DefaultView.ChartArea.AxisY.MaxValue and MinValue to your desired values.
If you want to adjust the Width of the bars you can refer to this help topic.
Petar Kirov
the Telerik team
Hi,
Thanks very much,I get that.and there is another question again.The default decimal places of the bar YValue is 2,For example,the true value is 0.012,but the display value on the bar label is 0.01. how can i set the decimal places?
You can set the decimal places and other formatting-related stuff by using Format Expressions. I advice you to check this help topic. I believe that it should answer most, if not of all, of your formatting questions.
Kind Regards,Petar Kirov
the Telerik team