本文整理汇总了Java中org.jfree.chart.axis.NumberAxis.setVerticalTickLabels方法的典型用法代码示例。如果您正苦于以下问题:Java NumberAxis.setVerticalTickLabels方法的具体用法?Java NumberAxis.setVerticalTickLabels怎么用?Java NumberAxis.setVerticalTickLabels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.axis.NumberAxis
的用法示例。
在下文中一共展示了NumberAxis.setVerticalTickLabels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: plot
import org.jfree.chart.axis.NumberAxis; //导入方法依赖的package包/类
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);
}