Пример #1
0
        private void SweepAnimation()
        {
            foreach (var s in ParentSurface.RenderableSeries)
            {
                if (s is BaseRenderableSeries series)
                {
                    var trans = new SweepAnimation();
                    trans.Duration       = TimeSpan.FromSeconds(5);
                    trans.AnimationDelay = TimeSpan.FromSeconds(1);
                    trans.EasingFunction = new CircleEase {
                        EasingMode = EasingMode.EaseIn
                    };

                    series.SeriesAnimation = trans;
                }
            }
        }
        public FiltersAPIExample()
        {
            InitializeComponent();

            OnUpdatedData(1.0d, 0.01d);

            var filteredDataLinearTrendline     = _originalData.ToLinearTrendline();
            var filteredDataPolynomialTrendline = _originalData.ToPolynomialTrend(3);
            var filteredDataScale  = _originalData.Scale(0.5);
            var filteredDataOffset = _originalData.Offset(-50.0);
            var filteredDataSpline = _originalData.ToSpline(5);
            var filteredDataCustom = new CustomFilter(_originalData);

            var sweepAnimation1 = new SweepAnimation()
            {
                AnimationDelay = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(3)
            };
            var sweepAnimation2 = new SweepAnimation()
            {
                AnimationDelay = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(3)
            };
            var sweepAnimation3 = new SweepAnimation()
            {
                AnimationDelay = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(3)
            };
            var sweepAnimation4 = new SweepAnimation()
            {
                AnimationDelay = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(3)
            };
            var sweepAnimation5 = new SweepAnimation()
            {
                AnimationDelay = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(3)
            };
            var sweepAnimation6 = new SweepAnimation()
            {
                AnimationDelay = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(3)
            };
            var sweepAnimation7 = new SweepAnimation()
            {
                AnimationDelay = TimeSpan.FromSeconds(1), Duration = TimeSpan.FromSeconds(3)
            };


            _originalData.SeriesName = "Original Data";
            filteredDataLinearTrendline.SeriesName     = "Linear Trendline";
            filteredDataPolynomialTrendline.SeriesName = "Polynomial (3rd Order)";
            filteredDataScale.SeriesName  = "Scaled * 0.5";
            filteredDataOffset.SeriesName = "Offset -50";
            filteredDataSpline.SeriesName = "Spline, Tension=5";
            filteredDataCustom.FilteredDataSeries.SeriesName = "Custom Filter";

            sciChart.RenderableSeries.Add(new XyScatterRenderableSeries()
            {
                DataSeries = _originalData, Stroke = Colors.Red, PointMarker = new EllipsePointMarker()
                {
                    Fill = Colors.Red, Stroke = Colors.Red
                }, SeriesAnimation = sweepAnimation1
            });
            sciChart.RenderableSeries.Add(new FastLineRenderableSeries()
            {
                DataSeries = filteredDataLinearTrendline, StrokeThickness = 2, Stroke = Colors.GreenYellow, SeriesAnimation = sweepAnimation2
            });
            sciChart.RenderableSeries.Add(new FastLineRenderableSeries()
            {
                DataSeries = filteredDataPolynomialTrendline, StrokeThickness = 2, Stroke = Colors.Yellow, SeriesAnimation = sweepAnimation3
            });
            sciChart.RenderableSeries.Add(new FastLineRenderableSeries()
            {
                DataSeries = filteredDataScale, StrokeThickness = 2, Stroke = Colors.DeepSkyBlue, SeriesAnimation = sweepAnimation4
            });
            sciChart.RenderableSeries.Add(new FastLineRenderableSeries()
            {
                DataSeries = filteredDataSpline, StrokeThickness = 1, Stroke = Colors.DeepSkyBlue, Opacity = 0.5, SeriesAnimation = sweepAnimation5
            });
            sciChart.RenderableSeries.Add(new FastLineRenderableSeries()
            {
                DataSeries = filteredDataOffset, StrokeThickness = 2, Stroke = Color.FromArgb(0x77, 0xFF, 0x33, 0x33), SeriesAnimation = sweepAnimation6
            });
            sciChart.RenderableSeries.Add(new FastLineRenderableSeries()
            {
                DataSeries = filteredDataCustom.FilteredDataSeries, StrokeThickness = 2, Stroke = Colors.MediumPurple, SeriesAnimation = sweepAnimation7
            });

            sweepAnimation1.StartAnimation();
            sweepAnimation2.StartAnimation();
            sweepAnimation3.StartAnimation();
            sweepAnimation4.StartAnimation();
            sweepAnimation5.StartAnimation();
            sweepAnimation6.StartAnimation();
            sweepAnimation7.StartAnimation();
        }