Example #1
0
        /// <summary>
        /// This method runs when the update starts
        /// </summary>
        public override void OnSeriesUpdateStart()
        {
            ActiveSplitters = 0;

            if (SplittersCollector == int.MaxValue - 1)
            {
                //just in case!
                Splitters.ForEach(s => s.SplitterCollectorIndex = 0);
                SplittersCollector = 0;
            }

            SplittersCollector++;

            if (IsPathInitialized)
            {
                Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);
                Path.Stroke          = Stroke;
                Path.StrokeThickness = StrokeThickness;
                Path.Fill            = Fill;
                Path.Visibility      = Visibility;
                Path.StrokeDashArray = StrokeDashArray;
                Panel.SetZIndex(Path, Panel.GetZIndex(this));
                return;
            }

            IsPathInitialized = true;

            Path = new Path
            {
                Stroke          = Stroke,
                StrokeThickness = StrokeThickness,
                Fill            = Fill,
                Visibility      = Visibility,
                StrokeDashArray = StrokeDashArray
            };

            Panel.SetZIndex(Path, Panel.GetZIndex(this));

            var geometry = new PathGeometry();

            Figure = new PathFigure();
            geometry.Figures.Add(Figure);
            Path.Data = geometry;

            Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);
        }
Example #2
0
        public override void OnSeriesUpdateStart()
        {
            ActiveSplitters = 0;

            if (SplittersCollector == int.MaxValue - 1)
            {
                //just in case!
                Splitters.ForEach(s => s.SplitterCollectorIndex = 0);
                SplittersCollector = 0;
            }

            SplittersCollector++;

            if (Figure != null)
            {
                var xIni = ChartFunctions.ToDrawMargin(Values.Limit1.Min, AxisTags.X, Model.Chart, ScalesXAt);

                if (Model.Chart.View.DisableAnimations)
                {
                    Figure.StartPoint = new Point(xIni, Model.Chart.DrawMargin.Height);
                }
                else
                {
                    Figure.BeginAnimation(PathFigure.StartPointProperty,
                                          new PointAnimation(new Point(xIni, Model.Chart.DrawMargin.Height),
                                                             Model.Chart.View.AnimationsSpeed));
                }
            }

            if (IsInView)
            {
                return;
            }

            IsInView = true;

            Path = new Path();
            BindingOperations.SetBinding(Path, Shape.StrokeProperty,
                                         new Binding {
                Path = new PropertyPath(StrokeProperty), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.FillProperty,
                                         new Binding {
                Path = new PropertyPath(FillProperty), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.StrokeThicknessProperty,
                                         new Binding {
                Path = new PropertyPath(StrokeThicknessProperty), Source = this
            });
            BindingOperations.SetBinding(Path, VisibilityProperty,
                                         new Binding {
                Path = new PropertyPath(VisibilityProperty), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.StrokeDashArrayProperty,
                                         new Binding {
                Path = new PropertyPath(StrokeDashArrayProperty), Source = this
            });
            var geometry = new PathGeometry();

            Figure = new PathFigure();
            geometry.Figures.Add(Figure);
            Path.Data = geometry;
            Model.Chart.View.AddToDrawMargin(Path);

            var x = ChartFunctions.ToDrawMargin(Values.Limit1.Min, AxisTags.X, Model.Chart, ScalesXAt);

            Figure.StartPoint = new Point(x, Model.Chart.DrawMargin.Height);

            var wpfChart = Model.Chart.View as Chart;

            if (wpfChart == null)
            {
                return;
            }

            var index = Stroke == null || Fill == null ? wpfChart.SeriesIndexCount++ : 0;

            var i = Model.Chart.View.Series.IndexOf(this);

            Panel.SetZIndex(Path, Model.Chart.View.Series.Count - i);

            if (Stroke == null)
            {
                SetValue(StrokeProperty, new SolidColorBrush(Chart.GetDefaultColor(index)));
            }
            if (Fill == null)
            {
                SetValue(FillProperty,
                         new SolidColorBrush(Chart.GetDefaultColor(index))
                {
                    Opacity = DefaultFillOpacity
                });
            }
        }
Example #3
0
        public override void OnSeriesUpdateStart()
        {
            ActiveSplitters = 0;

            if (SplittersCollector == short.MaxValue - 1)
            {
                //just in case!
                Splitters.ForEach(s => s.SplitterCollectorIndex = 0);
                SplittersCollector = 0;
            }

            SplittersCollector++;

            if (Figure != null && Values != null)
            {
                var yIni = ChartFunctions.ToDrawMargin(Values.GetTracker(this).YLimit.Min, AxisOrientation.Y, Model.Chart, ScalesYAt);

                if (Model.Chart.View.DisableAnimations)
                {
                    Figure.StartPoint = new Point(0, yIni);
                }
                else
                {
                    Figure.BeginPointAnimation(nameof(PathFigure.StartPoint), new Point(0, yIni),
                                               Model.Chart.View.AnimationsSpeed);
                }
            }

            if (IsPathInitialized)
            {
                Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);
                Path.Stroke          = Stroke;
                Path.StrokeThickness = StrokeThickness;
                Path.Fill            = Fill;
                Path.Visibility      = Visibility;
                Path.StrokeDashArray = StrokeDashArray;
                return;
            }

            IsPathInitialized = true;

            Path = new Path
            {
                Stroke          = Stroke,
                StrokeThickness = StrokeThickness,
                Fill            = Fill,
                Visibility      = Visibility,
                StrokeDashArray = StrokeDashArray
            };

            Canvas.SetZIndex(Path, Canvas.GetZIndex(this));

            var geometry = new PathGeometry();

            Figure = new PathFigure();
            geometry.Figures.Add(Figure);
            Path.Data = geometry;
            Model.Chart.View.AddToDrawMargin(Path);

            var y = ChartFunctions.ToDrawMargin(ActualValues.GetTracker(this).YLimit.Min, AxisOrientation.Y, Model.Chart, ScalesYAt);

            Figure.StartPoint = new Point(0, y);

            var i = Model.Chart.View.Series.IndexOf(this);

            Canvas.SetZIndex(Path, Model.Chart.View.Series.Count - i);
        }
Example #4
0
        public override void OnSeriesUpdateStart()
        {
            ActiveSplitters = 0;

            if (SplittersCollector == int.MaxValue - 1)
            {
                //just in case!
                Splitters.ForEach(s => s.SplitterCollectorIndex = 0);
                SplittersCollector = 0;
            }

            SplittersCollector++;

            if (Figure != null)
            {
                var yIni = ChartFunctions.ToDrawMargin(Values.Limit2.Min, AxisOrientation.Y, Model.Chart, ScalesYAt);

                if (Model.Chart.View.DisableAnimations)
                {
                    Figure.StartPoint = new Point(0, yIni);
                }
                else
                {
                    Figure.BeginAnimation(PathFigure.StartPointProperty,
                                          new PointAnimation(new Point(0, yIni),
                                                             Model.Chart.View.AnimationsSpeed));
                }
            }

            if (IsPathInitialized)
            {
                return;
            }

            IsPathInitialized = true;

            Path = new Path();
            BindingOperations.SetBinding(Path, Shape.StrokeProperty,
                                         new Binding {
                Path = new PropertyPath("Stroke"), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.FillProperty,
                                         new Binding {
                Path = new PropertyPath("Fill"), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.StrokeThicknessProperty,
                                         new Binding {
                Path = new PropertyPath("StrokeThickness"), Source = this
            });
            BindingOperations.SetBinding(Path, VisibilityProperty,
                                         new Binding {
                Path = new PropertyPath("Visibility"), Source = this
            });
            BindingOperations.SetBinding(Path, Panel.ZIndexProperty,
                                         new Binding {
                Path = new PropertyPath(Panel.ZIndexProperty), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.StrokeDashArrayProperty,
                                         new Binding {
                Path = new PropertyPath(StrokeDashArrayProperty), Source = this
            });
            var geometry = new PathGeometry();

            Figure = new PathFigure();
            geometry.Figures.Add(Figure);
            Path.Data = geometry;
            Model.Chart.View.AddToDrawMargin(Path);

            var y = ChartFunctions.ToDrawMargin(ActualValues.Limit2.Min, AxisOrientation.Y, Model.Chart, ScalesYAt);

            Figure.StartPoint = new Point(0, y);
        }
Example #5
0
        public override void OnSeriesUpdateStart()
        {
            ActiveSplitters = 0;

            if (SplittersCollector == int.MaxValue - 1)
            {
                //just in case!
                Splitters.ForEach(s => s.SplitterCollectorIndex = 0);
                SplittersCollector = 0;
            }

            SplittersCollector++;

            if (Figure != null)
            {
                var xIni = ChartFunctions.ToDrawMargin(Values.Limit1.Min, AxisTags.X, Model.Chart, ScalesXAt);

                if (Model.Chart.View.DisableAnimations)
                {
                    Figure.StartPoint = new Point(xIni, Model.Chart.DrawMargin.Height);
                }
                else
                {
                    Figure.BeginAnimation(PathFigure.StartPointProperty,
                                          new PointAnimation(new Point(xIni, Model.Chart.DrawMargin.Height),
                                                             Model.Chart.View.AnimationsSpeed));
                }
            }

            if (IsPathInitialized)
            {
                Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);
                return;
            }
            ;

            IsPathInitialized = true;

            Path = new Path();
            BindingOperations.SetBinding(Path, Shape.StrokeProperty,
                                         new Binding {
                Path = new PropertyPath(StrokeProperty), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.FillProperty,
                                         new Binding {
                Path = new PropertyPath(FillProperty), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.StrokeThicknessProperty,
                                         new Binding {
                Path = new PropertyPath(StrokeThicknessProperty), Source = this
            });
            BindingOperations.SetBinding(Path, VisibilityProperty,
                                         new Binding {
                Path = new PropertyPath(VisibilityProperty), Source = this
            });
            BindingOperations.SetBinding(Path, Panel.ZIndexProperty,
                                         new Binding {
                Path = new PropertyPath(Panel.ZIndexProperty), Source = this
            });
            BindingOperations.SetBinding(Path, Shape.StrokeDashArrayProperty,
                                         new Binding {
                Path = new PropertyPath(StrokeDashArrayProperty), Source = this
            });
            var geometry = new PathGeometry();

            Figure = new PathFigure();
            geometry.Figures.Add(Figure);
            Path.Data = geometry;

            Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);

            var x = ChartFunctions.ToDrawMargin(Values.Limit1.Min, AxisTags.X, Model.Chart, ScalesXAt);

            Figure.StartPoint = new Point(x, Model.Chart.DrawMargin.Height);

            base.OnSeriesUpdateStart();
        }
        public override void OnSeriesUpdateStart()
        {
            ActiveSplitters = 0;

            if (SplittersCollector == int.MaxValue - 1)
            {
                //just in case!
                Splitters.ForEach(s => s.SplitterCollectorIndex = 0);
                SplittersCollector = 0;
            }

            SplittersCollector++;

            var uw = Model.Chart.AxisY[ScalesYAt].EvaluatesUnitWidth
                ? ChartFunctions.GetUnitWidth(AxisOrientation.Y, Model.Chart, ScalesYAt) / 2
                : 0;
            var areaLimit = 0d;

            if (!double.IsNaN(AreaLimit))
            {
                areaLimit = ChartFunctions.ToDrawMargin(AreaLimit, AxisOrientation.Y, Model.Chart, ScalesYAt);
            }

            if (Figure != null && Values != null)
            {
                var yi = (ActualValues.GetPoints(this).FirstOrDefault() ?? new ChartPoint()).Y;
                yi  = ChartFunctions.ToDrawMargin(yi, AxisOrientation.Y, Model.Chart, ScalesYAt);
                yi -= uw;

                if (Model.Chart.View.DisableAnimations)
                {
                    Figure.StartPoint = new Point(areaLimit, yi);
                }
                else
                {
                    Figure.BeginPointAnimation(nameof(PathFigure.StartPoint),
                                               new Point(areaLimit, yi), Model.Chart.View.AnimationsSpeed);
                }
            }

            if (IsPathInitialized)
            {
                Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(Path);
                Path.Stroke          = Stroke;
                Path.StrokeThickness = StrokeThickness;
                Path.Fill            = Fill;
                Path.Visibility      = Visibility;
                Path.StrokeDashArray = StrokeDashArray;
                Canvas.SetZIndex(Path, Canvas.GetZIndex(this));
                return;
            }

            IsPathInitialized = true;

            Path = new Path
            {
                Stroke          = Stroke,
                StrokeThickness = StrokeThickness,
                Fill            = Fill,
                Visibility      = Visibility,
                StrokeDashArray = StrokeDashArray
            };

            Canvas.SetZIndex(Path, Canvas.GetZIndex(this));

            var geometry = new PathGeometry();

            Figure = new PathFigure();
            geometry.Figures.Add(Figure);
            Path.Data = geometry;
            Model.Chart.View.AddToDrawMargin(Path);

            var y = (ActualValues.GetPoints(this).FirstOrDefault() ?? new ChartPoint()).Y;

            y  = ChartFunctions.ToDrawMargin(y, AxisOrientation.Y, Model.Chart, ScalesYAt);
            y -= uw;
            Figure.StartPoint = new Point(areaLimit, y);
        }