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 )

Arguments

object
Required. A Chart object.
type
Required. An integer value which specifies the type of locale information to be set by the method (see table below).
data
Required. A string value containing the locale information the method will set.

Remarks

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

Example

Let us consider 2 different strings:

$values_str_1= "1.234,5;1.678,5";
$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


  1. 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)

  2. However, by calling the method SetLocaleInfo ...
    $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)

  3. PHP Sample Code

    The following PHP code illustrates use of the SetLocaleInfo method.

    // Let's set the categories of a chart object with a ";"-delimited string
    $decimal_separator= ",";
    $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 );
    
    $the_categories= "North America" .$sep. "South America" .$sep. "Europe" .$sep. "Middle East" .$sep. "Asia";
    $chart->SetCategoriesFromString( $the_categories );
    
    $the_values= "1.890,23" .$sep. "970,56" .$sep. "1590,91" .$sep. "576,85" .$sep. "376,35";
    $chart->SetSeriesValuesFromString( 0, $the_values );
    

    See Also

    SetSeriesValuesFromString Method | SetSeriesXValuesFromString Method | SetSeriesYValuesFromString Method | SetCategoriesFromString Method | SetDataFromTxtFile Method

    Applies To: Chart Object