Setting the Locale for a Graph

When a graph is instantiated, the Graph bean reads the locale of the Java Virtual machine (JVM) in which it runs. You can, however, specifically set the locale for the graph while the graph is running.

You should set the locale for your graph whenever you have more than one instance of the Graph bean running on a single JVM, or whenever users from more than one country or language group have access to the same instance of the Graph bean.

In a typical scenario, your JVM, which is in the U.S., might have two instances of the Graph bean running in it. Both instances will use a U.S. locale by default. One instance might supply information for users in France, and the other instance might supply information for users in Germany, so you cannot simply set the locale in the JVM for one or the other instance. Your application should determine the localization needs of your users and then set the locale of the graph so that it meets those needs.

How to set the locale

To set the locale for a graph, call the setLocale method of the graph, as shown in the following example. This example sets the locale for Germany.


myGraph.setLocale(Locale.GERMAN);