internal void UpdateLegendMarkers() { double markersSize = (double)GetValue(MarkersSizeProperty); legendMarker.Data = MarkerGeometries.LegendMarkerGeometry((MarkersType)GetValue(MarkersTypeProperty), markersSize); if (legendMarker.Data != null) { legendMarker.Data.Transform = new TranslateTransform(markersSize / 2, markersSize / 2); } }
internal override void BeforeArrange() { graphToCanvas.Matrix = new Matrix(xAxis.Scale, 0, 0, -yAxis.Scale, -xAxis.Offset - xAxis.AxisPadding.Lower, yAxis.Offset + yAxis.AxisTotalLength - yAxis.AxisPadding.Upper); canvasToGraph = (MatrixTransform)(graphToCanvas.Inverse); Curve.FilterMinMax(canvasToGraph, new Rect(new Point(xAxis.Min, yAxis.Min), new Point(xAxis.Max, yAxis.Max))); if (host.UseDirect2D == true && !host.direct2DControl.InitializationFailed) { lineD2D.Geometry = curve.ToDirect2DPathGeometry(lineD2D.Factory, graphToCanvas); markersD2D.SetGeometry((MarkersType)GetValue(MarkersTypeProperty), (double)GetValue(MarkersSizeProperty)); //host.direct2DControl.RequestRender(); } else { line.Data = LineGeometries.PathGeometryFromCurve(curve, graphToCanvas); markers.Data = MarkerGeometries.MarkersAsGeometry(Curve, graphToCanvas, (MarkersType)GetValue(MarkersTypeProperty), (double)GetValue(MarkersSizeProperty)); } Point annotationPoint = graphToCanvas.Transform(new Point(curve.xTransformed[0], curve.yTransformed[0])); annotation.SetValue(Canvas.TopProperty, annotationPoint.Y); annotation.SetValue(Canvas.LeftProperty, annotationPoint.X); }
internal static Geometry LegendMarkerGeometry(MarkersType markersType, double width, double height) { Geometry legendMarkerGeometry = null; switch (markersType) { case MarkersType.None: break; case MarkersType.Square: legendMarkerGeometry = MarkerGeometries.RectangleMarker(width, height, new Point(0, 0)); break; case MarkersType.Circle: legendMarkerGeometry = MarkerGeometries.EllipseMarker(width, height, new Point(0, 0)); break; default: legendMarkerGeometry = GetGenericGeometry(markersType, width, height); break; } return(legendMarkerGeometry); }