# Colors

> Source: https://manual.pvxplus.com/charting-alternatives-in-pxplus/colors/overview

The colors used to display individual datasets within a chart can be controlled in several ways. They can be:

- Specified in the chart definition **[Presets](https://manual.pvxplus.com/nomads-graphical-application/creating-panel-controls/chart-control/chart#presetsdef)**.
- Programmed using the **['CurrentSet](https://manual.pvxplus.com/properties/currentset)** and **[TextColour$](https://manual.pvxplus.com/properties/textcolor)** properties.
- Defined for various **[Theme](https://manual.pvxplus.com/nomads-graphical-application/system-maintenance-tools/system-options/themes)** and **[Visual Class](https://manual.pvxplus.com/nomads-graphical-application/system-maintenance-tools/system-options/visual-classes)** settings.
- Defined in a ***template*** file.
- Specified in the **[%NOMAD_Chart_Colors$](https://manual.pvxplus.com/nomads-graphical-application/appendix/nomads-variables/overview#chart_colors)** global variable. ***(NOMADS Only)***

These methods are described below.

| **Method** | **Description** |
| --- | --- |
| ***Presets*** | Colors of individual datasets can be defined in the chart definition **[Presets](https://manual.pvxplus.com/nomads-graphical-application/creating-panel-controls/chart-control/chart#presetsdef)** by setting the *Data Set* number and setting the *Property* to *TextColour*.<br>Note:  <br>This is the only Preset property supported by the Google chart interface. |
| ***Program*** | Programmatically set the dataset colors by setting the ['CurrentSet](https://manual.pvxplus.com/properties/currentset) property to the *Data Set* number and setting the ['TextColour$](https://manual.pvxplus.com/properties/textcolor) property to the desired color. |
| ***Themes and Visual Classes*** | Use the<br>*Chart Colors* property in the **[Themes Maintenance](https://manual.pvxplus.com/nomads-graphical-application/system-maintenance-tools/system-options/themes)** and **[Visual Classes Maintenance](https://manual.pvxplus.com/nomads-graphical-application/system-maintenance-tools/system-options/visual-classes)** utilities to select the colors to apply when plotting the different datasets of a chart. Click the dotted Query button or double click inside the cell to display the **Chart Colors** window, which provides a grid for assigning the colors:<br>\|  \|  \|  \|<br>\| --- \| --- \| --- \|<br>\|  \| ![](https://manual.pvxplus.com/migration-assets/6ebb0035d696373c0d2ad6488dea16a44cbd90fb4850eaa0c244144436c5fde9.jpg) \| ![](https://manual.pvxplus.com/migration-assets/2c002a8335be70bc76cf627a16a0e43a2c7ab8c58d808f2040e2933f26530500.png)  <br>***Run-Time Chart Example*** \|<br>This window consists of the following:<br>\|  \|  \|<br>\| --- \| --- \|<br>\| *(Drag and Drop)* \| *Four-headed arrow* button used to drag and drop an individual row to a different location within the **Chart Colors** grid to change the order of the rows entered. \|<br>\| *Set #* \| Dataset sequence (i.e. first dataset, second dataset, etc.). \|<br>\| *Color* \| Click the Query button (*magnifying glass*) to bring up the **Colour Selections** window for assigning a color to a dataset. After a color is selected, the color name/expression is displayed.<br>Note:  <br>After a color is selected, a new row is added to the bottom of the grid for adding another color, if desired. \|<br>\| *(Actual Color)* \| Displays the actual color after a *Color*is selected. \|<br>\| *Insert Above  <br>Insert Below* \| Adds a blank row above or below the currently selected row to allow a new color to be entered out of sequence.<br>Note:  <br>A new row cannot be inserted above or below a blank row. \|<br>\| *Delete Row(s)* \| Removes the currently selected row(s). To select ***multiple*** rows, use Shift-Click (consecutive selections) or Ctrl-Click (random selections). Prior to deleting, a message will display. \|<br>\| *Clear* \| Removes ***all*** the rows in the **Chart Colors** grid without needing to select them first. Prior to deleting, a message will display. \|<br>\| *OK* \| Saves the chart color selections and closes the **Chart Colors** window.<br>Note:  <br>Once chart color selections have been made, the Theme record must be saved/updated. If any unsaved changes are detected, a message will display. \|<br>\| *Cancel* \| Closes the **Chart Colors** window without saving changes. \|<br>*(The Chart Colors property in Themes Maintenance and Visual Classes Maintenance was added in PxPlus 2020.)* |
| ***Template File*** | The template file is a text file consisting of a list of colors (one per line). The file name ***must*** be **chart_clrs.txt** and be located in a sub-directory of **\*plus/inomads/templates**. For example, the default colors used for the Google charts are defined in **\*plus/inomads/templates/default/chart_clrs.txt**.  <br>  <br>To create an alternative color selection, create a **chart_clrs.txt** file and place it in a sub-directory of the ***templates*** directory.  <br>  <br>***Example:***  <br>  <br> **\*plus/inomads/templates**/*mytemplate*/**chart_clrs.txt**  <br>  <br>Then, set the global variable **%iNomads_Template$** with the name of the sub-directory (in this case **%iNomads_Template$="mytemplate"**).<br>Note:  <br>This method is valid for *both* iNomads *and* NOMADS environments. |
| ***NOMADS Global Variable*** | ***(NOMADS Only)***<br>Create a string consisting of color names (the last character in the string will be used as the separator) and assign it to the global variable **[%NOMAD_Chart_Colors$](https://manual.pvxplus.com/nomads-graphical-application/appendix/nomads-variables/overview#chart_colors)**.  <br>  <br>***Example:***  <br>  <br>**%Nomad_Chart_Colors$**="light red/light blue/dark green/yellow/RGB:192 255 192/" |

Colors can be specified using standard PxPlus colors (e.g. Light Red, Dark Blue, etc.), User-Defined colors (e.g. COLOR16), and RGB settings (e.g. RGB:192 255 192). Expressions may also be used in Theme and Visual Class settings for charts. If there are more datasets than colors specified, the colors will repeat.

Color ***precedence*** is:

1\. Programmed colors

2\. Preset colors

3\. Visual Class settings

4\. Theme settings

5\. Colors specified in the **[%NOMAD_Chart_Colors$](https://manual.pvxplus.com/nomads-graphical-application/appendix/nomads-variables/overview#chart_colors)** variable

6\. Template colors
