diff --git a/functions.php b/functions.php index dd54b0d0..704669f5 100644 --- a/functions.php +++ b/functions.php @@ -747,6 +747,10 @@ function get_view_graph_elements($view) { } else { $graph_args_array[] = "z=" . $default_size; } + + if ( isset($item['sortit']) ) { + $graph_args_array[] = "sortit=" . $item['sortit']; + } // If graph type is not specified default to line graph if (isset($item['graph_type']) && @@ -1111,7 +1115,8 @@ function build_aggregate_graph_config ($graph_type, $hreg, $mreg, $glegend, - $exclude_host_from_legend_label) { + $exclude_host_from_legend_label, + $sortit = true) { global $conf, $index_array, $hosts, $grid, $clusters, $debug, $metrics; @@ -1157,7 +1162,9 @@ function build_aggregate_graph_config ($graph_type, } } } - ksort($metric_matches); + if($sortit) { + ksort($metric_matches); + } } if( isset($metric_matches)){ $metric_matches_unique = array_unique($metric_matches); diff --git a/graph.php b/graph.php index 45186123..f6e026da 100644 --- a/graph.php +++ b/graph.php @@ -293,13 +293,20 @@ function build_aggregate_graph_config_from_url($conf_graph_colors) { $exclude_host_from_legend_label = (array_key_exists('lgnd_xh', $_GET) && $_GET['lgnd_xh'] == "true") ? TRUE : FALSE; + + $sortit = true; + if($_GET['sortit'] == "false") { + $sortit = false; + } + $graph_config = build_aggregate_graph_config($graph_type, $line_width, $_GET['hreg'], $_GET['mreg'], $graph_legend, - $exclude_host_from_legend_label); + $exclude_host_from_legend_label, + $sortit); } // Set up