private List <UIElement> GetLinePaths(LineGraph lineGraph, GraphParams graphParams) { var result = new List <UIElement>(); for (int i = 0; i < lineGraph.Points.Count - 1; i++) { var lineGeometry = new LineGeometry { StartPoint = GraphMathUtilities.TransformToCanvasCoords(graphParams, lineGraph.Points.ElementAt(i).Value), EndPoint = GraphMathUtilities.TransformToCanvasCoords(graphParams, lineGraph.Points.ElementAt(i + 1).Value) }; var linePath = new Path { Stroke = new SolidColorBrush(lineGraph.Color), Fill = new SolidColorBrush(lineGraph.Color), StrokeThickness = 2, Data = lineGeometry }; if (lineGraph.LineType != LinePattern.Solid) { linePath.StrokeDashArray = GraphMappingUtilities.GetLinePattern(lineGraph.LineType); } result.Add(linePath); } return(result); }
private UIElement GetCirclePath(CircleGraph circleGraph, GraphParams graphParams) { var circleGeometry = new EllipseGeometry { Center = GraphMathUtilities.TransformToCanvasCoords(graphParams, circleGraph.Center), RadiusX = circleGraph.Radius, RadiusY = circleGraph.Radius }; var pathGeometry = PathGeometry.CreateFromGeometry(circleGeometry); var path = new Path { Stroke = new SolidColorBrush(circleGraph.Color), StrokeThickness = 2, Data = pathGeometry }; if (circleGraph.Filled) { path.Fill = new SolidColorBrush(circleGraph.Color); } if (circleGraph.LineType != LinePattern.Solid) { path.StrokeDashArray = GraphMappingUtilities.GetLinePattern(circleGraph.LineType); } return(path); }
private UIElement GetComplexShapePath(ComplexShape complexShape, GraphParams graphParams) { var points = complexShape.Points.Select(p => GraphMathUtilities.TransformToCanvasCoords(graphParams, p.Value)); var polygon = new Polygon { Stroke = new SolidColorBrush(complexShape.Color), StrokeThickness = 2 }; var myPointCollection = new PointCollection(points); polygon.Points = myPointCollection; if (complexShape.Filled) { polygon.Fill = new SolidColorBrush(complexShape.Color); } if (complexShape.LineType != LinePattern.Solid) { polygon.StrokeDashArray = GraphMappingUtilities.GetLinePattern(complexShape.LineType); } return(polygon); }