In the last chapter, we introduced PopChart Script (PCScript). Most of the effects that we discuss in this chapter are generated with PCScript. In case you skipped the last chapter, you might want to read "Introduction to PCScript" in Chapter 6. We will also briefly review PCScript here.
In PCScript, each item in a PopChart is considered to be a separate object. There are four types of objects: graphs, text boxes, legends, and bitmaps. In this section, we will only discuss sending data to the graph object.
Every PCScript command that you send to PopChart Server will be in the following format:
object.method(paramater1,parameter2,...)
Objects are created and named in the PopChart appearance file (see "About Appearance Files" in Chapter 1 of the PopChart Builder User Guide). PCScript commands use the object names specified in the appearance file. For more info on object names, refer to "What is my Object Named?" in Chapter 6.
Note: Strings in PCScript do not have quotation marks around them. Because of this, if you have a comma or semi-colon in your category or series names, PopChart Server will not be able to interpret your string correctly. You can get around this problem by changing the parameter or item delimiters using the Main. ParamDelimiter or Main. ItemDelimiter command.
PCScript commands are sent to PopChart Server via a PCScript command string. A PCScript command string is a string that contains all of the PCScript commands in the order that they are to be executed.
The commands can run together, so that nothing is separating them from each other, or they can be separated by white space. They should not be separated by a semi-colon or any other character.
Example 7.1 demonstrates a valid PCScript command strings.
Example 7.1 PCScript Command String 1
graph.setCategories(Apples)textbox.setText(Apple Graph)graph.setSeries(Andy,10;Julie,14;Bryan,11)graph.addPopupText(1,1-3,Apples are Good)graph.DDEnable(1,1-3,http://www.applepies.com)
You can send your PCScript command string via the pcScript attribute.
This attribute should be set to your PCScript command string. The code below illustrates the use of the pcScript attribute in Java.
Example 7.2 Setting the PCScript Command String in PopChart Embedder
String pcscript="textbox.setText(Hello World)graph.setCategories(Apple)graph.setSeries(Andy;10)setSeries(Joe;15)setSeries(Jenny;20)";
PCScript is perfectly compatible with PopChart XML. Your object names in PCScript will be the same as your element names in PopChart XML. PCScript is processed after all PopChart XML has been read.