get the wrong return values
lhuangjs opened this issue · comments
Jia Huang commented
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?
Kerner commented
Because you are selecting an area that (partly) is outside of the axis bounds. That's perfectly normal.
Jia Huang commented
Hi,
When I do like that, It disappear
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
I get
miny = 102.0
maxy = 290.0
getValueForDisplay(miny) = 2.3843749999999995
getValueForDisplay(maxy) = 0.32812499999999994
Kerner commented
Hi see you are working on a zoomable MassSpectrum View. What about working on that together? Is the project already on GitHub?
Jia Huang commented
I am so sorry. I can' t add you as Collaborators in github because the project is not belong me. @kerner1000
Kerner commented
Jia Huang commented
@kerner1000 ok, I will If I use it.
Kerner commented
Without example code it is hard to tell what is the problem.