There are many dynamic changes you can make to the colors and styles of the data items in your graph, including:
Color themes specify colors for up to sixteen data series. These colors will be used for any bars, lines, symbols, pie wedges, and filled areas in the series. You can change a color theme for a graph in PopChart Builder by going to the Graph Properties > Colors dialog pane and selecting a new color theme from the Select a Color Theme pull-down menu.
PopChart 4.0.5 comes with several predefined color themes, including:
You can also create new color themes. For information on how to do this, refer to Chapter 11, "Color Themes," in the PopChart Server Reference manual.
You can change the color theme for a graph in PCScript with the graph. UseColorPalette() method. This method accepts as an argument the name of a color theme. For example, to use the ocean color theme, you would add the following PCScript command:
You can change the color theme for a graph in PopChart XML by setting the Name attribute of the graph's ColorPalette subelement to the name of the color theme that you want to use. For example, the tag below changes the graph's color theme to Subdued.
<Graph Name="graph"><ColorPalette Name="Subdued" /></Graph>
You can change the colors of your data series dynamically.
PCScript uses special commands to override the colors of various items (such as a series, symbol, line, bar, etc.). The override command for color is CLR_. This command should be followed by a six or eight digit hexadecimal color code (e.g. FF0000 for red, FF000088 for translucent red). There should not be a pound sign before the color.
Color override commands are used in the graph. SetSeries() and graph. SetCategories()methods. They should be placed in parenthesis in front of the item they apply to. So, to change the color for an entire data series to green, you would place (CLR_00FF00) in front of the series name in the graph. SetSeries() method, as done in the following example:
graph.setSeries((CLR_00FF00)Atlanta; 23; 36; 11; 7)
There are many other override commands, including ones that allow you to override area fill colors, bubble colors, and outline colors. For a complete list of these override commands, refer to Table 5.8 on page 5-33 of the PopChart Server Reference manual.
In PopChart XML, to change a series color, you will need to override its series definition tag. You can do this by changing the Color attribute of a graph's SeriesDefinition subelement for the series whose color you want to change. For example, the tag below changes the color of the fifth series to green.
<Graph Name="graph"><SeriesDefinition Number='5' Color='#00FF00' /></Graph>
Sometimes, you may want to change the colors of an individual data item dynamically. For example, perhaps you want to emphasize a single data item in your graph by changing its color to red. In the image below, we have changed the color of one of the bars in the PopChart image from Example 4.7.
PCScript uses special commands to override the colors of various items (such as a series, symbol, line, bar, etc.). The override command for color is CLR_. This command should be followed by a six or eight digit hexadecimal color code (e.g. FF0000 for red, FF000088 for translucent red). There should not be a pound sign before the color.
Color override commands are used in the graph. SetSeries() and graph. SetCategories()methods. They should be placed in parenthesis in front of the item they apply to. So, to change the color for an individual data item to red, you would place (CLR_FF0000) in front of the series name in the graph. SetSeries() method, as done in the following example:
graph.setSeries(Atlanta; 23; 36; (CLR_FF0000)11; 7)
There are many other override commands, including ones that allow you to override area fill colors, bubble colors, and outline colors. For a complete list of these override commands, refer to Table 5.8 on page 5-33 of the PopChart Server Reference manual.
You can also change the color of a data item by setting the Color attribute of the Data element in PopChart XML, as shown below. Changing a data item's color in PopChart XML must be done when you send your data to PopChart Server.
<Data Value="34" Popup="This is PopUp Text" />
For certain graphs, including Line, X-Y, Time Plot, Area, Bubble, and Radar, you can change some or all of the following settings: line width, symbol type, area fill, and bubble type.
To change these settings in PCScript, you should use the graph. SetSeriesStyle() method. For information about this method, you should refer to page 5-34 of the PopChart Server Reference manual.
To change these settings in PopChart XML, you should override a graph's SeriesDefinition element for the series that you are changing. The following attributes may be of interest to you: LineWidth, SymbolType, AreaFill, and BubbleType.