This is a migrated thread and some comments may be shown as answers.

ChartLegend ItemsPanelOrientation

1 Answer 50 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 26 May 2011, 04:44 PM
Hi,

in WPF I am using the follwoing as DefaultView.

<telerik:RadChart.DefaultView>
                      <telerik:ChartDefaultView ChartLegendPosition="Bottom">
                          <telerik:ChartDefaultView.ChartTitle>
                              <telerik:ChartTitle Content="..."/>
                          </telerik:ChartDefaultView.ChartTitle>
                          <telerik:ChartDefaultView.ChartArea>
                              <telerik:ChartArea SmartLabelsEnabled="True" LegendName="legend8"/>
                          </telerik:ChartDefaultView.ChartArea>
                          <telerik:ChartDefaultView.ChartLegend >
                              <telerik:ChartLegend  UseAutoGeneratedItems="True" DisplayMemberPath="Key" x:Name="legend8" 
                                                   ItemsPanelOrientation="Vertical" Header=""/>
                          </telerik:ChartDefaultView.ChartLegend>
                      </telerik:ChartDefaultView>
                  </telerik:RadChart.DefaultView>

As a result, I get vertically oriented LegendItems.

Using the same in SIlverlight, the items remain horizontally aligned?

Now I wonder whether this is a bug or there is any mistake in my code...

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 31 May 2011, 01:37 PM
Hello Matthias,
You code is correct and I will forward the problem to our developers. In the meantime, you can use the following workaround:

<UserControl.Resources>
    <Style x:Key="CustomLegend" TargetType="telerik:ChartLegend">
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <telerik:RadWrapPanel Orientation="Vertical" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
    <telerik:RadChart x:Name="RadChart1">
        <telerik:RadChart.DefaultView>
            <telerik:ChartDefaultView ChartLegendPosition="Bottom">
                <telerik:ChartDefaultView.ChartTitle>
                    <telerik:ChartTitle Content="..."/>
                </telerik:ChartDefaultView.ChartTitle>
                <telerik:ChartDefaultView.ChartArea>
                    <telerik:ChartArea SmartLabelsEnabled="True" LegendName="legend8"/>
                </telerik:ChartDefaultView.ChartArea>
                <telerik:ChartDefaultView.ChartLegend >
                    <telerik:ChartLegend  UseAutoGeneratedItems="True" DisplayMemberPath="LineCompanyName" x:Name="legend8"
                                                ItemsPanelOrientation="Vertical" Header="" Style="{StaticResource CustomLegend}"/>
                </telerik:ChartDefaultView.ChartLegend>
            </telerik:ChartDefaultView>
        </telerik:RadChart.DefaultView>
 
    </telerik:RadChart>
</Grid>


All the best,
Tsvetie
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Matthias
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or