private void DrawLine(double x1, double y1, double x2, double y2, ChartPlotInfo info, Brush brush, bool isDashed = false) { var line = new Line(); line.X1 = GeometricHelper.XCoordToChart(x1, info); line.X2 = GeometricHelper.XCoordToChart(x2, info); line.Y1 = GeometricHelper.YCoordToChart(y1, info); line.Y2 = GeometricHelper.YCoordToChart(y2, info); line.Stroke = brush; line.StrokeThickness = 2; if (isDashed) { line.StrokeThickness = 1; line.StrokeDashOffset = 5; } RenderElement(line); }
private void DrawCircle(DateTime dateTime, double p, ChartPlotInfo info, Brush brush) { var circle = new Ellipse(); circle.ToolTip = string.Format("Дата: {0:yyyy MMM dd}, значення: {1}", dateTime, p); circle.Stroke = brush; circle.Fill = Brushes.White; circle.Width = 10; circle.Height = 10; circle.StrokeThickness = 2; var x = GeometricHelper.DateToChart(dateTime, info) - circle.Width / 2; var y = GeometricHelper.YCoordToChart(p, info) - circle.Height / 2; Canvas.SetTop(circle, y); Canvas.SetLeft(circle, x); RenderElement(circle); }
private void DrawLine(DateTime x1, double y1, DateTime x2, double y2, ChartPlotInfo info, Brush brush, bool isDashed = false) { var line = new Line(); line.X1 = GeometricHelper.DateToChart(x1, info); line.X2 = GeometricHelper.DateToChart(x2, info); line.Y1 = GeometricHelper.YCoordToChart(y1, info); line.Y2 = GeometricHelper.YCoordToChart(y2, info); line.Stroke = brush; line.StrokeThickness = 2; if (isDashed) { DoubleCollection dashes = new DoubleCollection(2); dashes.Add(5); dashes.Add(5); line.StrokeThickness = 1; line.StrokeDashArray = dashes; } RenderElement(line); }