Namespace: GlobFX.SwiffChartGenerator
Assembly: GlobFX.SwiffChartGenerator (in GlobFX.SwiffChartGenerator.dll)

Specifies an item of locale information to be used when parsing string values in the following methods SetSeriesValuesFromString, SetSeriesXValuesFromString, SetSeriesYValuesFromString, SetCategoriesFromString and SetDataFromTxtFile.

Visual Basic
Public Sub SetLocaleInfo( type As LocaleInfoType, data As String )
C#
public void SetLocaleInfo( LocaleInfoType type, string data );

Arguments

type
An integer value which specifies the type of locale information to be set by the method (see table below).
data
A LocalInfoType enum value that specify 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 the LocaleInfoType enumeration as follows:

EnumValue Definition
LocaleInfoType.DecimalSeparator
Locale Decimal Separator
LocaleInfoType.ThousandSeparator
Locale Thousand Separator

Example

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


  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. Sample Code

    The following code illustrates use of the SetLocaleInfo method.

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

    See Also

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

    Applies To: Chart Object