0
這裏的情況是:如何告訴StackedBarChart的軸行爲?
該圖被初始化爲這樣:
protected NumberAxis xAxis;
protected NumberAxis yAxis;
protected StackedAreaChart<Number, Number> chart;
protected final XYChart.Series<Number, Number> waitingSeries
= new XYChart.Series<>();
protected final XYChart.Series<Number, Number> startedSeries
= new XYChart.Series<>();
protected final XYChart.Series<Number, Number> successSeries
= new XYChart.Series<>();
protected final XYChart.Series<Number, Number> failureSeries
= new XYChart.Series<>();
// ...
@Override
public void init()
{
// ...
xAxis = new NumberAxis();
xAxis.setLabel("Line number");
xAxis.setForceZeroInRange(false);
xAxis.setTickUnit(1.0);
xAxis.setTickMarkVisible(false);
yAxis = new NumberAxis();
yAxis.setTickMarkVisible(false);
chart = new StackedAreaChart<>(xAxis, yAxis);
chart.setAnimated(false);
chart.setTitle("Matcher status by line");
waitingSeries.setName("Waiting for children");
startedSeries.setName("Started this line");
successSeries.setName("Succeeded this line");
failureSeries.setName("Failed this line");
final ObservableList<XYChart.Series<Number, Number>> data
= chart.getData();
data.add(waitingSeries);
data.add(startedSeries);
data.add(successSeries);
data.add(failureSeries);
pane.setCenter(chart);
}
OK,所以:
- 即使我在設置兩個軸那刻度線不應該是可見的,它們是;
- 即使我告訴
xAxis
它的步驟應該是1,它顯示分數; - 再有就是這個,我在那裏更新數據:
(工作周圍的錯誤與SO聊天和符號列表VS代碼)
@Override
public void showLineMatcherStatus(final List<LineMatcherStatus> list,
final int startLine, final int nrLines)
{
display.xAxis.setLowerBound(startLine);
display.xAxis.setUpperBound(startLine + nrLines - 1);
// etc
在這種情況下startLine
爲1和nrLines
是25,那麼,endline是25.好,界限是尊重...
...但爲什麼x軸範圍從0到27.5?
如何讓軸的行爲?
只是一個快速的猜測,沒有時間來測試,但您可能需要'xAxis.setAutoRanging(假);' – 2015-02-07 21:34:04
@ James_D確實修復了x軸問題! – fge 2015-02-07 21:59:12