EnableCategory

Syntax graph.EnableCategory(true|false, CategoryNumber, [,CategoryNumber]*)

Description This enables or disables a category of data. By default, all categories of data are enabled, so you will probably only use this command to filter data categories.

This command can be used to filter any number of categories. Each category should be separated by a comma. It can also filter ranges of categories, as illustrated in Example 5.17 below. A range of categories is denoted by a hyphen between the low and high value in the range.

Perhaps the main difference between this command and the graph. EnableColumn() command is that it is a post-processing command. It occurs after data from a spreadsheet is converted to series and categories. This means that graph. Transposed() applies to this command, while it doesn't apply to graph. EnableColumn().

The usefulness of this method is illustrated with the following example—suppose you are importing data for a bar graph. When a user clicks on a certain category of bars, you want to drill-down to a line graph of just that category. By filtering out all of the other categories, you would be able to use the exact same data as you used from your bar graph, saving you from having to make another data query. For example, if a user drill-downed on the second column of data, you would add this PCScript command to filter out all of the other series:

Example 5.17 Hiding Data Categories

Graph.EnableCategories(false, 1, 3-6)