We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Show all items in legend

Thread ID:

Created:

Updated:

Platform:

Replies:

150820 Jan 21,2020 09:54 AM UTC May 13,2020 05:25 AM UTC WPF 6
loading
Tags: SfChart
Ondrej Svoboda
Asked On January 21, 2020 09:54 AM UTC

Hi,
I have ColumnSeries with 4 columns and I want to show them all in the legend, not just the series label. (same like it is for pie series) Is there a way how to do it?

Thanks

Hemalatha Marikumar [Syncfusion]
Replied On January 21, 2020 10:42 AM UTC

Hi Ondrej Svoboda, 
 
Greetings from Syncfusion. 
 
We would like to let you know that your requirement has been achieved by using Series property of ChartLegend as per in below UG link 
 
Please let us know if you need any further assistance. 
 
Regards, 
Hemalatha M. 


Ondrej Svoboda
Replied On January 22, 2020 10:16 AM UTC

Hi,
I'm trying to do this using binding, but it is not working. (demo attached) Am I doing something wrong?

Thanks

Attachment: FastChart505328937_2cb50d01.zip

Hemalatha Marikumar [Syncfusion]
Replied On January 23, 2020 09:12 AM UTC

Hi Ondrej Svoboda, 
 
We checked the provided sample and resolved the reported issue as per the modification made in code below. 
 
Code Snippet [XMAL]: 
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> 
        <StackPanel.DataContext> 
            <local:ViewModel x:Name="viewmodel"/> 
        </StackPanel.DataContext> 
        <Button x:Name="AddSeries" Content="Change series" Width="700" Height="40" Click="AddSeries_Click" HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" /> 
                           <chart:SfChart x:Name="Chart" Series="{Binding Series}"  Palette="Pineapple" > 
            <chart:SfChart.Legend> 
                <chart:ChartLegend  Series="{Binding Source={x:Reference viewmodel},Path=LegendSeries}"  ToggleSeriesVisibility="True" /> 
            </chart:SfChart.Legend> 
            <chart:SfChart.PrimaryAxis> 
           …. 
            </chart:SfChart> 
    </StackPanel> 
</Window> 
 
Screenshot: ColumnSeries 
 
 
 
Screenshot: LineSeries 
 
 
 
Please let us know if you need any further assistance. 
 
Regards, 
Hemalatha M. 


Ondrej Svoboda
Replied On May 12, 2020 08:10 AM UTC

Hi,
one more requirement: I need to bind legend labels to different property in my data source than I have for primary axis. Possible?

For example:

On primary axis I want to have item codes: 1,2,3,4,... but in the legend I need item description: BMW, Jaguar, Toyota, etc.

Thanks!

Ondrej Svoboda
Replied On May 12, 2020 12:03 PM UTC

Never mind, I've been able to solve this myself using ChartLegend.ItemTemplate.

Thanks anyway!

Suyamburaja Jayakumar [Syncfusion]
Replied On May 13, 2020 05:25 AM UTC

Hi Ondrej Svoboda,  
  
We are glad to hear that your requirement has been achieved.  
  
Please let us know if you need any further assistance on this.  
  
Regards,  
Suyamburaja J.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon