我正在使用JFreeChart,我想只有一個維度的圖表: 一個x軸(表示毫秒)和形狀(表示事件)。JFreeChart:一軸分佈圖
我創建了一個XYLineChart和具有隱藏y軸的XYPlot:
this.chart = ChartFactory.createXYLineChart(
"","","",dataset,PlotOrientation.VERTICAL, false, true,false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setRangeGridlinesVisible(false);
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(false);
NumberAxis range = (NumberAxis) plot.getRangeAxis();
range.setVisible(false);
range.setRange(0.0, 1.0);
range.setTickUnit(new NumberTickUnit(0.5));
在我使用的固定y座標的數據集。
我得到這個結果:
image 1 http://imageshack.us/a/img46/4935/pointsuw.jpg
,但我想有這樣的事情:
image 2 http://img521.imageshack.us/img521/3721/points2.jpg
如果我只是調整面板,整個圖表的大小(標題,數字,形狀)。 所以我想只調整「灰色區域」。
顯然,如果存在另一個適當的圖表類型,則會更好。
非常感謝。
請編輯您的問題包括[SSCCE(http://sscce.org/)所示的方法之一,它實現[這裏](http://stackoverflow.com/a/10277372/230513 )。 – trashgod 2013-05-03 02:08:55