/// <summary> /// Gets the point view. /// </summary> /// <param name="point">The point.</param> /// <param name="label">The label.</param> /// <returns></returns> public override IChartPointView GetPointView(ChartPoint point, string label) { var pbv = (RowPointView)point.View; if (pbv == null) { pbv = new RowPointView { IsNew = true, Rectangle = new Rectangle(), Data = new CoreRectangle() }; Model.Chart.View.AddToDrawMargin(pbv.Rectangle); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Rectangle); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HoverShape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.DataLabel); } pbv.Rectangle.Fill = Fill; pbv.Rectangle.Stroke = Stroke; pbv.Rectangle.StrokeThickness = StrokeThickness; pbv.Rectangle.StrokeDashArray = StrokeDashArray; pbv.Rectangle.Visibility = Visibility; Panel.SetZIndex(pbv.Rectangle, Panel.GetZIndex(this)); if (Model.Chart.RequiresHoverShape && pbv.HoverShape == null) { pbv.HoverShape = new Rectangle { Fill = Brushes.Transparent, StrokeThickness = 0 }; Panel.SetZIndex(pbv.HoverShape, int.MaxValue); var wpfChart = (Chart)Model.Chart.View; wpfChart.AttachHoverableEventTo(pbv.HoverShape); Model.Chart.View.AddToDrawMargin(pbv.HoverShape); } if (pbv.HoverShape != null) pbv.HoverShape.Visibility = Visibility; if (DataLabels && pbv.DataLabel == null) { pbv.DataLabel = BindATextBlock(0); Panel.SetZIndex(pbv.DataLabel, int.MaxValue - 1); Model.Chart.View.AddToDrawMargin(pbv.DataLabel); } if (pbv.DataLabel != null) pbv.DataLabel.Text = label; if (point.Stroke != null) pbv.Rectangle.Stroke = (Brush)point.Stroke; if (point.Fill != null) pbv.Rectangle.Fill = (Brush)point.Fill; pbv.LabelPosition = LabelsPosition; return pbv; }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (view as RowPointView); if (pbv == null) { pbv = new RowPointView { IsNew = true, Rectangle = new Rectangle(), Data = new CoreRectangle(), LabelInside = true }; BindingOperations.SetBinding(pbv.Rectangle, Shape.FillProperty, new Binding { Path = new PropertyPath(FillProperty), Source = this }); BindingOperations.SetBinding(pbv.Rectangle, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.Rectangle, Shape.StrokeThicknessProperty, new Binding {Path = new PropertyPath(StrokeThicknessProperty), Source = this}); BindingOperations.SetBinding(pbv.Rectangle, Shape.StrokeDashArrayProperty, new Binding {Path = new PropertyPath(StrokeDashArrayProperty), Source = this}); BindingOperations.SetBinding(pbv.Rectangle, Panel.ZIndexProperty, new Binding {Path = new PropertyPath(Panel.ZIndexProperty), Source = this}); BindingOperations.SetBinding(pbv.Rectangle, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); Model.Chart.View.AddToDrawMargin(pbv.Rectangle); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Rectangle); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HoverShape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.DataLabel); } if (Model.Chart.RequiresHoverShape && pbv.HoverShape == null) { pbv.HoverShape = new Rectangle { Fill = Brushes.Transparent, StrokeThickness = 0 }; Panel.SetZIndex(pbv.HoverShape, int.MaxValue); BindingOperations.SetBinding(pbv.HoverShape, VisibilityProperty, new Binding {Path = new PropertyPath(VisibilityProperty), Source = this}); var wpfChart = (Chart)Model.Chart.View; wpfChart.AttachHoverableEventTo(pbv.HoverShape); Model.Chart.View.AddToDrawMargin(pbv.HoverShape); } if (DataLabels && pbv.DataLabel == null) { pbv.DataLabel = BindATextBlock(0); Panel.SetZIndex(pbv.DataLabel, int.MaxValue - 1); Model.Chart.View.AddToDrawMargin(pbv.DataLabel); } if (pbv.DataLabel != null) pbv.DataLabel.Text = label; return pbv; }