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!
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()
Return Return
(string)
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>';
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.9.0 | |
3.24.0 | Introduced. |