Java 如何在X轴折线图(JFreechart)中显示较少的值?
如何才能显示较少的值在X轴上,要组织数据 然而,我想要的价值观都显示出来了。我的一个想法是使用变焦,这样你可以看到所有的记录,但不知道这是不是一个好主意,或者更确切地说,你甚至不知道它 正如你在图片中看到的,我的想法是数据更清晰,以便实现最好的一切 有人能帮我吗Java 如何在X轴折线图(JFreechart)中显示较少的值?,java,jfreechart,Java,Jfreechart,如何才能显示较少的值在X轴上,要组织数据 然而,我想要的价值观都显示出来了。我的一个想法是使用变焦,这样你可以看到所有的记录,但不知道这是不是一个好主意,或者更确切地说,你甚至不知道它 正如你在图片中看到的,我的想法是数据更清晰,以便实现最好的一切 有人能帮我吗 //Code with result from query and chart create 不要使用categoryplot,但类似的东西有日期和时间吗?Marian是正确的,当x轴显示值或日期时,不应使用Category
//Code with result from query and chart create
不要使用categoryplot,但类似的东西有日期和时间吗?Marian是正确的,当x轴显示值或日期时,不应使用CategoryPlot,而应使用XYPlot和DateAxis。如果要使用ChartFactory中的方法创建图表,则createTimeSeriesChart()可能是最佳选择。这也意味着您需要更改所使用的dataset对象。
String query="select (CONCAT(`date`, ' ', hour)), temperature from records where idTermomether like 'T1' and date between '2014-06-01' and '2014-06-03'";
JDBCCategoryDataset dataset = new JDBCCategoryDataset (CriaConexao.getConexao(),query);
JFreeChart chart = ChartFactory.createLineChart(" - Temperature", "Date", "Temperature", dataset, PlotOrientation.VERTICAL, false, true, true);
BarRenderer renderer = null;
CategoryPlot plot= chart.getCategoryPlot();
CategoryAxis xAxis=(CategoryAxis)plot.getDomainAxis();
xAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
renderer=new BarRenderer();
ChartFrame frame = new ChartFrame("Temperature", chart);
frame.setVisible(true);
frame.setSize(400,650);