Japanese Text not displayed on Image Generated by Servlet on winXP, Linux but displayed on Win2000
hello All,
I have developed a web App sample (project Proposal Purpose) that
creates various Charts (bar, pie, time series...) using JFreeChart API.
I need to have Japanese text in all the labels of the Chart.
I gave hard coded Japanese text to the method that creates the chart
for diagnosis Purpose.
The problem is the Image of the Chart that is created has Japanese text
in the Labels on Win2000 Pro. But the Same application when deployed to
winXP and also on Fedora Core 6 does not have Japanese Text on the
Labels. it just has '???' in place of the text.
I am using J2sdk1.4.2, Tomcat 5.0.28 on all the 3 machines(win2000,
winXP, Fedora Core 6)
If the API doesnt support Japanese Input then the Labels shouldn't have
displayed Japanese text on win2000. Hence Can this be related to Tomcat
or JRE ???
My Servlet Code is as follows:
protected void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
try {
DefaultCategoryDataset objDataset = new DefaultCategoryDataset();
String Series[] = {"'j=90=AB","=8F=97=90=AB"};
String Category[] = {"=83=80=83=93=83o=83C", "=83f=83=8A=81[",
"=83A=81[=83}=83_=83o=81[=83h"};
objDataset.addValue( new Double( 7000.0 ),Series[0] ,Category[0]
);
objDataset.addValue( new Double( 8000.0 ),Series[1] ,Category[0]
);
objDataset.addValue( new Double( 9000.0 ),Series[0] ,Category[1]
);
objDataset.addValue( new Double( 8000.0 ),Series[1] ,Category[1]
);
objDataset.addValue( new Double( 11000.0 ),Series[0] ,Category[2]
);
objDataset.addValue( new Double( 13000.0 ),Series[1] ,Category[2]
);
JFreeChart objChart = null;
objChart = ChartFactory.createBarChart(
"'j=90=AB/=8F=97=90=AB =8A=84=8D=87", //chart title
"'=AC", //X Axis label
"=90l=8C=FB", //Y Axis Label
objDataset,
PlotOrientation.HORIZONTAL, //plot orientation (Horizontal
Bar or Veritcal Bar)
true, // Is a legend required?
true, // Use tooltips
false // Configure chart to generate URLs?
);
HttpSession objSession = request.getSession();
ChartRenderingInfo objChartRenderingInfo = new
ChartRenderingInfo(new StandardEntityCollection());
String strFileName =
ServletUtilities.saveChartAsPNG(objChart,500,500,objChartRenderingInfo,objS=
ession);
request.getSession().setAttribute("FileName",strFileName);
RequestDispatcher objDispatcher = null;
objDispatcher =
getServletContext().getRequestDispatcher("/MyDisplayChart?filename=" +
strFileName);
objDispatcher.forward(request,response);
} catch(Exception ex) {
ex.printStackTrace();
}
}