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

legend item visibility inconsistency

2 Answers 85 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
M
Top achievements
Rank 1
M asked on 27 Aug 2015, 08:15 AM

Hi, ​how to make  legend items collapsed when the series visibility is set to collapsed / hidden (previously they were only collapsed when the series was collapsed and visible when the series was hidden).

   <ScrollViewer  VerticalScrollBarVisibility="Hidden" BorderBrush="Transparent"  Grid.Column="1" >
            <telerik:RadLegend  Visibility="Visible"   BorderBrush="Transparent" Margin="0,15,0,0"
                          Items="{Binding LegendItems, ElementName=chart ,Mode=TwoWay}"
                          Foreground="#FF767676"
                           FontFamily="Segoe UI" 
                            HorizontalAlignment="Left" 
                            FlowDirection="RightToLeft" 
                            VerticalAlignment="Bottom" 
                            VerticalContentAlignment="Stretch"
                            HorizontalContentAlignment="Stretch" 
                                   UseLayoutRounding="True"
                            VirtualizingStackPanel.VirtualizationMode="Recycling"
                            HoverMode="HighlightItem"
                            />
            
        </ScrollViewer>

2 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 31 Aug 2015, 08:12 AM
Hello,

The legend item should not be visible when the series is collapsed. I created a small project and I can confirm that there is a bug in the control. I have logged it in our feedback portal where you can vote and track its status and updated your Telerik points as a thank you for letting us know if this issue.

You can use a simple work-around for this. Use a template that has bound Visibility to the Visibility of the series:
<DataTemplate x:Key="legendItemTemplate1">
 <StackPanel Orientation="Horizontal" Visibility="{Binding Presenter.Visibility}">
 <Path Fill="{Binding MarkerFill}" Width="12" Height="12">
   <Path.Data>
    <Binding Path="ActualMarkerGeometry" RelativeSource="{RelativeSource AncestorType=telerik:LegendItemControl}">
     <Binding.Converter>
      <telerik:GeometryCloneConverter />
     </Binding.Converter>
    </Binding>
   </Path.Data>
   </Path>
  <TextBlock Margin="2" Text="{Binding Title}" />
 </StackPanel>
</DataTemplate>

I am just a little confused about the part where you mention that the legend item was collapsed when the series is hidden. There is no Hidden Visibility in Silverlight and I am unsure if I answered all of your questions. If you need more information, do contact us again and we will try to assist.

Regards,
Petar Marchev
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Petar Marchev
Telerik team
answered on 31 Aug 2015, 03:42 PM
Hello Jalil,

After a short investigation it seems that the behavior that you described is expected. I was incorrect to state that this is a bug, when this is actually the desired effect.

This is how we want the control to behave because we want to support a certain scenario. You can see this online QSF example where the interaction relies on legend items being produced for collapsed . series. You can see the RadLegend in the bottom right corner. The items have been retemplated and a toggle button has been used. The toggle button controls the visibility of the series. However, if the legend item disappeared when you clicked on it (and collapsed a series) there would be no way to bring the series back.

This is why I have declined the bug report I logged earlier today. I apologize for misleading you with my previous post.

You can still use the previously suggested work-around where the Visibility of the LegendItem is synced with the Visibility of the series. This way the chart will still produce a legend item, but the presenter will be collapsed. If you wish for the chart not to create a legend item, you can simply set the LegendSettings property to false (you can use a binding and a converter for this purpose).

One last thing, in the project I sent if you were to remove the item template, the chart will produce a legend item without a properly set MarkerBrush. We will investigate to see if we can improve things in this direction, so that the legend can display properly.

Regards,
Petar Marchev
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
ChartView
Asked by
M
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or