【发布时间】:2014-04-30 05:43:19
【问题描述】:
我正在尝试使用 JfreeChart 绘制 XYPlot。我的 X 轴有数字或客户说 30, 50 ,70 并且 Y 轴具有缓存命中率(其值有时会变化 0.01)当我设置 AutoRange 时,y 轴显示范围为 0.1 0.2 0.3..... 1.0。所以有时我的情节几乎是直线,因为它的变化很小。
我试过这段代码
JFreeChart chart = ChartFactory.createXYLineChart(
"Effect of Number of Clients", // Title
"Number of Clients", // x-axis Label
"Cache Hit Ratio", // y-axis Label
datasetLRU, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, // Show Legend
true, // Use tooltips
false // Configure chart to generate URLs?
);
chart.setBackgroundPaint(Color.white);
plot= chart.getXYPlot();
plot.setBackgroundPaint(Color.black);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
final ValueAxis axis = plot.getDomainAxis();
axis.setAutoRange(false);
final NumberAxis axis2 = new NumberAxis("Axis 2");
axis2.setAutoRangeIncludesZero(false);
axis2.setTickUnit(new NumberTickUnit(0.01));
plot.setDataset(1, datasetMARS);
plot.setRenderer(1, new StandardXYItemRenderer());
plot.setDataset(2, datasetNEW);
plot.setRenderer(2, new StandardXYItemRenderer());
所以任何人都可以帮助将 Y 轴范围设置为 0.01 0.02 0.03 .... 0.98 0.99 1.00 谢谢
【问题讨论】:
标签: jfreechart