'How to use multiline chart using microcharts - xamarin

I want to add a second line on the chart using little tricky method:

 <StackLayout>
             <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

            <microcharts:ChartView x:Name="chartView" 
                                   Grid.Row="0"
                                   Grid.Column="0"
                                   HeightRequest="200"/>

            <microcharts:ChartView x:Name="chartView2"
                                    Grid.Row="0"
                                    Grid.Column="0"
                                    HeightRequest="200"/>
                 </Grid>
 </StackLayout>

In CS file I create a two Lists with different values:

List<Entry> entries = new List<Entry>
    {
        new Entry(200)
        {
            Color=SKColor.Parse("#FF1943"),
            Label ="January",
            ValueLabel = "200"
        },
        new Entry(400)
        {
            Color = SKColor.Parse("00BFFF"),
            Label = "March",
            ValueLabel = "400"
        },
        new Entry(-100)
        {
            Color =  SKColor.Parse("#00CED1"),
            Label = "Octobar",
            ValueLabel = "-100"
        },
        };

    List<Entry> entries2 = new List<Entry>
    {
        new Entry(220)
        {
            Color=SKColor.Parse("#FF1943"),
            Label ="January",
            ValueLabel = "220"
        },
        new Entry(420)
        {
            Color = SKColor.Parse("00BFFF"),
            Label = "March",
            ValueLabel = "420"
        },
        new Entry(-120)
        {
            Color =  SKColor.Parse("#00CED1"),
            Label = "Octobar",
            ValueLabel = "-120"
        },
        };

In the button method I set these properties on the charts:

chartView.Chart = new LineChart()
        {
            Entries = entries,
            LineMode = LineMode.Spline,
            LineSize = 8,
            PointMode = PointMode.Circle,
            PointSize = 18,
            LabelTextSize = 40
        };

        chartView2.Chart = new LineChart()
        {
            Entries = entries2,
            LineMode = LineMode.Spline,
            LineSize = 8,
            PointMode = PointMode.Circle,
            PointSize = 18,
            LabelTextSize = 40
        };

But the result not displayed two lines on the chart:

ScreenShot

What can I do to display two lines ?

I look here: How to add 2 lines in Microchart for Xamarin Forms but I don't understant why I have to create for loop ?

How best to do it in my case



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source