Example #1
0
 /// <summary>
 /// 曲线控件属性初始化
 /// </summary>
 private void CurveInitialize()
 {
     dataSource1 = new ObservableDataSource <Point>();
     dataSource1.SetXYMapping(p => p);
     dataSource2 = new ObservableDataSource <Point>();
     dataSource2.SetXYMapping(p => p);
     dataSource3 = new ObservableDataSource <Point>();
     dataSource3.SetXYMapping(p => p);
     dataSource4 = new ObservableDataSource <Point>();
     dataSource4.SetXYMapping(p => p);
     dataSource5 = new ObservableDataSource <Point>();
     dataSource5.SetXYMapping(p => p);
     dataSource6 = new ObservableDataSource <Point>();
     dataSource6.SetXYMapping(p => p);
     dataSource7 = new ObservableDataSource <Point>();
     dataSource7.SetXYMapping(p => p);
     dataSource8 = new ObservableDataSource <Point>();
     dataSource8.SetXYMapping(p => p);
     plotter1.AddLineGraph(dataSource1, Colors.Red, 2, "轨顶温度");
     plotter1.AddLineGraph(dataSource2, Colors.Green, 2, "轨脚边温度");
     plotter1.AddLineGraph(dataSource3, Colors.Blue, 2, "内轨脚温度");
     plotter3.AddLineGraph(dataSource5, Colors.Red, 2, "喷风压力");
     plotter2.AddLineGraph(dataSource4, Colors.Red, 2, "冷却温度");
     plotter4.AddLineGraph(dataSource6, Colors.Green, 2, "轨顶流量");
     plotter4.AddLineGraph(dataSource7, Colors.Blue, 2, "轨腰流量");
     plotter4.AddLineGraph(dataSource8, Colors.Yellow, 2, "轨底流量");
 }
Example #2
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     planeLocations = new ObservableDataSource <Point>();
     // Set identity mapping of point in collection to point on plot
     planeLocations.SetXYMapping(p => p);
     plotter.AddLineGraph(planeLocations, 2, "Route");
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Create first source
            source1 = new ObservableDataSource <Tuple <double, double> >();
            source1.SetXYMapping(z => {
                Point p = new Point(z.Item1, z.Item2);
                return(p);
            });
            HorizontalAxis axis = (HorizontalAxis)plotter.MainHorizontalAxis;

            //axis.LabelProvider.SetCustomFormatter(info => info.Tick.ToString("#.######E+0"));
            axis.LabelProvider.SetCustomFormatter(info => StringUtils.CodeString(info.Tick));

            VerticalAxis axis2 = (VerticalAxis)plotter.MainVerticalAxis;

            //axis.LabelProvider.SetCustomFormatter(info => info.Tick.ToString("#.######E+0"));
            axis2.LabelProvider.SetCustomFormatter(info => StringUtils.CodeString(info.Tick));

            Random rnd = new Random();

            for (int i = 0; i < 50; i++)
            {
                source1.Collection.Add(new Tuple <double, double>(i, rnd.Next(100)));
                //sourcevoltage.Collection.Add(new Tuple<double, double>(i, 10 + rnd.Next(20)));
            }

            linegraph.DataSource = source1;
        }
 /// <summary>
 /// this is the constructor of this class.
 /// </summary>
 /// <param name="_planeLocations"></param>
 /// <param name="_plotter"></param>
 public TelnetServer(ObservableDataSource <Point> _planeLocations, ChartPlotter _plotter)
 {
     this.s         = null;
     planeLocations = _planeLocations;
     plotter        = _plotter;
     isConnected    = false;
 }
        public void EditGraph()
        {
            ObservableDataSource <Trade> source = new ObservableDataSource <Trade>(_listOfTrade);

            source.SetXMapping(c => c.Counter);
            source.SetYMapping(d => d.Price);

            ObservableDataSource <Trade> sourceMarker = new ObservableDataSource <Trade>(_listMarker);

            sourceMarker.SetXMapping(c => c.Counter);
            sourceMarker.SetYMapping(d => d.Price);

            plotter.AddLineGraph(source, new Pen(Brushes.Gold, 3), new PenDescription("chart"));

            LineAndMarker <MarkerPointsGraph> chartMarkerBuy = plotter.AddLineGraph(
                sourceMarker,
                new Pen(Brushes.Red, 3),
                new TrianglePointMarker {
                Size = 5, Fill = Brushes.Blue
            },
                new PenDescription("marker"));

            //chartMarkerBuy.LineGraph.DataSource = null;

            plotter.Viewport.FitToView();
        }
Example #6
0
        /// <summary>
        /// 创建直线源
        /// </summary>
        /// <param name="name"></param>线条标示
        /// <param name="lineColor"></param>线条颜色 eg: Brushs.red
        /// <param name="lineWidth"></param>线条宽度
        /// <param name="pointColor"></param>关键点颜色
        /// <param name="pointSize"></param>关键点大小
        /// <returns></returns>
        public s_Line AddLine(string name, SolidColorBrush lineColor, uint lineWidth, SolidColorBrush pointColor, uint pointSize)
        {
            s_Line line = new s_Line();

            ObservableDataSource <Point> dataSource = new ObservableDataSource <Point>();

            LineAndMarker <ElementMarkerPointsGraph> chart = new LineAndMarker <ElementMarkerPointsGraph>();


            chart = Plot.AddLineGraph(dataSource,
                                      new Pen(lineColor, lineWidth),
                                      new CircleElementPointMarker
            {
                Size  = pointSize,
                Brush = pointColor,
                Fill  = pointColor
            },
                                      new PenDescription(name));


            line.chart  = chart;
            line.source = dataSource;

            return(line);
        }
Example #7
0
        internal void EditTargetGraph(Point newPoint, ObservableDataSource <Point> dataSourceToUpdate)
        {
            var pt = SelectedLineForSubtitleFix.Where(s => newPoint.X == s.X).First();

            pt.Y = newPoint.Y;
            UpdateGraph(SelectedLineForSubtitleFix, dataSourceToUpdate);
        }
        public MainWindow()
        {
            InitializeComponent();

            // Create first source
            source1 = new ObservableDataSource<Point>();
            // Set identity mapping of point in collection to point on plot
            source1.SetXYMapping(p => p);

            source2 = new ObservableDataSource<Point>();
            source2.SetXYMapping(p => p);

            source3 = new ObservableDataSource<Point>();
            source3.SetXYMapping(p => p);

            source4 = new ObservableDataSource<Point>();
            source4.SetXYMapping(p => p);

            source5 = new ObservableDataSource<Point>();
            source5.SetXYMapping(p => p);

            // Add all three graphs. Colors are not specified and chosen random
            graphT = plotterT.AddLineGraph(source1, Colors.Red, 2, "TEMP");
            graphH = plotterH.AddLineGraph(source2, Colors.Green, 2, "HUM");
            graphD = plotterD.AddLineGraph(source3, Colors.Blue, 2, "DUST");
            graphP = plotterP.AddLineGraph(source4, Colors.DarkSeaGreen, 2, "PRESS");
            graphACC = plotterACC.AddLineGraph(source5, Colors.CadetBlue, 2, "ACC");

            //timer.Tick += new EventHandler(timer_Tick);//Alarm Signal lamp flicker
            //timer.Interval = new TimeSpan(1000);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Create first source
            source1 = new ObservableDataSource <Point>();
            // Set identity mapping of point in collection to point on plot
            source1.SetXYMapping(p => p);

            // Create second source
            source2 = new ObservableDataSource <Point>();
            // Set identity mapping of point in collection to point on plot
            source2.SetXYMapping(p => p);

            // Create third source
            source3 = new ObservableDataSource <Point>();
            // Set identity mapping of point in collection to point on plot
            source3.SetXYMapping(p => p);

            // Add all three graphs. Colors are not specified and chosen random

            //todo
            //plotter.AddLineGraph(source1, 2, "Data row 1");
            //plotter.AddLineGraph(source2, 2, "Data row 2");
            //plotter.AddLineGraph(source3, 2, "Data row 3");

            // Start computation process in second thread
            simThread = new Thread(new ThreadStart(Simulation));
            simThread.IsBackground = true;
            simThread.Start();
        }
Example #10
0
        private void UpdateGraph(SampleCollection col, ObservableDataSource <Point> dataSourceToUpdate)
        {
            var points = col.Select(p => new Point(p.X, p.Y));

            dataSourceToUpdate.Collection.Clear();
            dataSourceToUpdate.AppendMany(points);
        }
Example #11
0
        public PhosResultsViewModel(CamPhosResults camResults, SpectrometerPhosResults spectroResults)
        {
            base.DisplayName        = "PhosResultsViewModel";
            ShowListItemControl     = false;
            _phosImages             = camResults.Images;
            _phosFilteredImages     = camResults.FilteredImages;
            _phosSpectra            = spectroResults.Spectra;
            CurrentPhosItem         = 1;
            CurrentSpectraItem      = 1;
            SaveFolderPath          = Properties.Settings.Default.SaveFolderPath;
            _startTimeStamp         = camResults.StartTimeStamp;
            _spectrumStartTimeStamp = spectroResults.StartTimeStamp;

            CommandSetFolder           = new RelayCommand(param => SetFolder(), cc => _busy == false);
            CommandPreviousPhosItem    = new RelayCommand(param => PreviousPhosItem(), cc => _busy == false);
            CommandNextPhosItem        = new RelayCommand(param => NextPhosItem(), cc => _busy == false);
            CommandPreviousSpectraItem = new RelayCommand(param => PreviousSpectraItem(), cc => _busy == false);
            CommandNextSpectraItem     = new RelayCommand(param => NextSpectraItem(), cc => _busy == false);
            CommandSave    = new RelayCommand(param => Save(), cc => _busy == false);
            CommandSaveAll = new RelayCommand(param => Save(true), cc => _busy == false);

            CommandCalibrate = new RelayCommand(param => Calibrate());

            SpectrumData       = new ObservableDataSource <Point>();
            SmoothSpectrumData = new ObservableDataSource <Point>();
        }
Example #12
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     planeLocations = new ObservableDataSource <Point>();
     planeLocations.SetXYMapping(p => p);
     plotter.AddLineGraph(planeLocations, 2, "Route");
     flightBoardVM.PropertyChanged += Vm_PropertyChanged;
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            
            // Perform any additional setup after loading the view, typically from a nib.

            var localFile = Path.Combine (NSBundle.MainBundle.BundlePath, "TwitterJson.txt");

            TwitterResponse response;

            using (var reader = new StreamReader (localFile))
            {
                var serializer = DependencyResolver.Current.GetService<IJsonSerializer> ();

                response = serializer.DeserializeFromReader<TwitterResponse>(reader);
            }

            if (response != null)
            {
                var dataSource = new ObservableDataSource<Datum>(response.data);
                dataSource.Bind (this.table);
            }

//          serializer.Deserialize<TwitterResponse>()
        }
Example #14
0
        private void RebuildQuickView()
        {
            var spectrum = new ObservableDataSource <Point>(cursor.GetSpectrum());

            var quickViewSpectrum = new LineGraph(spectrum)
            {
                LinePen          = new Pen(new SolidColorBrush(Colors.Green), 3),
                Description      = new PenDescription("Raw Data"),
                FilteringEnabled = true
            };

            for (var childIndex = SpectrumQuickView.Children.Count - 1; childIndex > 0; childIndex--)
            {
                if (SpectrumQuickView.Children[childIndex] is LineGraph ||
                    SpectrumQuickView.Children[childIndex] is MarkerPointsGraph)
                {
                    SpectrumQuickView.Children.RemoveAt(childIndex);
                }
            }

            SpectrumQuickView.Children.Add(quickViewSpectrum);

            if (ViewModel.EnableQuickViewPeaks)
            {
                RebuildQuickViewPeaks();
            }
        }
 private void checkBox_origin_Unchecked(object sender, RoutedEventArgs e)
 {
     //x1_origin = 0;
     dataSource_Y1_Origin = new ObservableDataSource <Point>();
     plotter.Children.Remove(lineOrigin);
     plotterDisplayOrigin = false;
 }
Example #16
0
        public static void SetSourceMapping(this ObservableDataSource <HistoryData> source, ITag currentTag)
        {
            if (currentTag != null)
            {
                switch (currentTag.Address.VarType)
                {
                case DataType.BOOL:
                    source.SetYMapping(Y => Y.Value.Boolean ? 1 : 0);
                    break;

                case DataType.BYTE:
                    source.SetYMapping(Y => Y.Value.Byte);
                    break;

                case DataType.WORD:
                case DataType.SHORT:
                    source.SetYMapping(Y => Y.Value.Int16);
                    break;

                case DataType.TIME:
                case DataType.INT:
                    source.SetYMapping(Y => Y.Value.Int32);
                    break;

                case DataType.FLOAT:
                    source.SetYMapping(Y => Y.Value.Single);
                    break;
                }
            }
        }
 private void checkBox_shake_Unchecked(object sender, RoutedEventArgs e)
 {
     // x3_shake = 0;
     dataSource_Y2_Shake = new ObservableDataSource <Point>();
     plotter.Children.Remove(lineShake);
     plotterDisplayShake = false;
 }
Example #18
0
        public MainWindowViewModel(IEventAggregator ev)
        {
            Adding = true;

            a = 5;
            b = 50;

            disp = Dispatcher.CurrentDispatcher;

            ExampleCollection = new MTObservableCollection <Point>();
            ExampleCollection.Add(new Point(1, 1));
            ExampleCollection.Add(new Point(2, 2));
            ExampleCollection.Add(new Point(3, 3));
            ExampleCollection.Add(new Point(5, 5));

            ss = new ObservableDataSource <Point>();
            ss.AppendAsync(disp, new Point(1, 1));
            ss.AppendAsync(disp, new Point(2, 2));
            ss.AppendAsync(disp, new Point(3, 3));
            ss.AppendAsync(disp, new Point(5, 5));

            thread = new Thread(new ThreadStart(AddPoints));
            thread.IsBackground = true;
            thread.Start();
        }
Example #19
0
        private void ComputeCD(object sender, RoutedEventArgs e)
        {
            if (spaceViewModel.RawData == null)
            {
                return;
            }

            plotterCD.RemoveUserElements();
            m_CDlineGraphs.Clear();
            m_CDresults = new List <Point2D> [spaceViewModel.NumberOfDimensions];
            for (int n = 0; n < spaceViewModel.NumberOfDimensions; n++)
            {
                m_CDresults[n] = spaceViewModel.ComputeCorrelationalDimensionCurve(n + 2).ToList();
                var lineGraph = plotterCD.AddLineGraph(new ObservableDataSource <Point2D>(m_CDresults[n]), 1);
                m_CDlineGraphs.Add(lineGraph);
            }

            tabControlMain.SelectedIndex = 1;

            plotterKE.RemoveUserElements();
            for (int curveIndexA = 0, curveIndexB = 1; curveIndexB < spaceViewModel.NumberOfDimensions; curveIndexA++, curveIndexB++)
            {
                double firstCommonElement = Math.Max(m_CDresults[curveIndexA].First().X, m_CDresults[curveIndexB].First().X);
                int    i = m_CDresults[curveIndexA].IndexOf(m_CDresults[curveIndexA].First((p) => (p.X == firstCommonElement)));
                int    j = m_CDresults[curveIndexB].IndexOf(m_CDresults[curveIndexB].First((p) => (p.X == firstCommonElement)));

                var intersection = new ObservableDataSource <Point2D>();
                for (; i < m_CDresults[curveIndexA].Count && j < m_CDresults[curveIndexB].Count && m_CDresults[curveIndexA][i].X == m_CDresults[curveIndexB][j].X; i++, j++)
                {
                    intersection.AppendAsync(Dispatcher, new Point2D(m_CDresults[curveIndexA][i].X, m_CDresults[curveIndexA][i].Y - m_CDresults[curveIndexB][j].Y));
                }

                plotterKE.AddLineGraph(intersection, 1, String.Format("KE {0}-{1}", curveIndexA, curveIndexB));
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.

            var localFile = Path.Combine(NSBundle.MainBundle.BundlePath, "TwitterJson.txt");

            TwitterResponse response;

            using (var reader = new StreamReader(localFile))
            {
                var serializer = DependencyResolver.Current.GetService <IJsonSerializer> ();

                response = serializer.DeserializeFromReader <TwitterResponse>(reader);
            }

            if (response != null)
            {
                var dataSource = new ObservableDataSource <Datum>(response.data);
                dataSource.Bind(this.table);
            }

//          serializer.Deserialize<TwitterResponse>()
        }
Example #21
0
        private void circle()
        {
            double a     = amp.Max(h => h.Max(x => x));
            double delta = 0.01f;
            double i     = 0;

            bool circle = false;

            source2 = new ObservableDataSource <Point>();
            source2.SetXYMapping(p => p);

            while (!circle)
            {
                Point p = new Point(a * Math.Sin(i), a * Math.Cos(i));

                source2.AppendAsync(Dispatcher, p);

                if (source2.Collection.Count > 2 * Math.PI / delta + 1)
                {
                    circle = true;

                    Dispatcher.BeginInvoke(new Action(delegate()
                    {
                        vectPlotter.Children.Remove(cir);

                        cir = vectPlotter.AddLineGraph(source2, Colors.Gray, 2);

                        source2.Collection[source2.Collection.Count - 1] = source2.Collection[0];
                        vectPlotter.FitToView();
                    }));
                }

                i += delta;
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Create first source
            source1 = new ObservableDataSource<Point>();
            // Set identity mapping of point in collection to point on plot
            source1.SetXYMapping(p => p);

            // Create second source
            source2 = new ObservableDataSource<Point>();
            // Set identity mapping of point in collection to point on plot
            source2.SetXYMapping(p => p);

            // Create third source
            source3 = new ObservableDataSource<Point>();
            // Set identity mapping of point in collection to point on plot
            source3.SetXYMapping(p => p);

            // Add all three graphs. Colors are not specified and chosen random
            plotter.AddLineGraph(source1, 2, "Data row 1");
            plotter.AddLineGraph(source2, 2, "Data row 2");
            plotter.AddLineGraph(source3, 2, "Data row 3");

            // Start computation process in second thread
            Thread simThread = new Thread(new ThreadStart(Simulation));
            simThread.IsBackground = true;
            simThread.Start();
        }
 private void checkBox_origin_Checked(object sender, RoutedEventArgs e)
 {
     plotter.Children.Remove(lineOrigin);
     //x1_origin = 0;
     dataSource_Y1_Origin = new ObservableDataSource <Point>();
     lineOrigin           = plotter.AddLineGraph(dataSource_Y1_Origin, Colors.Gray, 2, "Origin");
     plotterDisplayOrigin = true;
 }
Example #24
0
 private void InitDataSource()
 {
     dataSource = new ObservableDataSource <Point>();
     for (int _ = 0; _ < TIMESPAN; ++_)
     {
         dataSource.AppendAsync(base.Dispatcher, new Point(0, 0));
     }
 }
 /// <summary>
 /// this is the constructor of this class.
 /// </summary>
 public FlightBoard()
 {
     InitializeComponent();
     planeLocations = new ObservableDataSource <Point>();
     plotter.AddLineGraph(planeLocations, Colors.Blue, 2, "Route");
     viewModel   = new FlightBoardViewModel(planeLocations, plotter);
     DataContext = viewModel;
 }
        private ObservableDataSource <TimeParam> InitSource()
        {
            var source = new ObservableDataSource <TimeParam>();

            source.SetXMapping(x => timeSpanAxis.ConvertToDouble(x.Time));
            source.SetYMapping(y => y.y);
            return(source);
        }
 public FlightBoard()
 {
     InitializeComponent();
     vm = FlightBoardViewModel.Instance;
     vm.PropertyChanged += Vm_PropertyChanged;
     planeLocations      = null;
     DataContext         = vm;
 }
Example #28
0
        private void UpdatePeakValue()
        {
            for (var childIndex = PeakValue.Children.Count - 1; childIndex > 0; childIndex--)
            {
                if (PeakValue.Children[childIndex] is LineGraph ||
                    PeakValue.Children[childIndex] is MarkerPointsGraph)
                {
                    PeakValue.Children.RemoveAt(childIndex);
                }
            }

            var xmin = double.MaxValue;
            var xmax = double.MinValue;
            var ymin = double.MaxValue;
            var ymax = double.MinValue;

            for (var peakIndex = 0; peakIndex < ViewModel.NumberOfDetectedPeaks; peakIndex++)
            {
                var peakId = peakIndex;
                var peak   = peaks.Get(peakId);

                if (peak == null)
                {
                    continue;
                }

                var points = peak.Keys.Select(voltage => new Point(voltage, peak[voltage].Alpha)).ToList();

                xmin = Math.Min(xmin, points.Min(p => p.X));
                ymin = Math.Min(ymin, points.Min(p => p.Y));
                xmax = Math.Max(xmax, points.Max(p => p.X));
                ymax = Math.Max(ymax, points.Max(p => p.Y));

                var data = new ObservableDataSource <Point>(points);

                var peakData = new MarkerPointsGraph(data)
                {
                    Marker =
                        new CirclePointMarker
                    {
                        Pen  = new Pen(new SolidColorBrush(peakColors[peakId]), 4),
                        Fill = new SolidColorBrush(peakColors[peakId])
                    },
                    Description = new StandardDescription($"peak {peakId} value")
                };

                PeakValue.Children.Add(peakData);
            }

            var logymin = Math.Log10(ymin);
            var logymax = Math.Log10(ymax);

            var rect = new Rect(new Point(xmin, logymin + 0.1 * logymax), new Point(xmax, logymax - 0.1 * logymax));

            PeakValue.Visible = rect;
            PeakValue.UpdateLayout();
        }
Example #29
0
 public void setLinesData(LinePlotter plotter)
 {
     this.initData      = plotter.initData;
     this.normalData    = plotter.normalData;
     this.distractAData = plotter.distractAData;
     this.distractBData = plotter.distractBData;
     this.distractCData = plotter.distractCData;
     this.distractDData = plotter.distractDData;
 }
Example #30
0
        private void BtnStart_OnClick(object sender, RoutedEventArgs e)
        {
            if (_ping == null)
            {
                Debug.Assert(_plotterChildren == null);
                Debug.Assert(_ds == null);
                try
                {
                    var host = (tbHost.Text ?? string.Empty).Trim();
                    if (string.IsNullOrWhiteSpace(host))
                    {
                        throw new ArgumentException("Host can not be empty.");
                    }
                    var interval = TimeSpan.Parse((tbInterval.Text ?? string.Empty));
                    if (interval <= TimeSpan.Zero)
                    {
                        throw new ArgumentException("Interval must be greater than zero.");
                    }
                    var timeout = TimeSpan.Parse((tbTimeout.Text ?? string.Empty));
                    if (timeout <= TimeSpan.Zero)
                    {
                        throw new ArgumentException("Timeout must be greater than zero.");
                    }
                    _ping = new PingClient(host, interval, timeout);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                _ds = new ObservableDataSource<PingResult>();
                _ping.PingTick += PingOnPingTick;
                //_ping.PingException += PingOnPingException;
                _ds.SetXMapping(item => dateAxis.ConvertToDouble(item.DateTime));
                _ds.SetYMapping(item => item.TimeCost.TotalMilliseconds);
                _plotterChildren = new IPlotterElement[]
                {
                    new LineGraph(_ds)
                    {
                        LinePen = new Pen(new SolidColorBrush(Colors.Green), 2),
                        Description = new PenDescription(_ping.Host)
                    },
                    new MarkerPointsGraph(_ds) {Marker = new CirclePointMarker {Size = 5}}
                };
                foreach (var child in _plotterChildren)
                {
                    plotter.AddChild(child);
                }

                Header.Content = string.Format("Ping {0}", _ping.Host);
            }
            _ping.Start();

            btnStart.IsEnabled = false;
            btnPause.IsEnabled = true;
            pnSettings.IsEnabled = false;
        }
 public ChartWorkspaceViewModel()
 {
     _itemValuesDataSource = new ObservableDataSource<SingleItemValueViewModel>();
     DateTime now = DateTime.Now;
     DateFrom = new DateTime(now.Year, now.Month, now.Day, 0,0,0);
     DateTo = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
     MonitorRequestDelay = 1000;
     _monitorState = MonitorState.passive;
 }
Example #32
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            planeLocations = new ObservableDataSource <Point>();
            // Set identity mapping of point in collection to point on plot
            planeLocations.SetXYMapping(p => p);

            plotter.AddLineGraph(planeLocations, 2, "Route");
            //Subscribe to event changes for points.
            vm.PropertyChanged += Vm_PropertyChanged;
        }
Example #33
0
		void EditPlotter()
		{
			_source = new ObservableDataSource<Trade>();
			_source.SetXMapping(x => x.Counter);
			_source.SetYMapping(y => y.Price);

			var line = plotter.AddLineGraph(_source,
					new Pen(Brushes.Gold, 3),
					new PenDescription("Sin(x + phase)"));
		}
Example #34
0
 void BuildCharts(int n)
 {
     sources = new ObservableDataSource <Point> [n];
     for (int i = 0; i < n; i++)
     {
         sources[i] = new ObservableDataSource <Point>();
         sources[i].SetXYMapping(p => p);
         plotter.AddLineGraph(sources[i], 1, dataReader.ChannelName(i));
     }
 }
 private void checkBox_shake_Checked(object sender, RoutedEventArgs e)
 {
     // if (dataSource_Y2_Shake == null)
     {
         dataSource_Y2_Shake = new ObservableDataSource <Point>();
         lineShake           = plotter.AddLineGraph(dataSource_Y2_Shake, Colors.HotPink, 2, "Shake");
     }
     //  plotter.Children.Remove(lineShake);
     plotterDisplayShake = true;
 }
 /// <summary>
 /// this is the constructor of this class.
 /// </summary>
 /// <param name="_planeLocations"></param>
 /// <param name="_plotter"></param>
 public FlightBoardModel(ObservableDataSource <Point> _planeLocations, ChartPlotter _plotter)
 {
     planeLocations = _planeLocations;
     plotter        = _plotter;
     ts             = new TelnetServer(planeLocations, plotter);
     mtc            = new MyTelnetClient();
     ip             = (string)Settings.Default["IP"];
     clientPort     = Int32.Parse((string)Settings.Default["PortClient"]);
     serverPort     = Int32.Parse((string)Settings.Default["PortServer"]);
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            irrResults = new ObservableDataSource<Point>();
            irrResults.SetXYMapping(p => p);

            plotter.AddLineGraph(irrResults, 1, "IRR");

            Thread simThread = new Thread(new ThreadStart(Plot));
            simThread.IsBackground = true;
            simThread.Start();
        }
Example #38
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ObservableDataSource<Point> source = new ObservableDataSource<Point>();
            this.plotter.AddLineGraph(source, Colors.Black, 1.0, "RVector");

            REngine engine = REngine.GetInstance();
            NumericVector sequence = engine.Evaluate("x <- seq(-3, 3, 0.01)").AsNumeric();
            NumericVector dnorm = engine.Evaluate("dnorm(x, 0, 1)").AsNumeric();
            IEnumerable<Point> data = sequence.Zip(dnorm, (x, y) => new Point(x, y));
            source.AppendMany(data);
        }
Example #39
0
        public Series(ChartPlotter plotter, string descr, double thick, Color color)
        {
            DataSource = new ObservableDataSource<Point>();
              DataSource.SetXYMapping(pt => pt);

              plotter.Dispatcher.Invoke((Action)
            delegate()
            {
              Graph = plotter.AddLineGraph(DataSource, color, thick, descr);
            }
              );
        }
        public MainWindow()
        {
            InitializeComponent();
            FillTestData();

            y_valuesDataSource = new ObservableDataSource<int>(y_values);
            y_valuesDataSource.SetYMapping(y => y);

            x_valuesDataSource = new ObservableDataSource<int>(x_values);
            x_valuesDataSource.SetXMapping(x => x);

            var compositeDataSource = new CompositeDataSource(x_valuesDataSource, y_valuesDataSource);

            //chartPlotter.AddLineGraph(compositeDataSource);

            //chartPlotter.Viewport.FlowDirection = FlowDirection.RightToLeft;
            //chartPlotter.Viewport.FitToView();
        }
Example #41
0
        private void run()
        {
            var lens = new LensCompiler();

            var currX = getDouble(StartPos, -10);
            var endX = getDouble(EndPos, 10);
            var currY = 0.0;
            var step = getDouble(Step, 0.1);

            var obs = new ObservableDataSource<Point>();
            obs.SetXYMapping(p => p);

            if (m_PreviousGraph != null)
                m_PreviousGraph.Remove();

            m_PreviousGraph = Chart.AddLineGraph(obs, Colors.Green, 2, "Graph");

            lens.RegisterProperty("x", () => currX);
            lens.RegisterProperty("y", () => currY, y => currY = y);

            try
            {
                var fx = lens.Compile(Func.Text);

                while (currX < endX)
                {
                    fx();
                    obs.AppendAsync(Chart.Dispatcher, new Point(currX, currY));
                    currX += step;
                }
            }
            catch (LensCompilerException ex)
            {
                MessageBox.Show(
                    ex.FullMessage,
                    "Compilation Error",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error
                );
            }
        }
Example #42
0
        public UIWindow(SimulationCore displayModule)
        {
            ElementHost.EnableModelessKeyboardInterop(this);

            InitializeComponent();

            mutationButtonMapping = new Dictionary<Button, List<Mutation>>();

            startConfigChoices = new Dictionary<ComboBoxItem, Type>();
            IEnumerable<String> paramFileNames = Directory.EnumerateFiles("Content");

            foreach (String f in paramFileNames)
            {
                if(System.IO.Path.GetExtension(f) == ".json"){
                    ComboBoxItem newItem = new ComboBoxItem();
                    newItem.Content = System.IO.Path.GetFileName(f);
                    startConfigurationComboBox.Items.Add(newItem);
                }
            }

            finalCellNumberDataSource = new ObservableDataSource<Point>();
            finalCellNumberDataSource.SetXYMapping(p => p);
            blastCellNumberDataSource = new ObservableDataSource<Point>();
            blastCellNumberDataSource.SetXYMapping(p => p);
            cellCount.AddLineGraph(finalCellNumberDataSource, Colors.Green, 2, "final cells");
            cellCount.AddLineGraph(blastCellNumberDataSource, Colors.Red, 2, "blast cells");
            cellCount.LegendVisible = false;

            mutationCountDataSource = new ObservableDataSource<Point>();
            mutationCountDataSource.SetXYMapping(p => p);
            mutationCount.AddLineGraph(mutationCountDataSource, Colors.Black, 2, "mutations");
            mutationCount.LegendVisible = false;

            bloodVesselCountCountDataSource = new ObservableDataSource<Point>();
            bloodVesselCountCountDataSource.SetXYMapping(p => p);
            bloodVesselCount.AddLineGraph(bloodVesselCountCountDataSource, Colors.Purple, 2, "blood vessels");
            bloodVesselCount.LegendVisible = false;

            stopSimulationButton.IsEnabled = false;
            mutationCreationButton.IsEnabled = false;
        }
Example #43
0
		public void EditGraph()
		{
			ObservableDataSource<Trade> source = new ObservableDataSource<Trade>(_listOfTrade);
			source.SetXMapping(c => c.Counter);
			source.SetYMapping(d => d.Price);

			ObservableDataSource<Trade> sourceMarker = new ObservableDataSource<Trade>(_listMarker);
			sourceMarker.SetXMapping(c => c.Counter);
			sourceMarker.SetYMapping(d => d.Price);

			plotter.AddLineGraph(source, new Pen(Brushes.Gold, 3), new PenDescription("chart"));

			LineAndMarker<MarkerPointsGraph> chartMarkerBuy = plotter.AddLineGraph(
				sourceMarker,
				new Pen(Brushes.Red, 3),
				new TrianglePointMarker { Size = 5, Fill = Brushes.Blue },
				new PenDescription("marker"));
			//chartMarkerBuy.LineGraph.DataSource = null;

			plotter.Viewport.FitToView();
		}
Example #44
0
        /// <summary>
        /// Constructeur
        /// </summary>
        public HomeViewModel()
        {
            // Set-up commands
            DisconnectCommand = new RelayCommand(param => Disconnect(), param => true);
            UserProfileCommand = new RelayCommand(param => UserProfile(), param => true);
            AllPatientCommand = new RelayCommand(param => AllPatient(), param => true);
            AllUserCommand = new RelayCommand(param => AllUser(), param => true);

            // Loading default viewmodel
            CurrentViewModel = new PatientManagementViewModel();

            SourceTemp = new ObservableDataSource<Point>();
            SourceTemp.SetXYMapping(p => p);

            SourceHeart = new ObservableDataSource<Point>();
            SourceHeart.SetXYMapping(p => p);

            /*
            ServiceLive.ServiceLiveClient serviceClient = new ServiceLive.ServiceLiveClient();
            serviceClient.Subscribe();
             */
        }
        /// <summary>
        /// Display data for both Processor graph and Queue graph
        /// </summary>
        /// <param name="procStats">Processor usage statistics</param>
        /// <param name="queueStats">Queue usage statistics per processor</param>
        public void DisplayGraphs(IEnumerable<Point> procStats, IEnumerable<IEnumerable<Point>> queueStats)
        {
            var colors = new[]
            {
              "#FFBF00",
              "#E32636",
              "#0000FF",
              "#008000",
              "#00FFFF",
              "#5D8AA8",
              "#4B5320",
              "#B8860B",
              "#6D351A",
              "#BDB76B",
              "#66FF00",
              "#CC5500",
              "#85BB65",
              "#DFFF00",
              "#8B008B"
            };

              // initialize processor usage graph
              var procSource = new ObservableDataSource<Point>();
              procSource.SetXYMapping(pt => pt);
              ProcessorUsageChart.AddLineGraph(procSource, Colors.Blue, 1, "Processor usage");
              procSource.AppendMany(procStats);

              var pidx = 1;
              foreach(var curr in queueStats)
              {
            var queueSource = new ObservableDataSource<Point>();
            procSource.SetXYMapping(pt => pt);
            QueueLengthChart.AddLineGraph(queueSource, (Color)ColorConverter.ConvertFromString(colors[(pidx-1) % colors.Length]), 2, "Processor #" + pidx.ToString() + " queue");
            queueSource.AppendMany(curr);
            pidx++;
              }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // 1. 
            this.source1 = new ObservableDataSource<Point>();
            this.source1.SetXYMapping(point => point);
            this.BalancePlotter.AddLineGraph(source1, Color.FromRgb(0, 0, 0), 1.0, "Balance");

            // 2. 
            this.source2 = new ObservableDataSource<Point>();
            this.source2.SetXYMapping(point => point);
            // this.MoterPlotter.AddLineGraph(source2, Color.FromRgb(64, 64, 0), 1.0, "MoterR");
            this.MoterPlotter.AddLineGraph(source2, new Pen(Brushes.White, 0), new CirclePointMarker { Size = 3.0, Fill = Brushes.Red }, new PenDescription("MoterR"));
            // this.MoterPlotter.AddLineGraph(source2, Color.FromRgb(0, 64, 64), 1.0, "MoterROdo");
            // this.MoterPlotter.AddLineGraph(source2, Color.FromRgb(128, 128, 128), 1.0, "MoterL");
            // this.MoterPlotter.AddLineGraph(source2, Color.FromRgb(128, 255, 255), 1.0, "MoterLOdo");

            // 3. 
            this.source3 = new ObservableDataSource<Point>();
            this.source3.SetXYMapping(point => point);
            this.SonicPlotter.AddLineGraph(source3, Color.FromRgb(128, 128, 0), 1.0, "Distance");

            // 4. 
            this.source4 = new ObservableDataSource<Point>();
            this.source4.SetXYMapping(point => point);
            this.ReflectionPlotter.AddLineGraph(source4, Color.FromRgb(128, 0, 128), 1.0, "Refrection");
            // まいまい式
            // this.ReflectionPlotter.AddLineGraph(source4, Color.FromRgb(0, 0, 0), 1.0, "Refrection(On)");
            // this.ReflectionPlotter.AddLineGraph(source4, Color.FromRgb(0, 0, 0), 1.0, "Refrection(Off)");

            // 5.
            this.source5 = new ObservableDataSource<Point>();
            this.source5.SetXYMapping(point => point);
            this.BatteryPlotter.AddLineGraph(source5, Color.FromRgb(128, 0, 128), 1.0, "Refrection");

            // TODO : EV3からBluetooth経由で受信したデータを表示する方法で確認を取ること
            StartSimulation2();
        }
        public MainWindow()
        {
            InitializeComponent();
            //plotter

            //LineGraph lineGraph = new LineGraph(
            //plotter.AddLineGraph(source1, 2, "Data row 1");

            //List<double> x = new List<double>();
            ObservableDataSource<Point> source1 = new ObservableDataSource<Point>();

            Point x = new Point();

            for (int i = 0; i < 4 ; i++)
            {
                x.X = i;
                x.Y = i * i;
                source1.Collection.Add(x);
            }
            
            //source1.SetXMapping(x);
            plotter.AddLineGraph(source1);

        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Create first source
            plotter.DataTransform = new Log10Transform();

            double[] xArray = new double[] { 15, 14, 16, 48, 50, 51 };
            double[] yArray = new double[] { 60, 63, 64, 124, 131, 144 };

            var xds = xArray.AsXDataSource();
            var yds = yArray.AsYDataSource();
            //var ds = new CompositeDataSource(xds, yds);
            
            //LineGraph hola = new LineGraph(ds);
            //plotter.Children.Add(hola);
            source1 = new ObservableDataSource<Tuple<double, double>>();
            source2 = new ObservableDataSource<Tuple<double, double>>();
            source1.SetXYMapping(z =>
            {
                Point p = new Point(z.Item1, z.Item2);
                return p;
            });

            source2.SetXYMapping(z =>
            {
                Point p = new Point(z.Item1, z.Item2);
                return p;
            });

            for (int i=0; i<xArray.Length; i++ )
            {
                source1.Collection.Add(new Tuple<double, double>(xArray[i], yArray[i]));
                source2.Collection.Add(new Tuple<double, double>(xArray[i], yArray[i]));
            }

            plotter.MainHorizontalAxis = new HorizontalAxis
            {
                TicksProvider = new LogarithmNumericTicksProvider(10),
                LabelProvider = new UnroundingLabelProvider() { CustomFormatter = info => StringUtils.CodeString(info.Tick) }
            };

            plotter.MainVerticalAxis = new VerticalAxis
            {
                TicksProvider = new LogarithmNumericTicksProvider(10),
                LabelProvider = new UnroundingLabelProvider() { CustomFormatter = info => StringUtils.CodeString(info.Tick) }
            };
            //axis.LabelProvider.SetCustomFormatter(info => info.Tick.ToString("#.######E+0"));
            //axis.LabelProvider.SetCustomFormatter(info => StringUtils.CodeString(info.Tick));

            //VerticalAxis axis2 = (VerticalAxis)plotter.MainVerticalAxis;
            ////axis.LabelProvider.SetCustomFormatter(info => info.Tick.ToString("#.######E+0"));
            //axis2.LabelProvider.SetCustomFormatter(info => StringUtils.CodeString(info.Tick));

            //HorizontalAxis xAxis = new HorizontalAxis
            //{
            //    TicksProvider = new LogarithmNumericTicksProvider(10),
            //    LabelProvider = new UnroundingLabelProvider() { CustomFormatter = info => StringUtils.CodeString(info.Tick) }
            //};
            //plotter.MainHorizontalAxis = xAxis;

            //VerticalAxis yAxis = new VerticalAxis
            //{
            //    TicksProvider = new LogarithmNumericTicksProvider(10),
            //    LabelProvider = new UnroundingLabelProvider()
            //};
            //plotter.MainVerticalAxis = yAxis;



            otherPlotter.DataTransform = new Log10XTransform();
            otherPlotter.MainHorizontalAxis = new HorizontalAxis
            {
                TicksProvider = new LogarithmNumericTicksProvider(10),
                LabelProvider = new UnroundingLabelProvider() { CustomFormatter = info => StringUtils.CodeString(info.Tick) }
            };
            //otherPlotter.MainHorizontalAxis = xAxis2;
            //otherPlotter.MainVerticalAxis = xAxis;

            //yAxis = new VerticalAxis
            //{
            //    TicksProvider = new LogarithmNumericTicksProvider(10),
            //    LabelProvider = new UnroundingLabelProvider()
            //};
            // otherPlotter.MainVerticalAxis = yAxis;



            linegraph.DataSource = source1;
            phasegraph.DataSource = source2;

        }
 public EditableTextViewModel ()
 {
     this.Items = new ObservableDataSource<EditableText> ();
     this.latestTextChange = new EditableText ();
     this.latestCheckChange = new EditableText ();
 }
        public void Register(HotItem item, ObservableDataSource<ItemProxy> items)
        {
            items.SetYMapping(y => y.SellPrice);
            items.SetXMapping(x => HorizontalAxis.ConvertToDouble(x.DateTime));

            ChartPlotter.AddLineGraph(items, 2.0, item.Name + " S");

            chartItems.Add(item.DataId, items);
            item.PropertyChanged += item_PropertyChanged;
        }
        // based on SimulationSample.csproj in DynamicDataDisplay v0.3.1
        private void InitPlotter()
        {
            plotterSourceRed   = CreateObservableDataSourceWithIdentiyMapping();
            plotterSourceGreen = CreateObservableDataSourceWithIdentiyMapping();
            plotterSourceBlue  = CreateObservableDataSourceWithIdentiyMapping();
            plotterSourceIR    = CreateObservableDataSourceWithIdentiyMapping();

            // Add all three graphs. Colors are not specified and chosen random
            plotter.AddLineGraph(plotterSourceRed,   Color.FromArgb(128, 255,   0,   0),   2, "Red");
            plotter.AddLineGraph(plotterSourceGreen, Color.FromArgb(255,   0, 255,   0),   2, "Green");
            plotter.AddLineGraph(plotterSourceBlue,  Color.FromArgb(128,   0,   0, 255),   2, "Blue");
            plotter.AddLineGraph(plotterSourceIR,    Colors.Gray,                          2, "IR");
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //plotter.DataTransform = new Log10Transform();
            
            // Create first source
            sourcecurrent = new ObservableDataSource<Tuple<double, double>>();
            sourcecurrent.SetXYMapping(z =>
            {
                Point p = new Point(z.Item1, z.Item2);
                return p;
            });

            //plotter.DataTransform = new Log10Transform();
            //HorizontalAxis xAxis = new HorizontalAxis
            //{
            //    TicksProvider = new NumericTicksProvider(),
            //    LabelProvider = new ExponentialLabelProvider()
            //};
            //plotter.MainHorizontalAxis = xAxis;
            //VerticalAxis yAxis = new VerticalAxis
            //{
            //    //TicksProvider = new LogarithmNumericTicksProvider(10),
            //    TicksProvider = new NumericTicksProvider(),
            //    LabelProvider = new ExponentialLabelProvider()
            //};
            //plotter.MainVerticalAxis = yAxis;

            HorizontalAxis axis = (HorizontalAxis)plotter.MainHorizontalAxis;
            //axis.LabelProvider.SetCustomFormatter(info => info.Tick.ToString("#.######E+0"));
            axis.LabelProvider.SetCustomFormatter(info => StringUtils.CodeString(info.Tick));

            VerticalAxis axisv = (VerticalAxis)plotter.MainVerticalAxis;
            //String.Format(new TelephoneFormatter(), "{0}", 0)
            axisv.LabelProvider.SetCustomFormatter(info => info.Tick.ToString("#.######E+0"));

            sourcevoltage = new ObservableDataSource<Tuple<double, double>>();
            sourcevoltage.SetXYMapping(z =>
            {
                Point p = new Point(z.Item1, z.Item2);
                return p;
            });

            //otherPlotter.DataTransform = new Log10Transform();
            //xAxis = new HorizontalAxis
            //{
            //    TicksProvider = new LogarithmNumericTicksProvider(10),
            //    LabelProvider = new UnroundingLabelProvider()
            //};
            //otherPlotter.MainHorizontalAxis = xAxis;
            //yAxis = new VerticalAxis
            //{
            //    TicksProvider = new LogarithmNumericTicksProvider(10),
            //    LabelProvider = new UnroundingLabelProvider()
            //};
            //otherPlotter.MainVerticalAxis = yAxis;



            //List<Point> list = new List<Point>();

            Random rnd = new Random();
            for (int i = 10; i < 300; i++)
            {
                sourcecurrent.Collection.Add(new Tuple<double, double>(i, 20000 + rnd.Next(10000)));
                sourcevoltage.Collection.Add(new Tuple<double, double>(i, 30 + rnd.Next(20)));
                //list.Add(new Point(i, rnd.Next(50)));
            }
            //plotter1.VerticalAxis.LabelProvider = new ExponentialLabelProvider();
            //LineGraph line = new LineGraph(source1);
            //line.AddToPlotter(plotter);
            // plotter.Children.Add(line);

            //otherPlotter.MainVerticalAxis.

            linegraph.DataSource = sourcevoltage ;
            linephase.DataSource = sourcecurrent;
            //axis = new VerticalAxisTitle();
            //linegraph = new Microsoft.Research.DynamicDataDisplay.LineGraph(
            // Creating the new DraggablePoint
            if (false)
            {
                int x1 = 10, y1 = 10;
                Point q = new Point(x1, y1);
                var globalPoint = new DraggablePoint(q);

                globalPoint.PositionChanged += (s, r) =>
                {
                    globalPoint.Position = q;
                };
                plotter.Children.Add(globalPoint);

            }
            
            // Set the point on the map

           
        }
Example #53
0
        // 查询
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string strDate = date.Text.ToString();
            nowTextBlock.Text = strDate;
            nowText = strDate;

            DataTable dataTable = new DataTable();
            dbTool.getNodeTeperature(strDate, this.node, out dataTable);

            // 将dataTable中的temperature加入到datasource
            plotter.Children.Remove(graphTemperature);
            dataSource = new ObservableDataSource<Point>();
            graphTemperature = plotter.AddLineGraph(dataSource, Colors.Green, 2, "结点"+this.node.ToString());
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                float temperature = float.Parse(dataTable.Rows[i].ItemArray[1].ToString());
                //Console.WriteLine("{0}", temperature);
                dataSource.AppendAsync(base.Dispatcher, new Point(i, temperature));
            }
        }
Example #54
0
        void OnWindowLoaded(object sender, RoutedEventArgs e)
        {
            RunWorkerInitMasterEmulator();
            lbDeviceDiscovery.ItemsSource = discoveredDevices;
            SetColorOfRect(false);
            UpdateButtons();

            //for (int i = 0; i < animatedX.Length; i++)
            //{
            //    animatedX[i] = 2 * Math.PI * i / animatedX.Length;
            //    animatedY[i] = Math.Sin(animatedX[i]);
            //}
            //EnumerableDataSource<double> xSrc = new EnumerableDataSource<double>(animatedX);
            //xSrc.SetXMapping(x => x);
            //animatedDataSource = new EnumerableDataSource<double>(animatedY);
            //animatedDataSource.SetYMapping(y => y);

            //// Adding graph to plotter
            //plotter.AddLineGraph(new CompositeDataSource(xSrc, animatedDataSource),
            //    new Pen(Brushes.Magenta, 3),
            //    new PenDescription("Sin(x + phase)"));

            //timer.Interval = TimeSpan.FromMilliseconds(10);
            //timer.Tick += AnimatedPlot_Timer;
            //timer.IsEnabled = true;

            // Force evertyhing plotted to be visible
            //plotter.FitToView();

            // Create first source
            source1 = new ObservableDataSource<Point>();
            // Set identity mapping of point in collection to point on plot
            source1.SetXYMapping(p => p);

            // Create second source
            source2 = new ObservableDataSource<Point>();
            // Set identity mapping of point in collection to point on plot
            source2.SetXYMapping(p => p);

            // Create third source
            source3 = new ObservableDataSource<Point>();
            // Set identity mapping of point in collection to point on plot
            source3.SetXYMapping(p => p);

            // Add all three graphs. Colors are not specified and chosen random
            plotter.AddLineGraph(source1, Colors.Red, 2, "Data 1");
            plotter.AddLineGraph(source2, Colors.Green, 2, "Data 2");
            plotter.AddLineGraph(source3, Colors.Blue, 2, "Data 3");
        }
        public void Begin()
        {
            try
            {
                for (int i = 0; i < MainViewModel.HotItemController.Queue.Count; i++)
                {
                    var item = MainViewModel.HotItemController.Queue[i];
                    if (!chartItems.ContainsKey(item.DataId))
                    {
                        if (item.IsSelected) // Chart selection
                        {
                            ObservableDataSource<ItemProxy> items = new ObservableDataSource<ItemProxy>();
                            items.SuspendUpdate();
                            Register(item, items);
                            items.ResumeUpdate();
                        }
                    }
                }
            }
            catch
            {

            }
        }
        //private void click_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        //{
        //    showDetailsUG.Children.Clear();
        //    for (int i = 1; i <= 30; i++)
        //        showDetailsUG.Children.Add(new ShowDetails(i));
        //}
        private void plotDetails_Click(object sender, RoutedEventArgs e)
        {
            ObservableDataSource<Point> source1 = null;

            // Create first source
            source1 = new ObservableDataSource<Point>();

            List<Point> list1 = new List<Point>();

            for (int i = 0; i < 30; i++)
            {
                Point p1 = new Point(i, 2 * i);
                list1.Add(p1);
            }
            source1.AppendMany(list1);
            // Set identity mapping of point in collection to point on plot
            source1.SetXYMapping(p => p);

            // Add all three graphs. Colors are not specified and chosen random
            plotter.AddLineGraph(source1, Color.FromRgb(0, 255, 0), 2, "Data row 1");

            // Create second source
            ObservableDataSource<Point> source2 = null;
            source2 = new ObservableDataSource<Point>();
            List<Point> list2 = new List<Point>();
            for (int j = 0; j < 30; j++)
            {
                Point p1 = new Point(j, 3 * j);
                list2.Add(p1);
            }
            source2.AppendMany(list2);

            // Set identity mapping of point in collection to point on plot
            source2.SetXYMapping(p => p);

            plotter.AddLineGraph(source2, Color.FromRgb(0, 0, 255), 2, "Data row 2");

            getDatewiseReport();
        }
Example #57
0
        public void lineDisplay(int node)
        {
            nowTextBlock.Text = DateTime.Now.ToShortDateString();

            DataTable dataTable = new DataTable();
            dbTool.getNodeTeperature(DateTime.Now.ToShortDateString(), node, out dataTable);

            // 将dataTable中的temperature加入到datasource
            plotter.Children.Remove(graphTemperature);
            dataSource = new ObservableDataSource<Point>();
            graphTemperature = plotter.AddLineGraph(dataSource, Colors.Green, 2, "结点"+node.ToString());
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                float temperature = float.Parse(dataTable.Rows[i].ItemArray[1].ToString());
                //Console.WriteLine("{0}", temperature);
                dataSource.AppendAsync(base.Dispatcher, new Point(i, temperature));
            }
        }
 private static ObservableDataSource<Point> CreateObservableDataSourceWithIdentiyMapping()
 {
     var result = new ObservableDataSource<Point>();
     result.SetXYMapping(p => p);
     return result;
 }
Example #59
0
 public GraphingData()
 {
     Channel_AllData = new ObservableDataSource<Point>();
     Channel_GraphData = new ObservableDataSource<Point>();
     Channel_GraphData.SetXYMapping(p => p);
 }
        private void btnResetConfirm_Click(object sender, RoutedEventArgs e)
        {
            List<ushort> address = new List<ushort>();
            List<ushort> value = new List<ushort>();
            address.Add(0x300);
            value.Add(0x05);//IMU_reset
            byte[] xmtData = sp3.GenerateFrame(GenerateAddressValuePair(address, value));
            if (sp.IsOpen)
            {
                sp.Write(xmtData, 0, xmtData.Length);
            }
            Run r = new Run(BitConverter.ToString(xmtData));
            paraConsole.Inlines.Add(r);
            paraConsole.Inlines.Add(new LineBreak());
            //滚动到当前光标处
            rtbConsole.ScrollToEnd();

            //clear the screen
            plotterIMU1.Children.Remove(graphEulerX1);
            plotterIMU1.Children.Remove(graphEulerY1);
            plotterIMU1.Children.Remove(graphEulerZ1);
            plotterIMU2.Children.Remove(graphEulerX2);
            plotterIMU2.Children.Remove(graphEulerY2);
            plotterIMU2.Children.Remove(graphEulerZ2);
            plotterIMU3.Children.Remove(graphEulerX3);
            plotterIMU3.Children.Remove(graphEulerY3);
            plotterIMU3.Children.Remove(graphEulerZ3);
            //timer.IsEnabled = true;
            EulerX1 = new ObservableDataSource<Point>();//draw curve
            EulerY1 = new ObservableDataSource<Point>();
            EulerZ1 = new ObservableDataSource<Point>();
            EulerX2 = new ObservableDataSource<Point>();//draw curve
            EulerY2 = new ObservableDataSource<Point>();
            EulerZ2 = new ObservableDataSource<Point>();
            EulerX3 = new ObservableDataSource<Point>();//draw curve
            EulerY3 = new ObservableDataSource<Point>();
            EulerZ3 = new ObservableDataSource<Point>();
            time = 0;
            graphEulerX1 = plotterIMU1.AddLineGraph(EulerX1, Colors.Green, 2, "X");//add new curve
            graphEulerY1 = plotterIMU1.AddLineGraph(EulerY1, Colors.Red, 2, "Y");
            graphEulerZ1 = plotterIMU1.AddLineGraph(EulerZ1, Colors.Blue, 2, "Z");
            graphEulerX2 = plotterIMU2.AddLineGraph(EulerX2, Colors.Green, 2, "X");//add new curve
            graphEulerY2 = plotterIMU2.AddLineGraph(EulerY2, Colors.Red, 2, "Y");
            graphEulerZ2 = plotterIMU2.AddLineGraph(EulerZ2, Colors.Blue, 2, "Z");
            graphEulerX3 = plotterIMU3.AddLineGraph(EulerX3, Colors.Green, 2, "X");//add new curve
            graphEulerY3 = plotterIMU3.AddLineGraph(EulerY3, Colors.Red, 2, "Y");
            graphEulerZ3 = plotterIMU3.AddLineGraph(EulerZ3, Colors.Blue, 2, "Z");
        }