PCScript

To send a Stock data set via PCScript, first specify your category names by calling the Graph. SetCategories() method. Each category name should be separated by a semi-colon. Then, send the data series to the graph with the Graph.SetSeries() commands. The first parameter in this command should be the series name. Then you should list each data item in the series, separating data values with a comma and data items with a semi-colon.

A Stock data item will consist of two to four data values, each separated by a comma. These values should be listed in the following order: high value, low value, open value, close value. The last two values are optional.

Assuming that your graph object is named graph, you could send the Stock data set of Example 12.12 to a graph with the PCScript in Example 12.14:

Example 12.14 Stock Data Set in PCScript

graph.SetCategories(6/1; 6/2; 6/3; 6/4) 

graph.SetSeries(Cool Company Stock; 13,11,12,11.3; 12,8,11.3,11; 13,9,11,11.9; 14,10,11.9,13.2)

Note: With stock graphs, you can also specify your category names directly in the Graph.SetSeries() method. To do this, simply list your category name as the first value in the data item (e.g. the first data item in Example 12.14 would be 6/1,11,12,11.3).This allows you to remove the Graph. SetCategories() statement.

If you need to change the order of the data values (e.g. open, high, low, close instead of high, low, open, close) using the Graph. SetStockHLOCOrder() Command. For instance, Example 12.15 shows how you would send the data from Example 12.12 if you changed the order of your data values to open, high, close, low.

Example 12.15 Changing Stock Data Value Order in PCScript

graph.SetStockHLOCOrder( 4, 2, 5, 3) 

graph.SetCategories(6/1; 6/2; 6/3; 6/4) 

graph.SetSeries(Cool Company Stock; 12,13,11,11.3; 11.3,12,8,11; 11,13,9,11.9; 11.9,14,10,13.2)

Note: When importing data from a table, column 1 is assumed to be the category name.

To learn more about sending data via PCScript, refer to "Sending Data with PopChart Script" in Chapter 6 of the PopChart Server User Guide.