SVGGraph options: label

« Return to previous page

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

The datatypes used in this documentation for specifying SVGGraph options are described below. All options can be a literal value of the data type described, a variable containing the data type, or an expression that will produce the data type when evaluated (and they must always be valid PHP expressions).

An array, the number and data types of its members will depend on the option for which is it used.
A boolean TRUE or FALSE value, or any values that convert easily such as 1, "1", 0 and "".
A callable function, which can be either the name of a function or an anonymous function itself.
Any of the colour values supported by SVG inside a single or double quoted string. These include three and six digit hex codes, RGB and RGBA colours, and colour names. SVG uses "none" for no colour, which generally leaves things transparent.
A colour value or one of the gradients and patterns supported by SVGGraph. See the SVGGraph colours page for details.
A negative or positive whole number or 0.
An integer or float value, or a string containing a number followed by one of these CSS units: px, in, cm, mm, pt, pc.
Any number supported by PHP, for example 1 or -3.2 or 1.63e5 or M_PI.
Single or double quoted strings. Remember to double-quote your strings if you are inserting a line break:
"Line 1\nLine 2".
Supported by:
ArrayGraph Bar3DGraph BarAndLineGraph BarGraph BoxAndWhiskerGraph BubbleGraph CandlestickGraph CylinderGraph Donut3DGraph DonutGraph EmptyGraph ExplodedDonut3DGraph ExplodedDonutGraph ExplodedPie3DGraph ExplodedPieGraph ExplodedSemiDonut3DGraph ExplodedSemiDonutGraph FloatingBarGraph GanttChart GroupedBar3DGraph GroupedBarGraph GroupedCylinderGraph Histogram HorizontalBar3DGraph HorizontalBarGraph HorizontalFloatingBarGraph HorizontalGroupedBar3DGraph HorizontalGroupedBarGraph HorizontalStackedBar3DGraph HorizontalStackedBarGraph LineGraph MultiLineGraph MultiRadarGraph MultiScatterGraph MultiSteppedLineGraph Pie3DGraph PieGraph PolarArea3DGraph PolarAreaGraph PopulationPyramid RadarGraph ScatterGraph SemiDonut3DGraph SemiDonutGraph StackedBar3DGraph StackedBarAndLineGraph StackedBarGraph StackedCylinderGraph StackedGroupedBar3DGraph StackedGroupedBarGraph StackedGroupedCylinderGraph StackedLineGraph SteppedLineGraph
global label data-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:

$settings['label'] = array(100, 200, "Label for (100, 200)",
  '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 »

This site uses cookies - details here.