SVGGraph options: label

« Return to SVGGraph options page

Option name:
Default value:
Added in version:
Data type:
array [?]


A negative or positive whole number or 0.
no [?]



$settings['widget_taste'] = 'banana';
$settings['widget_colour'] = array(
  'red', 'green', 'blue'


Supported by:
global label

Adds custom labels to the graph.

This option allows you to add your own labels to the graph containing any text and in any position.

The value of the option should be either an array containing the details of a single label or an array of label details arrays.

The first three fields in the label array must be the X and Y coordinates of whatever you want to label and the text to go in the label:

$settings['label'] = array(100, 200, "Label for (100, 200)");

In this example a label containing the text "Label for (100, 200)" is added to the graph. The location it is labelling is 100 pixels in from the left and 200 pixels down from the top.

The X and Y coordinates can be absolute values as shown in the example above, or any of the relative coordinates supported by SVGGraph. These are explained on the shapes page.

The positioning and styling of the labels comes from the relevant data_label_* settings, though these can be overridden in the label details array using these options:

type, space, font, font_size, font_adjust, font_weight, colour, back_colour, position, angle, padding, padding_x, padding_y, round, fill, outline_colour, outline_thickness, tail_length, tail_width, shadow_opacity

These options correspond to the equivalent data_label_* options, just with shortened names:

  'colour' => '#f00',
  'font' => 'Times New Roman'
$settings['data_label_position'] = 'below';

Here is the same example as before, but now it will be drawn using red text and in the Times New Roman font. The data_label_position option is set to draw all labels below the item they are labelling, so the label will be drawn underneath the (100, 200) coordinates.

See the custom labels page for more details.

See also:
show_data_labels shape data_label_type data_label_space data_label_font data_label_font_size data_label_font_adjust data_label_font_weight data_label_colour data_label_back_colour data_label_position data_label_angle data_label_padding data_label_padding_x data_label_padding_y data_label_round data_label_fill data_label_outline_colour data_label_outline_thickness data_label_tail_length data_label_tail_width data_label_shadow_opacity

« Back to top of page Main SVGGraph page »