Hi
I need to implenment a chart that if the value is possitive the bar color should be green, if the value is negative the color should be red, here is the data model:
class DataModel
{
public DateTime DataDate { get; set; }
public float DataValue{ get; set; }
public Color Foregroud
{
get
{
if (DataValue> 0)
return Colors.Green;
else
return Colors.Red;
}
}
}
and here is the xaml:
<Charts:SfChart x:Name="cMainIO" Grid.Row="1">
<Charts:SfChart.Behaviors>
<Charts:ChartZoomPanBehavior/>
</Charts:SfChart.Behaviors>
<Charts:SfChart.PrimaryAxis>
<Charts:CategoryAxis x:Name="Primaryx" LabelFormat="MM/dd" />
</Charts:SfChart.PrimaryAxis>
<!--SecondaryAxis with range customization-->
<Charts:SfChart.SecondaryAxis>
<Charts:NumericalAxis RangePadding="Round" StartRangeFromZero="False" />
</Charts:SfChart.SecondaryAxis>
<Charts:ColumnSeries ItemsSource="{Binding}" XBindingPath="DataDate" YBindingPath="DataValue" Interior="{Binding Foregroud, Mode=OneWay}" />
</Charts:SfChart>
When I run the app the color of bars are still blue,
How to fix it?