llms_get_donut( [type] $percentage, string $text = '', string $size = 'default', array $classes = array() )

Retrieve the HTML for a donut chart Note that this must be used in conjunction with some JS to initialize the chart!


Description Description


Parameters Parameters

$percentage

([type]) (Required) percentage to display

$text

(string) (Optional) text/caption to display (short)

Default value: ''

$size

(string) (Optional) size of the chart (mini, small, default, large)

Default value: 'default'

$classes

(array) (Optional) additional custom css classes to add to the chart element

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 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: