Skip to content

Vertical line: label text position is incorrect #3836

@VibrationAnalystCN

Description

@VibrationAnalystCN

Issue: (The position of LabelText on the X-axis is incorrect in version 5.0.32/33/34, which was correct in version 5.0.31 and previous versions.)

ScottPlot Version: (5.0.32)

        private static void AddVerticalLine(WpfPlot plot, string model, string type, double freq, Color color)
        {
            var vLine = plot.Plot.Add.VerticalLine(freq, 1, color, LinePattern.Dashed);
            vLine.LabelFontColor = Color.FromARGB(0xC0000000);
            vLine.LabelBorderColor = color;
            vLine.LabelBackgroundColor = Colors.Transparent;
            vLine.LabelText = $"{model} {type}={Math.Round(freq, 3)}Hz"; // Label the line with its position
            vLine.LabelRotation = -90;
            vLine.LabelAlignment = Alignment.MiddleRight;
            vLine.LabelOffsetX = -20;
            vLine.LabelOffsetY = -250;
        }

Plot-5 0 31
Plot-5 0 32
Plot-5 0 32-scaleTheX

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help WantedScott won't do this soon, but PRs from the community are welcome!⚠️ HIGH PRIORITY

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions