beto-rodriguez / LiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.

Home Page:https://livecharts.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LineSeries: Define the Value of the x axis

mimeie opened this issue · comments

Hi

I've tried and tried and still have no clue. Maybe it is simple what I am looking for.

I'd like to youse a LineSeries Chart to show the progress of a certain value (y axis) over time (seconds, x-axis). To create a LineSeries with some double Values is quite easy and is working fine. but then I cannot define the x value of a datapoint, the just increment (see red marking in screenshot).
image

I first thought it is an observablePoint
var series4 = new LineSeriesProperties<ObservablePoint> { Values = new ObservableCollection<ObservablePoint> { new ObservablePoint(2, 6)} }
but it only made some kind of block inside the chart.

thanks in advance for helping.

Hey,
as you've described, if you put a double collection into the Values property, the x values are simply incremented by one.
If you want to specify the values of the x-axis, you have to add an ObservablePoint array (or list) as values, where you can put in the x and y values you need. See this example from the official docs: https://livecharts.dev/docs/WPF/2.0.0-rc2/samples.lines.xy

Greetings, ImpyKid

thanks, that was what I was looking for