add new option visual setup for show only average in graphs or min and max ticket: 4076

This commit is contained in:
daniel 2016-11-14 16:30:44 +01:00
parent 6baa765d75
commit e80a76901b
3 changed files with 24 additions and 6 deletions

View File

@ -447,6 +447,14 @@ $table_chars->data[$row][1] .= __('Line').' ' .
$config["type_module_charts"] != 'area', true); $config["type_module_charts"] != 'area', true);
$row++; $row++;
$table_chars->data[$row][0] = __('Show only average');
$table_chars->data[$row][0] .= ui_print_help_tip(__('Allows only show the average in graphs'), true);
$table_chars->data[$row][1] = __('Yes').' ' .
html_print_radio_button ('only_average', 1, '', $config["only_average"], true).'  ';
$table_chars->data[$row][1] .= __('No').' ' .
html_print_radio_button ('only_average', 0, '', $config["only_average"], true);
$row++;
echo "<fieldset>"; echo "<fieldset>";
echo "<legend>" . __('Charts configuration') . "</legend>"; echo "<legend>" . __('Charts configuration') . "</legend>";
html_print_table ($table_chars); html_print_table ($table_chars);

View File

@ -514,6 +514,8 @@ function config_update_config () {
$error_update[] = __('Default line thickness for the Custom Graph.'); $error_update[] = __('Default line thickness for the Custom Graph.');
if (!config_update_value ('type_module_charts', (string) get_parameter('type_module_charts', 'area'))) if (!config_update_value ('type_module_charts', (string) get_parameter('type_module_charts', 'area')))
$error_update[] = __('Default type of module charts.'); $error_update[] = __('Default type of module charts.');
if (!config_update_value ('only_average', (bool) get_parameter('only_average', false)))
$error_update[] = __('Default show only average or min and max');
if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false))) if (!config_update_value ('render_proc', (bool) get_parameter('render_proc', false)))
$error_update[] = __('Display data of proc modules in other format'); $error_update[] = __('Display data of proc modules in other format');
if (!config_update_value ('render_proc_ok', (string) get_parameter('render_proc_ok', __('Ok') ))) if (!config_update_value ('render_proc_ok', (string) get_parameter('render_proc_ok', __('Ok') )))

View File

@ -91,11 +91,11 @@ $id = get_parameter('id');
}; };
function show_others() { function show_others() {
if (!$("#checkbox-avg_only").attr('checked')) { if ($('#checkbox-avg_only').is(":checked") == true) {
$("#hidden-show_other").val(0); $("#hidden-show_other").val(1);
} }
else { else {
$("#hidden-show_other").val(1); $("#hidden-show_other").val(0);
} }
} }
//--> //-->
@ -134,11 +134,19 @@ $id = get_parameter('id');
} }
$draw_alerts = get_parameter("draw_alerts", 0); $draw_alerts = get_parameter("draw_alerts", 0);
$avg_only = get_parameter ("avg_only", 1);
$show_other = (bool)get_parameter('show_other', false); if(isset($config['only_average'])){
if ($show_other) { $avg_only = 1;
}
else {
$avg_only = 0; $avg_only = 0;
} }
$show_other = get_parameter('show_other');
if (isset($show_other)) {
$avg_only = $show_other;
}
$period = get_parameter ("period", SECONDS_1DAY); $period = get_parameter ("period", SECONDS_1DAY);
$id = get_parameter ("id", 0); $id = get_parameter ("id", 0);
$width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH); $width = get_parameter ("width", STATWIN_DEFAULT_CHART_WIDTH);