Vvidget Code Reference Manual

Vvidget Code > Common Keys > Templates

Any attribute not defined by a Dictionary entry is defined by the contents of a template, which is a Vvidget Builder document. Those documents are located in the PVS (Peer Visual State) framework's resource directory located at:

/Library/Frameworks/Vvidget_PVS.framework/Resources/English.lproj/templates

If you use the Vvidget Code Embedded frameworks then those templates are located within your own application at:

<your app bundle path>/Contents/Frameworks/Vvidget_PVS.framework/Resources/English.lproj/templates

You can modify those templates by double clicking them and editing them in Vvidget Builder. That will modify the default template configuration for each graph type. If you do that then you should copy the entire Vvidget Embedded Frameworks directory to a location of your choosing, link against that and copy that into your application using a copy build phase as described by the Cocoa Programming Tutorial. That way you will not need to edit the stock Vvidget directory directly. However, using a templates key, as described next, is probably a better choice.

The best prescription for using custom templates is to use the templates key and define a path within your own application bundle's resource folder that contains templates. The easiest way to make your own templates is to copy the directory:

/Library/Frameworks/Vvidget_PVS.framework/Resources/English.lproj/templates

into the directory of your Xcode project, add that to your project and refer to that template directory for your needs by assigning the templates key with a value of that path. Note that the template document names are fixed, you can not change them. However, you may have multiple template directories to make graphs of the same type appear to have different template definitions.

As mentioned before, the templates are Vvidget Builder documents and can be altered like any other document. You can add graphics, change fonts and colors, etc. but one thing you should not do is remove any graphic that exists by default in the template. You must also not change the widget name of graphics in the template.

When you modify the template then the modifications affect all dynamic graphics of that type. For example, you can modify the color table for a Pie Chart in which case all pie charts referring to that templates directory will conform to the new color table scheme. In that way you can set up an application that has a color scheme consistent with your own company's guidelines, for example, and also make many different guideline specifications using different custom templates directories.

Notice that there are two types of templates:

So, as you see: Vvidget Code uses a dictionary to define dynamic components of a graph description and then also uses templates, as constructed by a GUI tool, to define static components. Or, to look at it another way: A template is used to define hard to comprehend visual attributes and those attributes are easily comprehended via a GUI tool. A dictionary is used to define numeric and string attributes that are easy to quantify within a simple textual encoding. The two combined form the output of Vvidget Code. Really the best of both worlds.

Template Folder

The template folder contains all of the template documents corresponding to each base and color table template type. The listing below shows the stock template folder.

cd /Library/Frameworks/Vvidget_PVS.framework/Resources/English.lproj/templates
ls -1
PVST_2Y_Date_Graph.book
PVST_Area_Graph.book
PVST_Attribution_Graph.book
PVST_Bar_Chart.book
PVST_Calendar_5.book
PVST_Calendar_6.book
PVST_Calendar_small.book
PVST_Column_Chart.book
PVST_Custom_Label_Bar_Chart.book
PVST_Custom_Label_Column_Chart.book
PVST_Date_Graph.book
PVST_Line_Graph.book
PVST_Perspective_Scatter_Chart.book
PVST_Perspective_Surface_Chart.book
PVST_Perspective_Volume_Chart.book
PVST_Pie_Chart.book
PVST_Point_Map_Chart.book
PVST_Polar_Line_Graph.book
PVST_Polar_Point_Map_Chart.book
PVST_R_Log_Line_Graph.book
PVST_R_Log_Point_Map_Chart.book
PVST_Scatter_Graph.book
PVST_Stock_Chart.book
PVST_XY_Log_Area_Graph.book
PVST_XY_Log_Line_Graph.book
PVST_XY_Log_Point_Map_Chart.book
PVST_XY_Log_Scatter_Graph.book
PVST_X_Log_Area_Graph.book
PVST_X_Log_Line_Graph.book
PVST_X_Log_Point_Map_Chart.book
PVST_X_Log_Scatter_Graph.book
PVST_Y_Log_Area_Graph.book
PVST_Y_Log_Line_Graph.book
PVST_Y_Log_Point_Map_Chart.book
PVST_Y_Log_Scatter_Graph.book
PVST_area_color_table.book
PVST_area_color_table_1.book
PVST_bar_color_table.book
PVST_bar_color_table_1.book
PVST_color_table.book
PVST_color_table_1.book
PVST_column_color_table.book
PVST_column_color_table_1.book
PVST_date_color_table.book
PVST_date_color_table_1.book
PVST_line_color_table.book
PVST_line_color_table_1.book
PVST_pie_color_table.book
PVST_pie_color_table_1.book
PVST_scatter_color_table.book
PVST_scatter_color_table_1.book
PVS_color_table.book
PVS_color_table_1.book
PVS_default_attributes.definition
PVS_default_template.book

The definitions of each template is given in the corresponding Dictionary section. If you want a custom template for a graph type then your task is to add a template directory within your own project and copy the appropriate template as listed above and defined in the corresponding dictionary description to your project's template directory.

As an example, to customize a line graph you will need to copy the PVST_Line_Graph.book template. For the most part, the template to chose is encoded into the template name and there isn't too much guess work. An example of the use of templates is given by the SimpleLineGraph project, which is available as a Vvidget Code example project and also as a link at the end of the Cocoa Programming Tutorial.

Please help improve this documentation. If a section is hard to understand, there is a typo, you would like a new section added, or you detect any other improvement that can be made then please email support@vvi.com with your information.




© Copyright 1993-2011 by VVimaging, Inc. (VVI); All Rights Reserved. Please email support@vvi.com with any comments you have concerning this documentation. See Legal for trademark and legal information.