Fixed Pie charts and legend. Tiquet: #3742
This commit is contained in:
parent
642a337bea
commit
54c6de6a41
|
@ -1816,7 +1816,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
case CUSTOM_GRAPH_PIE:
|
||||
return ring_graph($flash_charts, $graph_values, $width, $height,
|
||||
$others_str, $homeurl, $water_mark, $config['fontpath'],
|
||||
($config['font_size']+1), 1, false, $color, false);
|
||||
($config['font_size']+1), $ttl, false, $color, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -741,36 +741,37 @@ function ring_graph($flash_chart, $chart_data, $width,
|
|||
$total_modules = $chart_data['total_modules'];
|
||||
unset($chart_data['total_modules']);
|
||||
|
||||
|
||||
$max_values = 9;
|
||||
//Remove the html_entities
|
||||
$n = 0;
|
||||
$temp = array();
|
||||
$coloretes = array();
|
||||
foreach ($chart_data as $key => $value) {
|
||||
$temp[io_safe_output($key)] = $value['value'];
|
||||
$legend[] = io_safe_output($key) .": " . $value['value'] . " " .$value['unit'];
|
||||
//~ $coloretes[$n] = $colors[$n]['color'];
|
||||
//~ $n++;
|
||||
if ($n < $max_values) {
|
||||
$temp[io_safe_output($key)] = $value['value'];
|
||||
$legend[] = io_safe_output($key) .": " . $value['value'] . " " .$value['unit'];
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
$chart_data = $temp;
|
||||
|
||||
$chart_data_trunc = array();
|
||||
$coloretes = array();
|
||||
$n = 1;
|
||||
foreach ($chart_data as $key => $value) {
|
||||
if ($n < $max_values) {
|
||||
//~ foreach ($chart_data as $key => $value) {
|
||||
//~ if ($n < $max_values) {
|
||||
|
||||
$chart_data_trunc[$key] = $value;
|
||||
}
|
||||
//~ $chart_data_trunc[$key] = $value;
|
||||
//~ }
|
||||
//~ else {
|
||||
//~ if (!isset($chart_data_trunc[$others_str])) {
|
||||
//~ $chart_data_trunc[$others_str] = 0;
|
||||
//~ }
|
||||
//~ $chart_data_trunc[$others_str] += $value;
|
||||
//~ }
|
||||
$n++;
|
||||
}
|
||||
$chart_data = $chart_data_trunc;
|
||||
//~ $n++;
|
||||
//~ }
|
||||
//~ $chart_data = $chart_data_trunc;
|
||||
|
||||
//TODO SET THE LEGEND POSITION
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ $ttl = get_parameter('ttl', 1);
|
|||
|
||||
$graph = unserialize_in_temp($id_graph, true, $ttl);
|
||||
|
||||
if (!isset($graph)) {
|
||||
if (!$graph) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1111,6 @@ function pch_bullet_chart($graph_type, $data, $legend,
|
|||
/* Create and populate the pData object */
|
||||
$MyData = new pData();
|
||||
|
||||
html_debug($data,true);
|
||||
foreach ($data as $key => $dat) {
|
||||
$MyData->addPoints($dat, $key);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue