exception
java.lang.IllegalArgumentException: The 'quality' must be in the range 0.0f to 1.0f
org.jfree.chart.encoders.SunJPEGEncoderAdapter.setQuality(SunJPEGEncoderAdapter.java:102)
org.jfree.chart.encoders.ImageEncoderFactory.newInstance(ImageEncoderFactory.java:131)
org.jfree.chart.encoders.EncoderUtil.writeBufferedImage(EncoderUtil.java:152)
org.jfree.chart.ChartUtilities.writeChartAsJPEG(ChartUtilities.java:474)
com.company.chart.ChartGender.createTimeGraphByServlet(ChartGender.java:57)
com.servlet.Statistic.doGet(Statistic.java:48)
com.servlet.Statistic.service(Statistic.java:19)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
解决办法:
ChartUtilities.writeChartAsJPEG(res.getOutputStream(),100,chart,graphWidth,graphHigh,null);
限制quality必须小于等于1,所以修改一下,把100改成 0.1f就可以显示了。