nlybe/charts_api

FusionCharts integration on Elgg

5.5 2023-08-18 05:13 UTC

This package is auto-updated.

Last update: 2024-04-05 22:36:52 UTC


README

Elgg 5.0

Chart.js integration in Elgg. This plugin offers an API which can be used from other plugins on Elgg platforms in order to populate information in charts using the Chart.js.

At the moment plugin offers the option to create a simple Bar Chart.

How to Use

The sample code below will create a Bar Chart.

// 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);

Future Tasks List

  • Make a class for charts, so all parameters will be passed by using methods of this class
  • Integrate more options from Chart.js like select type of chart, chart styling etc