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
floatvalue, or a string containing a number followed by one of these CSS units:
- 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".
- 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
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.
Draws a string of text. The required fields are
text, which should be the string to display. By default the text shape's
fillis set to black, the
fontis set to "Arial" and the
font_sizeis set to 14. Text shapes also support the options
text_align(left, centre or right) and
line_spacing(which defaults to the font size).
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 first entry in the shape array is the type of shape to draw. Each shape has its own list of required fields for drawing that particular shape, and optional fields can be added to set the colour, line thickness, etc. 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.