当前位置: 首页>>代码示例>>C#>>正文


C# Point.AsDataSource方法代码示例

本文整理汇总了C#中Point.AsDataSource方法的典型用法代码示例。如果您正苦于以下问题:C# Point.AsDataSource方法的具体用法?C# Point.AsDataSource怎么用?C# Point.AsDataSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point的用法示例。


在下文中一共展示了Point.AsDataSource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Window1_Loaded

		private void Window1_Loaded(object sender, RoutedEventArgs e)
		{
			//plotter.Viewport.Visible = new DataRect(-1, -1.1, 200, 2.2);

			const int count = 14000;
			Point[] pts = new Point[count];

			for (int i = 0; i < count; i++)
			{
				double x = i / 20.0 - 1000;
				pts[i] = new Point(x, Math.Sin(x));
			}

#if !old
			var ds = pts.AsDataSource();

			LineChart chart = new LineChart { DataSource = ds };
			//chart.Filters.Clear();

			//InclinationFilter filter = new InclinationFilter();
			//BindingOperations.SetBinding(filter, InclinationFilter.CriticalAngleProperty, new Binding { Path = new PropertyPath("Value"), Source = slider });
			//chart.Filters.Add(filter);
			plotter.Children.Add(chart);

			//plotter.Children.Add(new LineChart { DataSource = new FunctionalDataSource { Function = x => Math.Atan(x) } });
			//plotter.Children.Add(new LineChart { DataSource = new FunctionalDataSource { Function = x => Math.Tan(x) } });
#else
			var ds2 = new Microsoft.Research.DynamicDataDisplay.DataSources.RawDataSource(pts);
			lineGraph = plotter.AddLineGraph(ds2);
#endif

			((NumericAxis)plotter.MainHorizontalAxis).TicksProvider = new CustomBaseNumericTicksProvider(Math.PI);
			((NumericAxis)plotter.MainHorizontalAxis).LabelProvider = new CustomBaseNumericLabelProvider(Math.PI, "π");
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:34,代码来源:Window1.xaml.cs

示例2: Page_Loaded

        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            const int N = 200;
            
            double step = Math.PI * 2 / N;

            #region CompositeDataSource
            double[] x = new double[N];
            double[] y = new double[N];
            
            for (int i = 0; i < N; i++)
            {
                x[i] = i *step;
                y[i] = Math.Sin(x[i]);
            }

            var xDataSource = x.AsXDataSource();
            var yDataSource = y.AsYDataSource();

            CompositeDataSource compositeDataSource = xDataSource.Join(yDataSource);

            sin = new LineGraph(compositeDataSource, "sin(x)");

            PlotterMain.Children.Add(sin);
            #endregion

            #region RawDataSource
            Point[] points = new Point[N];

            for (int i = 0; i < N; i++) { 
                points[i] = new Point(i*step, (0.7 * Math.Cos(x[i] * 3) + 3) + (1.5 * Math.Sin(x[i] / 2 + 4)));
            }

            RawDataSource rawDataSource = points.AsDataSource();
            
            cos = new LineGraph(rawDataSource, "(0.7 * Cos(3x)+3)+(1.5*Sin(x/2+4))");
            
            PlotterMain.Children.Add(cos);
            #endregion

            #region EnumerableDataSource and Custom Graph Settings
            
            MyClass[] myObjects = new MyClass[N];
            for (int i = 0; i < N; i++)
                myObjects[i] = new MyClass() { A = 0.1 + i * step };

            EnumerableDataSource<MyClass> enumDataSource = myObjects.AsDataSource<MyClass>();
            enumDataSource.SetXYMapping(o => new Point(o.A,o.B));

            LineGraphSettings settings = new LineGraphSettings();
            settings.LineColor = Colors.Magenta;
            settings.LineThickness = Math.PI;
            settings.Description = "Log10";
            log = new LineGraph(enumDataSource, settings);
            PlotterMain.Children.Add(log);

            #endregion

            PlotterMain.FitToView();
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:60,代码来源:Page.xaml.cs

示例3: Page_Loaded

        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            #region Data preparation
            const int N = 200;

            int[] thiknesses = new int[10];

            for(int i=0;i<10;i++)
                thiknesses[i] = i+1;

            Point[] points = new Point[N];
            double step = 10 / (double)N;

            for(int i=0;i<N;i++) {
                points[i].X = -5 + i*step;
                points[i].Y = Math.Exp(points[i].X);
            }

            EnumerableDataSource<Point> dataSource = points.AsDataSource<Point>();
            dataSource.SetXYMapping(point => point);
            #endregion

            graph = new LineGraphWithPoints(dataSource, "Graph Description");
            graph.LineThickness = 3;
            graph.LineColor = Colors.Red;

            
            MainPlotter.Children.Add(graph);
            MainPlotter.FitToView();

            TextBoxDescription.Text = graph.Description;
            if (MainPlotter.Legend != null)
                TextBoxDescriptionLength.Text = MainPlotter.Legend.AllowedDescriptionLength.ToString();
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:34,代码来源:Page.xaml.cs

示例4: addRandomPolynomial

        private void addRandomPolynomial()
        {
            int[] multipliers = new int[5];
            Point[] points = new Point[500];

            for (int i = 0; i < multipliers.Length; i++)
                multipliers[i] = (int)((random.NextDouble() - 0.5) * 200);

            double step = (double)(10) / points.Length;
            for (int i = 0; i < points.Length; i++)
            {
                points[i].X = -5 + (step * i);
                points[i].Y = Math.Pow(points[i].X, 5) +
                    multipliers[0] * Math.Pow(points[i].X, 4) +
                    multipliers[1] * Math.Pow(points[i].X, 3) +
                    multipliers[2] * Math.Pow(points[i].X, 2) +
                    multipliers[3] * points[i].X +
                    multipliers[4];
            }

            var dataSource = points.AsDataSource<Point>();
            dataSource.SetXYMapping(point => point);


            LineGraph polinom = new LineGraph(dataSource,
                multipliers[0]+" "+multipliers[1]+" "+multipliers[2]+" "+multipliers[3]+" "+multipliers[4]);
            
            mainPlotter.Children.Add(polinom);
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:29,代码来源:Page.xaml.cs


注:本文中的Point.AsDataSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。