Chart Legend items alignment issue

4 posts, 0 answers
  1. sri hari
    sri hari avatar
    4 posts
    Member since:
    Apr 2010

    Posted 28 Feb 2013 Link to this post

    Hi Telerik,

    I am having problem in chart legend like legend items are not aligning properly. i am using template to display chart and chart legend and i am using telerik RadWrapPanelto align the chart legend items and inside wrappanel legend items are displaying. i am attaching code snippet of legend style and screenshot for referrence and please help me how to solve this issue?
    <Style x:Key="ChartLegendStyle"
            TargetType="telerik:ChartLegend">
      
        <Setter Property="Padding" Value="0,0,0,0" />
        <Setter Property="Margin" Value="0,0,0,0"/>
        <Setter Property="FontSize" Value="10"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="white"/>
        <Setter Property="Width" Value="auto"/>
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush EndPoint="1,0"
                                     StartPoint="0,1"
                                     SpreadMethod="Pad">
                    <GradientStop Color="#FF616161"
                                  Offset="0" />
                    <GradientStop Color="#FF616161"
                                  Offset="1" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
      
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="HorizontalAlignment" Value="Left" />
      
           
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <telerik:RadWrapPanel Orientation="Horizontal" HorizontalAlignment="Left" UseLayoutRounding="True"/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>


  2. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 04 Mar 2013 Link to this post

    Hello,

    I prepared a sample using your legend style but couldn't reproduce the unwanted behaviour you are describing. I attached the sample and a capture of the result I get. Could you provide more information on how to reproduce the issue or can you point what steps we need to follow to reproduce it in our test project?

    All the best,
    Evgenia
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. sri hari
    sri hari avatar
    4 posts
    Member since:
    Apr 2010

    Posted 04 Mar 2013 Link to this post

    Hi telerik,
    thanks for your reply. I am getting issue in 2nd line if more items are added and 1st line is perfect in alignment as per my screenshot and based on grouping is done in grid ,then chart is displayed and legend is not properly aligned if more items are there in chart. if suppose i group by one column i.e IssueName or State which has long data in my grid then chart is displayed and IssueName/State legends are not properly aligned.  i am using width for chart legend i.e 200. please give me solution for this asap and waiting for your reply.

     

     

    radPieChartInqTyp7.DefaultView.ChartLegend.Width = 200;

     

     

     

    radPieChartInqTyp7.DefaultView.ChartLegendPosition = Telerik.Windows.Controls.Dock.Left;

     

     

     

    radPieChartInqTyp7.HorizontalAlignment = HorizontalAlignment.Left;

     

     

     

    radPieChartInqTyp7.DefaultView.ChartLegend.ItemsPanelOrientation = Orientation.Horizontal;

     

     

     

    radPieChartInqTyp7.DefaultView.ChartLegend.Style = Application.Current.Resources["ChartLegendStyle"] as Style;

     

  5. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 07 Mar 2013 Link to this post

    Hello,

    I used your code and modified the sample my colleague Evgenia has provided to you and the unwanted behavior with the legend is still not reproducible. I have also added more items, so the scenario is closer to yours. In order to provide you with an appropriate solution, could you modify the sample I have attached so the issue can be reproduced. Note that this is a forum thread and you should use a third party web site for uploading and sharing files in order to share it with us.

    All the best,
    Peshito
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top