Ejemplo n.º 1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 5 "..\..\..\CpuMemoryLinesDlg\SystemCpuUsageLineDlg.xaml"
                ((Processes_Manage.SystemCpuUsageLineDlg)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown);

            #line default
            #line hidden

            #line 6 "..\..\..\CpuMemoryLinesDlg\SystemCpuUsageLineDlg.xaml"
                ((Processes_Manage.SystemCpuUsageLineDlg)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.cpuUsageText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 3:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 2
0
		static void Main(string[] args)
		{
			ChartPlotter plotter = new ChartPlotter { Width = 200, Height = 200 };
			plotter.SaveScreenshot("1.png");

			Process.Start("1.png");
		}
Ejemplo n.º 3
0
		void Window1_Loaded(object sender, RoutedEventArgs e)
		{
			ChartPlotter plotter = new ChartPlotter();

			// setting properties of horizontal axis
			HorizontalTimeSpanAxis axis = new HorizontalTimeSpanAxis();
			// calculating minimal amd maximal x values
			double minX = axis.ConvertToDouble(new TimeSpan(-24, 0, 0));
			double maxX = axis.ConvertToDouble(new TimeSpan());

			TimeSpanTicksProvider ticksProvider = (TimeSpanTicksProvider)axis.TicksProvider;
			// changing ticks calculating strategy to prefer separation on hours
			ticksProvider.Strategy = new DelegateDateTimeStrategy((span) =>
			{
				if (span.TotalDays < 2 && span.TotalHours > 2) return DifferenceIn.Hour;

				// null makes to use base class return value
				return null;
			});

			plotter.MainHorizontalAxis = axis;

			DataRect visible = plotter.Viewport.Visible;
			visible.XMin = minX;
			visible.Width = maxX - minX;

			plotter.Viewport.Visible = visible;

			// grid is simply a visual root of window
			grid.Children.Add(plotter);
		}
Ejemplo n.º 4
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.DataPlot = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 2:
                this.PlotTitle = ((Microsoft.Research.DynamicDataDisplay.Header)(target));
                return;

            case 3:
                this.PlotYLabel = ((Microsoft.Research.DynamicDataDisplay.VerticalAxisTitle)(target));
                return;

            case 4:
                this.DataLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 5:
                this.ValueLabel = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.secondHeader = ((System.Windows.Controls.MenuItem)(target));

            #line 9 "..\..\MainWindow.xaml"
                this.secondHeader.Click += new System.Windows.RoutedEventHandler(this.secondHeader_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.secondFooter = ((System.Windows.Controls.MenuItem)(target));

            #line 10 "..\..\MainWindow.xaml"
                this.secondFooter.Click += new System.Windows.RoutedEventHandler(this.secondFooter_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 6
0
		void LogYWindow_Loaded(object sender, RoutedEventArgs e)
		{
			ChartPlotter plotter = new ChartPlotter();

			plotter.Children.Add(new CursorCoordinateGraph());

			plotter.DataTransform = new Log10YTransform();
			VerticalAxis axis = new VerticalAxis
			{
				TicksProvider = new LogarithmNumericTicksProvider(10),
				LabelProvider = new UnroundingLabelProvider()
			};
			plotter.MainVerticalAxis = axis;

			plotter.AxisGrid.DrawVerticalMinorTicks = true;

			const int count = 500;
			double[] xs = Enumerable.Range(1, count).Select(x => x * 0.01).ToArray();
			EnumerableDataSource<double> xDS = xs.AsXDataSource();

			var pows = xs.Select(x => Math.Pow(10, x));
			var linear = xs.Select(x => x);
			var logXs = Enumerable.Range(101, count).Select(x => x * 0.01);
			var logarithmic = logXs.Select(x => Math.Log10(x));

			plotter.AddLineGraph(pows.AsYDataSource().Join(xDS), "f(x) = 10^x");
			plotter.AddLineGraph(linear.AsYDataSource().Join(xDS), "f(x) = x");
			plotter.AddLineGraph(logarithmic.AsYDataSource().Join(logXs.AsXDataSource()), "f(x) = log(x)");

			Content = plotter;
		}
Ejemplo n.º 7
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 5 "..\..\..\..\xaml\HeavyMetal\CurveWindow.xaml"
                ((AIO.xaml.HeavyMetal.CurveWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.dianwei = ((Microsoft.Research.DynamicDataDisplay.Header)(target));
                return;

            case 4:
                this.dianliu = ((Microsoft.Research.DynamicDataDisplay.VerticalAxisTitle)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 8
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 12 "..\..\PlotWindow.xaml"
                ((TirePressureSensorWpfApp.PlotWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.MetroWindow_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.templotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.preplotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 4:
                this.freplotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 5:
                this.ampplotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\..\Views\FlightBoard.xaml"
                ((FlightSimulator.Views.FlightBoard)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.btnConnect = ((System.Windows.Controls.Button)(target));
                return;

            case 4:
                this.btnSettings = ((System.Windows.Controls.Button)(target));
                return;

            case 5:
                this.btnDisconnect = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 10
0
		static void Main(string[] args)
		{
			ChartPlotter plotter = new ChartPlotter();
			plotter.PerformLoad();
			plotter.Background = Brushes.Transparent;
			plotter.SaveScreenshot("1.png");
		}
Ejemplo n.º 11
0
		public void TestViewportContentBounds()
		{
			ChartPlotter plotter = new ChartPlotter();
			TempIPlotterElement element = new TempIPlotterElement();
			plotter.Children.Add(element);
			plotter.PerformLoad();
			plotter.Viewport.ClipToBoundsEnlargeFactor = 1.0;

			Assert.AreEqual(new DataRect(0, 0, 1, 1), plotter.Visible);

			Viewport2D.SetContentBounds(element, new DataRect(0, 0, 2, 2));

			Assert.AreEqual(new DataRect(0, 0, 2, 2), plotter.Visible);

			plotter.Children.Remove(element);

			Assert.AreEqual(new DataRect(0, 0, 1, 1), plotter.Visible);

			plotter.Children.Add(element);

			Assert.AreEqual(new DataRect(0, 0, 2, 2), plotter.Visible);

			Viewport2D.SetIsContentBoundsHost(element, false);

			Assert.AreEqual(new DataRect(0, 0, 1, 1), plotter.Visible);
		}
Ejemplo n.º 12
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 5 "..\..\..\..\Windows\VelocityOfChangeParametersXY.xaml"
                ((testTensileMachineGraphics.Windows.VelocityOfChangeParametersXY)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden

            #line 6 "..\..\..\..\Windows\VelocityOfChangeParametersXY.xaml"
                ((testTensileMachineGraphics.Windows.VelocityOfChangeParametersXY)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.plotterChangeOfR = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.plotterChangeOfE = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 13
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.btnChange = ((System.Windows.Controls.Button)(target));

            #line 16 "..\..\..\SubForms\wpfTerrainProfile.xaml"
                this.btnChange.Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.tbName = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this._groupLabel = ((Microsoft.Research.DynamicDataDisplay.Charts.ViewportUIContainer)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 14
0
 /// <summary>
 /// ExportChartPlotterPng
 /// </summary>
 /// <param name="path"></param>
 /// <param name="surface"></param>
 public static void ExportChartPlotterPng(Uri path, ChartPlotter surface)
 {
     if (path == null) return;
     //Save current canvas transform 保存当前画布变换
     Transform transform = surface.LayoutTransform;
     //reset current transform (in case it is scaled or rotated) 重设当前画布(如果缩放或旋转)
     surface.LayoutTransform = null;
     //Create a render bitmap and push the surface to it 创建一个渲染位图和表面
     RenderTargetBitmap renderBitmap = new RenderTargetBitmap(
         (int)surface.Width,
         (int)surface.Height,
         96d, 96d,
         PixelFormats.Pbgra32);
     renderBitmap.Render(surface);
     // Create a file stream for saving image
     using (FileStream outStream = new FileStream(path.LocalPath, FileMode.Create))
     {
         //Use png encoder for our data
         PngBitmapEncoder encoder = new PngBitmapEncoder();
         // push the rendered bitmap to it
         encoder.Frames.Add(BitmapFrame.Create(renderBitmap));
         // save the data to the stream
         encoder.Save(outStream);
     }
     // Restore previously saved layout 恢复以前保存布局
     surface.LayoutTransform = transform;
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 4 "..\..\..\5系统进程\SingleProcessCpuLine.xaml"
                ((Processes_Manage.SingleProcessCpuLine)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown);

            #line default
            #line hidden
                return;

            case 2:
                this.processName = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 3:
                this.cpuText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.processId = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 16
0
		public void TestAllElementsAddRemove()
		{
			ChartPlotter plotter = new ChartPlotter();

			var types = GetAllCharts();

			var plotterElements = new List<IPlotterElement>();
			plotter.Children.Clear();
			foreach (var type in types)
			{
				IPlotterElement element = (IPlotterElement)Activator.CreateInstance(type);
				plotterElements.Add(element);
				plotter.Children.Add(element);
			}

			foreach (var item in plotterElements)
			{
				Assert.AreEqual(plotter, item.Plotter);
			}

			plotter.Children.Clear();

			foreach (var item in plotterElements)
			{
				Assert.IsNull(item.Plotter, item.ToString());
			}
		}
Ejemplo n.º 17
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 9 "..\..\Window1.xaml"
     ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.OnOpenImageClick);
     
     #line default
     #line hidden
     return;
     case 2:
     this.check = ((System.Windows.Controls.CheckBox)(target));
     
     #line 11 "..\..\Window1.xaml"
     this.check.Checked += new System.Windows.RoutedEventHandler(this.CheckBox_Checked);
     
     #line default
     #line hidden
     
     #line 12 "..\..\Window1.xaml"
     this.check.Unchecked += new System.Windows.RoutedEventHandler(this.CheckBox_Checked);
     
     #line default
     #line hidden
     return;
     case 3:
     this.image = ((System.Windows.Controls.Image)(target));
     return;
     case 4:
     this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
     return;
     }
     this._contentLoaded = true;
 }
Ejemplo n.º 18
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\WpfCurve.xaml"
                ((WpfApp1.WpfCurve)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:

            #line 20 "..\..\WpfCurve.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 3:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 19
0
		public Window1()
		{
			InitializeComponent();

#if MULTIPLE
			for (int ix = 0; ix < colNum; ix++)
			{
				content.ColumnDefinitions.Add(new ColumnDefinition());
			}
			for (int iy = 0; iy < rowNum; iy++)
			{
				content.RowDefinitions.Add(new RowDefinition());
			}

			for (int ix = 0; ix < colNum; ix++)
			{
				for (int iy = 0; iy < rowNum; iy++)
				{
					ChartPlotter plotter = new ChartPlotter();
					plotter.MainHorizontalAxis = null;
					plotter.MainVerticalAxis = null;
					plotter.BorderThickness = new Thickness(1);
					Grid.SetColumn(plotter, ix);
					Grid.SetRow(plotter, iy);
					content.Children.Add(plotter);
					plotter.LegendVisibility = Visibility.Hidden;
					plotter.Legend.AutoShowAndHide = false;

					AnimatedDataSource ds = new AnimatedDataSource();
					data.Add(ds);

					LineGraph line = new LineGraph(ds.DataSource);
					line.Stroke = BrushHelper.CreateBrushWithRandomHue();
					line.StrokeThickness = 2;
					line.Filters.Add(new FrequencyFilter());
					plotter.Children.Add(line);
				}
			}
#else
			ChartPlotter plotter = new ChartPlotter();
			plotter.HorizontalAxis = null;
			plotter.VerticalAxis = null;

			content.Children.Add(plotter);
			for (int i = 0; i < rowNum * colNum; i++)
			{
				AnimatedDataSource ds = new AnimatedDataSource();
				data.Add(ds);

				LineGraph line = new LineGraph(ds.DataSource);
				line.LineBrush = BrushHelper.CreateBrushWithRandomHue();
				line.LineThickness = 1;
				line.Filters.Add(new FrequencyFilter());
				plotter.Children.Add(line);
			}
#endif

			Loaded += new RoutedEventHandler(Window1_Loaded);
		}
		public void TestDeserialization()
		{
			ChartPlotter plotter = new ChartPlotter();

			string xaml = XamlWriter.Save(plotter);

			ChartPlotter plotter2 = (ChartPlotter)XamlReader.Parse(xaml);
		}
Ejemplo n.º 21
0
		public void TestScreenRect()
		{
			ChartPlotter plotter = new ChartPlotter { Width = 200, Height = 100 };
			var img = plotter.CreateScreenshot();

			Rect screenRect = plotter.Viewport.Output;
			Assert.IsTrue(screenRect.Width > 0 && screenRect.Height > 0);
		}
Ejemplo n.º 22
0
        private static void OnVisibleInLegendChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ChartPlotter plotter = Plotter.GetPlotter(d) as ChartPlotter;

            if (plotter != null)
            {
                plotter.Legend.PopulateLegend();
            }
        }
Ejemplo n.º 23
0
		public void TestReversibility()
		{
			ChartPlotter plotter = new ChartPlotter();
			var genericPlotter = plotter.GetGenericPlotter<double, double>();
			genericPlotter.DataRect = new GenericRect<double, double>(0, 0, 2, 2);

			Assert.IsTrue(plotter.Visible == new DataRect(0, 0, 2, 2));
			Assert.IsTrue(genericPlotter.DataRect == new GenericRect<double, double>(0, 0, 2, 2));
		}
Ejemplo n.º 24
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 8 "..\..\..\RuntimeChart.xaml"
                ((CoreTest.RuntimeChart)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden

            #line 8 "..\..\..\RuntimeChart.xaml"
                ((CoreTest.RuntimeChart)(target)).Closed += new System.EventHandler(this.Window_Closed);

            #line default
            #line hidden
                return;

            case 2:
                this.comb1 = ((System.Windows.Controls.ComboBox)(target));

            #line 16 "..\..\..\RuntimeChart.xaml"
                this.comb1.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.comb1_SelectionChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.colorpicker = ((Microsoft.Windows.Controls.ColorPicker)(target));

            #line 18 "..\..\..\RuntimeChart.xaml"
                this.colorpicker.SelectedColorChanged += new System.Windows.RoutedPropertyChangedEventHandler <System.Windows.Media.Color>(this.ColorPicker_SelectedColorChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.chartPlotter1 = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 5:
                this.hTimeSpanAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis)(target));
                return;

            case 6:
                this.hilevel = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalLine)(target));
                return;

            case 7:
                this.lolevel = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalLine)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 25
0
		public void HorizontalAxisTest()
		{
			ChartPlotter target = new ChartPlotter();
			IAxis expected = new HorizontalAxis();
			IAxis actual;
			target.HorizontalAxis = expected;
			actual = target.HorizontalAxis;
			Assert.AreEqual(expected, actual);
		}
Ejemplo n.º 26
0
		public void VerticalAxisTest()
		{
			ChartPlotter plotter = new ChartPlotter();
			IAxis expected = new VerticalAxis();
			IAxis actual;
			plotter.VerticalAxis = expected;
			actual = plotter.VerticalAxis;
			Assert.AreEqual(expected, actual);
		}
Ejemplo n.º 27
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Win = ((Harmonic_1.MainWindow)(target));
                return;

            case 2:
                this.border1 = ((System.Windows.Controls.Border)(target));
                return;

            case 3:
                this.A_Grid = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.Select_Cont = ((System.Windows.Controls.TabControl)(target));
                return;

            case 5:

            #line 51 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.removeHarm);

            #line default
            #line hidden
                return;

            case 6:

            #line 52 "..\..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.addHarm);

            #line default
            #line hidden
                return;

            case 7:
                this.VectGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 8:
                this.vectPlotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 9:
                this.sinPlotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 10:
                this.specPlotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 28
0
		public void HorizontalAxisTest()
		{
			ChartPlotter plotter = new ChartPlotter();
			var expected = new HorizontalAxis();
			plotter.MainHorizontalAxis = expected;
			GeneralAxis actual = plotter.MainHorizontalAxis;

			Assert.AreEqual(expected, actual);
			Assert.IsTrue(plotter.Children.OfType<HorizontalAxis>().Count() == 1);
		}
Ejemplo n.º 29
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
         return;
     }
     this._contentLoaded = true;
 }
Ejemplo n.º 30
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.textBoxMuFunction = ((System.Windows.Controls.TextBox)(target));
                return;

            case 2:
                this.textBoxBetaFunction = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.textBoxSigmaFunction = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.textBoxFFunction = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:
                this.textBoxN = ((System.Windows.Controls.TextBox)(target));
                return;

            case 6:
                this.dataGridResults = ((System.Windows.Controls.DataGrid)(target));
                return;

            case 7:
                this.buttonCalculate = ((System.Windows.Controls.Button)(target));

            #line 108 "..\..\MainWindow.xaml"
                this.buttonCalculate.Click += new System.Windows.RoutedEventHandler(this.buttonCalculate_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.buttonClear = ((System.Windows.Controls.Button)(target));

            #line 112 "..\..\MainWindow.xaml"
                this.buttonClear.Click += new System.Windows.RoutedEventHandler(this.buttonClear_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.graphic = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
        public OptionGreekPositionView_1928()
        {
            InitializeComponent();
            this.DataContextChanged += new DependencyPropertyChangedEventHandler(ViewModelChanged);

            ChartPlotter cp = new ChartPlotter();

            this.drowChartPlotter(cp);

            this.chartGrid_.Children.Add(cp);
        }
 public static void PlotData(Stream outstream,int pixelWidth,int pixelHeight)
 {
     RenderTargetBitmap target = new RenderTargetBitmap(pixelWidth, pixelHeight, 96, 96, PixelFormats.Default);
     ChartPlotter plotter = new ChartPlotter();
     plotter.Width = 200;
     plotter.Height = 200;
     target.Render(plotter);
     PngBitmapEncoder encoder = new PngBitmapEncoder();
     encoder.Frames.Add(BitmapFrame.Create(target));
     encoder.Save(outstream);
 }
Ejemplo n.º 33
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);
            }
              );
        }
Ejemplo n.º 34
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 2:
                this.dateAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis)(target));
                return;

            case 3:
                this.t1 = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.button1 = ((System.Windows.Controls.Button)(target));

            #line 18 "..\..\..\MainWindow.xaml"
                this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.Message = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.Image = ((System.Windows.Controls.Image)(target));
                return;

            case 7:
                this.tb = ((System.Windows.Controls.TextBox)(target));

            #line 22 "..\..\..\MainWindow.xaml"
                this.tb.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.tb_TextChanged);

            #line default
            #line hidden
                return;

            case 8:
                this.tb2 = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
		public void TestXamlAreEqual()
		{
			ChartPlotter plotter = new ChartPlotter();
			plotter.Children.Clear();

			string plotterXaml = XamlWriter.Save(plotter);

			ChartPlotter empty = ChartPlotter.CreateEmpty();
			empty.Children.Clear();

			string emptyXaml = XamlWriter.Save(empty);

			Assert.AreEqual(plotterXaml, emptyXaml);
		}
Ejemplo n.º 36
0
		public void TestAddingToPlotter()
		{
			HorizontalLine line = new HorizontalLine { Value = 0.2 };
			ChartPlotter plotter = new ChartPlotter();
			plotter.Children.Add(line);

			VerticalLine line2 = new VerticalLine { Value = 0.1 };
			plotter.Children.Add(line2);

			VerticalRange range = new VerticalRange { Value1 = 0.1, Value2 = 0.3 };
			plotter.Children.Add(range);

			RectangleHighlight rect = new RectangleHighlight { Bounds = new Rect(0, 0, 1, 1) };
			plotter.Children.Add(rect);
		}
		public void TestAddingNull()
		{
			ChartPlotter plotter = new ChartPlotter();
			bool thrown = false;
			try
			{
				plotter.Viewport.Restrictions.Add(null);
			}
			catch (ArgumentNullException)
			{
				thrown = true;
			}

			Assert.IsTrue(thrown);
		}
Ejemplo n.º 38
0
        public void ShouldThrowOnNanInVisible()
        {
            ChartPlotter plotter = new ChartPlotter();
            bool thrown = false;
            try
            {
                plotter.Visible = new Rect(Double.NaN, 0, 1, 1);
            }
            catch (ArgumentException)
            {
                thrown = true;
            }

            Assert.IsTrue(thrown);
        }
Ejemplo n.º 39
0
        private static void OnPlotterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PieChart chart = (PieChart)d;

            d3.ChartPlotter currPlotter = e.NewValue as d3.ChartPlotter;
            if (currPlotter != null)
            {
                chart.OnPlotterAttached(currPlotter);
            }
            else
            {
                d3.ChartPlotter prevPlotter = e.OldValue as d3.ChartPlotter;
                chart.OnPlotterDetaching(prevPlotter);
            }
        }
Ejemplo n.º 40
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Plot = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));

            #line 11 "..\..\ScopeShow.xaml"
                this.Plot.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Plot_MouseDown);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 41
0
        internal GenericChartPlotter(ChartPlotter plotter, AxisBase <THorizontal> horizontalAxis, AxisBase <TVertical> verticalAxis)
        {
            if (horizontalAxis == null)
            {
                throw new ArgumentNullException(Strings.Exceptions.PlotterMainHorizontalAxisShouldNotBeNull);
            }
            if (verticalAxis == null)
            {
                throw new ArgumentNullException(Strings.Exceptions.PlotterMainVerticalAxisShouldNotBeNull);
            }

            this.horizontalAxis = horizontalAxis;
            this.verticalAxis   = verticalAxis;

            this.plotter = plotter;
        }
Ejemplo n.º 42
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));

            #line 7 "..\..\PlotCurve.xaml"
                this.plotter.Loaded += new System.Windows.RoutedEventHandler(this.plotter_Loaded);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 43
0
		public LineChartTest()
		{
			chart = new LineChart();
			chart.DataSource = new TestDataSource();

			ChartPlotter plotter = new ChartPlotter();
			plotter.PerformLoad();
			plotter.Children.Add(chart);

			PrivateObject privateObject = new PrivateObject(chart);
			LineChart_Accessor target = new LineChart_Accessor(privateObject);

			canvas = target.canvas;

			paths = canvas.Children.Cast<Path>();
		}
		public void TestAddAndRemoveItems()
		{
			ChartPlotter plotter = new ChartPlotter();
			plotter.PerformLoad();

			DevMarkerChart chart = new DevMarkerChart();
			chart.MarkerBuilder = new EllipseMarker();

			plotter.Children.Add(chart);

			ObservableCollection<Point> source = new ObservableCollection<Point>();
			chart.ItemsSource = source;

			const int count = 10;

			// stage 1
			for (int i = 0; i < count; i++)
			{
				source.Add(new Point());
				Assert.AreEqual(source.Count, chart.Items.Count);
			}

			for (int i = count - 1; i >= 0; i--)
			{
				source.RemoveAt(i);
				Assert.AreEqual(source.Count, chart.Items.Count);
			}


			// stage 2
			for (int i = 0; i < count; i++)
			{
				source.Add(new Point());
				Assert.AreEqual(source.Count, chart.Items.Count);
			}

			Random rnd = new Random();
			for (int i = count - 1; i >= 0; i--)
			{
				int index = rnd.Next(0, source.Count - 1);
				source.RemoveAt(index);
				Assert.AreEqual(source.Count, chart.Items.Count);
			}

			// todo check that all items are visible
		}
Ejemplo n.º 45
0
        // *********************************************** //
        public ViewModel(ChartPlotter plotter)
        {
            _curves = new Curve[]
                          {
                              new Curve("sin",Colors.Red,index=>Math.Sin(0.1 * index)),
                              new Curve("cos",Colors.Blue,index=>2*Math.Cos(0.3 * index)),
                          };

            foreach (var curve in _curves)
            {
                curve.AddToPlotter(plotter);
            }

            CanCalculate = true;

            _startStopCmd = new RelayCommand(StartStopCalculate);
        }
Ejemplo n.º 46
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 2:
                this.dateAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis)(target));
                return;

            case 3:
                this.Txtlog = ((System.Windows.Controls.TextBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 47
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.lblSubMix = ((System.Windows.Controls.Label)(target));
                return;

            case 2:
                this.chartSubMix = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.Axis_X_SubMix = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 48
0
		public void VerticalAxisIsDefaultTest()
		{
			ChartPlotter plotter = new ChartPlotter();

			VerticalAxis axis = (VerticalAxis)plotter.VerticalAxis;
			VerticalAxis axis2 = new VerticalAxis();
			plotter.Children.Add(axis2);

			Assert.AreEqual(plotter.VerticalAxis, axis);
			Assert.IsTrue(axis.IsDefaultAxis);

			axis2.IsDefaultAxis = true;
			Assert.AreEqual(plotter.VerticalAxis, axis2);
			Assert.IsFalse(axis.IsDefaultAxis);

			axis.IsDefaultAxis = true;
			Assert.AreEqual(plotter.VerticalAxis, axis);
			Assert.IsFalse(axis2.IsDefaultAxis);
		}
Ejemplo n.º 49
0
		public void HorizontalAxisIsDefaultTest()
		{
			ChartPlotter plotter = new ChartPlotter();

			HorizontalAxis axis = (HorizontalAxis)plotter.HorizontalAxis;
			HorizontalAxis axis2 = new HorizontalAxis();
			plotter.Children.Add(axis2);

			Assert.AreEqual(plotter.HorizontalAxis, axis);
			Assert.IsTrue(axis.IsDefaultAxis);

			axis2.IsDefaultAxis = true;
			Assert.AreEqual(plotter.HorizontalAxis, axis2);
			Assert.IsFalse(axis.IsDefaultAxis);

			axis.IsDefaultAxis = true;
			Assert.AreEqual(plotter.HorizontalAxis, axis);
			Assert.IsFalse(axis2.IsDefaultAxis);
		}
Ejemplo n.º 50
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 7 "..\..\MainWindow.xaml"
                ((USB_GUI.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.label = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.label1 = ((System.Windows.Controls.Label)(target));
                return;

            case 5:
                this.label1_Copy = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.label1_Copy1 = ((System.Windows.Controls.Label)(target));
                return;

            case 7:
                this.label1_Copy2 = ((System.Windows.Controls.Label)(target));
                return;

            case 8:
                this.label1_Copy3 = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 51
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 5 "..\..\MainWindow.xaml"
                ((Animation.AnimatedSampleWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 52
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\..\View\TradeIndexView.xaml"
                ((OKCoinClient.View.TradeIndexView)(target)).Loaded += new System.Windows.RoutedEventHandler(this.TradeIndexView_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.chartThisWeek1 = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.Axis_X_ThisWeek1 = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis)(target));
                return;

            case 4:
                this.chartNextWeek1 = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 5:
                this.Axis_X_NextWeek1 = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis)(target));
                return;

            case 6:
                this.chartQuarter1 = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 7:
                this.Axis_X_Quarter1 = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis)(target));
                return;

            case 8:
                this.chartIndex = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 53
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 22 "..\..\..\Views\FlightBoard.xaml"
                ((System.Windows.Controls.Grid)(target)).Loaded += new System.Windows.RoutedEventHandler(this.FlightBoard_Loaded_1);

            #line default
            #line hidden
                return;

            case 2:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 54
0
		public void HorizontalAxisIsDefaultTest()
		{
			ChartPlotter plotter = new ChartPlotter();
			plotter.PerformLoad();

			HorizontalAxis axis = (HorizontalAxis)plotter.MainHorizontalAxis;
			HorizontalAxis axis2 = new HorizontalAxis();
			plotter.Children.Add(axis2);

			Assert.AreEqual(plotter.MainHorizontalAxis, axis);
			Assert.IsTrue(axis.IsDefaultAxis);
			Assert.AreEqual(2, plotter.Children.OfType<HorizontalAxis>().Count());

			axis2.IsDefaultAxis = true;
			Assert.AreEqual(axis2, plotter.MainHorizontalAxis);
			Assert.IsFalse(axis.IsDefaultAxis);

			axis.IsDefaultAxis = true;
			Assert.AreEqual(plotter.MainHorizontalAxis, axis);
			Assert.IsFalse(axis2.IsDefaultAxis);
		}
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 2:
                this.dateAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.HorizontalDateTimeAxis)(target));
                return;

            case 3:
                this.countAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.Axes.VerticalIntegerAxis)(target));
                return;

            case 4:
                this.lbl_temp = ((System.Windows.Controls.Label)(target));
                return;

            case 5:
                this.lbl_pressure = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.lbl_humidity = ((System.Windows.Controls.Label)(target));
                return;

            case 7:
                this.selected_date = ((System.Windows.Controls.DatePicker)(target));

            #line 67 "..\..\..\Pages\DataVisualization.xaml"
                this.selected_date.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.datechanged);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 56
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.TimeControl = ((System.Windows.Controls.Label)(target));
                return;

            case 2:
                this.preSelectIndex = ((System.Windows.Controls.ComboBox)(target));

            #line 20 "..\..\..\..\Window\OnLineStatic.xaml"
                this.preSelectIndex.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.OnSelectionChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.TControl = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 5:
                this.yAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.VerticalAxis)(target));
                return;

            case 6:
                this.xAxis = ((Microsoft.Research.DynamicDataDisplay.Charts.DateTimeAxis)(target));
                return;

            case 7:
                this.wnd_lower = ((System.Windows.Controls.StackPanel)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 57
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 10 "..\..\..\..\page\record\replay.xaml"
                ((XjHealth.page.record.replay)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Page_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.plotter = ((Microsoft.Research.DynamicDataDisplay.ChartPlotter)(target));
                return;

            case 3:
                this.btn_hr = ((XjHealth.lib.ImageButton)(target));
                return;

            case 4:
                this.btn_hrv = ((XjHealth.lib.ImageButton)(target));
                return;

            case 5:
                this.btn_stress = ((XjHealth.lib.ImageButton)(target));
                return;

            case 6:
                this.btn_mood = ((XjHealth.lib.ImageButton)(target));
                return;

            case 7:
                this.btn_backmain = ((XjHealth.lib.ImageButton)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 58
0
 private void Redraw(ListBox graphsFilter, ChartPlotter plotter)
 {
     //remove old graphs
     for (int i = 0; i < plotter.Children.Count; i++)
     {
         if (plotter.Children[i] is LineChart)
         {
             //(plotter.Children[i] as LineChart).RemoveFromPlotter();
             (plotter.Children[i] as LineChart).RemoveFromPlotter();
             //plotter.Children.RemoveAt(i);
             i--;
         }
     }
     //draw new graphs
     foreach (Cultivation cultivation in cultivationsSelectionBox.SelectedItems)
     {
         foreach (string param in graphsFilter.SelectedItems)
         {
             switch (param)
             {
                 case DimensionSymbol.Turbidity:
                 case DimensionSymbol.Biomass_Concentration:
                 case DimensionSymbol.O2_Saturation:
                 case DimensionSymbol.CO2_Saturation:
                 case DimensionSymbol.CHx_Saturation:
                     //TODO: modify this - the first plot comes onto the left y axis - all additional plots get their own y-axes (which have to be created!!)
                     plotter.AddLineChart(cultivation.PostprocessingLogs[param].DataSource).WithDescription(param).WithStroke(new SolidColorBrush(DimensionSymbol.ParameterColors[param])).WithStrokeThickness(2);
                     //plotter.AddLineGraph((cultivation.PostprocessingLogs[param] as DataPostprocessingLog).DataSource, DimensionSymbol.ParameterColors[param], 2, param);
                     break;
                 default:
                     plotter.AddLineChart(cultivation.LiveLogs[param].DataSource).WithDescription(param).WithStroke(new SolidColorBrush(DimensionSymbol.ParameterColors[param])).WithStrokeThickness(2);
                     //plotter.AddLineGraph(cultivation.LiveLogs[param].DataSource, DimensionSymbol.ParameterColors[param], 2, param);
                     break;
             }
         }
     }
 }
Ejemplo n.º 59
0
		public void TestAllElementsAddRemove()
		{
			ChartPlotter plotter = new ChartPlotter();
			plotter.PerformLoad();

			var types = GetAllCharts();

			var withoutCtor = from type in types
							  let ctors = type.GetConstructors()
							  let noParameterlessCtor = (from c in ctors
														 let p = c.GetParameters()
														 select p).All(p => p.Length >= 1)
							  where noParameterlessCtor
							  select type;

			var plotterElements = new List<IPlotterElement>();
			plotter.Children.Clear();
			foreach (var type in types)
			{
				IPlotterElement element = (IPlotterElement)Activator.CreateInstance(type);
				plotterElements.Add(element);
				plotter.Children.Add(element);
			}

			foreach (var item in plotterElements)
			{
				Assert.AreEqual(plotter, item.Plotter);
			}

			plotter.Children.Clear();
			plotter.Wait(DispatcherPriority.Background);

			foreach (var item in plotterElements)
			{
				Assert.IsNull(item.Plotter, item.ToString());
			}
		}
Ejemplo n.º 60
0
 public Basechart(Dispatcher p, ChartPlotter newchart, Dictionary<string, string> packagelist)
 {
     //Init variables
     colorpool.Add(Colors.Blue);
     colorpool.Add(Colors.Red);
     colorpool.Add(Colors.Green);
     colorpool.Add(Colors.Yellow);
     colorpool.Add(Colors.Pink);
     disp = p;
     chart = newchart;
     msr.Width = 300;
     this.chart.Viewport.Restrictions.Add(msr);
     //chart.MainVerticalAxis.
     chart.FitToView();
     //chart.Legend.LegendLeft = 10.0;
     chart.MouseMove += new MouseEventHandler(chart_MouseMove);
     chart.MouseLeave += new MouseEventHandler(chart_MouseLeave);
     chart.LegendVisibility = Visibility.Hidden;
     //pkglist = packagelist;
     //datalist = new Dictionary<string, ObservableDataSource<Point>>();
     ThreadStart ts = new ThreadStart(asyncProcData);
     newThread = new Thread(ts);
     newThread.Start();
 }