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 custom legend label and color for sfchart xamarin forms

Hi,

I am using sfchart in my xamarin forms app. The color of the bars depends on the value of the bar and the bars can take 4 different colors. I could do this using custom brushes.

But now, I want to show only 4 legends corresponding to these four color of bars. Is there a way to do this?

In short I need the following. A snapshot of the chart is shown below. As you can see, I am getting only one legend here. But I need 4 based on bar colors.

Bar value 0 - 75 , Legend label - Below threshold, legend color - red
Bar value 75 - 100 , Legend label - between threshold and target, legend color - yellow
Bar value 100 - 150 , Above target and below excellence, legend color - green
Bar value > 150  , Legend label - Above excellence, legend color - blue






1 Reply

SP Saravana Pandian Murugan Syncfusion Team June 13, 2017 04:21 PM UTC

Hi Naveen,

Thanks for using Syncfusion product.

We have achieved your requirement using the custom legend instead of built-in legend items. In the sample, we have used BoxView and Label as LegendLayout and added this in ScrollView for scrolling.

Sample: https://www.syncfusion.com/downloads/support/forum/130942/ze/CustomLegendLabel365994400

Please check the sample and let us know if you need further assistance on this.

Regards,
Saravana Pandian M.


Loader.
Live Chat Icon For mobile
Up arrow icon