llms_get_donut( mixed $percentage, string $text = '', string $size = 'default', array $classes = array() )

Retrieve the HTML for a donut chart


Description Description

Note that this must be used in conjunction with some JS to initialize the chart!


Top ↑

Parameters Parameters

$percentage

(mixed) (Required) Percentage to display

$text

(string) (Optional) Text/caption to display (short). Default is empty string.

Default value: ''

$size

(string) (Optional) Size of the chart (mini, small, default, large). Default is 'default'.

Default value: 'default'

$classes

(array) (Optional) Additional custom css classes to add to the chart element. Default is empty array.

Default value: array()


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/llms.functions.core.php

 */
function llms_get_donut( $percentage, $text = '', $size = 'default', $classes = array() ) {
	$percentage = is_numeric( $percentage ) ? $percentage : 0;
	$classes    = array_merge( array( 'llms-donut', $size ), $classes );
	$classes    = implode( ' ', $classes );
	$percentage = 'mini' === $size ? round( $percentage, 0 ) : llms()->grades()->round( $percentage );
	return '
		<div class="' . $classes . '" data-perc="' . $percentage . '">
			<div class="inside">
				<div class="percentage">
					' . $percentage . '<small>%</small>
					<div class="caption">' . $text . '</div>
				</div>
			</div>
		</div>';


Top ↑

Changelog Changelog

Changelog
Version Description
3.9.0
3.24.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.