Exemplo n.º 1
0
        internal override void OnUpdateView(DataPoint dataPoint)
        {
            DataPointView view = dataPoint.View;

            if (view == null)
            {
                return;
            }
            FrameworkElement frameworkElement = view.MarkerView;
            bool             flag             = this.IsMarkerVisible(dataPoint) && ValueHelper.CanGraph(view.AnchorPoint.X) && ValueHelper.CanGraph(view.AnchorPoint.Y);

            if (flag && frameworkElement == null)
            {
                this.OnCreateView(dataPoint);
                frameworkElement = view.MarkerView;
            }
            else if (!flag && frameworkElement != null)
            {
                this.OnRemoveView(dataPoint);
                frameworkElement = (FrameworkElement)null;
            }
            if (frameworkElement == null)
            {
                return;
            }
            AnchorPanel.SetHideOverlapped((UIElement)frameworkElement, this.CanHideMarker(dataPoint));
            AnchorPanel.SetMaximumMovingDistance((UIElement)frameworkElement, 0.0);
            AnchorPanel.SetAnchorPoint((UIElement)frameworkElement, view.AnchorPoint);
            AnchorPanel.SetContentPosition((UIElement)frameworkElement, ContentPositions.MiddleCenter);
        }
Exemplo n.º 2
0
        internal override void OnUpdateView(DataPoint dataPoint)
        {
            base.OnUpdateView(dataPoint);
            DataPointView view = dataPoint.View;

            if (view == null || view.MarkerView == null)
            {
                return;
            }
            double        markerSize    = this.GetMarkerSize(dataPoint);
            MarkerControl markerControl = view.MarkerView as MarkerControl;

            if (markerControl != null)
            {
                markerControl.Width  = markerSize;
                markerControl.Height = markerSize;
            }
            Path path = view.MarkerView as Path;

            if (path != null)
            {
                path.Width  = markerSize;
                path.Height = markerSize;
                path.Data   = VisualUtilities.GetMarkerGeometry(dataPoint.MarkerType, new Size(markerSize, markerSize));
            }
            this.SeriesPresenter.UpdateDataPointZIndex(dataPoint);
            dataPoint.UpdateActualLabelMargin(markerSize);
            ((AnchorPanel)this.MarkersPanel).Invalidate();
        }
Exemplo n.º 3
0
        protected override void BindViewToDataPoint(DataPoint dataPoint, FrameworkElement view, string valueName)
        {
            IAppearanceProvider appearanceProvider = (IAppearanceProvider)dataPoint;

            if (appearanceProvider != null)
            {
                BarControl barControl = view as BarControl;
                if (barControl != null)
                {
                    if (valueName == "Fill" || valueName == null)
                    {
                        barControl.Background = appearanceProvider.Fill;
                    }
                    if (valueName == "Stroke" || valueName == null)
                    {
                        barControl.BorderBrush = appearanceProvider.Stroke;
                    }
                    if (valueName == "StrokeThickness" || valueName == null)
                    {
                        barControl.BorderThickness = new Thickness(appearanceProvider.StrokeThickness);
                    }
                    if (valueName == "Opacity" || valueName == "ActualOpacity" || valueName == null)
                    {
                        barControl.Opacity = dataPoint.ActualOpacity;
                    }
                    if (valueName == "Effect" || valueName == "ActualEffect" || valueName == null)
                    {
                        barControl.Effect = dataPoint.ActualEffect;
                    }
                }
                else
                {
                    Shape shape = view as Shape;
                    if (shape != null)
                    {
                        if (valueName == "Fill" || valueName == null)
                        {
                            shape.Fill = dataPoint.Fill;
                        }
                        if (valueName == "Opacity" || valueName == "ActualOpacity" || valueName == null)
                        {
                            shape.Opacity = dataPoint.ActualOpacity;
                        }
                        if (valueName == "Effect" || valueName == "ActualEffect" || valueName == null)
                        {
                            shape.Effect = dataPoint.ActualEffect is ShaderEffect ? dataPoint.ActualEffect : (Effect)null;
                        }
                    }
                }
            }
            DataPointView dataPointView = dataPoint != null ? dataPoint.View : (DataPointView)null;

            if (dataPointView == null)
            {
                return;
            }
            this.LabelPresenter.BindViewToDataPoint(dataPoint, (FrameworkElement)dataPointView.LabelView, valueName);
            this.MarkerPresenter.BindViewToDataPoint(dataPoint, dataPointView.MarkerView, valueName);
        }
Exemplo n.º 4
0
        protected override void BindViewToDataPoint(DataPoint dataPoint, FrameworkElement view, string valueName)
        {
            DataPointView dataPointView = dataPoint != null ? dataPoint.View : (DataPointView)null;

            if (dataPointView == null)
            {
                return;
            }
            this.LabelPresenter.BindViewToDataPoint(dataPoint, (FrameworkElement)dataPointView.LabelView, valueName);
            this.MarkerPresenter.BindViewToDataPoint(dataPoint, dataPointView.MarkerView, valueName);
        }
Exemplo n.º 5
0
        protected override void BindViewToDataPoint(DataPoint dataPoint, FrameworkElement view, string valueName)
        {
            if (valueName == null || valueName == "Stroke" || (valueName == "StrokeThickness" || valueName == "StrokeDashType") || (valueName == "ActualEffect" || valueName == "Effect" || (valueName == "ActualOpacity" || valueName == "Opacity")))
            {
                this.ChartArea.UpdateSession.ExecuteOnceAfterUpdating((Action)(() => this.UpdateLinePoints()), (object)new Tuple <Series, string>((Series)this.Series, "__UpdateLinePoints__"), (string)null);
            }
            DataPointView dataPointView = dataPoint != null ? dataPoint.View : (DataPointView)null;

            if (dataPointView == null)
            {
                return;
            }
            this.LabelPresenter.BindViewToDataPoint(dataPoint, (FrameworkElement)dataPointView.LabelView, valueName);
            this.MarkerPresenter.BindViewToDataPoint(dataPoint, dataPointView.MarkerView, valueName);
        }
Exemplo n.º 6
0
        protected virtual void CreateView(DataPoint dataPoint)
        {
            if (this.ChartArea == null)
            {
                return;
            }
            DateTime      now           = DateTime.Now;
            DataPointView dataPointView = new DataPointView(dataPoint);

            dataPoint.View         = dataPointView;
            dataPointView.MainView = this.CreateViewElement(dataPoint);
            dataPoint.CreateNotificationBindings();
            this.BindViewToDataPoint(dataPoint, dataPointView.MainView, (string)null);
            this.OnViewCreated(dataPoint);
            this.ChartArea.UpdateSession.Update((IUpdatable)dataPoint);
            this.ChartArea.UpdateSession.AddCounter("SeriesPresenter.CreateView", DateTime.Now - now);
        }
Exemplo n.º 7
0
        protected override void UpdateView(DataPoint dataPoint)
        {
            if (!this.IsDataPointViewVisible(dataPoint))
            {
                return;
            }
            DateTime    now         = DateTime.Now;
            XYDataPoint xyDataPoint = dataPoint as XYDataPoint;

            if (xyDataPoint != null && this.CanGraph(xyDataPoint))
            {
                DataPointView view = dataPoint.View;
                if (view != null)
                {
                    FrameworkElement mainView = view.MainView;
                    if (mainView != null)
                    {
                        bool            flag                = this.ChartArea.Orientation != Orientation.Horizontal;
                        RectOrientation rectOrientation     = RectOrientation.BottomTop;
                        Point           positionInAxisUnits = this.GetPositionInAxisUnits(xyDataPoint);
                        Point           point1              = new Point(Math.Round(positionInAxisUnits.X), Math.Round(positionInAxisUnits.Y));
                        object          crossingPosition    = this.Series.YAxis.Scale.ActualCrossingPosition;
                        Point           basePoint           = new Point(positionInAxisUnits.X, this.Series.YAxis.AxisPresenter.ConvertDataToAxisUnits(crossingPosition) ?? 0.0);
                        Point           point2              = new Point(Math.Round(basePoint.X), Math.Round(basePoint.Y));
                        double          num1                = point1.X + Math.Round(this.PointClusterOffset);
                        double          num2                = this.MinMaxScreenCoordinates(positionInAxisUnits.Y);
                        double          num3                = Math.Round(this.PointWidth);
                        double          height              = this.MinMaxScreenCoordinates(basePoint.Y - positionInAxisUnits.Y);
                        if (ValueHelper.Compare(xyDataPoint.YValue as IComparable, crossingPosition as IComparable) != 0 && Math.Abs(height) < 2.0 && this.CanAdjustHeight())
                        {
                            height = basePoint.Y - positionInAxisUnits.Y >= 0.0 ? 2.0 : -2.0;
                            num2   = point2.Y - height;
                        }
                        if (height < 0.0)
                        {
                            rectOrientation = RectOrientation.TopBottom;
                            height          = Math.Abs(height);
                            num2           -= height;
                        }
                        double num4 = this.MinMaxScreenCoordinates(this.GetYOffsetInAxisUnits(xyDataPoint, positionInAxisUnits, basePoint));
                        double num5 = Math.Round(num2 - num4);
                        double num6 = this.AdjustColumnHeight(height);
                        if (flag)
                        {
                            if (rectOrientation == RectOrientation.BottomTop)
                            {
                                rectOrientation = RectOrientation.RightLeft;
                            }
                            else if (rectOrientation == RectOrientation.TopBottom)
                            {
                                rectOrientation = RectOrientation.LeftRight;
                            }
                            Canvas.SetLeft((UIElement)mainView, num5);
                            Canvas.SetTop((UIElement)mainView, num1);
                            mainView.Width   = num6;
                            mainView.Height  = num3;
                            view.AnchorRect  = new Rect(num5, num1, num6, num3);
                            view.AnchorPoint = rectOrientation != RectOrientation.RightLeft ? new Point(num5 + num6, num1 + this.PointWidth / 2.0) : new Point(num5, num1 + this.PointWidth / 2.0);
                        }
                        else
                        {
                            Canvas.SetLeft((UIElement)mainView, num1);
                            Canvas.SetTop((UIElement)mainView, num5);
                            mainView.Width   = num3;
                            mainView.Height  = num6;
                            view.AnchorRect  = new Rect(num1, num5, num3, num6);
                            view.AnchorPoint = rectOrientation != RectOrientation.BottomTop ? new Point(num1 + this.PointWidth / 2.0, num5 + num6) : new Point(num1 + this.PointWidth / 2.0, num5);
                        }
                        BarControl barControl = mainView as BarControl;
                        if (barControl != null)
                        {
                            barControl.Orientation = rectOrientation;
                        }
                        view.AnchorRectOrientation = rectOrientation;
                    }
                }
            }
            base.UpdateView(dataPoint);
            if (this.ChartArea == null)
            {
                return;
            }
            this.ChartArea.UpdateSession.AddCounter("ColumnSeriesPresenter.UpdateView", DateTime.Now - now);
        }