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

How to set legend position dynamically in SfChart?

Hello

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?


Regards



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:SfChart.Legend>

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

</chart:SfChart.Legend>

 

 

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

 

Regards,

Sumathi J


Attachment: Trendline_Sample_8376f1da.zip

Loader.
Live Chat Icon For mobile
Up arrow icon