public MainWindow() { InitializeComponent(); _bufferLength = _maxSamples; _nChannels = 8; _graphModels = new GraphModel[_nChannels]; _graphs = new Graph[_nChannels]; for (int i = 0; i < _nChannels; i++) { _graphs[i] = new Graph(); _graphModels[i] = new GraphModel(_graphs[i]); _graphs[i].xMin = 0; _graphs[i].xMax = _maxSamples-1; _graphs[i].yMin = -1500; _graphs[i].yMax = 1500; _graphs[i].topEdge = 5; _graphs[i].bottomEdge = 5; _graphs[i].rightEdge = 5; _graphs[i].leftEdge = 5; _graphs[i].plotColor = Color.FromArgb(200,0,0,255); //Because writable bitmaps use premultiplied alpha! graphsGrid.Children.Add(_graphs[i]); } //Initialising plot data PrepareData(); //Setting and starting timer; _timer = new FastTimer(3, 100, InsertPoints); _timer.Start(); }
/// <summary> /// Initialization of the view components for all graphs in the program /// </summary> private void PrepareGraphs() { //Acquisition _acqGraphs = new Graph[acqViewModel.plotModels.Length]; _acqIntervals = new IntervalMarker[acqViewModel.plotModels.Length]; for (int i = 0; i < acqViewModel.plotModels.Length; i++) { _acqGraphs[i] = new Graph(); _acqGraphs[i].leftTitle = (i+1).ToString(); _acqGraphs[i].isToggleable = true; _acqIntervals[i] = new IntervalMarker(); _acqIntervals[i].visualIndex = -1; _acqIntervals[i].color = Color.FromArgb(64, 0, 255, 0); _acqIntervals[i].visible = false; _acqGraphs[i].graphMarkers.Add(_acqIntervals[i]); acqViewModel.plotModels[i].graph = _acqGraphs[i]; _acqGraphs[i].Margin = new Thickness(2); _acqGraphs[i].bottomEdge = 1; _acqGraphs[i].topEdge = 1; acqGraphsGrid.Children.Add(_acqGraphs[i]); _acqGraphs[i].toggle = true; } //Realtime -> Should be something similar _reaGraphs = new Graph[reaViewModel.plotModels.Length]; _reaIntervals = new IntervalMarker[reaViewModel.plotModels.Length]; _reaThresholds = new ThresholdMarker[reaViewModel.plotModels.Length]; for (int i = 0; i < reaViewModel.plotModels.Length; i++) { _reaGraphs[i] = new Graph(); _reaGraphs[i].leftTitle = (i+1).ToString(); _reaGraphs[i].isToggleable = false; _reaIntervals[i] = new IntervalMarker(); _reaIntervals[i].visualIndex = -1; _reaIntervals[i].color = Color.FromArgb(64, 0, 255, 0); _reaIntervals[i].visible = false; _reaGraphs[i].graphMarkers.Add(_reaIntervals[i]); _reaThresholds[i] = new ThresholdMarker(); _reaThresholds[i].visualIndex = 1; _reaThresholds[i].color = Color.FromArgb(255, 255, 0, 255); _reaThresholds[i].visible = false; _reaGraphs[i].graphMarkers.Add(_reaThresholds[i]); reaViewModel.plotModels[i].graph = _reaGraphs[i]; _reaGraphs[i].Margin = new Thickness(2); reaGraphsGrid.Children.Add(_reaGraphs[i]); } }
public GraphModel(Graph graph) { Init(); this._graph = graph; }