function _fusioncharts_values in Charts 7
Create the values object using FusionCharts
Parameters
$type: String. The data type. It can be 'category', 'set' or 'trendline'
$data: Array. The data to be converted to XML
$options: Array (optional). Data options
Return value
Array, the XML array
2 calls to _fusioncharts_values()
- _fusioncharts_series in fusioncharts/
fusioncharts.inc - Convert all Series-level data.
- _fusioncharts_series_single in fusioncharts/
fusioncharts.inc - Convert all Series-level data.
File
- fusioncharts/
fusioncharts.inc, line 20 - @author Bruno Massa http://drupal.org/user/67164
Code
function _fusioncharts_values($type, $data, $options = array()) {
switch ($type) {
case 'category':
$attr = 'label';
$global_type = 'categories';
break;
case 'set':
$attr = 'value';
$global_type = 'dataSet';
break;
case 'trendline':
$attr = 'value';
$global_type = 'trendlines';
break;
}
// Create each value.
$values = array();
while (list(, $value) = each($data)) {
if (is_array($value)) {
$values[] = array(
'key' => $type,
'attributes' => $value,
);
}
else {
$values[] = array(
'key' => $type,
'attributes' => array(
$attr => $value,
),
);
}
}
// Create the XML array
if (empty($options['no_wrap'])) {
return array(
'key' => $global_type,
'value' => $values,
'attributes' => $options,
);
}
else {
return $values;
}
}