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: November 16, 2018).
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 08:55 AM UTC Dec 4,2015 10:56 AM UTC WPF 1
Tags: SfChart
yalcin oksuz
Asked On December 2, 2015 08:55 AM UTC


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 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


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