Example: Multiple Primary and Fill Colors in a Drawing

At first glance that the same Color and Color, fill values in the Style dialog apply to all areas, lines and points in a drawing may seem a limitation.   It is easy to use different Color and Color, fill settings for different objects with different colors for areas, for lines and for points.   This example shows the simple procedure to use.

eg_multiple_primary_fill_colors01_01.png

 

The default use of Color  and Color, fill settings applies those colors to all objects in the drawing, including to all areas, to all lines and to all points.    That is convenient when a drawing participates as a layer in a map and we would like to apply the same settings to all objects, so that the layer has a common look as regards color.

 

If we like we can use thematic formatting to apply different values of Color and Color, fill to areas, lines and points within the same drawing.  

 

To do that we create a field in the drawing's table that specifies the type of the object and then we use that field to control the formatting of Color and Color, fill.

eg_multiple_primary_fill_colors01_02.png

In the table above we have created an nvarchar field called Type that contains the text values 'area', 'line' or 'point' for area, line or point objects respectively.   See the Notes below for how to create and populate the field.

 

With the focus on the drawing window, we choose Edit - Style to launch the Style dialog.

 

eg_multiple_primary_fill_colors01_06.png

 

Click on Color to highlight it and then pull down the Source menu.

 

eg_multiple_primary_fill_colors01_07.png

 

Choose Field: Type as the Source.

 

eg_multiple_primary_fill_colors01_08.png

 

Choosing a field as the Source automatically opens up controls for thematic formatting, a process also usded in the Example: Format the Size of City Points by Population  topic.   In this case the Type field is an nvachar field so the only Method that can be used for breaks is unique values.   We press the Tally button.

 

eg_multiple_primary_fill_colors01_09.png

 

That opens up a list of the unique values, which are the 'area', 'line', and 'point' strings.   We can now choose colors for each.

 

eg_multiple_primary_fill_colors01_10.png

 

We will choose the above colors and press Apply.   

eg_multiple_primary_fill_colors01_11.png

The result is unappealing because we have not yet changed the Color, fill value from the current light purple.   We will now change that.

 

eg_multiple_primary_fill_colors01_12.png

 

Back in the Style dialog we click on Color, fill to highlight that property.   Once again we pull down the Source menu to choose Field: Type.

 

eg_multiple_primary_fill_colors01_13.png

 

We press the Tally button and then choose colors as seen above for the area, line and point colors.   Press Apply.

eg_multiple_primary_fill_colors01_14.png

The overall result is now much better.    We have one drawing which uses different settings of Color and Color, fill depending on whether objects are areas, lines or points.

Notes

Creating the Type Field - This example depends upon the use of a Type field to control the formatting of Color and Color, fill.

eg_multiple_primary_fill_colors01_02.png

Creating and populating that extra field is easy.  We can do it either with an UPDATE query or by using the Select dialog and the Transform dialog.     Following is the procedure using dialogs.   

 

We create a new field called Type that is data type nvarchar using the procedure illustrated in the Example: Add a Field to a Table and Fill It  topic.  The new field is initially full of NULL values.

 

In the examples below we have already populated the area records with 'area' and the line records with 'line' strings.   We will show the procedure for points, which is exactly the analogous procedure that was used for areas and lines.

eg_multiple_primary_fill_colors01_02a.png

We start with the table that has NULL values for the Type field for all point records.   We press Edit - Select to launch the Select dialog.

 

eg_multiple_primary_fill_colors01_03.png

 

Choose Points and the Geom field to select all points.   Press Replace Selection.

 

eg_multiple_primary_fill_colors01_04.png

 

All records with point objects in the Geom field are selected.   Next we choose Edit - Transform to launch the Transform dialog.

 

eg_multiple_primary_fill_colors01_05.png

 

Important: check the Restrict to selection box.   

 

For the Target field we choose Type.  We choose the Copy template and enter the string 'point' into the Value box.   Press Update Field.

eg_multiple_primary_fill_colors01_05a.png

 

The Type field for all point records is populated with the text string 'point'.    Choose Edit - Select None to deselect the records.  

See also

Getting Started

 

User Interface Basics

 

Maps

 

Editing Tables

 

Drawings

 

Style

 

Example: Format a Drawing using the Style Dialog - In this example we provide a first, step by step look at how to format areas in a drawing using the Style dialog.  We can specify the same formatting for all areas or use a field to automatically set formatting, a process usually known as thematic formatting.

 

Example: Format the Size of City Points by Population - A common GIS task is to format the size of points in a drawing based on some value.  For example, the size of points that represent cities might be formatted based on the value of the city's population, with cities that have larger populations being marked by larger point icons.  This is an example of thematic formatting and is easy to do using the Style dialog.

 

Example: Add, Delete and Edit Thematic Formatting Intervals - This topic provides a step by step example of adding, deleting and editing intervals in the Style dialog that are used for thematic formatting.

 

Example: Style Properties in the mfd_meta Table - Style properties for drawings such as colors for areas are stored in human readable JSON values as properties in the mfd_meta system table.   This example shows how we can copy formatting from one drawing to another by simply copying values between records in the mfd_meta table.

 

Example: Formatting Tricks - The visualization capabilities of Manifold using Style can be exploited to provide many visual effects.  This topic provides some examples of how to use Style in unexpected ways to create a range of more elaborate effects.

 

Example: How Not to Format a Drawing -  When using Style to format a drawing it is a really bad idea to use the same color for objects that is used for the background color.    It can also be a bad idea to use transparent color.   This topic illustrates why.