Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crosshairs broken in v1.5.4 #340

Open
matoos32 opened this issue Jan 14, 2023 · 6 comments
Open

Crosshairs broken in v1.5.4 #340

matoos32 opened this issue Jan 14, 2023 · 6 comments

Comments

@matoos32
Copy link

matoos32 commented Jan 14, 2023

Going from release v1.5.3 to v1.5.4 crosshair functionality stopped working. Clicking on charts no longer updates the crosshair.

To reproduce:

Setup

  1. Find demos with crosshairs: https://github.com/jfree/jfree-demos/search?q=crosshair
    Note: jfree-demos currently lists JfreeChart v1.5.3 in the README but doesn't have a v1.5.3 release tag. It's up to v1.5.2.
  2. git clone https://github.com/jfree/jfree-demos.git
  3. cd jfree-demos
  4. git checkout -b crosshair-test v2.0

Test v1.5.2

  1. mvn clean package
  2. java -cp target/org.jfree.demos-2.0-jar-with-dependencies.jar org.jfree.chart.demo2.TimeSeriesChartDemo1
  3. Observe clicking the chart updates the crosshair.
  4. Close the app.

Test v1.5.3

  1. Set the POM jfreechart dependency to v1.5.3
  2. Repeat build and launch steps.
  3. Observe clicking the chart updates the crosshair.
  4. Close the app.

Test v1.5.4

  1. Set the POM jfreechart dependency to v1.5.4
  2. Repeat build and launch steps.
  3. Observe the crosshair doesn't update. If you resize the window (trigger a re-draw) the crosshair updates to the last clicked location.

I suspect it's related to a v1.5.4 contribution.

@trashgod
Copy link
Contributor

trashgod commented Jan 14, 2023

For reference, I can reproduce the anomaly in TimeSeriesChartDemo1 and similar examples that make the crosshairs visible on the plot, but not in examples that use CrosshairOverlay, seen here and here.

@jfree
Copy link
Owner

jfree commented Jan 14, 2023

At first glance it seems to be caused by the removal of this line in ChartPanel.java between v1.5.3 and v1.5.4:

image

jfree added a commit that referenced this issue Jan 14, 2023
@matoos32
Copy link
Author

Thanks for having taken a look!

@trashgod
Copy link
Contributor

Yes, thank you. After restoring the call to setNotify(), I can no longer reproduce the anomaly. Related discussion may be found here and here.

@Yuri-Blankenstein-TNO
Copy link

At first glance it seems to be caused by the removal of this line in ChartPanel.java between v1.5.3 and v1.5.4:

image

I know exactly when this was introduced, see #233 (comment).
The problem now is that large charts are re-rendered every time when a user clicks with the mouse.
This leads to very laggy behavior when selecting chart elements, though the selection itself is rendered using an ChartOverlay which is very fast.

@Yuri-Blankenstein-TNO
Copy link

I've created an alternative solution that prevents charts without corsshairs to redraw on every mouse click, see #362.

For this I have reused - what seems - an older implementation JFreeChart#handleClick(...) that exactly seems to solve this issue. This public method isn't called anywhere else anymore within the library.

Yuri-Blankenstein-TNO added a commit to Yuri-Blankenstein-TNO/jfreechart that referenced this issue May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants