Vvidget Code Reference Manual

Vvidget Code > Dictionary > Column Chart

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

Overloaded Fill ColorX-Labels And Different Colors
ExampleExample
Second Format TypeExtruded
ExampleExample

A column chart is a sequence rectangles (columns) whose height is determined by scalar data values. The x-axis numeric values are typically reassigned to text that identifies the column with a name identifier. Columns can be stacked or offset. By default, a column chart has x-ticks but those can be turned off on the associated template. The template can also be adjusted to give gradient columns and many other graphical attributes. A column chart is essentially a bar chart in the opposing dimension and often a column chart is referred to as a bar chart as the column representation of the data are themselves bars.

An example code fragment illustration follows:

/* Start of Illustration Code Fragment */

[constructor VC_append_key:"chart_type" string_value:@"column"];
[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_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 column, indicating a column 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 column. 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 column. If 0 then the columns have no width and if 0.5 then the columns touch adjacent columns. The default is 0.25.
does_stack_barsIf 0 then columns are offset, if 1 then columns are stacked. This only makes sense for group columns 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_Column_ChartForms the static attributes for this chart type when there are no label keys.
PVST_Custom_Label_Column_ChartForms the static attributes for this chart type when there is at least one label key. The bottom margin is greater to accommodate longer labels.
PVST_column_color_tableForms the column color attributes for odd format type indices.
PVST_column_color_table_1Forms the column color attributes for even format type indices.

Other examples

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

Example

Notice how the X-Title is clipped. That is because the X-Labels are long. If you need a particular result then you need to modify the template. For example: You can turn off the X-Title or you can rotate the X-Labels less or you can do both. The specific solution is dependent upon the particular problem.

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.