-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Good First IssueThis issue has limited complexity and may be a good start for new contributorsThis 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!Scott won't do this soon, but PRs from the community are welcome!
Description
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
ScottPlot/src/ScottPlot5/ScottPlot5/Plottables/Rectangle.cs
Lines 4 to 49 in 6d34698
| 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); | |
| } | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Good First IssueThis issue has limited complexity and may be a good start for new contributorsThis 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!Scott won't do this soon, but PRs from the community are welcome!