mycred_create_chart
Description
Returns an instance of the myCRED_Chart object for building charts using the Statistics add-on.
This function is only available if the Statistics add-on is enabled.
Available since version 1.8
Returns
(obj) Returns the myCRED_Chart object.
Parameters
| Param | Type | Required | Description | |
|---|---|---|---|---|
function mycred_create_chart( |
||||
$args |
array | No | An array of global arguments for charts. |
|
) { ... } |
||||
Examples
Example 1: Generate a pie chart based on the points in circulation on our website.
$global_args = array(
'title' => 'Points in Circulation'
);
$chart = mycred_create_chart( $global_args );
// The data to show in the chart.
$data = mycred_get_circulation_data();
if ( ! empty( $data ) ) {
echo $chart->pie_chart( $data );
}