<chart:LineSeries ItemsSource="{Binding LineSeriesData}" XBindingPath="Date" YBindingPath="Value">
<chart:LineSeries.ColorModel>
<chart:ChartColorModel CustomBrushes="{Binding ColorCollection}" Palette="Custom">
</chart:ChartColorModel>
</chart:LineSeries.ColorModel>
</chart:LineSeries> |
foreach(var v in LineSeriesData)
{
if (v.Value > 0)
ColorCollection.Add(Color.Green);
else
ColorCollection.Add(Color.Red);
} |
<chart:SfChart.ColorModel>
<chart:ChartColorModel Palette="Custom">
<chart:ChartColorModel.CustomGradientColors>
<chart:ChartGradientColor StartPoint="0.5,1" EndPoint="0.5, 0">
<chart:ChartGradientColor.GradientStops>
<chart:ChartGradientStop Color="Red" Offset= "0"/>
<chart:ChartGradientStop Color="Green" Offset= "1"/>
</chart:ChartGradientColor.GradientStops>
</chart:ChartGradientColor>
</chart:ChartColorModel.CustomGradientColors>
</chart:ChartColorModel>
</chart:SfChart.ColorModel> |