Skip to content

SP5: Need Ellipse plot type #3277

@swharden

Description

@swharden

I'm creating the cookbook recipes now with a placeholder assuming these will be created in the next few days

The newly added Rectangle plottable can be copied and adapted to draw an ellipse

public class Rectangle : IPlottable
{
public bool IsVisible { get; set; } = true;
public IAxes Axes { get; set; } = new Axes();
public IEnumerable<LegendItem> LegendItems => LegendItem.Single(Label, FillStyle, LineStyle);
public LineStyle LineStyle { get; set; } = new() { Color = Colors.Black, Width = 1 };
public FillStyle FillStyle { get; set; } = new() { Color = Colors.Red };
public string Label { get; set; } = string.Empty;
public double X1 { get; set; }
public double X2 { get; set; }
public double Y1 { get; set; }
public double Y2 { get; set; }
public CoordinateRect CoordinateRect
{
get
{
double left = Math.Min(X1, X2);
double right = Math.Max(X1, X2);
double bottom = Math.Min(Y1, Y2);
double top = Math.Max(Y1, Y2);
return new CoordinateRect(left, right, bottom, top);
}
set
{
X1 = value.Left;
X2 = value.Right;
Y1 = value.Bottom;
Y2 = value.Top;
}
}
public AxisLimits GetAxisLimits() => new(CoordinateRect);
public void Render(RenderPack rp)
{
using SKPaint paint = new();
FillStyle.ApplyToPaint(paint);
PixelRect rect = Axes.GetPixelRect(CoordinateRect);
Drawing.Fillectangle(rp.Canvas, rect, paint);
LineStyle.ApplyToPaint(paint);
Drawing.DrawRectangle(rp.Canvas, rect, paint);
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First IssueThis issue has limited complexity and may be a good start for new contributorsHelp WantedScott won't do this soon, but PRs from the community are welcome!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions