Vvidget Code Reference Manual

Vvidget Code > Dictionary > Bar Chart

This section explains how to form a dictionary for a bar chart such as these:

Overridden ColorLabels With Color Map
ExampleExample
Second Format TypeExtruded
ExampleExample

A bar chart is a sequence rectangles (bars) whose width is determined by scalar data values. The y-axis numeric values are typically reassigned to text that identifies the bar with a name identifier. Bars can be stacked or offset. By default, a bar chart has x-ticks but those can be turned off on the associated template. The template can also be adjusted to give gradient bars and many other graphical attributes.

An example code fragment illustration follows:

/* Start of Illustration Code Fragment */

[constructor VC_append_key:"chart_type" string_value:@"bar"];
[constructor VC_append_key:"chart_subtype" string_value:@"default"];
[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_values" string_value:@"1 2 3 4 5"];
[constructor VC_append_key:"fill_color" string_value:@"0000FF"];

/* End of Illustration Code Fragment */

The code fragment above can be inserted into the illustration code section of the Illustration project for an immediate running Cocoa application. For additional information consult the Illustration section.

The following table defines the dictionary key and value pairs:

Chart Specific Entries
KeyValue Description
chart_type¹The chart type is the string bar, indicating a bar chart.
chart_subtype¹The chart subtype is always the string default
chart_format_type¹One of the strings {default , alternate, extruded} which produces the varied results of the figures above.
titleThe main title of the graph. If this key is not present then the template's title is used.
x_titleThe x title of the graph. If this key is not present then the template's x-title is used.
y_titleThe y title of the graph. If this key is not present then the template's y-title is used.
data_valuesA white space delimited list of values representing the length of the bar. See Data Oriented keys for additional information and keys.
label_IA string for the I-th label value. I starts at 1.
bar_half_widthA number from 0.0 to 0.5 indicating the half width of the bar. If 0 then the bars have no width and if 0.5 then the bars touch adjacent bars. The default is 0.25.
does_stack_barsIf 0 then bars are offset, if 1 then bars are stacked. This only makes sense for group bars when the data_I key is used.
fill_colorA hex encoded representation of a RGBA color value. This only is in effect for format type 1. If this key is not present then the color table template is used.
fill_color_IA hex encoded representation of a RGBA color value for the I-th bar. I starts at 1 (example: fill_color_2=FF0000 assigns the 2nd bar to a red fill color). This entry overrides the fill_color and the table color specifications.
templatesA custom Templates directory.

¹ Do not include this key value pair in the Interface Builder Plugin Inspector input string. It is included for you automatically.

If you incorporate this functionality into your own application then please consult Cocoa Programming. If you incorporate this functionality into CLI scripts then please consult Script Programming.

You can also modify the following Templates:

Template Document Names
TemplateDescription
PVST_Bar_ChartForms the static attributes for this chart type when there are no label keys.
PVST_Custom_Label_Bar_ChartForms the static attributes for this chart type when there is at least one label key. The left margin is greater to accommodate longer labels.
PVST_bar_color_tableForms the bar color attributes for odd format type indices.
PVST_bar_color_table_1Forms the bar color attributes for even format type indices.

Other examples

Group bars can be formed by using the data_I keys instead of the data_values key. Here is an example:

Example

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.