在單個系列中,即時間系列圖表中,必須獲得不同的形狀。但它沒有來...請參考下面的代碼,告訴我我犯了什麼錯誤?形狀在if和else if語句中沒有變化Jfreechart
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);
事情是你所示的代碼生成suppled截圖? – GrahamA 2013-04-05 15:29:47
@GrahamA它沒有生成...但我需要輸出像上面的截圖 – Ree 2013-04-06 04:18:11