Vvidget Code Reference Manual
This section gives a quick explanation of what Vvidget Code does.
Goal
The Vvidget Code design criterion is based upon two goals:
- To efficiently place a graph into your application, be it a desktop or mobile application, unix service or web-based SOA client. Efficiency is determined by speed of programming as well as speed of the resulting code execution.
- To give advanced graphical features and tools that do not require programming and facilitate the embedding of a graph within your own application.
One Type Of Final Result - A Cocoa Application
One type of final result is a Cocoa application. When you build a Cocoa application that uses Vvidget the result is the normal Application bundle, a directory with a .app extension that looks like a file within the Finder. When you open up that bundle and look at its contents then you will find the following directory layout:
Application Bundle File Layout
|
- Contents/Frameworks
The Vvidget Embedded Frameworks are located in the Frameworks sub-directory of your application. Other frameworks may also be present in this directory depending on your use.
- Contents/MacOS
The binary of your application (from the code you write) is enclosed in this directory. There is normally only one binary file with the name of your application.
- Contents/Resources/English.lproj
The user interface, particularly the one with the graph view in it, is located in this directory and analogous language specific directories.
- Contents/Resources/my_templates
If your application has graph formatting customization then it can contain multiple template directories. Those directories contain Vvidget Builder documents that relate to the static graphics of the graphic view. The my_template name is just an example and you can name the template directory anything you wish and also have multiple template directories.
|
Quick Explanation: How to program a graph
The following quickly explains how to program a graph using Vvidget Code. A more through explanation is given in the Cocoa Programming Tutorial section. The steps are as follows:
- Make a normal Cocoa application project using Xcode.
- Load the Vvidget Code Interface Builder plugin and drag the VvidgetCodeClientView to your application's window and hook that graph to an instance variable of a controller in your application. For demonstration sake, call that instant variable graphView.
- Add some code, such as the following:
constructor = [graphView get_VC_input_string_constructor];
[constructor VC_append_key:"chart_type" string_value:@"line"];
[constructor VC_append_key:"chart_subtype" string_value:@"linear"];
[constructor VC_append_key:"chart_format_type" string_value:@"default"];
[constructor VC_append_key:"title" string_value:@"My Title"];
[constructor VC_append_key:"x_title" string_value:@"My X Title"];
[constructor VC_append_key:"y_title" string_value:@"My Y Title"];
[constructor VC_append_key:"data_1" string_value:@"1 5 2 6 3 7"];
[constructor VC_append_key:"line_color" string_value:@"0000FF"];
That code enters the specification of the graph into the graphView in the form of a Dictionary. The specification is complete and describes a linear line graph and the graph is ready to be made and displayed.
- Add the following code to update the graphView and then display it:
[graphView VCN_update_using_input_string_constructor];
[graphView display];
- A benefit of Vvidget Code is to be able to access the powerful layout application Vvidget Builder right from your own application. Add the following action method to your code and hook it up to a menu item or a button.
- (IBAction) export:(id)sender
{
[graphView VCN_export_to_vvidget_builder];
}
- That is it really. There isn't much too it. The rest is related to different system configurations, dictionary entries and templates that define the static attributes of the graph, such as label fonts, title fonts, grid colors, etc. All of those are made with the GUI tool Vvidget Builder and no programming is involved. Vvidget Code uses default templates so you need not concern yourself with templates to begin with, but eventually you may wish to use them.
Summary
In a nutshell, Vvidget Code is designed with the following attributes:
- Encloses functionality into your application for the purposes of making graphs without other dependencies so that you can distribute your application without external references.
- Uses a dictionary to build the specifications of the graph.
- Adds discrete yet powerful features with one method call.
- Makes use of optional templates, made via the layout tool Vvidget Builder, in order to layout the complex portion of a graph such as fonts and colors.
- Approaches the task of making a graph directly without indirection, essentially turning a dictionary (a keyed list) of attributes into a graph.
- Uses its design to provide a uniform and ubiquitous paradigm so that your knowledge of Vvidget can be used in seemingly disparate situation. Which means that reuse is very high and amortization is quick.
Where Next
Now that you have a basic understanding of Vvidget Code the next step it to branch out and make an Application. I would suggest the Illustration section. If you simply want to read reference material descriptions then you can start off with any of the Dictionary sections.
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. |