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

Chart Legend items alignment issue

3 Answers 77 Views
Chart
This is a migrated thread and some comments may be shown as answers.
sri hari
Top achievements
Rank 1
sri hari asked on 28 Feb 2013, 12:52 PM
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>


3 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 04 Mar 2013, 04:31 PM
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.

0
sri hari
Top achievements
Rank 1
answered on 05 Mar 2013, 04:31 AM
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;

 

0
Peshito
Telerik team
answered on 07 Mar 2013, 04:43 PM
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.

Tags
Chart
Asked by
sri hari
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
sri hari
Top achievements
Rank 1
Peshito
Telerik team
Share this question
or