kerner1000 / javafx-chart-zooming

JavaFX chart zooming. (No, not just chart *scaling*)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get the wrong return values

lhuangjs opened this issue · comments

chart.setOnMouseReleased(new EventHandler<MouseEvent>() {
	@Override
	public void handle(final MouseEvent event) {
	final Bounds bb = chartBackground.sceneToLocal(rect.getBoundsInLocal());
	final double minx = bb.getMinX();
	final double maxx = bb.getMaxX();
	final double miny = bb.getMinY();
	final double maxy = bb.getMaxY();
	doZoom(true, chart.getXAxis().getValueForDisplay(minx), chart.getXAxis().getValueForDisplay(maxx));
	doZoom(false, chart.getYAxis().getValueForDisplay(miny), chart.getYAxis().getValueForDisplay(maxy));
	rect.setWidth(0);
	rect.setHeight(0);
	}
});

when I drag and print miny and maxy, I get negative. Why?

Because you are selecting an area that (partly) is outside of the axis bounds. That's perfectly normal.

Hi,
When I do like that, It disappear
test

I get

miny = -326.0
maxy =  -108.0
getValueForDisplay(miny)) = 7.065625
getValueForDisplay(maxy) = 4.6812499999999995

However, if I do not put the chart in grid pane, it can work, like that
test2
I get

miny = 102.0
maxy = 290.0
getValueForDisplay(miny) = 2.3843749999999995
getValueForDisplay(maxy) = 0.32812499999999994

Hi see you are working on a zoomable MassSpectrum View. What about working on that together? Is the project already on GitHub?

I am so sorry. I can' t add you as Collaborators in github because the project is not belong me. @kerner1000

@lhuangjs OK, but be aware of this project's license. If you use this project in a closed source/ commercial project of your own, you need to mention this usage in your own licence statement.

@kerner1000 ok, I will If I use it.

Without example code it is hard to tell what is the problem.