If I have a large number of series (or data points in a single pie series), the legend gets cut off. I tried to template the chart to put a ScrollViewer around the LegendPanel, but that didn't work since the XamWebChart.cs code adds the LegendPanel to its RootElement, so I get this:
XamWebChart Warning: Element is already the child of another element
This was my template (which I applied in code behind):
<ControlTemplate TargetType="igChart:XamWebChart"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Grid x:Name="RootElement" Background="{TemplateBinding Background}" Margin="{TemplateBinding Padding}" > <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto" MaxWidth="200"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Grid x:Name="CaptionPanel" Grid.Row="0" Grid.ColumnSpan="2" Grid.Column="0"/> <Grid x:Name="ScenePanel" Grid.Column="0" Grid.Row="1"/> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Grid.Column="1" Grid.Row="1" > <Grid x:Name="LegendPanel" Grid.Column="1" Grid.Row="1" /> </ScrollViewer> <!--<igChart:Legend x:Name="LegendPanel" Grid.Column="1" Grid.Row="1" MaxWidth="200"/>--> </Grid> </Border></ControlTemplate>
Is there any way to get some sort of scrolling in the legend so I can see all the items in a pie series (even beyond 50 or so gets cut off depending on the control size)?
Thanks,Keith
Could you share more detail as to how you are moving between them? Are they in a tab control or are you removing and adding them to the visual tree? If you could provide a small sample that illustrates the issue that would help. You may need to have the fake canvas refresh when the controls loaded event fires also, depending on what you are doing.
-Graham
I have used this on one of my applications. In my application I am moving from one chart to another with the click of series of buttons. When I land on the chart that I have included the "FakeCanvas" on the first time it works great. However, when I go from that chart to another chart and then come back, the legend items are totally gone. How do I get the items to build each time?
Thanks
ptilwani,
It's come to my attention Developer Support is helping you with this issue, is there any more assistance you need?
Hi Graham,
Please find the ResourceDictStyle.txt attached which is nothing but a resource dictionary.
In my Page.Xaml I try applying the declared style to the legend in the following way:
<igChart:XamWebChart.Legend>
<igChart:Legend MaxWidth="100" Style="{StaticResource ScrollableLegend}" />
</igChart:XamWebChart.Legend>
Then I get the following error:
Error: Unhandled Error in Silverlight Application Code:2255 Category:Runtime Error Message:AG_E_PARSER_BAD_TYPE MethodName:
If I decalre the style in UserControl.Resources everything works fine. Please tell me if you need any more info.
For starters, make sure you have the same Xaml namespace declarations in your resource dictionary as in the file you originally had the style defined in. Are there any more details about the error than that? Can you provide a sample the reproduces the problem?