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.



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.


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.




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




Choose Field: Type as the Source.




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.




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




We will choose the above colors and press Apply.   


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




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.




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


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.


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


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.


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.




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




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




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.



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




Editing Tables






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.