Namespace: GlobFX.SwiffChartGenerator
Assembly: GlobFX.SwiffChartGenerator (in GlobFX.SwiffChartGenerator.dll)
Set series X and Y values from data encoded in a separator-delimited string (for XY-Scatter and XY-Curves).
Public Sub SetSeriesXYValuesFromString( index As Integer, values As String )
public void SetSeriesXYValuesFromString( int index, string values );
Note: This method is available when manipulating XY data series required for displaying XY-Curves and XY-Scatter. Note that the Chart type (ie: bar, column, line, etc.) is defined in the Swiff Chart style file (.scs) which must be loaded via the LoadStyle method.
You can set both the X and Y values of a specified series in a chart with data encoded in a string (i.e. the values argument). The string must be formatted as a list of pairs of numerical values, two consecutive values must be separated by a separator character that can be specified with the SetSeparators method.
Here is an example of X Y value pairs encoded in a string with the character ";" as separator.
myEncodedString= "1;12;2;7.5;3;11.3;4;9.2;5;5.3"
This encoded string is interpreted as a set of 5 xy-points whose coordinates are (1,12) (2,7.5) (3,11.3) (4,9.2) (5,5.3)
The string argument values is parsed by the chart object according to the separator characters specified to the chart object (see the SetSeparators method for specifying separator characters and rules).
The ";" character is the default separator character.
If the index argument refers to a series that does not exist in the chart object, the series is created.
The following code shows how to store the XY values of the table below using the SetSeriesXYValuesFromString method. This table has two series named "Year 2006" and "Year 2007". Each of these two series contains independant X values and Y values.
|
' Let's build the series and categories string with ";" as separator Dim sep As String = ";" Dim ignore_mult_separators As Boolean = True ' Before setting the series and categories, we must specify the separators chart.SetSeparators(sep, ignore_mult_separators) ' Add the first series "Year 2006" Dim str_xy As String = "1" + sep + "12" + sep + "2" + sep + "7.5" + sep + "3" + sep + "11.3" + sep + "4" + sep + "9.2" + sep + "5" + sep + "5.3" ' Fill the first series with the XY values stored in the str_xy variable chart.SetSeriesCaption(0, "Year 2006") chart.SetSeriesXYValuesFromString(0, str_xy) ' Add the second series "Year 2007" str_xy= "1.5" + sep + "14" + sep + "1.8" + sep + "9.9" + sep + "3.7" + sep + "13.1" + sep + "3.9" + sep + "11.5" + sep + "5.8" + sep + "4.9" ' Fill the second series with the XY values stored in the str_xy variable chart.SetSeriesCaption(1, "Year 2007") chart.SetSeriesXYValuesFromString(1, str_xy)
// Let's build the series and categories string with ";" as separator string sep= ";"; bool ignore_mult_separators= true; // Before setting the series and categories, we must specify the separators chart.SetSeparators(sep, ignore_mult_separators); // Add the first series "Year 2006" string str_xy= "1" + sep + "12" + sep + "2" + sep + "7.5" + sep + "3" + sep + "11.3" + sep + "4" + sep + "9.2" + sep + "5" + sep + "5.3"; // Fill the first series with the XY values stored in the str_xy variable chart.SetSeriesCaption(0, "Year 2006"); chart.SetSeriesXYValuesFromString(0, str_xy); // Add the second series "Year 2007" str_xy= "1.5" + sep + "14" + sep + "1.8" + sep + "9.9" + sep + "3.7" + sep + "13.1" + sep + "3.9" + sep + "11.5" + sep + "5.8" + sep + "4.9"; // Fill the second series with the XY values stored in the str_xy variable chart.SetSeriesCaption(1, "Year 2007"); chart.SetSeriesXYValuesFromString(1, str_xy);
SeriesCount Property | SetSeriesXValuesFromString Method | SetSeriesXValuesFromString Method | SetSeriesCaption Method | GetSeriesXValue Method | GetSeriesYValue Method
Applies To: Chart Object