JavaFX - XYChart with Axis Hidden

2019-08-28 00:34发布

问题:

Is it possible to make an XYChart that has its axis hidden? Ideally removed.

From looking at source it seems that it must have one due to the limitation that XYChart does not check for null Axis when layoutChartChildren() is called, which is a shame since XYChart provides for multiple data series and the addition of data in a series.

IMO a separation of concern from the Axis.

Any thoughts on a solution?

回答1:

After you have shown a stage displaying the chart, call:

for (Node n: chart.lookupAll(".axis")) {
  n.setVisible(false);
}


标签: java javafx-2