public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (view as BubblePointView); if (pbv == null) { pbv = new BubblePointView { IsNew = true, Ellipse = new Ellipse() }; BindingOperations.SetBinding(pbv.Ellipse, Shape.FillProperty, new Binding { Path = new PropertyPath(FillProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeDashArrayProperty, new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this }); Model.Chart.View.AddToDrawMargin(pbv.Ellipse); } else { pbv.IsNew = false; } if ((Model.Chart.View.HasTooltip || Model.Chart.View.HasDataClickEventAttached) && 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 = Model.Chart.View as Chart; if (wpfChart == null) { return(null); } wpfChart.AttachEventsTo(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); }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (view as BubblePointView); if (pbv == null) { pbv = new BubblePointView { IsNew = true, Ellipse = new Ellipse() }; BindingOperations.SetBinding(pbv.Ellipse, Shape.FillProperty, new Binding { Path = new PropertyPath(FillProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeDashArrayProperty, new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this }); Model.Chart.View.AddToDrawMargin(pbv.Ellipse); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Ellipse); 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); }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (view as BubblePointView); if (pbv == null) { pbv = new BubblePointView { IsNew = true, Ellipse = new Ellipse() }; BindingOperations.SetBinding(pbv.Ellipse, Shape.FillProperty, new Binding { Path = new PropertyPath(FillProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, Panel.ZIndexProperty, new Binding {Path = new PropertyPath(Panel.ZIndexProperty), Source = this}); BindingOperations.SetBinding(pbv.Ellipse, Shape.StrokeDashArrayProperty, new Binding {Path = new PropertyPath(StrokeDashArrayProperty), Source = this}); Model.Chart.View.AddToDrawMargin(pbv.Ellipse); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Ellipse); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HoverShape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.DataLabel); } if ((Model.Chart.View.HasTooltip || Model.Chart.View.HasDataClickEventAttached) && 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 = Model.Chart.View as Chart; if (wpfChart == null) return null; wpfChart.AttachEventsTo(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; }