Reputation: 2065
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) ?
Upvotes: 1
Views: 1289
Reputation: 205785
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);
Upvotes: 2
Reputation: 9336
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).
Upvotes: 1