// Finished nvd3 chart

This commit is contained in:
Damien Metzger committed 2013-09-20 18:12:10 +02:00
1 parent 02e5913dd6
commit ed1574e9ed
1 file changed
+8 -3
+8 -3
View File
@@ -78,8 +78,8 @@ class GraphNvD3 extends ModuleGraphEngine
nv.models.lineChart()', nv.models.lineChart()',
'pie' => ' 'pie' => '
nv.models.pieChart() nv.models.pieChart()
.x(function(d) {return d.label}) .x(function(d) { return d.label; })
.y(function(d) {return d.value}) .y(function(d) { return d.value; })
.showLabels(true) .showLabels(true)
.showLegend(false)' .showLegend(false)'
); );
@@ -150,12 +150,17 @@ class GraphNvD3 extends ModuleGraphEngine
{ {
$nvd3_values = array(); $nvd3_values = array();
if (Tools::getValue('type') == 'pie') if (Tools::getValue('type') == 'pie')
{
foreach ($this->_values as $x => $y) foreach ($this->_values as $x => $y)
$nvd3_values[] = array('label' => $this->_legend[$x], 'value' => $y); $nvd3_values[] = array('label' => $this->_legend[$x], 'value' => $y);
$array['data'] = $nvd3_values;
}
else else
{
foreach ($this->_values as $x => $y) foreach ($this->_values as $x => $y)
$nvd3_values[] = array('x' => $x, 'y' => $y); $nvd3_values[] = array('x' => $x, 'y' => $y);
$array['data'][] = array('values' => $nvd3_values, 'key' => $this->_titles['main']); $array['data'][] = array('values' => $nvd3_values, 'key' => $this->_titles['main']);
}
} }
else else
foreach ($this->_values as $layer => $gross_values) foreach ($this->_values as $layer => $gross_values)