Setting colors within the model
Color as indicator
An important aspect of an end-user interface is the use of color. Color helps to visualize certain properties of the data contained in the interface. As an example, you might want to show in red all those numbers that are negative or exceed a certain threshold.
Setting colors in the model
AIMMS provides a flexible way to specify colors for individual data elements. The color of data in every graphical object in the graphical interface can be defined through an (indexed) “color” parameter. Inside your model you can make assignments to such color parameters based on any condition.
In AIMMS, all named colors are contained in the predefined set
AllColors. This set contains all colors predefined by AIMMS, as well
as the set of logical color names defined by you for the project.
Whenever you add a new logical color name to your project through the
color dialog box, the contents of the set
AllColors will be updated
Every (indexed) element parameter with the set
AllColors as its
range can be used as a color parameter. You can simply associate the
appropriate colors with such a parameter through either its definition
or through an assignment statement.
ColorOfTransport(i,j) is a color parameter defining the
color of the variable
Transport(i,j) in an object in the end-user
interface. The following assignment to
ColorOfTransport will cause
all elements of
Transport(i,j) that exceed the threshold
LargeTransportThreshold to appear in red.
ColorOfTransport((i,j) | Transport(i,j) >= LargeTransportThreshold) := 'Red' ;
Creating Non-Persistent User Colors
Non-persistent user colors
During the start up of an AIMMS project, the set
AllColors is filled
initially with the collection of persistent user colors defined through
the Tools-User Colors dialog box.
Through the functions listed below, you can extend the set
programmatically with a collection of non-persistent colors, whose
lifespan is limited to a single session of a project.
The argument colorname must be a string or an element in the set
AllColors. The arguments red, green and blue must be scalars
between 0 and 255.
Adding non-persistent colors
You can use the function
UserColorAdd to add a non-persistent color
colorname to the set
AllColors. The RGB-value associated with the
newly added user color must be specified through the arguments red,
green and blue. The function will fail if the color already exists,
either as a persistent or non-persistent color.
Deleting and modifying colors
Through the functions
can delete or modify the RGB-value of an existing non-persistent color.
The function will fail if the color does not exist, or if the specified
color is a persistent color. Persistent colors can only be modified or
deleted through the Tools- User Colors dialog box.
You can obtain the RGB-values associated with both persistent and
non-persistent user colors using the function
function will fail if the specified color does not exist.