1

I am displaying data in my livecharts and Label values are binded (visible in debugging). But somehow in the UI, it is showing one or two values instead of all the values in string array from the backend.

Model.cs Code:

private string[] _Labels;
public string[] Labels
{
    get
    {
        return _Labels;
    }
    set
    {
        SetProperty(ref _Labels, value);
    }
}

ModelViewCode.cs

Labels = new[] {"Maria", "Susan", "Charles", "Frida"};

XAML:

<lvc:CartesianChart.AxisX>
    <lvc:Axis Labels="{Binding Labels}">
    </lvc:Axis>
</lvc:CartesianChart.AxisX>

Screenshot

Image of the Output

CDspace
  • 2,639
  • 18
  • 30
  • 36
user3387691
  • 11
  • 1
  • 2

1 Answers1

4

Define an AxisSeparator for your axis like this, and set its Step property to 1

<lvc:CartesianChart.AxisX>
    <lvc:AxesCollection>
        <lvc:Axis Labels="{Binding Labels}">
            <lvc:Axis.Separator>
                <lvc:Separator Step="1" />
            </lvc:Axis.Separator>
        </lvc:Axis>
    </lvc:AxesCollection>
</lvc:CartesianChart.AxisX>
Yvonnila
  • 635
  • 1
  • 5
  • 22
  • 1
    Wow, that wasn't very intuitive to me. Your proposed solution works perfectly well, showing all the labels. – j00hi Nov 20 '19 at 11:51