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

How to set legend position dynamically in SfChart?


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?


1 Reply

SJ Sumathi Jayaraj Syncfusion Team December 4, 2015 10:56 AM UTC

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

Live Chat Icon For mobile
Up arrow icon