SVGGraph options: shape
- 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 EmptyGraph ExplodedPie3DGraph ExplodedPieGraph FloatingBarGraph GroupedBar3DGraph GroupedBarGraph GroupedCylinderGraph Histogram HorizontalBarGraph HorizontalFloatingBarGraph HorizontalGroupedBarGraph HorizontalStackedBarGraph LineGraph MultiLineGraph MultiRadarGraph MultiScatterGraph Pie3DGraph PieGraph PolarArea3DGraph PolarAreaGraph PopulationPyramid RadarGraph ScatterGraph SemiDonutGraph StackedBar3DGraph StackedBarAndLineGraph StackedBarGraph StackedCylinderGraph StackedGroupedBar3DGraph StackedGroupedBarGraph StackedGroupedCylinderGraph StackedLineGraph
Draws a circle. The required fields are
r, the centre coordinates and radius.
Draws an ellipse. The required fields are
ry. These are the centre coordinates and the X radius and Y radius.
Draws a rectangle. The required fields are
height. Some useful optional fields are
ry, which specify the corner radius in the X and Y directions. For a rounded corner you only need to specify one of them.
Draws a straight line. The required fields are
y2, the coordinates of both ends of the line.
polyline and polygon
Draw multiple joined line segments.
polylineleaves the shape open,
polygoncloses the shape by drawing a line from the last point back to the first point.
The only required field is
points, which should be an array containing a list of X and Y coordinates of the points to draw.
Draws one of the predefined SVGGraph markers. The required fields are
type, and the standard marker options
marker_angleare available as the fields
Draws an image. The required fields are
src. The optional fields
heightcan be used to override the image's natural size, and the boolean option
false) can be set to
trueto enable stretching the shape of the image.
Draws a figure. The required fields are
name, which should be the name that you gave to the figure. Figures are user-defined shapes created using the
figureoption, and they cannot be altered using the stroke, fill and other styling options. The
depthoptions will work though.
Adds custom shapes to the graph.
This option allows you to add your own geometric shapes to the graph in any position.
The value of the option should be either an array containing the details of a single shape, or an array containing multiple shape details arrays.
The only option inside the details array that is common to all types of shape is the first entry which specifies the type of shape to be drawn. The available types and the extra data fields required to draw them are:
All of these (apart from
SVG basic shapes,
and any fields not mentioned above are passed straight through as attributes
to the underlying SVG code with one slight modificiation - any fields with
underscores will have them converted to hyphens, so
The shape option is described in depth on the shapes page.