/// <summary> /// Gets the view of a given point /// </summary> /// <param name="point"></param> /// <param name="label"></param> /// <returns></returns> public override IChartPointView GetPointView(ChartPoint point, string label) { var pbv = (ScatterPointView)point.View; if (pbv == null) { pbv = new ScatterPointView { IsNew = true, Shape = new Path { Stretch = Stretch.Fill, 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.Parse(); p.Fill = Fill; p.Stroke = Stroke; p.StrokeThickness = StrokeThickness; p.Visibility = Visibility; Canvas.SetZIndex(p, Canvas.GetZIndex(this)); p.StrokeDashArray = StrokeDashArray; if (Model.Chart.RequiresHoverShape && pbv.HoverShape == null) { pbv.HoverShape = new Rectangle { Fill = new SolidColorBrush(Windows.UI.Colors.Transparent), StrokeThickness = 0 }; Canvas.SetZIndex(pbv.HoverShape, short.MaxValue); var uwpfChart = (Chart)Model.Chart.View; uwpfChart.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); Canvas.SetZIndex(pbv.DataLabel, short.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); }
/// <summary> /// Gets the view of a given point /// </summary> /// <param name="point"></param> /// <param name="label"></param> /// <returns></returns> public override IChartPointView GetPointView(ChartPoint point, string label) { var pbv = (StepLinePointView)point.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; Canvas.SetZIndex(pbv.VerticalLine, Canvas.GetZIndex(this)); pbv.HorizontalLine.StrokeThickness = StrokeThickness; pbv.HorizontalLine.Stroke = Stroke; pbv.HorizontalLine.StrokeDashArray = StrokeDashArray; pbv.HorizontalLine.Visibility = Visibility; Canvas.SetZIndex(pbv.HorizontalLine, Canvas.GetZIndex(this)); if (Math.Abs(PointGeometrySize) > 0.1 && pbv.Shape == null) { pbv.Shape = new Path { Stretch = Stretch.Fill, StrokeThickness = StrokeThickness }; Model.Chart.View.AddToDrawMargin(pbv.Shape); } if (pbv.Shape != null) { pbv.Shape.Fill = PointForeground; 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.Parse(); Canvas.SetZIndex(pbv.Shape, Canvas.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 = new SolidColorBrush(Windows.UI.Colors.Transparent), StrokeThickness = 0 }; Canvas.SetZIndex(pbv.HoverShape, short.MaxValue); var uwpfChart = (Chart)Model.Chart.View; uwpfChart.AttachHoverableEventTo(pbv.HoverShape); Model.Chart.View.AddToDrawMargin(pbv.HoverShape); } if (pbv.HoverShape != null) { pbv.HoverShape.Visibility = Visibility; } if (DataLabels) { pbv.DataLabel = UpdateLabelContent(new DataLabelViewModel { FormattedText = label, Instance = point.Instance }, pbv.DataLabel); } return(pbv); }
/// <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 mhr = PointGeometrySize < 10 ? 10 : PointGeometrySize; var pbv = (VerticalBezierPointView)point.View; if (pbv == null) { pbv = new VerticalBezierPointView { 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 = new SolidColorBrush(Windows.UI.Colors.Transparent), StrokeThickness = 0, Width = mhr, Height = mhr }; Canvas.SetZIndex(pbv.HoverShape, short.MaxValue); var uwpfChart = (Chart)Model.Chart.View; uwpfChart.AttachHoverableEventTo(pbv.HoverShape); Model.Chart.View.AddToDrawMargin(pbv.HoverShape); } if (pbv.HoverShape != null) { pbv.HoverShape.Visibility = Visibility; } if (Math.Abs(PointGeometrySize) > 0.1 && pbv.Shape == null) { pbv.Shape = new Path { Stretch = Stretch.Fill, 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.Parse(); pbv.Shape.Visibility = Visibility; Canvas.SetZIndex(pbv.Shape, Canvas.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); Canvas.SetZIndex(pbv.DataLabel, short.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="point"></param> /// <param name="label"></param> /// <returns></returns> public override IChartPointView GetPointView(ChartPoint point, string label) { var mhr = 30;//PointGeometrySize < 10 ? 10 : PointGeometrySize; var pbv = (HorizontalBezierPointView)point.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.ClickLineShape); point.SeriesView.Model.Chart.View .EnsureElementBelongsToCurrentDrawMargin(pbv.DataLabel); } if (Model.Chart.RequiresHoverShape && pbv.HoverShape == null) { pbv.HoverShape = new Ellipse { Fill = new SolidColorBrush(Windows.UI.Colors.Transparent), StrokeThickness = 0, Width = mhr, Height = mhr }; pbv.ClickLineShape = new Rectangle { Fill = new SolidColorBrush(Windows.UI.Colors.Transparent), StrokeThickness = 0, Width = 2, Height = 1000, }; Canvas.SetZIndex(pbv.HoverShape, short.MaxValue); Canvas.SetZIndex(pbv.ClickLineShape, short.MaxValue); var uwpfChart = (Chart)Model.Chart.View; uwpfChart.AttachHoverableEventTo(pbv.HoverShape); uwpfChart.AttachHoverableEventTo(pbv.ClickLineShape); uwpfChart.DataClick += UwpfChart_DataClick; Model.Chart.View.AddToDrawMargin(pbv.HoverShape); Model.Chart.View.AddToDrawMargin(pbv.ClickLineShape); } if (pbv.HoverShape != null) { pbv.HoverShape.Visibility = Visibility; } if (pbv.ClickLineShape != null) { pbv.ClickLineShape.Visibility = Visibility; } if (Math.Abs(PointGeometrySize) > 0.1 && pbv.Shape == null) { pbv.Shape = new Path { Stretch = Stretch.Fill, 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.Parse(); pbv.Shape.Visibility = Visibility; Canvas.SetZIndex(pbv.Shape, Canvas.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 = UpdateLabelContent(new DataLabelViewModel { FormattedText = label, Instance = point.Instance }, pbv.DataLabel); } return(pbv); }