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

Repainting a specified series to improve repaint performance #269

Open
RNuWM opened this issue Jun 8, 2018 · 2 comments
Open

Repainting a specified series to improve repaint performance #269

RNuWM opened this issue Jun 8, 2018 · 2 comments

Comments

@RNuWM
Copy link

RNuWM commented Jun 8, 2018

I have a fairly complex chart scheme that includes interactive mouse support. One feature is a mouse follower icon that follows XY series data as a separate XY series composed of a single data point. The pseudocode to update this single data point series is:

chart.updateXYSeries(seriesName, xVal, yVal, null);
chartPanel.revalidate();
chartPanel.repaint();

Being a single point, the update is, in principle, extremely lightweight. However, the entire chart is repainted which can be very significant work if a lot of data is displayed in the other series. This repaint time is very noticeable in something interactive like mouse feedback.

For comparison, this maintains good mouse interaction regardless of the background data size.

Is there a change in approach I can use to improve my performance with the existing XChart library? Is there some way to repaint specific series? I believe the answer is no, but I may be missing something.

If not, maybe we can enhance XCharts with some sort of layering system in its rendering logic. I’m essentially trying to update a layer that’s on top of a static backing image.

@timmolter
Copy link
Member

I really don't know if that is possible with Java Swing. There would need to be some way to define layers like you said. Can Swing do that?

@RNuWM
Copy link
Author

RNuWM commented Jun 13, 2018

I am far from a Swing expert but it's likely that using a JLayeredPane could accomplish independently rendered layers that visually combine for the completed chart.

I think JPanel's (maybe some sort of modified XChartPanel) could be stacked in the JLayeredPane with the non-base layers having there background opacity turn off (transparent).

Obviously, trying something like this would be a large and invasive undertaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants