PHP code example of nlybe / charts_api
1. Go to this page and download the library: Download nlybe/charts_api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nlybe / charts_api example snippets
// set an array with labels
$ch_labels = [];
// set an array with data
$ch_data = [];
$entities = elgg_get_entities($options);
foreach (entities as $e) {
array_push($ch_labels, $e->title);
array_push($ch_data, calculate_likes($e));
}
$vars['ch_labels'] = $ch_labels;
$vars['ch_data'] = $ch_data;
echo elgg_view('charts_api/charts_api', $vars);