fix legend pdf chart verticals

This commit is contained in:
daniel 2020-12-17 16:58:20 +01:00 committed by Daniel Rodriguez
parent 7ae5b65740
commit 76da033775
5 changed files with 42 additions and 5 deletions

View File

@ -193,11 +193,13 @@ if ($editGraph) {
$count_module_array = count($module_array);
if ($count_module_array > 10) {
if ($count_module_array > $config['items_combined_charts']) {
ui_print_warning_message(
__(
'The maximum number of items in a chart is 10. You have %s elements, only first 10 will be displayed.',
$count_module_array
'The maximum number of items in a chart is %d. You have %d elements, only first %d will be displayed.',
$config['items_combined_charts'],
$count_module_array,
$config['items_combined_charts']
)
);
}

View File

@ -908,6 +908,20 @@ $row++;
);
$row++;
$table_chars->data[$row][0] = __('Number of elements in Custom Graph');
$table_chars->data[$row][1] = html_print_input_text(
'items_combined_charts',
$config['items_combined_charts'],
'',
5,
5,
true,
false,
false,
''
);
$row++;
$table_chars->data[$row][0] = __('Use round corners');
$table_chars->data[$row][1] = html_print_checkbox_switch(
'round_corner',

View File

@ -4107,6 +4107,11 @@ function generator_chart_to_pdf(
if ($type_graph_pdf === 'vbar') {
$width_img = $params['generals']['pdf']['width'];
$height_img = $params['generals']['pdf']['height'];
} else if ($type_graph_pdf === 'combined'
&& $params_combined['stacked'] == CUSTOM_GRAPH_VBARS
) {
$width_img = 650;
$height_img = ($params['height'] + 50);
} else {
$width_img = 550;
$height_img = $params['height'];

View File

@ -1177,6 +1177,10 @@ function config_update_config()
$error_update[] = __('Default type of module charts.');
}
if (!config_update_value('items_combined_charts', (string) get_parameter('items_combined_charts', 10))) {
$error_update[] = __('Default Number of elements in Custom Graph.');
}
if (!config_update_value('type_interface_charts', (string) get_parameter('type_interface_charts', 'line'))) {
$error_update[] = __('Default type of interface charts.');
}
@ -2869,6 +2873,10 @@ function config_process_config()
config_update_value('type_module_charts', 'area');
}
if (!isset($config['items_combined_charts'])) {
config_update_value('items_combined_charts', 10);
}
if (!isset($config['type_interface_charts'])) {
config_update_value('type_interface_charts', 'line');
}

View File

@ -1557,7 +1557,7 @@ function graphic_combined_module(
}
// Only 10 item for chart.
if ($i > 9) {
if ($i >= $config['items_combined_charts']) {
break;
}
@ -2153,7 +2153,12 @@ function graphic_combined_module(
case CUSTOM_GRAPH_HBARS:
case CUSTOM_GRAPH_VBARS:
$label = '';
$i = 0;
foreach ($module_list as $module_item) {
if ($i >= $config['items_combined_charts']) {
break;
}
if (is_metaconsole() === true) {
$server = metaconsole_get_connection_by_id(
$module_item['server']
@ -2213,6 +2218,8 @@ function graphic_combined_module(
if (is_metaconsole() === true) {
metaconsole_restore_db();
}
$i++;
}
$color = color_graph_array();
@ -2267,7 +2274,7 @@ function graphic_combined_module(
$options['generals']['rotate'] = true;
$options['generals']['forceTicks'] = true;
$options['x']['labelWidth'] = $sizeLabelTickWidth;
$options['x']['labelWidth'] = ($params['pdf'] === true) ? 30 : $sizeLabelTickWidth;
$options['generals']['arrayColors'] = $color;
$options['grid']['backgroundColor'] = 'transparent';
$options['grid']['backgroundColor'] = $background_color;
@ -3924,6 +3931,7 @@ function graph_custom_sql_graph(
$options['generals']['arrayColors'] = $color;
$options['x']['labelWidth'] = 75;
if ($ttl === 2) {
$options['x']['labelWidth'] = 35;
$options['backgroundColor'] = 'transparent';
$options['grid']['backgroundColor'] = 'transparent';
$options['y']['color'] = 'transparent';