Problem in java local

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
abhay.asingh
Posts: 58
Joined: Mon Dec 15, 2008 7:07 am
Location: India
Contact:

Problem in java local

Post by abhay.asingh » Mon Jun 15, 2009 8:32 am

Hi,

I want to display charts for different languages( say japanese).
I have a property file from where i can set the Locals. for japanese i have set
Local=jp_JP

but when i generate charts it gives me junk chars... i have changed browser(mozilla/IE 6) encoding to UTF-8.(i can see other text, other then chart in proper way).
I am using jre1.5.0 (sun) in Suse 10.0 O/S.
Do i need to install any language package?
i have psfont.properties.ja file in my jre/lib/
Abhay Singh

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Problem in java local

Post by david.gilbert » Mon Jun 15, 2009 10:54 pm

Most likely Java is using a different font to your browser...and the font the browser is using supports the Japanese characters you want to display, while the font that Java is using doesn't.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

abhay.asingh
Posts: 58
Joined: Mon Dec 15, 2008 7:07 am
Location: India
Contact:

Re: Problem in java local

Post by abhay.asingh » Wed Jun 17, 2009 12:32 pm

Hi,

I think you are right, i wrote the map file for the chart created and if view that map file in any editer then i found junk chars where i need
text in new language.
but when i checked my log file i found that its taking correct locale
I used this to set locale

Code: Select all

 Locale locales = new Locale("ja", "JP");
 Locale.setDefault(new Locale("ja", "JP"));
 String displayLanguage = locales.getDisplayLanguage(locales);
 log.info("Locale="+locales.toString() + ": " + displayLanguage);
and my log file entries is
INFO Graphserver:78:main Locale=ja_JP: 日本語

where in chart it showes like this

http://www.postimage.org/image.php?v=aVMKiwr

(check legends and text above legend)
What should i do to make this working..? i am not getting any idea...
Abhay Singh

abhay.asingh
Posts: 58
Joined: Mon Dec 15, 2008 7:07 am
Location: India
Contact:

Re: Problem in java local

Post by abhay.asingh » Fri Jul 03, 2009 5:10 am

Hi,
Can any one please help me in this, i have tried all option i came across like,
Changing the charcterset of stored data... (utf8)
passing charcterEncoding in jdbcURL while making connection to data base for fetching data... (utf8)
Setting LOCALE for my programme...

Please help me..
Abhay Singh

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Problem in java local

Post by david.gilbert » Fri Jul 03, 2009 7:55 am

As I said, Java is using a font that doesn't include glyphs for the characters you want to display. Change the font to one with better unicode support, and you'll see the characters you are expecting.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

abhay.asingh
Posts: 58
Joined: Mon Dec 15, 2008 7:07 am
Location: India
Contact:

Re: Problem in java local

Post by abhay.asingh » Fri Jul 03, 2009 8:26 am

Hi,

I am useing org.jfree.chart.ChartFactory functions like createBarChart etc..
and there is no options to pass fonts , in this case i need to wirte functions for tooltip, legends and labels seperatly right?
Abhay Singh

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Problem in java local

Post by david.gilbert » Fri Jul 03, 2009 9:22 am

You have different options:

(1) Change the default font for the JVM:

http://java.sun.com/javase/technologies ... -rendering

(2) Create a new ChartTheme with the font you want, and apply that to your charts (then you won't have to change each and every font attribute in the chart structure);

(3) Go through the chart structure and change each font attribute individually.

Note that if you are coding a Swing application, the tool tip font is controlled by the look and feel, not JFreeChart.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

ashabokade
Posts: 7
Joined: Thu Mar 13, 2014 12:22 pm
antibot: No, of course not.

Re: Problem in java local

Post by ashabokade » Thu Mar 13, 2014 12:29 pm

Even I am creating chart by following method.
chart = ChartFactory.createBarChart3D(..);
then in my dataset having language of Japanese,Hindi,Chinese..etc..how can i support to have the chart display all the language as with the tables like the java locales.

???
please help
Thanks in advance.

Locked