[Vertical Bar Charts] Preserve order after truncate label

This commit is contained in:
fermin831 2018-03-01 13:16:36 +01:00
parent 3359870c2f
commit 287d28de4e
1 changed files with 6 additions and 6 deletions

View File

@ -188,9 +188,9 @@ function vbar_graph(
$tick_color); $tick_color);
} }
else { else {
$new_chart_data = array();
foreach ($chart_data as $key => $value) { foreach ($chart_data as $key => $value) {
if(strlen($key) > 20){ if(strlen($key) > 20){
if(strpos($key, ' - ') != -1){ if(strpos($key, ' - ') != -1){
$key_temp = explode(" - ",$key); $key_temp = explode(" - ",$key);
$key_temp[0] = $key_temp[0]." \n"; $key_temp[0] = $key_temp[0]." \n";
@ -198,14 +198,14 @@ function vbar_graph(
$key2 = $key_temp[0].$key_temp[1]; $key2 = $key_temp[0].$key_temp[1];
io_safe_output($key2); io_safe_output($key2);
} }
$chart_data[$key2]['g'] = $chart_data[$key]['g']; $new_chart_data[$key2]['g'] = $chart_data[$key]['g'];
unset($chart_data[$key]); } else {
$new_chart_data[$key] = $value;
} }
} }
$graph = array(); $graph = array();
$graph['data'] = $chart_data; $graph['data'] = $new_chart_data;
$graph['width'] = $width; $graph['width'] = $width;
$graph['height'] = $height; $graph['height'] = $height;
$graph['color'] = $color; $graph['color'] = $color;