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


C# EnumerableDataSource.SetXMapping方法代码示例

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


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

示例1: Window_Loaded

		private void Window_Loaded(object sender, RoutedEventArgs e)
		{
			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
			
			//todo
			//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();
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:26,代码来源:AnimationSample.xaml.cs

示例2: DrawChart

        private void DrawChart()
        {
            var xpoints = new int[_visitedPoints.Count];
            var ypoints = new int[_visitedPoints.Count];
            var times = new int[_visitedPoints.Count];
            for (int i = 0; i < times.Length; i++)
            {
                times[i] = i;
                xpoints[i] = (int) _visitedPoints[i].Position.X;
                ypoints[i] = (int) _visitedPoints[i].Position.Y;
            }

            var timesDataSource = new EnumerableDataSource<int>(times);
            timesDataSource.SetXMapping(x => timeAxis.ConvertToDouble(x));

            var xPointsDataSource = new EnumerableDataSource<int>(xpoints);
            xPointsDataSource.SetYMapping(y => Convert.ToInt32(y));

            var yPointsDataSource = new EnumerableDataSource<int>(ypoints);
            yPointsDataSource.SetYMapping(y => Convert.ToInt32(y));

            var compositeDataSource1 = new CompositeDataSource(xPointsDataSource, timesDataSource);
            var compositeDataSource2 = new CompositeDataSource(yPointsDataSource, timesDataSource);

            plotter.AddLineGraph(compositeDataSource1,
                                 new Pen(Brushes.GreenYellow, 2),
                                 new CirclePointMarker {Size = 10.0, Fill = Brushes.Red},
                                 new PenDescription("x/t"));
            plotter.AddLineGraph(compositeDataSource2,
                                 new Pen(Brushes.Gold, 2),
                                 new CirclePointMarker {Size = 10.0, Fill = Brushes.DodgerBlue},
                                 new PenDescription("y/t"));

            plotter.Viewport.FitToView();
        }
开发者ID:taesiri,项目名称:electric-field,代码行数:35,代码来源:DataChart.xaml.cs

示例3: PlantView_DataContextChanged

    void PlantView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
    {
      foreach (var g in _extGraphs)
        ExtGraph.Children.Remove(g);
      _extGraphs.Clear();

      foreach (var g in _wells)
        ExtGraph.Children.Remove(g);
      _wells.Clear();

      

      PlantViewModel P = e.NewValue as PlantViewModel;
      if (P != null)
      {
        EnumerableDataSource<Time.Core.TimestampValue> ds = new EnumerableDataSource<TimestampValue>(P.plant.Extractions.AsTimeStamps);
        ds.SetXMapping(var => dateAxis.ConvertToDouble(var.Time));
        ds.SetYMapping(var => var.Value);
        _extGraphs.Add(ExtGraph.AddLineGraph(ds, new Pen(Brushes.Black, 3), new PenDescription("Groundwater")));

        if (P.plant.SurfaceWaterExtrations.Items.Count > 0)
        {
          EnumerableDataSource<Time.Core.TimestampValue> ds2 = new EnumerableDataSource<TimestampValue>(P.plant.SurfaceWaterExtrations.AsTimeStamps);
          ds2.SetXMapping(var => dateAxis.ConvertToDouble(var.Time));
          ds2.SetYMapping(var => var.Value);
          _extGraphs.Add(ExtGraph.AddLineGraph(ds2, new Pen(Brushes.Red, 3), new PenDescription("Surface water")));
        }
      }
      ZoomToTimeScale();
    }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:30,代码来源:PlantView.xaml.cs

示例4: CreateHistograms

        private void CreateHistograms()
        {
            EnumerableDataSource<int> x = new EnumerableDataSource<int>(Enumerable.Range(0, 256).ToArray());
            x.SetXMapping(_x => _x);

            Func<int, double> mapping;
            if (check.IsChecked.GetValueOrDefault())
                mapping = logMapping;
            else
                mapping = linearMapping;

            red = new EnumerableDataSource<int>(reds);
            red.SetYMapping(mapping);
            green = new EnumerableDataSource<int>(greens);
            green.SetYMapping(mapping);
            blue = new EnumerableDataSource<int>(blues);
            blue.SetYMapping(mapping);

            CompositeDataSource rDS = new CompositeDataSource(x, red);
            CompositeDataSource gDS = new CompositeDataSource(x, green);
            CompositeDataSource bDS = new CompositeDataSource(x, blue);

            plotter.RemoveAllGraphs();
            plotter.AddLineGraph(rDS, Colors.Red, 1, "Red").FilteringEnabled = false;
            plotter.AddLineGraph(gDS, Colors.Green, 1, "Green").FilteringEnabled = false;
            plotter.AddLineGraph(bDS, Colors.Blue, 1, "Blue").FilteringEnabled = false;
        }
开发者ID:modulexcite,项目名称:DynamicDataDisplay,代码行数:27,代码来源:Page.xaml.cs

示例5: MainWindow_Loaded

		private void MainWindow_Loaded(object sender, RoutedEventArgs e)
		{
			// Prepare data in arrays
			const int N = 100;
			double[] x = new double[N];
			double[] y = new double[N];

			for (int i = 0; i < N; i++)
			{
				x[i] = i * 0.1;
				y[i] = Math.Cos(x[i]);
			}

			// Add data sources:
			var yDataSource = new EnumerableDataSource<double>(y);
			yDataSource.SetYMapping(Y => Y);
			yDataSource.AddMapping(ShapeElementPointMarker.ToolTipTextProperty,
				Y => string.Format("Value is {0}", Y));

			var xDataSource = new EnumerableDataSource<double>(x);
			xDataSource.SetXMapping(X => X);

			CompositeDataSource compositeDataSource = new CompositeDataSource(xDataSource, yDataSource);

			plotter.Viewport.Restrictions.Add(new PhysicalProportionsRestriction { ProportionRatio = 1 });

			// adding graph to plotter
			plotter.AddLineGraph(compositeDataSource,
				new Pen(Brushes.Goldenrod, 3),
				new SampleMarker(),
				new PenDescription("Cosine"));
		}
开发者ID:elsiete,项目名称:DynamicDataDisplay,代码行数:32,代码来源:MainWindow.xaml.cs

示例6: showprogress

        private void showprogress()
        {
            DBProgressConnect DBProgressConnect_Inst = new DBProgressConnect();
            DataTable ProgressData = new DataTable();
            ProgressData = DBProgressConnect_Inst.Read(globaldata.current_user);
            datagrid1.ItemsSource = ProgressData.DefaultView;
            int data_count = DBProgressConnect_Inst.Count(globaldata.current_user);
            DateTime[] dates = new DateTime[data_count];
            double[] scores = new double[data_count];

            for (int i = 0; i < data_count; i++)
            {
                dates[i] = Convert.ToDateTime(ProgressData.Rows[i][1]);
                scores[i] = Convert.ToDouble(ProgressData.Rows[i][2]);
            }

            var datesDataSource = new EnumerableDataSource<DateTime>(dates);
            datesDataSource.SetXMapping(x => dateAxis.ConvertToDouble(x));

            var scoreDataSource = new EnumerableDataSource<double>(scores);
            scoreDataSource.SetYMapping(y => y);

            CompositeDataSource compositeDataSource1 = new CompositeDataSource(datesDataSource, scoreDataSource);

            Plotter.AddLineGraph(compositeDataSource1, new Pen(Brushes.Blue, 2), new CirclePointMarker { Size = 10.0, Fill = Brushes.Red }, new PenDescription("Time vs. Score for "+globaldata.current_user+""));

            Plotter.Viewport.FitToView();
        }
开发者ID:mominul,项目名称:SAT,代码行数:28,代码来源:scoresheet.xaml.cs

示例7: CreateCurrencyDataSource

		private EnumerableDataSource<CurrencyInfo> CreateCurrencyDataSource(List<CurrencyInfo> rates)
		{
			EnumerableDataSource<CurrencyInfo> ds = new EnumerableDataSource<CurrencyInfo>(rates);
			ds.SetXMapping(ci => dateAxis.ConvertToDouble(ci.Date));
			ds.SetYMapping(ci => ci.Rate);
			return ds;
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:CurrencyExchangeSample.xaml.cs

示例8: Window1

		public Window1()
		{
			InitializeComponent();

			Content = plot;

			plot.MainHorizontalAxis = axis;

			const int N = 10;

			double[] x = new double[N];
			double[] y = new double[N];
			DateTime[] date = new DateTime[N];

			for (int i = 0; i < N; i++)
			{
				x[i] = i * 0.1;
				y[i] = Math.Sin(x[i]);
				date[i] = DateTime.Now.AddMinutes(-N + i);
			}

			EnumerableDataSource<double> xs = new EnumerableDataSource<double>(x);
			xs.SetYMapping(_x => _x);
			EnumerableDataSource<DateTime> ys = new EnumerableDataSource<DateTime>(date);
			ys.SetXMapping(axis.ConvertToDouble);

			CompositeDataSource ds = new CompositeDataSource(xs, ys);

			plot.AddLineGraph(ds);
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:30,代码来源:Window1.xaml.cs

示例9: MainWindow

        //Instance of object which contains configuration for sending data.
        //ULoader_JSON config;
        //Instacje of object which sends data.
        //USender uSender;
        public MainWindow()
        {
            InitializeComponent();

            attentionValuesCollection = new DataCollection();

            var attentionDataSource = new EnumerableDataSource<Data>(attentionValuesCollection);
            attentionDataSource.SetXMapping(x => dateAttention.ConvertToDouble(x.Date));
            attentionDataSource.SetYMapping(y => y.Value);
            plotterAttention.AddLineGraph(attentionDataSource, Colors.Red, 2, "Attetion");

            connector = new Connector();
            connector.DeviceConnected += new EventHandler(OnDeviceConnected);
            connector.DeviceConnectFail += new EventHandler(OnDeviceFail);
            connector.DeviceValidating += new EventHandler(OnDeviceValidating);

            connector.ConnectScan("COM3");

            //Stworzenie obiektu typu Random do wyboru losowego słowa ze słownika.
            randomWordNumber = new Random();

            wordNumber = 0;

            attentionComingCounter = 0;
            attentionValueSum = 0;
            puzzlesSolved = 0;
            wordStatList = new List<WordStat>();
            currentWord = "";

            //config = new ULoader_JSON(@"..\..\config.json");
            //uSender = config.GetSender("output1");
        }
开发者ID:Sektu,项目名称:MindwaveApp,代码行数:36,代码来源:MainWindow.xaml.cs

示例10: Window_Loaded

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Prepare data in arrays
            const int N = 100;
            double[] x = new double[N];
            double[] cs = new double[N];
            double[] sn = new double[N];

            for (int i = 0; i < N; i++)
            {
                x[i] = i * 0.1;
                cs[i] = Math.Sin(x[i]);
                sn[i] = Math.Cos(x[i]);
            }

            // Add data sources:
            // 3 partial data sources, containing each of arrays
            var snDataSource = new EnumerableDataSource<double>(sn);
            snDataSource.SetYMapping(y => y);

            var xDataSource = new EnumerableDataSource<double>(x);
            xDataSource.SetXMapping(lx => lx);

            var csDataSource = new EnumerableDataSource<double>(cs);
            csDataSource.SetYMapping(y => y);

            var csqDataSource = new EnumerableDataSource<double>(cs);
            csqDataSource.SetYMapping(y => y * y);


            // 2 composite data sources and 2 charts respectively:
            // creating composite data source
            CompositeDataSource compositeDataSource1 = new CompositeDataSource(xDataSource, snDataSource);
            // adding graph to plotter
            plotter.AddLineGraph(compositeDataSource1,
                new Pen(Brushes.DarkGoldenrod, 3),
                new CirclePointMarker { Size = 10, Fill = Brushes.Red },
                new PenDescription("Sin"));

            // creating composite data source for cs values
            CompositeDataSource compositeDataSource2 = new CompositeDataSource(xDataSource, csDataSource);
            // Adding second graph to plotter
            plotter.AddLineGraph(compositeDataSource2,
                new Pen(Brushes.Blue, 3),
                new TrianglePointMarker { Size = 20, Fill = Brushes.Blue },
                new PenDescription("Cos"));

            // creating composite data source for cs^2 values
            CompositeDataSource compositeDataSource3 = new CompositeDataSource(xDataSource, csqDataSource);
            // Adding thirs graph to plotter
            Pen dashed = new Pen(Brushes.Magenta, 3);
            dashed.DashStyle = DashStyles.Dot;
            plotter.AddLineGraph(compositeDataSource3,
                dashed,
                new PenDescription("Cos^2"));

            // Force evertyhing plotted to be visible
            plotter.FitToView();
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:59,代码来源:Window1.xaml.cs

示例11: ExperimentalIV_DataSource

        public ExperimentalIV_DataSource(List<PointD> data)
        {
            _ExperimentalData = data;
            _ExperimentalDataSource = new EnumerableDataSource<PointD>(_ExperimentalData);
            _ExperimentalDataSource.SetXMapping(x => x.X);
            _ExperimentalDataSource.SetYMapping(y => y.Y);

            dispatcher = Dispatcher.CurrentDispatcher;
        }
开发者ID:GandziukVI,项目名称:BreakJunctionsExperiment,代码行数:9,代码来源:ExperimentalDataSource.cs

示例12: Handle

		/// <summary>
		/// Updates the graph of the histogram with the newly calculated data of the frame
		/// once it is rendered.
		/// </summary>
		public override void Handle(Pipeline.TickRenderedMessage message)
		{
			Data = new EnumerableDataSource<KeyValuePair<int, double>>(
				NodeModel.Data.Select((datum, idx) => new KeyValuePair<int, double>(idx, datum))
			);
			Data.SetXMapping(k => k.Key);
			Data.SetYMapping(k => k.Value);
			NotifyOfPropertyChange(() => Data);
		}
开发者ID:Kha,项目名称:YUV.KA,代码行数:13,代码来源:HistogramViewModel.cs

示例13: CreatePerformanceGraph

 private void CreatePerformanceGraph(string instanceName, string counterName)
 {
     var perfData = new PerformanceData(new PerformanceCounter("Process", counterName, instanceName));
     var filteredData = new FilteringDataSource<PerformanceInfo>(perfData, new MaxSizeFilter());
     var dataSource = new EnumerableDataSource<PerformanceInfo>(filteredData);
     dataSource.SetXMapping(pi => (pi.Time.TimeOfDay.TotalSeconds - (_currentTotal == 0 ? _currentTotal = pi.Time.TimeOfDay.TotalSeconds : _currentTotal)));
     dataSource.SetYMapping(pi => Proc.GetCpuValue(pi.Value));
     Plotter.AddLineGraph(dataSource, 0.8, string.Format("{0} - {1}", counterName, instanceName));
 }
开发者ID:ventsislav-georgiev,项目名称:ProcessTools,代码行数:9,代码来源:ProcessPerf.xaml.cs

示例14: Window1_Loaded

		void Window1_Loaded(object sender, RoutedEventArgs e)
		{
			List<WeatherData> data = CreateData(100);

			chart.DataSource = data;

			EnumerableDataSource<WeatherData> dataSource = new EnumerableDataSource<WeatherData>(data);
			dataSource.SetXMapping(weather => weather.Day);
			dataSource.SetYMapping(weather => weather.Temperature);

			var line = plotter.AddLineGraph(dataSource);
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:12,代码来源:Window1.xaml.cs

示例15: Window_Loaded

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Prepare table. We use standart data table
            DataTable table = new DataTable();
            table.Columns.Add("Sine", typeof(double));
            table.Columns.Add("Time", typeof(DateTime));
            table.Columns.Add("Index", typeof(int));
            table.Columns.Add("Sqrt", typeof(double));

            for (int i = 0; i < 100; i++)
            {
                table.Rows.Add(
                    Math.Sin(i / 10.0),
                    DateTime.Now + new TimeSpan(0, 0, i),
                    i,
                    Math.Sqrt(i));
            }

            // Prepare data source with mapping 
            TableDataSource data = new TableDataSource(table);
            // X is time in seconds
            data.SetXMapping(row => ((DateTime)row["Time"] - (DateTime)table.Rows[0][1]).TotalSeconds);
            // Y is value of "Sine" column
            data.SetYMapping(row => 10 * (double)row["Sine"]);
            // Map HSB color computes from "Index" column to dependency property Brush of marker
            data.AddMapping(ShapePointMarker.FillProperty,
                row => new SolidColorBrush(new HsbColor(3 * (int)row["Index"], 1, 1).ToArgbColor()));
            // Map "Sqrt" based values to marker size
            data.AddMapping(ShapePointMarker.SizeProperty,
                row => 4 + (double)row["Sqrt"]);

            // Plot first graph
            plotter.AddLineGraph(data,
                new Pen(Brushes.Blue, 2),
                new CirclePointMarker(),
                new PenDescription("First series (Sine)"));

            // Prepare data source for second graph. table.Rows is enumerable, 
            // so we can plot its contents as IEnumerable with items of TableRow type
            EnumerableDataSource<DataRow> data2 = new EnumerableDataSource<DataRow>(table.Rows);
            // X is time in seconds again
            data2.SetXMapping(row => ((DateTime)row["Time"] - (DateTime)table.Rows[0][1]).TotalSeconds);
            // Y is value of "Sqrt" column
            data2.SetYMapping(row => (double)row["Sqrt"]);

            // Plot second graph without markers
            plotter.AddLineGraph(data2,
                Colors.Red, 3.0,
                "Second series (Sqrt)");

            // Force evertyhing plotted to be visible
            plotter.Viewport.FitToView();
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:53,代码来源:Window1.xaml.cs


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