Difference between revisions of "Graph Style Templates"

(Complete rewrite)
Line 1: Line 1:
 
[[What's new in Analytica 4.0?]] >
 
[[What's new in Analytica 4.0?]] >
  
You can store graph style settings in a <em>Graph Style Template</em>, and then use the template in specific graphs without having to individually select and define color, font and style combinations. Because the template is an Analytica object, you can maintain several graph style templates within a single model, and even create libraries of graph style templates.
+
A <em>Graph Style Template</em> is a collection of graph settings that you can apply to any graph. It lets you apply a combination of settings together -- say style, colors, fonts, and background -- defining a particular style you like. Analytica offers some existing graph templates, and more will be available in libraries. You can also create your own graph templates, saving a combination of settings you find useful -- perhaps, to define a common style for a model, or even for your entire organization.
  
= Selecting a Pre-Existing Graph Style Template=
+
=== To use a Graph Style Template ===
  
To select a pre-existing style template for a graph, bring up the Graph Setup dialog and select the template name in the "Style Template" pulldown at the top of the window.
+
To apply an existing graph template to a graph:
 +
# Open the '''Graph Setup''' dialog by double-clicking on the graph.
 +
# From the '''Style template''' menu at the bottom of the dialog, select the template you want. (If you don't see it, you may first need to read in a library containing the template you want.)
 +
# To visualize available templates, click the '''Preview''' tab. As you select each template from the '''Style template''' menu, it will immediately show what it looks like for the selected graph. All settings from the template, will be immediately reflected on the other tab.
 +
# If you want to modify any other settings for this graph, you can do so now.
 +
# When you are happy with the template and any other modifed settings (check them in the '''Preview''' tab), click "Apply".
  
When you select a template in the pulldown, the settings for that template are immediately reflected in the graph setup controls.  The "Set Default" button changes to read "Set Template". 
+
=== To define a new Graph Style Template ===
  
You can then modify individual style settings if the template style is not perfect.
+
To create a new Graph Template so you can reuse a collection of graph settings for other variables:
 +
# Open the '''Graph Setup''' dialog by double-clicking on the graph with the settings you want to reuse, or on a new variable if you want to use only new settings.
 +
# If you want to modify or add any other graph settings, do that now. If you want to make a new template, as modifications to an existing template, you could select the existing template and click '''Apply template'''.
 +
# Click the Preview tab to see what the template settings will look like.
 +
# From the "Style Template" pulldown menu, select "New Template". 
 +
# Enter a name for the template
 +
# Click the "Set Template" button.
  
== Apply Button ==
+
This click creates the new template, and will saved it with the model. You may now apply it to any graph in the model.
  
Pressing Apply saves any modifications you have made since the template was selected in the current variable's graph setup.  Settings that were not modified are only in the template, so if the template settings change, so will your graph's appearance.
+
=== Graph templates and setting associations ===
  
= Defining a New Graph Style Template =
+
'''Chart type settings:''' Graph settings from the '''Chart type''' tab are associated with a particular view. For example, if you set '''Linestyle''' to symbols only for a Sample plot, it will use that line style for any Sample plot, but not for other uncertainty views, such as Mid, Statistics, PDF, or CDF.  A template may contain different Style settings for each view.
  
From the Graph Setup dialog, select the "New Template" option from the "Style Template" pulldown. Enter a name. When you press the "Set Template" button, a new template object is created. This object is initially a child of your top-level model or module, but has no visual depiction on the diagram view.  It can be seen in the outliner view.
+
'''Axes:''' If the horizontal axis is an index (the usual case), any settings on the '''Axes Ranges''' tab, apply to that index only. For example, suppose variable Earthquake_damage is indexed on the horizontal axis by Richter_scale. You set Richter_scale to Log scale, and save into a template T. If you use template T for another variable Y, also indexed by Richter_scale, it will also display Richter_scale on a log scale. If Y is not indexed by Richter_scale, this setting will have no effect on it.
  
Any settings you have defined for this graph, or since the template was created, are then saved into the new style template.
+
'''Uncertainty options and graph templates:''' A Graph template will also save non-default settings made in the '''Uncertainty setup''' dialog tabs -- '''Statistics''', '''Confidence bands''', '''Probability density''', or C'''umulative probability'''.  Such settings will apply to the corresponding uncertainty view of any variable using the template.  Changes to the Uncertainty sample tab -- e.g. to Sample size -- are global, affecting the entire model: They are not associated with particular variable, or saved in a graph template.
  
The newly created template begins with any settings that have already been specified.  So, for example, if you had selected a pre-existing template, modified some settings, and then created a "New Template", the new template will have the settings of the original template plus the modifications.  If you continue to modify it before you press "Set Template", those settings will also be part of the new template. 
+
For more see [[Graph_Setting_Associations]]
  
The new template doesn't actually exist until you press the "Set Template" button.  So, if you press Apply or Cancel to leave the dialog, the template will not be created.  To correct this mistake, re-open graph settings on the same graph (which now has the settings you wish to comprise the template), select "New Template" again and enter a name, and press the "Set Template" button.
+
=== Changing the Global Default ===
  
= Renaming a Style Template =
+
"Global Default" specifies the default settings used by every graph unless overridden in the '''Graph setup''' dialog for that graph or by a template that it uses. If the '''Style Template''' menu says '''Global default''', it means that the graph uses the global defaults with no template. 
  
With a style template selected in the graph setup, click in the combo box area to enter edit mode. Type the new name. The text here is actually the title attribute for the style, the underlying identifier is not renamed.
+
To modify the global defaults:
 +
# Select a new variable with no graph settings, or a graph whose settings you want to make the global default.
 +
# Double click on the graph to open '''Graph setup''' dialog.
 +
# If you want, make further changes to the settings, and review them in the '''Preview''' tab.
 +
# From the "Style template menu, select "Global Default", if it isn't already selected.
 +
# Click "Set default" button.
  
= Modifying a Style =
+
'''Note:'''Changes to global defaults will change all existing and new graphs that use those global defaults -- that is, all that are not overridden by any nondefault Graph settings specifically set for that graph or the template that it uses.
  
Bring up a graph, select the style, and adjust the graph's appearance to your liking.  Press "Set Template".  All style settings that had ever been changed, either by the template, or while adjusting the graph, will become part of the template.  (Those that have never been touched will remain inherited from the global default).
 
  
If you want to control exactly which styles are set in the template, create a new variable (which therefore has no pre-existing style settings), graph something (e.g., Time^2) and then bring up the graph setup dialog, select the style, make only those changes you want in the Template and press "Set Template".  You can delete the variable afterwards, the template will remain.
+
=== To modify a Graph Style Template ===
  
If you re-select "New Template" before pressing "Set Template", you will create a new template that consists of the settings found in the old template, modified by settings made for the current variable or modified since the dialog has been open.
+
To modify an existing Graph Style Template T:
 +
# Open the "Graph setup dialog by double clicking on a graph for variable V.
 +
# If variable V does not already use template T, select T from the Style template menu.
 +
# Modify any '''Graph settings''' you want for T.
 +
# Check the effect in the '''Preview''' tab.
 +
# When satisfied, click '''Set template'''.
  
= Moving a Style Template =
+
'''Note:''' Any changes you make to a template will affect all variables that use it -- except for variables that override the template settings.
  
If you want to move the style template object, for example, if you'd like to locate it in a particular linked module, this must be done using the Typescript [[Move|Move command]].
+
=== To rename a Graph style template ===
  
= Deleting a Style Template =
+
# Open the Graph setup dialog, by double-click on a graph.
 +
# In the '''Style template''' menu, select the Graph template you want to rename.
 +
# Click the '''Style template'''menu to select the old name.
 +
# Type in the new name.
 +
# Click '''Set template'''.
  
Deleting a style template can only be done in the outliner window or typescript. If any graphs use the template, the link to the template will be removed and those graphs will lose the settings from the template.
+
Note: The template "name" is actually the Title of the object. Changing the name does not change the Template's identifier. Renaming a template does not affect any variables that use it.
  
= Global Default =
+
=== Saving Graph Style Templates into a Library module ===
  
The "Global Default" option displays initially in the "Style Template" pulldown.  This indicates that no style template is used, so any settings not explicitly set are inherited from the global defaults (system variables, associated index, etc).  The "Set Default" button can be used to change the global defaults used by all non-template graphs.
+
A Graph style template is a class of object in Analytica, usually saved inside your model at the top level. Analytica does ''not'' show Graph templates in a Diagram, but it does list them in the Outline view.  
  
= To Stop using a template =
+
If you want to collect templates into a module or library for reuse by other models, you may want to move them from the main model into a library module Template_library:
 +
# Open the Outline window by clicking on its icon.
 +
# Find the template in the Outline window, a double click to open its Object Window.
 +
# Copy the identifier of the template by double-clicking the identifier in the Object window, and pressing control-C.
 +
# Open the typescript window by control-'
 +
# Type "Move <Template-ID>  Template_library\\\
 +
where you <Template-ID> is the identifier you paste with control-V. [[Move|Move command]]
  
If you have a graph that uses a template, and you wish to unlink it from the template, change the "Style Template" pulldown back to "Global Default". A question is asked: "Do you want to transfer the settings from Template XXX to this variable's graph setup?".  Answering no will dump all settings that come from the template.  Answering Yes will leave these settings in place.
+
Repeat for any other templates you want to include. When complete, you can save the Template_library as a separate library file in the usual way:
 +
# Double-click the Template_library to open its Object Window (in Edit mode)
 +
# Press the Class menu at top-left of the Object window to open it, and change selection to Filed library.
 +
# Answer the prompts for the new file name and folder location, and click '''Save'''.
 +
 
 +
=== To delete a Style Template ===
  
= Associations =
+
As described for Moving a template, open an Object window for the template, copy its identifier, and open the typescript view. Then
 +
# Type "Delete <template-id>" into the typescript, where <template-id> is the identifier of the template that you paste or type.
  
Graph settings having an index [[Graph_Setting_Associations|association]] will apply only to the specific index, even when stored in a template.  For example, suppose you set up a graph having Richter_Magnitude on the X-axis, and you set this X-axis to be log-scaled.  Next, suppose you store this setting in a template.  When you use this template for another graph, you will not necessarily get a log-scaled X-axis -- the log-scaling will apply IF the X-axis is Richter_Magnitude.  Since this setting was stored in a template, rather than in the Global Default, graphs not using this template will not log-scale Richter_magnitude.
+
When you delete a template, it will remove links from any graphs to that template. Any settings on those graphs made by the template will revert to the Global defaults.  
  
Index-range settings (auto-scale, manual settings, log-scaling, reverse order, categorical, include zero) apply only to the specific index, even if stored in a template.
+
=== To Stop using a template ===
  
Line style settings also have the same associations as usual, even if stored in a template.  Therefore, if you set the line style for a discrete prob mass plot, this line style will apply to discrete line style plots. A single template may contain different line styles for each of the graph view clusters.
+
If you have a graph that uses a template, and you wish to unlink it from the template, change the "Style Template" pulldown back to "Global Default". A question is asked: "Do you want to transfer the settings from Template XXX to this variable's graph setup?".  Answering no will dump all settings that come from the template.  Answering Yes will leave these settings in place.

Revision as of 23:03, 25 February 2007

What's new in Analytica 4.0? >

A Graph Style Template is a collection of graph settings that you can apply to any graph. It lets you apply a combination of settings together -- say style, colors, fonts, and background -- defining a particular style you like. Analytica offers some existing graph templates, and more will be available in libraries. You can also create your own graph templates, saving a combination of settings you find useful -- perhaps, to define a common style for a model, or even for your entire organization.

To use a Graph Style Template

To apply an existing graph template to a graph:

  1. Open the Graph Setup dialog by double-clicking on the graph.
  2. From the Style template menu at the bottom of the dialog, select the template you want. (If you don't see it, you may first need to read in a library containing the template you want.)
  3. To visualize available templates, click the Preview tab. As you select each template from the Style template menu, it will immediately show what it looks like for the selected graph. All settings from the template, will be immediately reflected on the other tab.
  4. If you want to modify any other settings for this graph, you can do so now.
  5. When you are happy with the template and any other modifed settings (check them in the Preview tab), click "Apply".

To define a new Graph Style Template

To create a new Graph Template so you can reuse a collection of graph settings for other variables:

  1. Open the Graph Setup dialog by double-clicking on the graph with the settings you want to reuse, or on a new variable if you want to use only new settings.
  2. If you want to modify or add any other graph settings, do that now. If you want to make a new template, as modifications to an existing template, you could select the existing template and click Apply template.
  3. Click the Preview tab to see what the template settings will look like.
  4. From the "Style Template" pulldown menu, select "New Template".
  5. Enter a name for the template.
  6. Click the "Set Template" button.

This click creates the new template, and will saved it with the model. You may now apply it to any graph in the model.

Graph templates and setting associations

Chart type settings: Graph settings from the Chart type tab are associated with a particular view. For example, if you set Linestyle to symbols only for a Sample plot, it will use that line style for any Sample plot, but not for other uncertainty views, such as Mid, Statistics, PDF, or CDF. A template may contain different Style settings for each view.

Axes: If the horizontal axis is an index (the usual case), any settings on the Axes Ranges tab, apply to that index only. For example, suppose variable Earthquake_damage is indexed on the horizontal axis by Richter_scale. You set Richter_scale to Log scale, and save into a template T. If you use template T for another variable Y, also indexed by Richter_scale, it will also display Richter_scale on a log scale. If Y is not indexed by Richter_scale, this setting will have no effect on it.

Uncertainty options and graph templates: A Graph template will also save non-default settings made in the Uncertainty setup dialog tabs -- Statistics, Confidence bands, Probability density, or Cumulative probability. Such settings will apply to the corresponding uncertainty view of any variable using the template. Changes to the Uncertainty sample tab -- e.g. to Sample size -- are global, affecting the entire model: They are not associated with particular variable, or saved in a graph template.

For more see Graph_Setting_Associations

Changing the Global Default

"Global Default" specifies the default settings used by every graph unless overridden in the Graph setup dialog for that graph or by a template that it uses. If the Style Template menu says Global default, it means that the graph uses the global defaults with no template.

To modify the global defaults:

  1. Select a new variable with no graph settings, or a graph whose settings you want to make the global default.
  2. Double click on the graph to open Graph setup dialog.
  3. If you want, make further changes to the settings, and review them in the Preview tab.
  4. From the "Style template menu, select "Global Default", if it isn't already selected.
  5. Click "Set default" button.

Note:Changes to global defaults will change all existing and new graphs that use those global defaults -- that is, all that are not overridden by any nondefault Graph settings specifically set for that graph or the template that it uses.


To modify a Graph Style Template

To modify an existing Graph Style Template T:

  1. Open the "Graph setup dialog by double clicking on a graph for variable V.
  2. If variable V does not already use template T, select T from the Style template menu.
  3. Modify any Graph settings you want for T.
  4. Check the effect in the Preview tab.
  5. When satisfied, click Set template.

Note: Any changes you make to a template will affect all variables that use it -- except for variables that override the template settings.

To rename a Graph style template

  1. Open the Graph setup dialog, by double-click on a graph.
  2. In the Style template menu, select the Graph template you want to rename.
  3. Click the Style templatemenu to select the old name.
  4. Type in the new name.
  5. Click Set template.

Note: The template "name" is actually the Title of the object. Changing the name does not change the Template's identifier. Renaming a template does not affect any variables that use it.

Saving Graph Style Templates into a Library module

A Graph style template is a class of object in Analytica, usually saved inside your model at the top level. Analytica does not show Graph templates in a Diagram, but it does list them in the Outline view.

If you want to collect templates into a module or library for reuse by other models, you may want to move them from the main model into a library module Template_library:

  1. Open the Outline window by clicking on its icon.
  2. Find the template in the Outline window, a double click to open its Object Window.
  3. Copy the identifier of the template by double-clicking the identifier in the Object window, and pressing control-C.
  4. Open the typescript window by control-'
  5. Type "Move <Template-ID> Template_library\\\

where you <Template-ID> is the identifier you paste with control-V. Move command

Repeat for any other templates you want to include. When complete, you can save the Template_library as a separate library file in the usual way:

  1. Double-click the Template_library to open its Object Window (in Edit mode)
  2. Press the Class menu at top-left of the Object window to open it, and change selection to Filed library.
  3. Answer the prompts for the new file name and folder location, and click Save.

To delete a Style Template

As described for Moving a template, open an Object window for the template, copy its identifier, and open the typescript view. Then

  1. Type "Delete <template-id>" into the typescript, where <template-id> is the identifier of the template that you paste or type.

When you delete a template, it will remove links from any graphs to that template. Any settings on those graphs made by the template will revert to the Global defaults.

To Stop using a template

If you have a graph that uses a template, and you wish to unlink it from the template, change the "Style Template" pulldown back to "Global Default". A question is asked: "Do you want to transfer the settings from Template XXX to this variable's graph setup?". Answering no will dump all settings that come from the template. Answering Yes will leave these settings in place.

Comments


You are not allowed to post comments.