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


C# LineSeries.SetBinding方法代码示例

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


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

示例1: AddNewCurves

        } // constructor

        public void AddNewCurves(CurvePoint[][] xCurvePoints, double xYShift)
        {
            if (!Dispatcher.CheckAccess())
            {
                Action lAction = () => { AddNewCurves(xCurvePoints, xYShift); };
                App.Current.Dispatcher.BeginInvoke(lAction);
                return;
            }

            // find the Y axis
            LinearAxis lYAxis = null;
            foreach (IAxis lAxis in _MainWindow.myChart.Axes)
            {
                if (lAxis.Orientation != AxisOrientation.Y) continue;
                lYAxis = lAxis as LinearAxis;
            }

            int lCount = xCurvePoints.GetUpperBound(0);
            LineSeries[] lLineSeries = new LineSeries[lCount];
            for (int x = 0, n = lCount; x < n; x++)
            {
                LineSeries lLine = new LineSeries();
                lLineSeries[x] = lLine;
                lLine.DependentRangeAxis = lYAxis;

                lLine.Title = "manually added curve";
                lLine.SetBinding(LineSeries.ItemsSourceProperty, new Binding());

                lLine.IndependentValueBinding = new Binding("Time");
                lLine.DependentValueBinding = new Binding("CurveId");

                Style lLineStyle = new Style(typeof(Polyline));
                //lLineStyle.Setters.Add(new Setter(Polyline.StrokeStartLineCapProperty, PenLineCap.Flat));
                //lLineStyle.Setters.Add(new Setter(Polyline.StrokeEndLineCapProperty, PenLineCap.Triangle));

                Style lPointStyle = new Style(typeof(DataPoint));

                if (xYShift == 0.0)
                {
                    lLineStyle.Setters.Add(new Setter(Polyline.StrokeThicknessProperty, 3.0));
                    lPointStyle.Setters.Add(new Setter(DataPoint.WidthProperty, 0.0));
                    lPointStyle.Setters.Add(new Setter(DataPoint.BackgroundProperty, new SolidColorBrush(Colors.LightGreen)));
                }
                else
                {
                    lLineStyle.Setters.Add(new Setter(Polyline.StrokeThicknessProperty, 1.0));
                    lPointStyle.Setters.Add(new Setter(DataPoint.WidthProperty, 0.0));
                    lPointStyle.Setters.Add(new Setter(DataPoint.BackgroundProperty, new SolidColorBrush(Colors.Black)));
                }
                lLine.PolylineStyle = lLineStyle;
                lLine.DataPointStyle = lPointStyle;

                xCurvePoints[x][0].CurveId -= xYShift;
                xCurvePoints[x][1].CurveId -= xYShift;
                lLine.ItemsSource = xCurvePoints[x];
                _MainWindow.myChart.Series.Add(lLine);
            }
        } //
开发者ID:huoxudong125,项目名称:HQF.Tutorial.WPF,代码行数:60,代码来源:ViewModel.cs

示例2: UpdateChart

        private void UpdateChart()
        {
            foreach (SeriesData seriesData in Controller.Graph.Series.Where(s => s.Visible))
            {
                var series = new LineSeries
                {
                    DependentValuePath = "Amount",
                    IndependentValuePath = "Month",
                    IsSelectionEnabled = true,
                    DataContext = seriesData
                };

                var plotsBinding = new Binding
                {
                    Path = new PropertyPath("Plots")
                };
                series.SetBinding(DataPointSeries.ItemsSourceProperty, plotsBinding);

                var titleBinding = new Binding
                {
                    Path = new PropertyPath("SeriesName")
                };
                series.SetBinding(Series.TitleProperty, titleBinding);

                var visibilityBinding = new Binding
                {
                    Path = new PropertyPath("Visible"),
                    Converter = new BooleanToVisibilityConverter()
                };
                series.SetBinding(VisibilityProperty, visibilityBinding);

                series.SelectionChanged += SeriesOnSelectionChanged;

                this.Chart.Series.Add(series);
            }
        }
开发者ID:Benrnz,项目名称:BudgetAnalyser,代码行数:36,代码来源:LongTermSpendingGraph.xaml.cs

示例3: DrawCurve_WPF_Runtime

        private void DrawCurve_WPF_Runtime(Chart lChart, AxisPointDateTime lAxisPointDateTimeX, AxisPointLinear lAxisPointLinearY)
        {
            PriceClusterSimple lDataPoint = new PriceClusterSimple(lAxisPointDateTimeX.MouseAxisValueAbsolute, lAxisPointLinearY.MouseAxisValueAbsolute);

            if (ManualPoints != null)
            {
                if (_DrawNewLine)
                {
                    _DrawNewLine = false;
                    ManualPoints.Clear();
                    ManualPoints.Add(lDataPoint); // from
                    ManualPoints.Add(lDataPoint); // to
                }
                else
                {
                    ManualPoints.RemoveAt(1);
                    ManualPoints.Add(lDataPoint); // to
                }
                return;
            }

            ManualPoints = new ObservableCollection<PriceClusterSimple>();
            ManualPoints.Add(lDataPoint);
            ManualPoints.Add(lDataPoint);
            LineSeries lNewLineSeries = new LineSeries();
            lNewLineSeries.Title = "manually added curve";
            lNewLineSeries.SetBinding(LineSeries.ItemsSourceProperty, new Binding());
            lNewLineSeries.ItemsSource = ManualPoints;
            lNewLineSeries.IndependentValueBinding = new Binding("Date");
            lNewLineSeries.DependentValueBinding = new Binding("Price");
            lNewLineSeries.DependentRangeAxis = lAxisPointLinearY.Axis;
            Setter lHeightSetter = new Setter(FrameworkElement.HeightProperty, 0.0);
            Setter lWidthSetter = new Setter(FrameworkElement.WidthProperty, 0.0);
            Setter lColor = new Setter(Control.BackgroundProperty, new SolidColorBrush(Colors.Black));
            Style lStyle = new Style(typeof(Control));
            lNewLineSeries.DataPointStyle = lStyle;
            lStyle.Setters.Add(lHeightSetter);
            lStyle.Setters.Add(lWidthSetter);
            lStyle.Setters.Add(lColor);
            lChart.Series.Add(lNewLineSeries);
        } //
开发者ID:huoxudong125,项目名称:HQF.Tutorial.WPF,代码行数:41,代码来源:MainWindow.xaml.cs

示例4: viewModel_SelectedParameterIDChanged

        void viewModel_SelectedParameterIDChanged(object sender, EventArgs e)
        {
            FlightAnalysisSubLiteViewModel viewModel = this.GetViewModel();
            if (viewModel == null || viewModel.ChartViewModel == null
                || this.DataLoader == null)
                return;

            var tempArray = new string[] { viewModel.SelectedParameterID };

            this.DataLoader.LoadRawDataAsync(tempArray);
            var tempGroup = AircraftDataAnalysisModel1.WinRT.DataModel.FlightAnalysisChartGroupFactory.CalculateBindingGroups(tempArray);
            //Group must be only one
            var gpName = tempGroup.First().Key;

            var rawDatas = DataLoader.GetRawData(viewModel.SelectedParameterID);
            Dictionary<int, SimpleDataPoint> pointMapper = new Dictionary<int, SimpleDataPoint>();
            foreach (var item in viewModel.ChartViewModel)
            {
                if (!pointMapper.ContainsKey(item.Second))
                {
                    pointMapper.Add(item.Second, item);
                }
            }

            foreach (var raw in rawDatas)
            {
                if (pointMapper.ContainsKey(raw.Second))
                {
                    pointMapper[raw.Second].Value = raw.Values[0];
                }
            }

            var Xaxis1 = this.tracker1.Axes["xm1XAxis1"] as CategoryXAxis;
            var Yaxis1 = this.tracker1.Axes["xm1YAxis1"] as NumericYAxis;
            var Xaxis2 = this.tracker1.Axes["xm1XAxis2"] as CategoryXAxis;
            var Yaxis2 = this.tracker1.Axes["xm1YAxis2"] as NumericYAxis;
            //Left YAxis    
            var xaxis = Xaxis1;
            var yaxis = Yaxis1;

            if (gpName != viewModel.Group1ID)
            {                //Right YAxis
                xaxis = Xaxis2;
                yaxis = Yaxis2;
            }

            Series temp = this.tracker1.Series["addParamSerie"];
            if (temp != null)
                this.tracker1.Series.Remove(temp);

            LineSeries serie = new LineSeries() { Name = "addParamSerie" };
            serie.XAxis = xaxis;
            serie.ItemsSource = viewModel.ChartViewModel;
            serie.SetBinding(LineSeries.VisibilityProperty, new Binding()
            {
                Path = new PropertyPath("CompareParameterSerieVisibility"),
                Source = viewModel
            });
            serie.YAxis = yaxis;
            serie.Title = ApplicationContext.Instance.GetFlightParameterCaption(viewModel.SelectedParameterID);
            serie.Legend = this.TitleLegend;
            serie.MarkerType = MarkerType.None;
            serie.ValueMemberPath = "Value";
            serie.DataContext = viewModel;

            this.tracker1.Series.Add(serie);
        }
开发者ID:K-Library-NET,项目名称:PopcornStudios,代码行数:67,代码来源:FlightAnalysisSubLite.xaml.cs


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