0
我目前正在將應用程序從Windows環境遷移到Redhat。此應用程序正在使用JfreeChart 1.0.6。它是一個在Open-JDK6上運行的Redhat無頭環境中的tomcat 7中部署的Web應用程序)。JFreeChart奇怪的渲染(無頭紅帽)
我獲得以下PNG。它看起來像手寫的圖表,一切都朝向圖像的頂部。
有人已經遇到這樣的問題,並得到了解決?
查看我的見下表:
image http://img194.imageshack.us/img194/4489/graph20120801105017.png
參見一段代碼生成下面的圖表:
FacesContext facesContext = FacesContext.getCurrentInstance();
ServletContext servlet = (ServletContext)facesContext.getExternalContext().getContext();
HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
String path = null;
if (null != servlet.getRealPath("/"))
{
path = servlet.getRealPath("/");
}
else
{
path = servlet.getResource("/").getPath();
}
File stockageImg = new File(path+Constants.CHEMIN_GRAPH+CM50Util.dateHeureJour()+Constants.EXTENSION_GRAPH);
ChartRenderingInfo info = new ChartRenderingInfo (new StandardEntityCollection());
DefaultXYDataset dataset = new DefaultXYDataset();
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
try
{
dataset.addSeries("CM moyen Annuel", courbeRef);
dataset.addSeries("CM non dépassé plus de 5% du temps", courbe95);
//creation du graphique
JFreeChart chart = ChartFactory.createXYLineChart(
"Courbes de décroissance",
"Distance en m\u00E8tre",
"Champ",
dataset,
PlotOrientation.VERTICAL,
true,
false,
false);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(renderer);
IntervalMarker intervalIncertitude = new IntervalMarker(Double.parseDouble(resultDistanceMin.replace(Constants.UNITE_DISTANCE, "")), Double.parseDouble(resultDistanceMax.replace(Constants.UNITE_DISTANCE, "")));
intervalIncertitude.setPaint(new Color(222, 222, 255, 128));
plot.addDomainMarker(intervalIncertitude, Layer.BACKGROUND);
Marker distanceTiers = new ValueMarker(Double.parseDouble(resultDistance.replace(Constants.UNITE_DISTANCE, "")));
distanceTiers.setPaint(Color.BLACK);
plot.addDomainMarker(distanceTiers);
renderer.setSeriesPaint(0, Color.GREEN);
renderer.setSeriesPaint(1, Color.BLUE);
ChartUtilities.saveChartAsPNG(stockageImg, chart, 800, 400, info);
} catch (Exception e) {
log.error("erreur generation graphique ",e);
}
字體替換可能發生了。請編輯您的問題以包含生成所示圖表的[sscce](http://sscce.org/)。 – trashgod 2012-08-01 20:15:43