The following describes the parameters which can be entered manually or used along with the helper functions to create what is called the Chart API array structure of the Chart module.

Array Structure for REQUIRED parameters

Any chart requires the mandatory parameters detailed below.

Parameter / GIC Parm /
Format / Notes
Description
#chart_id / - /
String

Unique id representing the chart
#type / cht /
Human Readable value

Chart type, with Chart Types as allowed values ... Read more
#data / chd /
Array / (1)

Array of nested arrays or numeric values ... Read more

Array Structure for OPTIONAL parameters

Any of the parameters detailed below can be used to refine the chart specifications. Specifying any of them is optional. For parameters that are not specified the chart module will use a predefined default value.

Parameter / GIC Parm /
Format /
Chart Types /
Helper Function(s) /
Notes
Description
#title / chtt /
String /
All /
chart_title();

Chart title and style ... Read more
#size / chs /
Array /
All /
chart_size();

Array such as array('#width' => 300, '#height' => 150), which is the default, to set the total width and height of the chart image, including legends, margins, and titles which are clipped to fit within the total chart size ... Read more
#legends / chdl /
Array /
All /
-

Array of legends with the same size and keys as #data array is, e.g. array('60%', '40%'), describing each dataset ... Read more
#legend_position / chdlp /
String /
All /
-

The position of the legend, and order of the legend entries, e.g. bvs|r ... Read more
#labels / chl /
Array /
Pie /
-

Array of labels, with the same size and keys as #data array is, e.g. array('60%', '40%'), describing dataset series ... Read more
#adjust_resolution / - /
Boolean /
??? /
- /
(2)

Resize the graph to fit the #size (FALSE by default).
#line_styles / chls /
Array /
Line, Radar /
chart_line_style();

Array of line styles to specify line thickness and solid/dashed style ... Read more
#grid_lines / chg /
Array /
Line, Bar, Radar, Scatter /
chart_grid_lines();

Array to add solid or dotted grid lines on the chart ... Read more
#shape_markers / chm /
Array /
Bar, Line, Radar, Scatter /
chart_shape_marker();

Array of graphical markers for all or individual data points on a chart ... Read more
#data_colors / chco /
Array /
All /
- /
(3)

Array of hex color values to specify the colors of a specific series, or all elements of a series. Use of chart_unique_color() is recommended ... Read more
#chart_fill / chf /
Array /
All /
chart_fill()

Array of chart fill colors and styling ... Read more
#mixed_axis_labels / chxt /
Array /
Line, Bar, Radar, Scatter /
chart_mixed_axis_range_label()
chart_mixed_axis_label()

Array of mixed axis labels ... Read more
#mixed_axis_label_styles/chxs/
Array /
Line, Bar, Radar, Scatter /
chart_mixed_axis_label_styles()

Array of font size, color, and alignment for axis labels ... Read more
#bar_size / chbh /
String /
Bar /
chart_bar_size()

Bar widths and spacing between bars and groups ... Read more
#countries / chld /
Array /
Line, Bar, Radar, Scatter /
-

An array of countries, used for Dynamic Icon Markers ... Read more
#georange / chtm /
String /
??? /
-

The geographical scope ... Read more
#margins / chma /
Array /
All /
-

Array such as array('#left_margin' => 10, '#right_margin' => 10, #top_margin' => 15, '#bottom_margin' => 5, #legend_width' => 20, '#legend_height' => 12), to set margins and legend width and height ... Read more

Notes

(1)
Use 'NULL' string to represent empty values.
(2)
  • if TRUE then data is adjusted to the resolution available which ensures that data is represented using the full range of values available.
  • if an array is passed (rather than a boolean), #adjust represents that the data should be adjusted, and #max indicates what value should be considered the maximum value to which all other values will resolve to. Example: values of [5, 8, 12] will not be represented well when the chart has a range of 100 values, 12 will be represented at 100 (unless a max is specified) and other values are adjusted appropriately.
(3)
Values must exclude '#'.

Allowed values

Chart Types

  • CHART_TYPE_LINE ('Line')
  • CHART_TYPE_LINE_NO_AXIS ('Line - No Axis')
  • CHART_TYPE_LINE_XY ('Line - XY')
  • CHART_TYPE_BAR_H ('Bar - Horizontal')
  • CHART_TYPE_BAR_V ('Bar - Vertical')
  • CHART_TYPE_BAR_H_GROUPED ('Bar - Grouped Horizontal')
  • CHART_TYPE_BAR_V_GROUPED ('Bar - Grouped Vertical')
  • CHART_TYPE_PIE ('Pie')
  • CHART_TYPE_PIE_3D ('Pie - 3D')
  • CHART_TYPE_PIE_CONCENTRIC ('Pie - Concentric')
  • CHART_TYPE_VENN ('Venn Diagram')
  • CHART_TYPE_SCATTER ('Scatter plot')
  • CHART_TYPE_MAP ('Map')
  • CHART_TYPE_RADAR ('Radar')
  • CHART_TYPE_RADAR_FILLED ('Radar - Filled')
  • CHART_TYPE_GMETER ('Goole-o-meter')
  • CHART_TYPE_QR ('QR code')

Note: Refer to Chart Types for a list all image charts and infographics available.

Marker Types

  • CHART_MARKER_ARROW
  • CHART_MARKER_CROSS
  • CHART_MARKER_DIAMOND
  • CHART_MARKER_CIRCLE
  • CHART_MARKER_SQUARE
  • CHART_MARKER_VIRTICAL_LINE_X
  • CHART_MARKER_VIRTICAL_LINE_TOP
  • CHART_MARKER_HORIZONTAL_LINE
  • CHART_MARKER_X

Axis

  • CHART_AXIS_X_BOTTOM
  • CHART_AXIS_X_TOP
  • CHART_AXIS_Y_LEFT
  • CHART_AXIS_Y_RIGHT

Alignment

  • CHART_ALIGN_LEFT
  • CHART_ALIGN_CENTER
  • CHART_ALIGN_RIGHT

Legend Position

  • CHART_LEGEND_BOTTOM
  • CHART_LEGEND_TOP
  • CHART_LEGEND_BOTTOM_VERTICAL
  • CHART_LEGEND_TOP_VERTICAL
  • CHART_LEGEND_RIGHT
  • CHART_LEGEND_LEFT

Bar Width and Spacing

  • CHART_ABSOLUTE_SPACING
  • CHART_RELATIVE_SPACING