Hi,
I am using XamWebChart, but for some reason the text in the legend is cut off;
These are my settings:
<Style x:Key="Style_IGChartLegend" TargetType="igChart:Legend"> <Setter Property="Background" Value="#00000000" /> <Setter Property="BorderBrush" Value="#FFeaeaea" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igChart:Legend"> <Border Padding="5,5,5,5" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" > <Canvas x:Name="RootElement" /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style>
<Style x:Key="Style_IGChartLegendItem" TargetType="igChart:LegendItem"> <Setter Property="Foreground" Value="#FF000000" /> <Setter Property="Stroke" Value="#00FFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="igChart:LegendItem"> <Grid x:Name="RootElement"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Rectangle RadiusX="0" RadiusY="0" x:Name="LegendItemIcon" Grid.Column="0" Width="15" Height="15" Fill="{TemplateBinding Fill}" Stroke="{TemplateBinding Stroke}" StrokeThickness="0" /> <TextBlock x:Name="LegendItemText" Margin="5,0,0,0" Height="Auto" FontSize="8" HorizontalAlignment="Left" Grid.Column="1" Text="{TemplateBinding Text}" Foreground="{TemplateBinding Foreground}" ToolTipService.ToolTip="{TemplateBinding Text}"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="Stroke" Value="#00FFFFFF" /> </Style>
<igChart:XamWebChart x:Name="chart" EndPaletteBrush="#FFDEC51E" VerticalContentAlignment="Top" Width="800" HorizontalContentAlignment="Left"> <igChart:XamWebChart.Legend> <igChart:Legend Visibility="Visible" VerticalAlignment="Top" LegendItemStyle="{StaticResource Style_IGChartLegendItem}" Style="{StaticResource Style_IGChartLegend}" Height="150" Margin="5,0,0,0" /> <!----> </igChart:XamWebChart.Legend> <igChart:XamWebChart.Series> <igChart:Series ChartType="Pie" Label="TestSeriesLabel" DataSource="{Binding}" DataMapping="Label=Label;Value=Value;ToolTip = ToolTip"/> </igChart:XamWebChart.Series> </igChart:XamWebChart>
The user control which is parent of the chart has Auto dimensions...
Thanks
Do you actually allow long legend item names?
This is very important to me, so please help...
The dimensions of the legend can be adjusted with Width and Height. Is there a reason you're not setting the Width on the legend?
Yes, there is:
Whether set or no, it is the same! Text still cut off...
Sorry, the multiline legend text isn't currently supported and longer labels get trimmed with an ellipsis character. There's no elegant workaround that I can think of, other than maybe displaying your own custom legend on top of the chart. You can also report this to our developer support group so this can be logged and we can make improvements.
Does this not-replying situation means that this can't be done?
I'm using 10.1
As you can see from the topic, the legend items are my problem, not the legend width;
As much as I widen the grid, the legend items text remains cut-off;
Please send me a screen-shot with this text in the legend items:
Instead of:
Item Label 1 -> Microsoft Windows XP Professional
Item Label 2 -> Microsoft Windows Vista Enterprise
Item Label 3 -> Microsoft Windows XP Professional (parallel installed) SP0 DE
Item Label 4 -> This is even a bigger text than the previous ones, which should be complete
Please send me a screen shot
I tried setting Width on the legend and I did see the legend's size change.
<igChart:XamWebChart.Legend> <igChart:Legend Visibility="Visible" VerticalAlignment="Top" LegendItemStyle="{StaticResource Style_IGChartLegendItem}" Style="{StaticResource Style_IGChartLegend}" Height="150" Width="150" Margin="5,0,0,0" /> <!----> </igChart:XamWebChart.Legend>
I'm also attaching the image of the resulting chart.
What version of Silverlight and NetAdvantage are you using?