# Configuring the variables and their parameters

A programmer can configure the curves that are displayed in the graphical part with one or more config files.

Such a file has to be located under the `config/` folder.

## Chaining configuration files

The current process for getting the different information is the following :
1. Available variables and parameters are got from InfluxDB, more specifically in the `setup_info` field of the measurements `nicos/se_main`, `nicos/se_stick`, `nicos/se_addons`. Here :
    - The category `*` is given to parameters `value` and `target`, the category `-` is given to any other parameters.
    - The unit is `1` is it is not present or if it is an empty string, or the unit if correct.
    - The color is not given yet.
2. The configuration file `generic.ini` is first used to modify the different values for each couple variable/parameter.
3. The configuration file `<instrument>.ini` is then used.
4. When the available variables are got via the GUI, the user configuration is finally used.

If a color was not given yet, an automatic color is used.

## Functionnalities summary

A programmer can :

For a variable :
- show a parameter which is not "value" or "target"
- hide "value" or "target" parameter

For a parameter :
- specify the category of the corresponding curve
- specify the color of the corresponding curve
- specify the unit of the corresponding curve


## File structure

```ini
[chart]
<variable.parameter>=<options>
```

## Indicating a parameter

To indicate a parameter, the programmer has first to indicate the SECOP name of the variable (case sensitive).
If the options are concerning the `value` field, then nothing more has to be specified.
- Example : `T_plato`

In the other case, the programmer has to use a dot, followed by the name of the parameter (as it is in NICOS).
- Example : `T_plato.raw`

Finally, the equal sign must be used to then indicate the options and their values.
- Example : `T_plato.target=<options>`

## Giving the options

### Using positionnal arguments

One can give the different options for a parameter by using a comma separated value (without spaces around commas) list.   
The order is `cat`, `color`, `unit`.

- Example : `T_plato.raw=raw,#0000FF` This indicates that the `raw` parameter will be displayed in the raw category of its unit (inherited from previous configuration files), and will have a blue color.

### Using keywords arguments

One can indicate to which option a value is given, independently of its position in the comma separated list, by using keywords. This can be useful if we want to indicate only the unit without indicating/overwritting the category and/or the color.

To use keywords : `<keyword>:<value>`

Possible keywords are :
- `cat` : specifies the category
- `color` : specifies the color (6 digits hexadecimal color)
- `unit` : specifies the unit

Example : `T_plato=color:#0000FF,cat:other` This indicates that the `value` parameter of T_plato will be displayed in blue, in the "other" category of its unit (inherited from previous configuration files).

### Using both

Once a keyword argument is used for a parameter, it is then not possible to use positionnal arguments for this parameter.
- Example : `T_plato=unit:K,#FF0000` is invalid, because no keyword is given after the use of `unit` for the other options.   

Valid syntaxes for this example are `T_plato=unit:K,color:#FF0000` or `T_plato=color:#FF0000,unit:K`, or `T_plato=,#FF0000,K`.

## Special values and omissions

If `cat` is `*`, then the associated parameter is displayed, in the block of its unit.
If `cat` is `-`, then the associated parameter is not displayed. This can be used to explicitely hide `value` and/or `target` parameters of a variable.

Omitting a value means that it will be inherited from the previous configuration files.

## Diverse examples

- `T_plato=-` : the `value` parameter of T_plato is never displayed
- `T_plato.raw=*` : the `raw` parameter of T_plato will be displayed in the default block corresponding to its unit