ScottPlot / ScottPlot/ScottPlot

Render a Crosshair crashes due to System.Collections.Generic.KeyNotFoundException

Open
#4,773 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.8k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Hi togehter, first of all, thanks for the great plot library. You're doing a fantastic job :)

Issue: I use scott plot in my application. Sometimes my application crashes when using a crosshair due to a KeyNotFoundException. I have identify the code location: Plottables\HorizontalLine.cs#RenderLast(): line 60

    float x = LabelOppositeAxis
        ? rp.DataRect.Right + LabelStyle.PixelPadding.Right
        : rp.DataRect.Left - LabelStyle.PixelPadding.Left - rp.Layout.PanelOffsets[Axes.YAxis];

My Y-Axis changes its limits, so that it cannot be found in the Dictionary [rp.Layout.PanelOffsets[Axes.YAxis];]

ScottPlot Version: 5.0.54

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Plottables\HorizontalLine.cs in RenderLast(), especially the PanelOffsets lookup at line 60. Reproduce the crosshair crash while changing the Y-axis limits, then verify that rendering completes without a KeyNotFoundException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.