Y axis fixed in custom graphs, now show correctly the numeration. Ticket#2578.

This commit is contained in:
Arturo Gonzalez Diaz 2015-08-21 10:49:49 +02:00
parent fa83eac6c5
commit b4e9e2db83
4 changed files with 5032 additions and 5027 deletions

View File

@ -1366,7 +1366,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $homeurl, $water_mark, $config['fontpath'],
$fixed_font_size, "", $ttl, array(), array(), 0, 0, '',
$fixed_font_size, $unit, $ttl, array(), array(), 0, 0, '',
false, '', true, $background_color);
break;
default:

View File

@ -267,6 +267,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color,
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$graph['backgroundColor'] = $backgroundColor;
$graph['unit'] = $unit;
$id_graph = serialize_in_temp($graph, null, $ttl);

View File

@ -111,6 +111,9 @@ if (isset($graph['force_height'])) {
if (isset($graph['period'])) {
$period = $graph['period'];
}
if (isset($graph['unit'])){
$unit = $graph['unit'];
}
if (!$force_height) {
if ($height < (count($graph['data']) * 14)) {
@ -307,7 +310,7 @@ switch($graph_type) {
case 'line':
pch_vertical_graph($graph_type, $data_keys, $data_values, $width,
$height, $rgb_color, $xaxisname, $yaxisname, false, $legend,
$font, $antialiasing, $water_mark, $font_size, $backgroundColor);
$font, $antialiasing, $water_mark, $font_size, $backgroundColor, $unit);
break;
case 'threshold':
pch_threshold_graph($graph_type, $data_keys, $data_values, $width,
@ -625,7 +628,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
$legend = array(), $font, $antialiasing, $water_mark = '', $font_size,
$backgroundColor = 'white') {
$backgroundColor = 'white', $unit = '') {
/* CAT:Vertical Charts */
if (!is_array($legend) || empty($legend)) {
@ -692,7 +695,8 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$MyData->setSerieWeight($point_id, 0);
}
$MyData->setAxisUnit(0, $unit);
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC);
//$MyData->addPoints($data,"Yaxis");
$MyData->setAxisName(0,$yaxisname);
$MyData->addPoints($index,"Xaxis");

View File

@ -2783,12 +2783,12 @@
if ( $Mode == AXIS_FORMAT_METRIC )
{
if (abs($Value) > 1000000000)
return(round($Value/1000000000,$Format)."g".$Unit);
if (abs($Value) > 1000000)
return(round($Value/1000000,$Format)."m".$Unit);
if (abs($Value) >= 1000000000)
return(round($Value/1000000000,$Format)." G ".$Unit);
if (abs($Value) >= 1000000)
return(round($Value/1000000,$Format)." M ".$Unit);
elseif (abs($Value) >= 1000)
return(round($Value/1000,$Format)."k".$Unit);
return(round($Value/1000,$Format)." K ".$Unit);
}
return($Value.$Unit);