#674 crosshair is incorrectly positioned

General (896)

Crosshair is not positioned correctly when one of the
axes is not locked to data. In this case it is snapped
to the "closest to zero" value on the other axis.

From the implementation standpoint, it is caused by
the way updateCrosshairX/Y methods in CrosshairState
class are called.

The supplied patch resolves the problem and also fixes
crosshair painting and positioning for ContourPlot.


  • Sergei Ivanov

    Sergei Ivanov - 2006-09-25

    Patch against version 1.0.2

  • David Gilbert

    David Gilbert - 2006-10-13

    Logged In: YES

    Thanks for the report. I can see the problem, which is
    caused by the anchorX and anchorY values never being

    I can't use your patch as is, since it modifies the API, and
    I'm trying to avoid that in the 1.0.x series of JFreeChart.
    Also, there is no need to check (for the single axis cases)
    whether we are in data space or Java2D space, since the
    result will be the same either way (it only matters when you
    are looking at both axes, where the scales might differ a
    lot). I'll come up with an alternative fix.

    I didn't look at the ContourPlot stuff yet (although if you
    are using ContourPlot, please take a look at the
    XYBlockRenderer class in the "experimental" packages in the
    1.0.2 release - it allows similar kinds of charts, but
    within the standard XYPlot framework. It still needs work,
    but comments are welcome).

  • David Gilbert

    David Gilbert - 2006-10-13
    • labels: --> General
    • assigned_to: nobody --> mungady
  • David Gilbert

    David Gilbert - 2006-10-13

    Logged In: YES

    I've committed a fix for the crosshair positioning, for
    inclusion in the 1.0.3 release.

  • Sergei Ivanov

    Sergei Ivanov - 2006-10-19

    Logged In: YES

    The reason behind API modification is simple -- I wanted
    to come up with a "clean" fix, which would be preserving
    the existing logic. Even though one of the data spaces is
    actually never used, I decided to support both modes,
    which led to passing extra parameters into the methods.

    The reason behind ContourPlot modification is simple - it
    was affected by the modified API. I brought it in sync
    with my changes and slightly optimised along the way.

  • Sergei Ivanov

    Sergei Ivanov - 2007-02-27

    Logged In: YES
    Originator: YES

    I think this ussue may be closed now.

  • David Gilbert

    David Gilbert - 2007-02-28
    • status: open --> closed-fixed
  • David Gilbert

    David Gilbert - 2007-02-28

    Logged In: YES
    Originator: NO

    OK, closing.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks