问题
Can I draw only vertical data axis (without axis line( in XYPlot and only horizontal line in grid lines (I know the hack - draw them by white color, that is coincident with background color, may be, there is more pure way) ?

回答1:
You can specify currency formatting on the range axis using setNumberFormatOverride()
, as shown here.
NumberFormat currency = NumberFormat.getCurrencyInstance();
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setNumberFormatOverride(currency);
回答2:
Here is a simple example.
// create a dataset...
XYSeries series = new XYSeries("Random Data");
series.add(1.0, 500.2);
series.add(10.0, 694.1);
// Create an XY Line chart
XYSeriesCollection data = new XYSeriesCollection(series);
JFreeChart chart = ChartFactory.createXYLineChart("XY Series Demo",
null,
"Y",
data,
PlotOrientation.VERTICAL,
true,
true,
false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setDomainGridlinesVisible(false);
The vertical lines are hidden by calling plot.setDomainGridLinesVisible(false).
来源:https://stackoverflow.com/questions/14442404/xyplot-without-vertical-axis-and-horizontal-line-grid