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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set legend position dynamically in SfChart?

Thread ID:





121331 Dec 2,2015 03:55 AM Dec 4,2015 05:56 AM WPF 1
Tags: SfChart
yalcin oksuz
Asked On December 2, 2015 03:55 AM


I want to position the legend in the bottom left chart area. In the knowledge base (https://www.syncfusion.com/kb/4684/how-to-customize-the-legends-position), it is advised to use floating type with specifying offsetX and offsetY values. But if I hardcode offset values, if the window/chart area is resized, legend position may move to undesired positions. How can I make it responsive to window resizing?


Sumathi Jayaraj [Syncfusion]
Replied On December 4, 2015 05:56 AM

Hi Yalcin,


Thanks for contacting Syncfusion support.


We can achieve your requirement by setting DockPosition with HorizontalAlignment to the ChartLegend.


Code snippet:



    <chart:ChartLegend DockPosition="Bottom" HorizontalAlignment="Left"/>




We have prepared a sample and please find the sample in the below attachment.



Sumathi J

Attachment: Trendline_Sample_8376f1da.zip


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.

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