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 control line colors in sfChart Line char type

How can I set the color of a line in a line chart?  I have these two lines, and they are assigned automatically colors about Blue and Brown, but I want to pick the color myself.

I tried using Stroke and Border attributes, but neither of those affect the line color.  StrokeWidth does change the width. Palette works, but of course it's not what I want (I want the entire line the same color).


<SFCharts:LineSeries Label="YTD Billable Hours" XBindingPath="FirstDayOfMonth" YBindingPath="YtdBillableHours" ItemsSource="{Binding MonthlyHoursVsBudget}"
                                                     StrokeThickness="2" ShowTooltip="True" TooltipTemplate="{StaticResource MonthlyHoursDataTemplate}"/>
                               
<SFCharts:LineSeries Label="YTD Budget" XBindingPath="FirstDayOfMonth" YBindingPath="YtdBudgetBillableHours" ItemsSource="{Binding MonthlyHoursVsBudget}"
                                                     StrokeThickness="2"/>

3 Replies

SJ Sumathi Jayaraj Syncfusion Team November 24, 2014 04:07 PM UTC

Hi Rob,

 

Thank you for using Syncfusion products.

 

SfChart provides the API for defining the color of the individual series. By default, Metro palette will applied for the series. You can define the color using Interior property as in below code snippet.

 

Code snippet:

 

<chart:LineSeries XBindingPath="Name" Interior="Red" ShowTooltip="True" StrokeThickness="2" ItemsSource="{Binding power}" Label="Sports" YBindingPath="Sports"/>

 

Note : For the series like line and spline, Stroke is not applicable.

 

Regards,

Sumathi J



RK Rob Kerr November 25, 2014 04:46 PM UTC

Thanks, Sumathi.  The "Interior" property was exactly what I needed to know.  Works great!


MK Magesh Kumar Krishnan Syncfusion Team November 26, 2014 05:22 AM UTC

Hi Rob,
Thanks for the update. Please let us know if you require further assistance on this.
Thanks,
Magesh Kumar K

Loader.
Up arrow icon