//We have added buy value in 0th index.
var buys = (int)viewModel.Data[0].TotalBuys;
Random rd = new Random();
double y1;
for (int i = 0; i < 6; i++)
{
//Set each buy value
if (buys > 0)
y1 = rd.Next(0, buys);
else
y1 = rd.Next(buys, 0);
LineAnnotation line = new LineAnnotation()
{
X1 = 2.6,//We have set jan month in 3rd index, so that we have set mid point for X1 and X2
X2 = 3.4,
Y1 = y1,
Y2 = y1,
Stroke = new SolidColorBrush(Colors.White)
};
chart.Annotations.Add(line);
} |
<chart:StackingColumnSeries XBindingPath="Month" YBindingPath="Sells"
StrokeThickness="2" Stroke="Transparent"
Label="Sells"
ItemsSource="{Binding Data}"/>
<chart:StackingColumnSeries XBindingPath="Month" YBindingPath="Income"
Label="Income"
StrokeThickness="2" Stroke="Transparent"
ItemsSource="{Binding Data}"/>
<chart:StackingColumnSeries XBindingPath="Month" YBindingPath="Expenses"
Label="Expenses"
StrokeThickness="2" Stroke="Transparent"
ItemsSource="{Binding Data}"/>
<chart:StackingColumnSeries XBindingPath="Month" YBindingPath="Buys"
Label="Buys"
StrokeThickness="2" Stroke="Transparent"
ItemsSource="{Binding Data}"/> |
<chart:SfChart.Annotations>
<chart:HorizontalLineAnnotation Y1="0" Stroke="Black"/>
</chart:SfChart.Annotations> |