It seems that CrosshairOverlayFX currently doesn't support CombinedDomainXYPlot. When you add it as an overlay (viewer.canvas.addOverlay(crosshair)) it will issue a NPE because it's unable to find a valid plot instance here:
|
XYPlot plot = (XYPlot) chart.getPlot(); |
A potential solution is to let CrosshairOverlayFX accept the right plot in the constructor. In this case, and I'm not sure the best way to account for this, you'll also need to update the yy value computation (e.g. for vertical combined plots) so that the crosshair shows at the right height:
|
double yy = yAxis.valueToJava2D(y, dataArea, yAxisEdge); |
For example, if the top chart has a weight of 2 and the bottom chart has a weight of 1, then the computation above needs to be multiplied by 2/3.
It seems that
CrosshairOverlayFXcurrently doesn't supportCombinedDomainXYPlot. When you add it as an overlay (viewer.canvas.addOverlay(crosshair)) it will issue a NPE because it's unable to find a valid plot instance here:jfreechart-fx/src/main/java/org/jfree/chart/fx/overlay/CrosshairOverlayFX.java
Line 67 in 83d824c
A potential solution is to let
CrosshairOverlayFXaccept the right plot in the constructor. In this case, and I'm not sure the best way to account for this, you'll also need to update theyyvalue computation (e.g. for vertical combined plots) so that the crosshair shows at the right height:jfreechart-fx/src/main/java/org/jfree/chart/fx/overlay/CrosshairOverlayFX.java
Line 90 in 83d824c
For example, if the top chart has a weight of
2and the bottom chart has a weight of1, then the computation above needs to be multiplied by2/3.