Skip to content

Instantly share code, notes, and snippets.

@backsy
Created November 19, 2016 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save backsy/94fa0e5ff7882e6479b236fccf0d4111 to your computer and use it in GitHub Desktop.
Save backsy/94fa0e5ff7882e6479b236fccf0d4111 to your computer and use it in GitHub Desktop.
Bindings
MainWindow.xaml
<wpf:LineSeries x:Name="LineSeries" PointGeometrySize="18" StrokeThickness="4" />
MainWindow.xaml.cs
this.OneWayBind(ViewModel, vm => vm.ChartValues, v => v.LineSeries.Values);
MainWindowViewModel.cs
public double Point {
get { return _point; }
set {
_point = value;
var now = DateTime.Now;
ChartValues.Add(new MeasureModel
{
DateTime = now,
Value = value
});
SetAxisLimits(now);
if (ChartValues.Count > 30) ChartValues.RemoveAt(0);
}
}
parser
.SensorValues
.Select(values => values.Temp1)
.Subscribe(val => Point = val);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment