Java Code Examples for org.jfree.chart.axis.NumberAxis#setVerticalTickLabels()
The following examples show how to use
org.jfree.chart.axis.NumberAxis#setVerticalTickLabels() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlotUtil.java From StockPrediction with MIT License | 5 votes |
public static void plot(double[] predicts, double[] actuals, String name) { double[] index = new double[predicts.length]; for (int i = 0; i < predicts.length; i++) index[i] = i; int min = minValue(predicts, actuals); int max = maxValue(predicts, actuals); final XYSeriesCollection dataSet = new XYSeriesCollection(); addSeries(dataSet, index, predicts, "Predicts"); addSeries(dataSet, index, actuals, "Actuals"); final JFreeChart chart = ChartFactory.createXYLineChart( "Prediction Result", // chart title "Index", // x axis label name, // y axis label dataSet, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); XYPlot xyPlot = chart.getXYPlot(); // X-axis final NumberAxis domainAxis = (NumberAxis) xyPlot.getDomainAxis(); domainAxis.setRange((int) index[0], (int) (index[index.length - 1] + 2)); domainAxis.setTickUnit(new NumberTickUnit(20)); domainAxis.setVerticalTickLabels(true); // Y-axis final NumberAxis rangeAxis = (NumberAxis) xyPlot.getRangeAxis(); rangeAxis.setRange(min, max); rangeAxis.setTickUnit(new NumberTickUnit(50)); final ChartPanel panel = new ChartPanel(chart); final JFrame f = new JFrame(); f.add(panel); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.pack(); f.setVisible(true); }
Example 2
Source File: AdminJFreeChartController.java From Spring-MVC-Blueprints with MIT License | 4 votes |
private void adjustAxis(NumberAxis axis, boolean vertical) { axis.setRange(-3.0, 3.0); axis.setTickUnit(new NumberTickUnit(0.5)); axis.setVerticalTickLabels(vertical); }