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. Image for the cookie policy date

Show all items in legend

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

6 Replies

HM Hemalatha Marikumar Syncfusion Team 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. 



OS Ondrej Svoboda 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


HM Hemalatha Marikumar Syncfusion Team 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. 



OS Ondrej Svoboda 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!


OS Ondrej Svoboda May 12, 2020 12:03 PM UTC

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

Thanks anyway!


SJ Suyamburaja Jayakumar Syncfusion Team 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.  


Loader.
Live Chat Icon For mobile
Up arrow icon