Using Overlay for data selection (rectangle, freehand)

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
LaurentBourges
Posts: 1
Joined: Fri Jun 08, 2012 9:00 pm
antibot: No, of course not.

Using Overlay for data selection (rectangle, freehand)

Post by LaurentBourges » Fri Jun 08, 2012 10:01 pm

I am using JFreeChart for 2 years for my job on one scientific software ASPRO 2 and made several extensions.
I advocate I must take some time to provide JFreeChart patches for many of them. However, it requires often to generalize my custom code ...
For example:
- bounded number and date axes
- define the plot's background image with one scientific model and support zoom in / out (zoom event hack) ...
- square XY plot to ensure the plot keeps a fixed aspect ratio
- log paint scale ...
- custom annotations that support auto-fit (font size, position ...) to avoid overlapping between bars on gantt chart

Look at the documentation to see such features: http://www.jmmc.fr/twiki/bin/view/Jmmc/ ... JmmcAspro2

For data handling, I need again advanced features (crosshair, data selection ...) i.e. advanced interactions between data and plots.

For last 2 days I worked a lot on using JFreeChart Overlay mechanism to:
- draw efficient crosshair (CrossHairOverlay) which is automatically matching the closest data point as XYPlot does with its own crosshair / lockOnData feature but it does not require plot redraw: ~10 ms instead of 500 ms (> 40 000 data points)
- create my own EnhancedChartPanel to deal with mouse listeners / zoom rectangle (event redirection)
- create my own SelectionOverlay to provide a toolbar (zoom, rectangular selection, freehand selection ...) which uses double buffering (performance again) to paint selected data points

Definitely Overlays are very useful as they are not rendered on outputs (png, pdf ...) and the only way to use Java2D to paint over the chart / plot ...

PS: Entity are great (disabled for performance) but probably less efficient: I prefer doing my own lookup on dataset(s) using rectangle coordinates expressed in data space.

I want here to share this knowledge and provide soon one working patch for JFreeChart 1.0.13 / 14.

Should I first provide the patch in this forum or directly on sourceforge ?

Is there somebody interested for such features ?

I searched this forum and several times people are looking for such feature: Is there any roadmap on next JFreeChart release ?
David Gilbert, are you interested by such feature in JFreeChart trunk ? Do you have already experimental work related to data selection / interaction using the mouse ?

Here is a sample of rectangular data selection:
Image

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: Using Overlay for data selection (rectangle, freehand)

Post by matinh » Mon Jun 11, 2012 3:35 pm

Hi!

Active development is unfortunately currently rare on JFreeChart. However, there are active users and sometimes contributions.
I'd say create a patch, attach it to the patch-tracker at sourceforge.net and link to it from this post (and vice versa). Discussion should take place on the forum or on the jfreechart-dev mailinglist. A broader audience is probably reached on this forum, though.

hth,
- martin

bandaf
Posts: 3
Joined: Wed Mar 19, 2014 1:07 pm
antibot: No, of course not.

Re: Using Overlay for data selection (rectangle, freehand)

Post by bandaf » Thu Mar 20, 2014 5:58 pm

Hello Laurent/Martin,

Just trying to follow up the topic you raised regarding overlays. Was any of your work incorporated
into later JFreeChart releases? I am looking for a solution on rendering plots using overlays but can
not get both the scatter plot and its regression line to render. I have defined two datasets and renderers
and turned the opacity flag of the second overlay to "false".

Any suggestions will be appreciated,

Faustin

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Using Overlay for data selection (rectangle, freehand)

Post by david.gilbert » Thu Mar 20, 2014 6:31 pm

Do you need to use overlays for this? You can put multiple datasets and renderers into a single plot.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

bandaf
Posts: 3
Joined: Wed Mar 19, 2014 1:07 pm
antibot: No, of course not.

Re: Using Overlay for data selection (rectangle, freehand)

Post by bandaf » Wed Jun 11, 2014 4:55 pm

Hi again. I had packed this task but I am back. What I want to do is once I have rendered my scatterplot. I generate a regression
line. The issue I want to clarify with your suggestion Gilbert, is where redering the regression line, I will be able to manipulate, i.e
with the mouse, pick either of the end points of the line and move the line over the scatterplots. Furthermore, if I want to delete this
regression line, will I be able to delete it and retain the underlying scatterplot? Was of the opinion that usage of an overlay would help.

Thanks

Locked