none
How to change orientation of legend items in silverlight chart.

    General discussion

  • Hi,

      I successfully showed legend above chart(Changed position). Legend items are showing in vertical position. I want to show items in horizantal position, say 4 items in first row and 4 in next row.

    So how can i acheive this.

     

    Thanks,

    Mahendra

    Friday, April 03, 2009 12:08 PM

All replies

  • Hi,

      I need exactly the same thing. Plz anybody give solution on that

     

    Thanks,

    Raj

    Monday, April 06, 2009 8:26 AM
  • can you give a sketch of what you want?

    Monday, April 06, 2009 10:48 AM
  • Hi,

       Suppose there are three lines say A1,A2,A3 in linechart.Then in legend we can see A1,A2 and A3 with colors one below other. But i want to show A1,A2 and A3 in horizantal position.

     

    Thanks,

    Raj.

    Tuesday, April 07, 2009 1:19 AM
  • Hi!!

    I need the same thing. If there are 6 LegendItems, I want them in two rows below the chart, 3 in each row. Now I've them below the chart, but not in horizontal as mentioned. If anyone has the solution, please help.

    Thanks in advance.

     

     

    Thursday, May 14, 2009 1:33 AM
  • Did anyone get a solution for this. Can you please post it if you do.

    Tuesday, May 26, 2009 3:41 PM
  • In the default style the legend items are displayed in a StackPanel. Change the orientation property of the StackPanel to horizontal and the items should display horizontally.
    Monday, September 07, 2009 11:20 AM
  • Use this following style & modify according to ur customization.

      <Style x:Key="ChartStyle1" TargetType="charting:Chart">
                <Setter Property="BorderBrush" Value="Black"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="IsTabStop" Value="False"/>
                <Setter Property="Padding" Value="10"/>
                <Setter Property="TitleStyle">
                    <Setter.Value>
                        <Style TargetType="datavis:Title">
                            <Setter Property="FontSize" Value="16"/>
                            <Setter Property="FontWeight" Value="Bold"/>
                            <Setter Property="HorizontalAlignment" Value="Center"/>
                            <Setter Property="Margin" Value="0,10,0,10"/>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="LegendStyle">
                    <Setter.Value>
                        <Style TargetType="datavis:Legend">
                            <Setter Property="Margin" Value="15,0,15,0"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                            <Setter Property="BorderBrush" Value="#FFDBDBDB"/>
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.442,0.005" StartPoint="0.558,0.995">
                                        <GradientStop Color="#FFDBDBDB"/>
                                        <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="ItemsPanel">
                                <Setter.Value>
                                    <ItemsPanelTemplate>
                                        <StackPanel Orientation="Horizontal" />
                                    </ItemsPanelTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="ChartAreaStyle">
                    <Setter.Value>
                        <Style TargetType="Panel">
                            <Setter Property="MinWidth" Value="380"/>
                            <Setter Property="MinHeight" Value="320"/>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="PlotAreaStyle">
                    <Setter.Value>
                        <Style TargetType="Grid">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.457,0.296" StartPoint="0.459,1.296">
                                        <GradientStop Color="#FFCBCBCB"/>
                                        <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="charting:Chart">
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto"/>
                                        <RowDefinition Height="*"/>
                                    </Grid.RowDefinitions>
                                    <datavis:Title Content="{TemplateBinding Title}" Style="{TemplateBinding TitleStyle}"/>
                                    <Grid Margin="0,15,0,15" Grid.Row="1">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
    
                                        <datavis:Legend FontFamily="Times New Roman" FontSize="12" FontWeight="Normal"  x:Name="Legend" Grid.Row="2" Header="{TemplateBinding LegendTitle}" Style="{TemplateBinding LegendStyle}"/>
                                        <chartingprimitives:EdgePanel x:Name="ChartArea" Grid.Row="0" Style="{TemplateBinding ChartAreaStyle}">
                                            <Grid Style="{TemplateBinding PlotAreaStyle}" Canvas.ZIndex="-1"/>
                                            <Border BorderBrush="#FF919191" BorderThickness="1" Canvas.ZIndex="10"/>
                                        </chartingprimitives:EdgePanel>
                                    </Grid>
                                </Grid>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>




    Thursday, January 27, 2011 7:34 AM
  • Hey Thanks for this post.

    But it did not resolved my problem.

    But when I used following properties, it worked.

    May be it will be helpful to some one

     <Setter Property="ItemsPanel">
            <Setter.Value>
                      <ItemsPanelTemplate>
                               <toolkit:WrapPanel Orientation="Horizontal">
                               </toolkit:WrapPanel>
                       </ItemsPanelTemplate>
             </Setter.Value>
    </Setter>
    Saturday, April 07, 2012 8:02 AM
  • i m using a pie chart and

    i want my legend panel parallel to the my pie chart ...

    please suggest me

    thanks in advance....

    Thursday, May 10, 2012 12:42 AM