How do I create a graph where the x, y values are updated?
I tried it as below. The simple graph works. But the x,y graph does not. How can I create an x,y graph this way?
C# code simple graph:
List<int> ValuesPoints = new List<int>();
for (int x = 0; x < 10; x ++)
ValuesPoints.Add(x);
ObservableCollection<ISeries> seriesCollection = new ObservableCollection<ISeries>();
grfArbeitsfenster2.Series = seriesCollection;
seriesCollection.Add(new LineSeries<int>
{
Values = ValuesPoints
});
C# code x,y graph
List<ObservablePoint> ValuesPoints = new List<ObservablePoint>();
for (int x = 0; x < 10; x++)
ValuesPoints.Add(new ObservablePoint(x, x+1));
ObservableCollection<ISeries> seriesCollection = new ObservableCollection<ISeries>();
grfArbeitsfenster2.Series = seriesCollection;
seriesCollection.Add(new LineSeries<ObservablePoint>
{
Values = ValuesPoints
});
Wpf Code:
<lvc:CartesianChart x:Name="grfArbeitsfenster2"
Series="{Binding Series}"
Width="700"
Height="350"
Margin="183,101,96.2,1885" />
How do I create a graph where the x, y values are updated?
I tried it as below. The simple graph works. But the x,y graph does not. How can I create an x,y graph this way?
C# code simple graph:
List<int> ValuesPoints = new List<int>();
for (int x = 0; x < 10; x ++)
ValuesPoints.Add(x);
ObservableCollection<ISeries> seriesCollection = new ObservableCollection<ISeries>();
grfArbeitsfenster2.Series = seriesCollection;
seriesCollection.Add(new LineSeries<int>
{
Values = ValuesPoints
});
C# code x,y graph
List<ObservablePoint> ValuesPoints = new List<ObservablePoint>();
for (int x = 0; x < 10; x++)
ValuesPoints.Add(new ObservablePoint(x, x+1));
ObservableCollection<ISeries> seriesCollection = new ObservableCollection<ISeries>();
grfArbeitsfenster2.Series = seriesCollection;
seriesCollection.Add(new LineSeries<ObservablePoint>
{
Values = ValuesPoints
});
Wpf Code:
<lvc:CartesianChart x:Name="grfArbeitsfenster2"
Series="{Binding Series}"
Width="700"
Height="350"
Margin="183,101,96.2,1885" />
Just going off of the documentation of the livecharts library, but have you tried binding to an ObservableCollection of ICartesianSeries rather than an ObservableCollection of ISeries?
The CartesianChart control is a 'ready to go' control to create plots using the Cartesian coordinate system, To get started all you need to do is assign the Series property with a collection of ICartesianSeries.
Link for Reference