Specifies an item of locale information to be used when parsing string values in the following methods SetSeriesValuesFromString, SetSeriesXValuesFromString, SetSeriesYValuesFromString, SetCategoriesFromString and SetDataFromTxtFile.
void object.SetLocaleInfo( int type, String data )
By default, the SetSeriesValuesFromString, SetSeriesXValuesFromString, SetSeriesYValuesFromString, SetCategoriesFromString and SetDataFromTxtFile methods use the items of locale information provided by the System. Locale information depend on the language of the System.
The type of locale information is defined by an integer value (the type parameter) which is interpreted as follows:
Code | Definition |
---|---|
1 |
Locale Decimal Separator |
2 |
Locale Thousand Separator |
Let us consider 2 different strings:
String values_str_1= "1.234,5;1.678,5"; String values_str_2= "1234.5;1678.5";
And let us pretend that the regional settings on the system are:
"," as decimal separator
"." as thousand separator
Then the 2 strings will be interpreted as:
values_str_1 first value: 1234.5 (correct) second value: 1678.5 (correct) values_str_2 first value: 12345 (wrong) second value: 16785 (wrong)
chart.SetLocaleInfo( 1, "." ); // Decimal separator chart.SetLocaleInfo( 2, " " ); // Thousand separator... the 2 previous strings will be interpreted as:
values_str_1 first value: 1.2345 (wrong) second value: 1.6785 (wrong) values_str_2 first value: 1234.5 (correct) second value: 1678.5 (correct)
The following JSP code illustrates use of the SetLocaleInfo method.
// Let's set the categories of a chart object with a ";"-delimited string String decimal_separator= ","; String thousand_separator= "."; // Before setting the series and categories, we must specify the locale info // so that Swiff Chart Generator will correctly interpret the strings chart.SetLocaleInfo( 1, decimal_separator ); chart.SetLocaleInfo( 2, thousand_separator ); String the_categories= "North America" + sep + "South America" + sep + "Europe" + sep + "Middle East" + sep + "Asia"; chart.SetCategoriesFromString( the_categories ); String the_values= "1.890,23" + sep + "970,56" + sep + "1590,91" + sep + "576,85" + sep + "376,35"; chart.SetSeriesValuesFromString( 0, the_values );
SetSeriesValuesFromString Method | SetSeriesXValuesFromString Method | SetSeriesYValuesFromString Method | SetCategoriesFromString Method | SetDataFromTxtFile Method
Applies To: Chart Object