Gradient color

Hello, in my Xamarin android app I am using the following code to set gradient color 

Com.Syncfusion.Charts.ChartGradientColor gradientColor = new Com.Syncfusion.Charts.ChartGradientColor() { StartPoint = new PointF(0.5f, 1), EndPoint = new PointF(0.5f, 0) };
            Com.Syncfusion.Charts.ChartGradientStop stop1 = new Com.Syncfusion.Charts.ChartGradientStop() { Color = Color.ParseColor("#fdc8e9"), Offset = 0 };
            Com.Syncfusion.Charts.ChartGradientStop stop2 = new Com.Syncfusion.Charts.ChartGradientStop() { Color = Color.ParseColor("#ac0c52"), Offset = 1 };
            gradientColor.GradientStops.Add(stop1);
            gradientColor.GradientStops.Add(stop2);
            Com.Syncfusion.Charts.ChartGradientColorCollection gradientColors = new Com.Syncfusion.Charts.ChartGradientColorCollection()
            {
                gradientColor
            };

With this code I get gradient color from bottom to top. My question is, how can set gradient color from left to right? 

Thank you very much

3 Replies

DV Divya Venkatesan Syncfusion Team April 18, 2018 06:22 AM UTC

Hi Konstantinos, 
 
Thanks for contacting Syncfusion support. 
 
You can set the gradiant color from left to right of chart by setting the StartPoint and EndPoint properties of ChartGradientColor as shown in the below code snippet. 
 
Code snippet[C#]: 
Com.Syncfusion.Charts.ChartGradientColor gradientColor = new Com.Syncfusion.Charts.ChartGradientColor() 
{ 
    StartPoint = new PointF(0, 0.5f), EndPoint = new PointF(1, 0.5f) 
}; 
 
Please refer the following user guide link to know more about gradiant colors. 
 
Output: 
 
 
Please let us know if you need any further assistance. 
 
Regards, 
Divya Venkatesan 



KE Konstantinos Evangelidis April 18, 2018 08:27 AM UTC

Thank you very much. Works. 


DV Divya Venkatesan Syncfusion Team April 19, 2018 11:57 AM UTC

Hi Konstantinos,

Thanks for the update. We are glad to know that the given solution works.

Please let us know if you need any further assistance.

Regards,
Divya Venkatesan



Loader.
Up arrow icon