public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (ScatterPointView)view; if (pbv == null) { pbv = new ScatterPointView { IsNew = true, Shape = new Path { Stretch = Stretch.Fill, ClipToBounds = true, StrokeThickness = StrokeThickness } }; Model.Chart.View.AddToDrawMargin(pbv.Shape); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Shape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HoverShape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.DataLabel); } var p = (Path)pbv.Shape; p.Data = PointGeometry; p.Fill = Fill; p.Stroke = Stroke; p.StrokeThickness = StrokeThickness; p.Visibility = Visibility; Panel.SetZIndex(p, Panel.GetZIndex(this)); p.StrokeDashArray = StrokeDashArray; 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.Shape.Stroke = (Brush)point.Stroke; } if (point.Fill != null) { pbv.Shape.Fill = (Brush)point.Fill; } 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); }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (ColumnPointView)view; if (pbv == null) { pbv = new ColumnPointView { IsNew = true, Rectangle = new Rectangle(), Data = new CoreRectangle(), LabelPosition = BarLabelPosition.Merged }; 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); } pbv.Rectangle.Fill = Fill; pbv.Rectangle.StrokeThickness = StrokeThickness; pbv.Rectangle.Stroke = Stroke; 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; } return(pbv); }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var mhr = PointGeometrySize < 5 ? 5 : PointGeometrySize; var pbv = (VBezierPointView)view; if (pbv == null) { pbv = new VBezierPointView { Segment = new BezierSegment(), Container = Figure, IsNew = true }; } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Shape); 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, Width = mhr, Height = mhr }; 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 (PointGeometry != null && Math.Abs(PointGeometrySize) > 0.1 && pbv.Shape == null) { pbv.Shape = new Ellipse(); BindingOperations.SetBinding(pbv.Shape, Shape.FillProperty, new Binding { Path = new PropertyPath(PointForeroundProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, WidthProperty, new Binding { Path = new PropertyPath(PointGeometrySizeProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, HeightProperty, new Binding { Path = new PropertyPath(PointGeometrySizeProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); Panel.SetZIndex(pbv.Shape, int.MaxValue - 2); Model.Chart.View.AddToDrawMargin(pbv.Shape); } 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); }
/// <summary> /// Gets the view of a given point /// </summary> /// <param name="view"></param> /// <param name="point"></param> /// <param name="label"></param> /// <returns></returns> public virtual IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { throw new NotImplementedException(); }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (view as PiePointView); if (pbv == null) { pbv = new PiePointView { IsNew = true, Slice = new PieSlice() }; BindingOperations.SetBinding(pbv.Slice, Shape.FillProperty, new Binding { Path = new PropertyPath(FillProperty), Source = this }); BindingOperations.SetBinding(pbv.Slice, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.Slice, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.Slice, Shape.StrokeDashArrayProperty, new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this }); BindingOperations.SetBinding(pbv.Slice, PieSlice.PushOutProperty, new Binding { Path = new PropertyPath(PushOutProperty), Source = this }); BindingOperations.SetBinding(pbv.Slice, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this }); BindingOperations.SetBinding(pbv.Slice, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); Model.Chart.View.AddToDrawMargin(pbv.Slice); } else { pbv.IsNew = false; } if ((Model.Chart.View.HasTooltip || Model.Chart.View.HasDataClickEventAttached) && pbv.HoverShape == null) { pbv.HoverShape = new PieSlice { 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 = (OhlcPointView)view; if (pbv == null) { pbv = new OhlcPointView { IsNew = true, HighToLowLine = new Line(), OpenLine = new Line(), CloseLine = new Line() }; Model.Chart.View.AddToDrawMargin(pbv.HighToLowLine); Model.Chart.View.AddToDrawMargin(pbv.OpenLine); Model.Chart.View.AddToDrawMargin(pbv.CloseLine); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HighToLowLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.OpenLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.CloseLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HoverShape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.DataLabel); } pbv.HighToLowLine.StrokeThickness = StrokeThickness; pbv.CloseLine.StrokeThickness = StrokeThickness; pbv.OpenLine.StrokeThickness = StrokeThickness; pbv.HighToLowLine.StrokeDashArray = StrokeDashArray; pbv.CloseLine.StrokeDashArray = StrokeDashArray; pbv.OpenLine.StrokeDashArray = StrokeDashArray; pbv.HighToLowLine.Visibility = Visibility; pbv.CloseLine.Visibility = Visibility; pbv.OpenLine.Visibility = Visibility; var i = Panel.GetZIndex(this); Panel.SetZIndex(pbv.HighToLowLine, i); Panel.SetZIndex(pbv.CloseLine, i); Panel.SetZIndex(pbv.OpenLine, i); 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.Open < point.Close) { pbv.HighToLowLine.Stroke = IncreaseBrush; pbv.CloseLine.Stroke = IncreaseBrush; pbv.OpenLine.Stroke = IncreaseBrush; } else { pbv.HighToLowLine.Stroke = DecreaseBrush; pbv.CloseLine.Stroke = DecreaseBrush; pbv.OpenLine.Stroke = DecreaseBrush; } return(pbv); }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var mhr = PointGeometrySize < 10 ? 10 : PointGeometrySize; var pbv = (HorizontalBezierPointView)view; if (pbv == null) { pbv = new HorizontalBezierPointView { Segment = new BezierSegment(), Container = Figure, IsNew = true }; } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Shape); 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, Width = mhr, Height = mhr }; 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 (PointGeometry != null && Math.Abs(PointGeometrySize) > 0.1 && pbv.Shape == null) { if (PointGeometry != null) { pbv.Shape = new Path { Stretch = Stretch.Fill, ClipToBounds = true, StrokeThickness = StrokeThickness }; } Model.Chart.View.AddToDrawMargin(pbv.Shape); } if (pbv.Shape != null) { pbv.Shape.Fill = PointForeround; pbv.Shape.Stroke = Stroke; pbv.Shape.StrokeThickness = StrokeThickness; pbv.Shape.Width = PointGeometrySize; pbv.Shape.Height = PointGeometrySize; pbv.Shape.Data = PointGeometry; pbv.Shape.Visibility = Visibility; Panel.SetZIndex(pbv.Shape, Panel.GetZIndex(this) + 1); if (point.Stroke != null) { pbv.Shape.Stroke = (Brush)point.Stroke; } if (point.Fill != null) { pbv.Shape.Fill = (Brush)point.Fill; } } 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 OhlcPointView); if (pbv == null) { pbv = new OhlcPointView { IsNew = true, HighToLowLine = new Line(), OpenLine = new Line(), CloseLine = new Line() }; BindingOperations.SetBinding(pbv.HighToLowLine, Shape.StrokeThicknessProperty, new Binding {Path = new PropertyPath(StrokeThicknessProperty), Source = this}); BindingOperations.SetBinding(pbv.CloseLine, Shape.StrokeThicknessProperty, new Binding {Path = new PropertyPath(StrokeThicknessProperty), Source = this}); BindingOperations.SetBinding(pbv.OpenLine, Shape.StrokeThicknessProperty, new Binding {Path = new PropertyPath(StrokeThicknessProperty), Source = this}); BindingOperations.SetBinding(pbv.HighToLowLine, Shape.StrokeDashArrayProperty, new Binding {Path = new PropertyPath(StrokeDashArrayProperty), Source = this}); BindingOperations.SetBinding(pbv.CloseLine, Shape.StrokeDashArrayProperty, new Binding {Path = new PropertyPath(StrokeDashArrayProperty), Source = this}); BindingOperations.SetBinding(pbv.OpenLine, Shape.StrokeDashArrayProperty, new Binding {Path = new PropertyPath(StrokeDashArrayProperty), Source = this}); BindingOperations.SetBinding(pbv.HighToLowLine, Panel.ZIndexProperty, new Binding {Path = new PropertyPath(Panel.ZIndexProperty), Source = this}); BindingOperations.SetBinding(pbv.CloseLine, Panel.ZIndexProperty, new Binding {Path = new PropertyPath(Panel.ZIndexProperty), Source = this}); BindingOperations.SetBinding(pbv.OpenLine, Panel.ZIndexProperty, new Binding {Path = new PropertyPath(Panel.ZIndexProperty), Source = this}); BindingOperations.SetBinding(pbv.HighToLowLine, VisibilityProperty, new Binding {Path = new PropertyPath(VisibilityProperty), Source = this}); BindingOperations.SetBinding(pbv.CloseLine, VisibilityProperty, new Binding {Path = new PropertyPath(VisibilityProperty), Source = this}); BindingOperations.SetBinding(pbv.OpenLine, VisibilityProperty, new Binding {Path = new PropertyPath(VisibilityProperty), Source = this}); Model.Chart.View.AddToDrawMargin(pbv.HighToLowLine); Model.Chart.View.AddToDrawMargin(pbv.OpenLine); Model.Chart.View.AddToDrawMargin(pbv.CloseLine); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HighToLowLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.OpenLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.CloseLine); 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; if (point.Open < point.Close) { BindingOperations.SetBinding(pbv.HighToLowLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(IncreaseBrushProperty), Source = this }); BindingOperations.SetBinding(pbv.CloseLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(IncreaseBrushProperty), Source = this }); BindingOperations.SetBinding(pbv.OpenLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(IncreaseBrushProperty), Source = this }); } else { BindingOperations.SetBinding(pbv.HighToLowLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(DecreaseBrushProperty), Source = this }); BindingOperations.SetBinding(pbv.CloseLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(DecreaseBrushProperty), Source = this }); BindingOperations.SetBinding(pbv.OpenLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(DecreaseBrushProperty), Source = this }); } return pbv; }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (view as PiePointView); if (pbv == null) { pbv = new PiePointView { IsNew = true, Slice = new PieSlice() }; BindingOperations.SetBinding(pbv.Slice, Shape.FillProperty, new Binding { Path = new PropertyPath(FillProperty), Source = this }); BindingOperations.SetBinding(pbv.Slice, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.Slice, Shape.StrokeThicknessProperty, new Binding {Path = new PropertyPath(StrokeThicknessProperty), Source = this}); BindingOperations.SetBinding(pbv.Slice, Shape.StrokeDashArrayProperty, new Binding {Path = new PropertyPath(StrokeDashArrayProperty), Source = this}); BindingOperations.SetBinding(pbv.Slice, PieSlice.PushOutProperty, new Binding {Path = new PropertyPath(PushOutProperty), Source = this}); BindingOperations.SetBinding(pbv.Slice, Panel.ZIndexProperty, new Binding {Path = new PropertyPath(Panel.ZIndexProperty), Source = this}); BindingOperations.SetBinding(pbv.Slice, VisibilityProperty, new Binding {Path = new PropertyPath(VisibilityProperty), Source = this}); Model.Chart.View.AddToDrawMargin(pbv.Slice); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Slice); 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 PieSlice { 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 = (StepLinePointView)view; if (pbv == null) { pbv = new StepLinePointView { IsNew = true, HorizontalLine = new Line(), VerticalLine = new Line() }; Model.Chart.View.AddToDrawMargin(pbv.HorizontalLine); Model.Chart.View.AddToDrawMargin(pbv.VerticalLine); Model.Chart.View.AddToDrawMargin(pbv.Shape); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Shape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HoverShape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.DataLabel); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HorizontalLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.VerticalLine); } pbv.VerticalLine.StrokeThickness = StrokeThickness; pbv.VerticalLine.Stroke = AlternativeStroke; pbv.VerticalLine.StrokeDashArray = StrokeDashArray; pbv.VerticalLine.Visibility = Visibility; Panel.SetZIndex(pbv.VerticalLine, Panel.GetZIndex(this)); pbv.HorizontalLine.StrokeThickness = StrokeThickness; pbv.HorizontalLine.Stroke = Stroke; pbv.HorizontalLine.StrokeDashArray = StrokeDashArray; pbv.HorizontalLine.Visibility = Visibility; Panel.SetZIndex(pbv.HorizontalLine, Panel.GetZIndex(this)); if (PointGeometry != null && Math.Abs(PointGeometrySize) > 0.1 && pbv.Shape == null) { if (PointGeometry != null) { pbv.Shape = new Path { Stretch = Stretch.Fill, ClipToBounds = true, StrokeThickness = StrokeThickness }; } Model.Chart.View.AddToDrawMargin(pbv.Shape); } if (pbv.Shape != null) { pbv.Shape.Fill = Fill; pbv.Shape.StrokeThickness = StrokeThickness; pbv.Shape.Stroke = Stroke; pbv.Shape.StrokeDashArray = StrokeDashArray; pbv.Shape.Visibility = Visibility; pbv.Shape.Width = PointGeometrySize; pbv.Shape.Height = PointGeometrySize; pbv.Shape.Data = PointGeometry; Panel.SetZIndex(pbv.Shape, Panel.GetZIndex(this) + 1); if (point.Stroke != null) { pbv.Shape.Stroke = (Brush)point.Stroke; } if (point.Fill != null) { pbv.Shape.Fill = (Brush)point.Fill; } } 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; } return(pbv); }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var pbv = (view as StepLinePointView); if (pbv == null) { pbv = new StepLinePointView { IsNew = true, HorizontalLine = new Line(), VerticalLine = new Line() }; BindingOperations.SetBinding(pbv.VerticalLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(AlternativeStrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.VerticalLine, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.VerticalLine, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); BindingOperations.SetBinding(pbv.VerticalLine, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this }); BindingOperations.SetBinding(pbv.VerticalLine, Shape.StrokeDashArrayProperty, new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this }); BindingOperations.SetBinding(pbv.HorizontalLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.HorizontalLine, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.HorizontalLine, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); BindingOperations.SetBinding(pbv.HorizontalLine, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this }); BindingOperations.SetBinding(pbv.HorizontalLine, Shape.StrokeDashArrayProperty, new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this }); Model.Chart.View.AddToDrawMargin(pbv.HorizontalLine); Model.Chart.View.AddToDrawMargin(pbv.VerticalLine); Model.Chart.View.AddToDrawMargin(pbv.Shape); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.Shape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HoverShape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.DataLabel); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HorizontalLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.VerticalLine); } if (PointGeometry != null && Math.Abs(PointGeometrySize) > 0.1 && pbv.Shape == null) { if (PointGeometry != null) { pbv.Shape = new Path { Stretch = Stretch.Fill, ClipToBounds = true, StrokeThickness = StrokeThickness }; BindingOperations.SetBinding(pbv.Shape, Path.DataProperty, new Binding { Path = new PropertyPath(PointGeometryProperty), Source = this }); } else { pbv.Shape = new Ellipse(); } BindingOperations.SetBinding(pbv.Shape, Shape.FillProperty, new Binding { Path = new PropertyPath(PointForeroundProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, Shape.StrokeProperty, new Binding { Path = new PropertyPath(StrokeProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, WidthProperty, new Binding { Path = new PropertyPath(PointGeometrySizeProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, HeightProperty, new Binding { Path = new PropertyPath(PointGeometrySizeProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); BindingOperations.SetBinding(pbv.Shape, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this, Converter = new NextZIndexConverter() }); Model.Chart.View.AddToDrawMargin(pbv.Shape); } 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; } if (point.Stroke != null) { pbv.Shape.Stroke = (Brush)point.Stroke; } if (point.Fill != null) { pbv.Shape.Fill = (Brush)point.Fill; } return(pbv); }
public override IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { var mhr = PointDiameter < 10 ? 10 : PointDiameter; var pbv = (view as HBezierPointView); if (pbv == null) { pbv = new HBezierPointView { Segment = new BezierSegment(), Container = Figure, IsNew = true }; } 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, Width = mhr, Height = mhr }; 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 (Math.Abs(PointDiameter) > 0.1 && pbv.Ellipse == null) { pbv.Ellipse = new Ellipse(); BindingOperations.SetBinding(pbv.Ellipse, Shape.FillProperty, new Binding { Path = new PropertyPath(PointForeroundProperty), 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, WidthProperty, new Binding { Path = new PropertyPath(PointDiameterProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, HeightProperty, new Binding { Path = new PropertyPath(PointDiameterProperty), Source = this }); BindingOperations.SetBinding(pbv.Ellipse, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); Panel.SetZIndex(pbv.Ellipse, int.MaxValue - 2); Model.Chart.View.AddToDrawMargin(pbv.Ellipse); } 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 OhlcPointView); if (pbv == null) { pbv = new OhlcPointView { IsNew = true, HighToLowLine = new Line(), OpenLine = new Line(), CloseLine = new Line() }; BindingOperations.SetBinding(pbv.HighToLowLine, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.CloseLine, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.OpenLine, Shape.StrokeThicknessProperty, new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this }); BindingOperations.SetBinding(pbv.HighToLowLine, Shape.StrokeDashArrayProperty, new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this }); BindingOperations.SetBinding(pbv.CloseLine, Shape.StrokeDashArrayProperty, new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this }); BindingOperations.SetBinding(pbv.OpenLine, Shape.StrokeDashArrayProperty, new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this }); BindingOperations.SetBinding(pbv.HighToLowLine, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this }); BindingOperations.SetBinding(pbv.CloseLine, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this }); BindingOperations.SetBinding(pbv.OpenLine, Panel.ZIndexProperty, new Binding { Path = new PropertyPath(Panel.ZIndexProperty), Source = this }); BindingOperations.SetBinding(pbv.HighToLowLine, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); BindingOperations.SetBinding(pbv.CloseLine, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); BindingOperations.SetBinding(pbv.OpenLine, VisibilityProperty, new Binding { Path = new PropertyPath(VisibilityProperty), Source = this }); Model.Chart.View.AddToDrawMargin(pbv.HighToLowLine); Model.Chart.View.AddToDrawMargin(pbv.OpenLine); Model.Chart.View.AddToDrawMargin(pbv.CloseLine); } else { pbv.IsNew = false; point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.HighToLowLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.OpenLine); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.CloseLine); 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; } if (point.Open < point.Close) { BindingOperations.SetBinding(pbv.HighToLowLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(IncreaseBrushProperty), Source = this }); BindingOperations.SetBinding(pbv.CloseLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(IncreaseBrushProperty), Source = this }); BindingOperations.SetBinding(pbv.OpenLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(IncreaseBrushProperty), Source = this }); } else { BindingOperations.SetBinding(pbv.HighToLowLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(DecreaseBrushProperty), Source = this }); BindingOperations.SetBinding(pbv.CloseLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(DecreaseBrushProperty), Source = this }); BindingOperations.SetBinding(pbv.OpenLine, Shape.StrokeProperty, new Binding { Path = new PropertyPath(DecreaseBrushProperty), Source = this }); } return(pbv); }
public virtual IChartPointView GetPointView(IChartPointView view, ChartPoint point, string label) { throw new NotImplementedException(); }