SVGGraph options: label
- 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).
array(), the number and data types of its members will depend on the option for which is it used.
- A boolean
FALSEvalue, or any values that convert easily such as
- 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
- Any number supported by PHP, for example
- Single or double quoted strings. Remember to double-quote your strings
if you are inserting a line break:
"Line 1\nLine 2".
- no [?]
Per-dataset options allow specifying one option for all datasets or an array of options to be used for each dataset in turn. If there are more datasets than entries in the option array, the sequence will be repeated.
$settings['widget_taste'] = 'banana'; $settings['widget_colour'] = array('red', 'green', 'blue');
For this example, the widgets for all datasets will taste of banana. The graph will use red widgets for dataset 0, green widgets for dataset 1 and blue widgets for dataset 2. Dataset 3 repeats the sequence so its widgets will be red, dataset 4 will have green widgets and dataset 5 will have blue widgets.
- Supported by:
- Bar3DGraph BarAndLineGraph BarGraph BoxAndWhiskerGraph BubbleGraph CylinderGraph DonutGraph ExplodedPieGraph FloatingBarGraph GroupedBar3DGraph GroupedBarGraph GroupedCylinderGraph Histogram HorizontalBarGraph HorizontalFloatingBarGraph HorizontalGroupedBarGraph HorizontalStackedBarGraph LineGraph MultiLineGraph MultiRadarGraph MultiScatterGraph Pie3DGraph PieGraph PolarAreaGraph PopulationPyramid RadarGraph ScatterGraph SemiDonutGraph StackedBar3DGraph StackedBarAndLineGraph StackedBarGraph StackedCylinderGraph StackedGroupedBar3DGraph StackedGroupedBarGraph StackedGroupedCylinderGraph StackedLineGraph
- 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
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
settings, though these can be overridden in the label details array using these
These options correspond to the equivalent
data_label_* options, just with
$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.