Functions

Get the markup for an average line

_draw_average(float $average, float $y_scale) : string

Parameters

$average

float

Average value

$y_scale

float

Y scale

Returns

stringThe markup

Get the markup for a standard pair of axes

_draw_axes(float $max_y, float $y_scale, string $x_label, string $y_label) : string

Parameters

$max_y

float

Maximum Y value

$y_scale

float

Y scale

$x_label

string

X axis label

$y_label

string

Y axis label

Returns

stringThe markup

Get the SVG markup for a key for a chart, such as a pie chart, using the specified data

_draw_key(array $data, string $start_colour, integer $start_x, integer $start_y, string $units) : string

Parameters

$data

array

An array of the data to be keyed up

$start_colour

string

The starting colour for the key

$start_x

integer

The starting X position

$start_y

integer

The starting Y position

$units

string

The units (e.g. %)

Returns

stringThe SVG markup for the described key

Get the SVG markup for a segment of a circle.

_draw_segment(string $colour, integer $angle, integer $radius, integer $start_x, integer $start_y, integer $end_x, integer $end_y) : string

It is designed to be used in the construction of a pie chart

Parameters

$colour

string

The hexadecimal-formatted colour for the shape

$angle

integer

The angle of the segment

$radius

integer

The radius of the segment

$start_x

integer

The X position of the start vertex

$start_y

integer

The Y position of the start vertex

$end_x

integer

The X position of the end vertex

$end_y

integer

The Y position of the end vertex

Returns

stringThe SVG markup for the described segment

Take the SVG and make all the styles inline.

_filter_svg_css(string $plot) : string

Disabled as not needed for native SVG implementations

Parameters

$plot

string

The SVG

Returns

string... made to have inline styles

Get the markup required to finish an SVG document

_finish_svg(string $plot) : string

Parameters

$plot

string

The plot markup to insert first

Returns

stringThe markup

Get the next hexadecimal colour from the specified one, where each of the Red, Green or Blue columns can either be 00, 33, 66 or 99, to provide a viewable contrast between two adjacent colours

_get_next_colour(string $current_colour) : string

Parameters

$current_colour

string

The hexadecimal-format colour to be incremented

Returns

stringThe incremented hexadecimal colour

Get the markup required to start a new SVG document

_start_svg() : string

Returns

stringThe markup

Create a bar chart from the specified data and return the SVG markup

create_bar_chart(array $data, string $x_label, string $y_label, string $x_units, string $y_units) : string

Parameters

$data

array

The data to be used in the creation of the bar chart

$x_label

string

The X axis label

$y_label

string

The Y axis label

$x_units

string

The X axis units label

$y_units

string

The Y axis units label

Returns

stringThe SVG markup for the described bar chart

Draw a pie chart with the specified data and return the SVG markup

create_pie_chart(array $data) : string

Parameters

$data

array

The data to be used in the creation of the pie chart

Returns

stringThe SVG markup for the described pie chart

Create a scatter graph using the data provided and return the SVG markup

create_scatter_graph(array $data, string $x_label, string $y_label, string $x_units, string $y_units) : string

Parameters

$data

array

The data to be used in the creation of the scatter graph

$x_label

string

The X axis label

$y_label

string

The Y axis label

$x_units

string

The X axis units label

$y_units

string

The Y axis units label

Returns

stringThe SVG markup for the described scatter graph

Standard code module initialisation function.

init__svg() 

Constants

 

BAR_WIDTH

BAR_WIDTH 

 

BOX_SIZE

BOX_SIZE 

 

BOX_SPACING

BOX_SPACING 

 

CROSS_SIZE

CROSS_SIZE 

 

MIN_X_MARKER_DISTANCE

MIN_X_MARKER_DISTANCE 

 

MIN_Y_MARKER_DISTANCE

MIN_Y_MARKER_DISTANCE 

 

PIE_RADIUS

PIE_RADIUS 

 

PLOT_HEIGHT

PLOT_HEIGHT 

 

PLOT_HEIGHT_BIAS

PLOT_HEIGHT_BIAS 

 

PLOT_WIDTH

PLOT_WIDTH 

 

PLOT_WIDTH_BIAS

PLOT_WIDTH_BIAS 

 

SVG_HEIGHT

SVG_HEIGHT 

 

SVG_WIDTH

SVG_WIDTH 

 

TEXT_HEIGHT

TEXT_HEIGHT 

 

VIEWPORT_HEIGHT

VIEWPORT_HEIGHT 

 

VIEWPORT_WIDTH

VIEWPORT_WIDTH 

 

X_AXIS_HEIGHT

X_AXIS_HEIGHT 

 

X_LABEL_HEIGHT

X_LABEL_HEIGHT 

 

X_PADDING

X_PADDING 

 

Y_AXIS_WIDTH

Y_AXIS_WIDTH 

 

Y_LABEL_WIDTH

Y_LABEL_WIDTH 

 

Y_PADDING

Y_PADDING