在单个系列中,即在时间序列图中,必须获得不同的形状。但它不会来......请参考以下代码并告诉我我犯了什么错误?
TimeSeriesCollection dataset = new TimeSeriesCollection(glucoseries);
JFreeChart chart = ChartFactory.createTimeSeriesChart("Glucometer","Date","value",dataset,true,true,false);
XYPlot xyplot = (XYPlot)chart.getPlot();
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyplot.getRenderer();
int glucovalue = Integer.parseInt(glcvalue);
if(glucovalue<80)
{
renderer.setSeriesShape(0,new Ellipse2D.Double(-3.0,-3.0,8.0,8.0));
renderer.setSeriesShapesVisible(0,true);
}
else if(glucovalue>80 && glucovalue<100)
{
renderer.setSeriesShape(0,ShapeUtilities.createUpTriangle(4.0f));
renderer.setSeriesShapesVisible(0,true);
}
else if(glucovalue>100 && glucovalue< 120)
{
renderer.setSeriesShape(0,ShapeUtilities.createDiamond(4.0f));
renderer.setSeriesShapesVisible(0,true);
}
else
{
renderer.setSeriesShape(0,ShapeUtilities.createDownTriangle(4.0f));
renderer.setSeriesShapesVisible(0,true);
}
ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
File file1 = new File(request.getRealPath("\\jspchart\\gluco7.png"));
ChartUtilities.saveChartAsPNG(file1, chart, 700, 400, info);