Skip to content

New plot type: Bracket #4547

@FULL69

Description

@FULL69

In ScottPlot 4, I used Bracket plottable. I'm starting to use ScottPlot 5, but I haven't found this.
I added an ArrowShape to implement it in this way:

public class BracketLine : IArrowShape
{
    public void Render(RenderPack rp, PixelLine arrowLine, ArrowStyle arrowStyle)
    {
        float length = arrowLine.Length;

        PixelLine[] lines = [
            new PixelLine(0, 0, 0, -arrowStyle.ArrowheadWidth / 4),
            new PixelLine(0, 0, length, 0),
            new PixelLine(length, 0, length, -arrowStyle.ArrowheadWidth / 4),
            new PixelLine(length/2, 0, length/2, arrowStyle.ArrowheadWidth / 4)
        ];

        rp.CanvasState.Save();
        rp.CanvasState.Translate(arrowLine.Pixel2);
        rp.CanvasState.RotateDegrees(arrowLine.AngleDegrees + 90);

        // origin is the tip, base extends to the right
        Drawing.DrawLines(rp.Canvas, rp.Paint, lines, arrowStyle.LineStyle);

        rp.CanvasState.Restore();
    }
}

and I modified ArrowShape.cs adding BracketLine in enum and adding item in switch:

ArrowShape.BracketLine => new ArrowShapes.BracketLine(), 

Bracket

The Cook book "Arrow Shapes" show it correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions