Skip to content

AxisLineVector: GetDataLimits returns infinity even when limited by Min or Max #2371

@ChrisAtVault

Description

@ChrisAtVault

Bug Report

Issue:
Based on #1415, when a plot contains an AxisLine (in my particular case a HLineVector) with Min or Max property set and one calls GetDataLimits, the resulting AxisLimits should contain Min, Max instead of $+/-\infty$. For example when using a HLineVector with Min and Max set GetDataLimits should return something like ${AxisLimits: x=[Min, Max], y=[min(Ys), max(Ys)]}$ instead of ${AxisLimits: x=[-∞, ∞], y=[min(Ys), max(Ys)]}$.

Reproducing:

var formsPlot1 = new ScottPlot.FormsPlot();
var horizontalLine = new HLineVector()
{
          Ys = new double[] { 5 },
          Min = 1,
          Max = 10,
};

formsPlot1.Plot.Add(horizontalLine);
formsPlot1.Render();

var limits = formsPlot1.Plot.GetDataLimits();
Debug.WriteLine($"Limits:  xMin: {limits.XMin}, xMax: {limits.XMax}, yMin: {limits.YMin}, yMax: {limits.YMax}");

System Details

  • ScottPlot Version: 4.1.60
  • Operating System: Windows 10
  • Application Type: WinForms
  • .NET Version: .Net 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    BUGunexpected behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions