I am trying to make a pie chart, using chartjs, to display almost all the data in a database. What it does is count how many times a certain word is used in the database and it uses that count as the value and the word as the name.
In my pie chart I have almost 10 values that are about .01% of the pie chart and i'm trying to remove them.
Anyone have any ideas?
Also google searching this makes it seem like chartjs is not that popular nor supported, would it be more reasonable to use something else?
EDIT:
cakephp MODEL:
function pieChart($conditions = null) {
//Get Data for PieChart
$this->RecordDrug->virtualFields['sum'] ='COUNT(*)';
$records = array();
$records=$this->RecordDrug->find('list',
array(
'conditions' => $conditions,
'fields' => array( 'Drug.drug', 'sum'),
'contain' => array( 'Drug', 'Record' ),
'group' => 'Drug.Drug'
));
return $records;
}
CONTROLLER:
$pieChart = $this->Record->pieChart();
$this->set('output',$pieChart);
VIEW:
var pieChartDataSource = [
<?php
foreach($output as $compound => $sum){
echo "{category: '".$compound."', value: ".$sum."}, ";
}
?>
];