CreateChartTheme()
Summary
Creates a pie or bar chart theme on the current layer.
Changes
Psychological Scaling option added to Version 2019.
Syntax
theme_name = CreateChartTheme(string identifier, array field_specs, string type, array options)
| Argument | Contents |
|---|---|
| identifier | The desired name for the theme |
| field_specs | An array of strings that contains the field specs for the fields in the theme |
| type | The type of chart: Bar, Pie, or Stack (for stacked bars) |
| Option | Type | Contents |
|---|---|---|
| Title | String | Title of the theme, as it appears in the legend (defaults to theme_name) |
| Data Source | String | Indicates which data are scanned to determine the minimum and maximum values. If "All" (the default), all features are scanned; if "Screen" only features appearing on the screen in the current map are scanned. |
| Minimum Value | Real | Features with values below the minimum are displayed at minimum size (defaults to the minimum value found in the data) |
| Maximum Value | Real | Features with values above the maximum are displayed at maximum size (defaults to the maximum value found in the data) |
| Minimum Size | Real | Minimum pie diameter or total bar length (in points) corresponding to the minimum value (defaults to 0) |
| Maximum Size | Real | Maximum pie diameter or total bar length (in points) corresponding to the maximum value (defaults to 54) |
| Psychological Scaling | Boolean | Whether to use perceptual scaling (Flannery method) to compensate for the human tendency to underestimate circle sizes (defaults to "False") |
| Width | Real | The bar or stack chart width in points (defaults to 14) |
| 3D | Boolean | Whether bar or stack charts are drawn with 3-D effects (defaults to "False") |
| Direction | String | Whether bar or stack charts are "Vertical" (the default) or "Horizontal" |
Returns
A string indicating the actual name of the theme.
Notes
-
CreateChartTheme() creates a theme on the current layer.
-
After creating the theme, you need to set theme styles; for more information, see Theme Styles.
-
To display the theme, call ShowTheme(); for more information, see Themes.
-
All fields in field_specs must be from the same view and mappable to the current layer.
-
If either the minimum or maximum value is unspecified, CreateChartTheme() scans the data for the layer to find an appropriate minimum and maximum.
Example
CreateChartTheme("HH by Income", // the name of the theme
{"Zip.[Low Income HH]", "Zip.[Avg. Income HH]", "Zip.[High Income HH]"}, // Three fields are used
"Stack", // Stacked bars...
{{"3-D", "True"}, {"Direction", "Vertical"}}) // Vertical, w/ 3-D effects
Error Codes
| Error | Meaning |
|---|---|
| NotFound | There is no current layer, or the specified field(s) do(es) not exist on the current layer, or the specified field(s) do(es) not contain any valid data |
| Escape | The user interrupted scanning of the data |
| Error | An argument or option has the wrong type or the wrong number of values, or an error occurred while scanning the data |
See Also
| Function | Summary |
|---|---|
| CreateTheme() | Creates a color or pattern theme on the current layer |
| CreateContinuousTheme() | Creates a continuous (scaled-symbol) theme on the current layer |
| CreateDotTheme() | Creates a dot-density theme on the current layer |
| DestroyTheme() | Removes the definition of a theme from the current layer |
| GetTheme() | Gets information about a theme |
| GetThemes() | Gets a list of themes defined on the current layer |
| ShowTheme() | Displays a theme on the current layer |