Home > Blockchain >  How do I get the X-Axis value of clicked data point LiveCharts
How do I get the X-Axis value of clicked data point LiveCharts

Time:10-17

I am trying to get the X-Axis label of a CartesianChart after clicking a data point.
I need the label as it contains a DateTime that I can use to load in more data and load the next chart. I cannot find anything similar. Can someone point me in the right directions or provide some code so I can continue with my work ?

Here is the chart itself:

            <lvc:CartesianChart DataClickCommand="{Binding DrillDownCommand}" Series="{Binding SeriesCollectionDatum}" LegendLocation="None" Margin="10,10,10,0" Background="#c0c1bf" Height="222" VerticalAlignment="Top">
                <lvc:CartesianChart.AxisX>
                    <lvc:Axis Title="Datum" Labels="{Binding LabelsDatum}" LabelsRotation="20" Foreground="Black" FontSize="12" FontWeight="Bold">
                        <lvc:Axis.Separator>
                            <lvc:Separator StrokeThickness="0" Step="1"/>
                        </lvc:Axis.Separator>
                    </lvc:Axis>
                </lvc:CartesianChart.AxisX>
                <lvc:CartesianChart.AxisY>
                    <lvc:Axis Title="Broj" LabelFormatter="{Binding Formatter}" Foreground="Black" FontSize="12" FontWeight="Bold">
                        <lvc:Axis.Separator>
                            <lvc:Separator StrokeThickness="1" Step="10"/>
                        </lvc:Axis.Separator>
                    </lvc:Axis>
                </lvc:CartesianChart.AxisY>
            </lvc:CartesianChart>

The DrillDownCommand is bound in my ViewModel and it takes a ChartPoint as a parameter.

CodePudding user response:

Switched to System.Windows.Controls.DataVisualization.Charting. Surprisingly easy to use and works like a charm for, in my case, smaller data sets.

  • Related