@@ -67,11 +67,11 @@ public function initGraph($options)
6767 $ width = $ this ->width + 100 ;
6868
6969 if (!isset ($ _REQUEST ['date1 ' . $ randname ])) {
70- $ _REQUEST ['date1 ' . $ randname ] = strftime ( ' %Y-%m-% d ' , time ()
70+ $ _REQUEST ['date1 ' . $ randname ] = date ( ' Y-m- d ' , time ()
7171 - ($ options ['delay ' ] * 24 * 60 * 60 ));
7272 }
7373 if (!isset ($ _REQUEST ['date2 ' . $ randname ])) {
74- $ _REQUEST ['date2 ' . $ randname ] = strftime ( ' %Y-%m-% d ' );
74+ $ _REQUEST ['date2 ' . $ randname ] = date ( ' Y-m- d ' );
7575 }
7676
7777 $ backtrace = debug_backtrace ();
@@ -404,13 +404,13 @@ public function imageSmoothAlphaLine($image, $x1, $y1, $x2, $y2, $dcol)
404404 continue ;
405405 }
406406
407- $ trgb = ImageColorAt ($ image , $ x , (int ) floor ($ y ));
407+ $ trgb = ImageColorAt ($ image , ( int ) floor ( $ x ) , (int ) floor ($ y ));
408408 $ tcr = ($ trgb >> 16 ) & 0xFF ;
409409 $ tcg = ($ trgb >> 8 ) & 0xFF ;
410410 $ tcb = $ trgb & 0xFF ;
411411 imagesetpixel (
412412 $ image ,
413- $ x ,
413+ ( int ) floor ( $ x ) ,
414414 (int ) floor ($ y ),
415415 imagecolorallocatealpha (
416416 $ image ,
@@ -421,13 +421,13 @@ public function imageSmoothAlphaLine($image, $x1, $y1, $x2, $y2, $dcol)
421421 ),
422422 );
423423
424- $ trgb = ImageColorAt ($ image , $ x , (int ) ceil ($ y ));
424+ $ trgb = ImageColorAt ($ image , ( int ) ceil ( $ x ) , (int ) ceil ($ y ));
425425 $ tcr = ($ trgb >> 16 ) & 0xFF ;
426426 $ tcg = ($ trgb >> 8 ) & 0xFF ;
427427 $ tcb = $ trgb & 0xFF ;
428428 imagesetpixel (
429429 $ image ,
430- $ x ,
430+ ( int ) ceil ( $ x ) ,
431431 (int ) ceil ($ y ),
432432 imagecolorallocatealpha (
433433 $ image ,
@@ -681,9 +681,9 @@ public function showHbar($params, $dashboard = false, $width = false)
681681 $ index = 0 ;
682682 foreach ($ datas as $ label => $ data ) {
683683 $ bx1 = 250 ;
684- $ by1 = ( $ index + 1 ) * 1.25 * $ height_bar + .05 * $ height + 2 ;
684+ $ by1 = round (( $ index + 1 ) * 1.25 * $ height_bar + .05 * $ height + 2 ) ;
685685 $ bx2 = $ bx1 + round (($ data * ($ width - 300 )) / $ max );
686- $ by2 = $ by1 + $ height_bar ;
686+ $ by2 = round ( $ by1 + $ height_bar) ;
687687
688688 //createbar
689689 ImageFilledRectangle ($ image , $ bx1 , (int ) $ by1 , (int ) $ bx2 , (int ) $ by2 , hexdec ($ palette [$ index ]));
@@ -922,8 +922,8 @@ public function showPie($params, $dashboard = false, $width = false)
922922
923923 //text associated with pie arc (only for angle > 2°)
924924 if ($ angle > 2 && ($ show_label == 'always ' || $ show_label == 'hover ' )) {
925- $ xtext = $ x - 1 + cos (deg2rad (($ start_angle + $ angle ) / 2 )) * ($ radius / 1.7 );
926- $ ytext = $ y + 5 - sin (deg2rad (($ start_angle + $ angle ) / 2 )) * ($ radius / 1.7 );
925+ $ xtext = round ( $ x - 1 + cos (deg2rad (($ start_angle + $ angle ) / 2 )) * ($ radius / 1.7 ) );
926+ $ ytext = round ( $ y + 5 - sin (deg2rad (($ start_angle + $ angle ) / 2 )) * ($ radius / 1.7 ) );
927927 imagettftext (
928928 $ image ,
929929 $ this ->fontsize ,
@@ -1274,12 +1274,12 @@ public function drawSunburstLevel($image, $datas, $params = [])
12741274 //define label position
12751275 if (is_array ($ data )) {
12761276 //show label inside its arc
1277- $ xtext = $ x - $ dx * $ tw + cos ($ amr ) * (0.5 * $ radius - $ step / 3 );
1278- $ ytext = $ y + $ dy * $ th - sin ($ amr ) * (0.5 * $ radius - $ step / 4 );
1277+ $ xtext = round ( $ x - $ dx * $ tw + cos ($ amr ) * (0.5 * $ radius - $ step / 3 ) );
1278+ $ ytext = round ( $ y + $ dy * $ th - sin ($ amr ) * (0.5 * $ radius - $ step / 4 ) );
12791279 } else {
12801280 //show label outside of its arc
1281- $ xtext = $ x + 3 - $ dx * $ tw + cos ($ amr ) * (0.5 * $ radius + $ step / 16 );
1282- $ ytext = $ y + $ dy * $ th - sin ($ amr ) * (0.5 * $ radius + $ step / 8 );
1281+ $ xtext = round ( $ x + 3 - $ dx * $ tw + cos ($ amr ) * (0.5 * $ radius + $ step / 16 ) );
1282+ $ ytext = round ( $ y + $ dy * $ th - sin ($ amr ) * (0.5 * $ radius + $ step / 8 ) );
12831283 }
12841284
12851285 //draw label
@@ -1310,8 +1310,8 @@ public function drawSunburstLevel($image, $datas, $params = [])
13101310 $ th = abs ($ box [5 ] - $ box [1 ]);
13111311
13121312 //define label position
1313- $ xtext = $ x - $ dx * $ tw + cos ($ samr ) * (0.5 * $ radius - $ step / 8 );
1314- $ ytext = $ y + $ dy * $ th - sin ($ samr ) * (0.5 * $ radius - $ step / 16 );
1313+ $ xtext = round ( $ x - $ dx * $ tw + cos ($ samr ) * (0.5 * $ radius - $ step / 8 ) );
1314+ $ ytext = round ( $ y + $ dy * $ th - sin ($ samr ) * (0.5 * $ radius - $ step / 16 ) );
13151315
13161316 //draw label
13171317 imagettftext (
@@ -1715,10 +1715,10 @@ public function showVstackbar($params, $dashboard = false, $width = false)
17151715 if ($ dashboard ) {
17161716 $ height = 350 ;
17171717 }
1718- $ x_bar = (0.85 * $ this ->width / $ nb_bar );
1719- $ width_bar = $ x_bar * .85 ;
1720- $ y_labels_width = .1 * $ this ->width ;
1721- $ x_labels_height = $ height - 0.95 * $ height ;
1718+ $ x_bar = round (0.85 * $ this ->width / $ nb_bar );
1719+ $ width_bar = round ( $ x_bar * .85 ) ;
1720+ $ y_labels_width = round ( .1 * $ this ->width ) ;
1721+ $ x_labels_height = round ( $ height - 0.95 * $ height) ;
17221722 $ legend_height = $ nb_labels2 * 15 + 10 ;
17231723
17241724 //longueur du texte en dessous des barres
@@ -1753,8 +1753,8 @@ public function showVstackbar($params, $dashboard = false, $width = false)
17531753 //draw x-axis grey step line and values ticks
17541754 $ xstep = round (($ height - $ legend_height - $ x_labels_height ) / 12 );
17551755 for ($ i = 0 ; $ i <= 12 ; $ i ++) {
1756- $ yaxis = $ height - $ x_labels_height - $ xstep * $ i ;
1757- imageLine ($ image , (int ) (.9 * $ y_labels_width ), (int ) $ yaxis , (int ) (0.95 * $ this ->width ), (int ) $ yaxis , hexdec ($ this ->grey ));
1756+ $ yaxis = round ( $ height - $ x_labels_height - $ xstep * $ i) ;
1757+ imageLine ($ image , (int ) round (.9 * $ y_labels_width ), (int ) $ yaxis , (int ) round (0.95 * $ this ->width ), (int ) $ yaxis , hexdec ($ this ->grey ));
17581758
17591759 //value label
17601760 $ val = round ($ i * $ cum / 12 , 1 );
@@ -1822,7 +1822,7 @@ public function showVstackbar($params, $dashboard = false, $width = false)
18221822 foreach ($ data as $ subdata ) {
18231823 $ by1 = $ by2 ;
18241824 $ bx1 = $ y_labels_width + $ index1 * $ x_bar ;
1825- $ by2 = $ by1 - $ subdata * ($ height - $ legend_height - $ x_labels_height ) / $ cum ;
1825+ $ by2 = round ( $ by1 - $ subdata * ($ height - $ legend_height - $ x_labels_height ) / $ cum) ;
18261826 $ bx2 = $ bx1 + $ width_bar ;
18271827
18281828 if ($ by1 != $ by2 ) { // no draw for empty datas
@@ -1855,7 +1855,7 @@ public function showVstackbar($params, $dashboard = false, $width = false)
18551855 $ textwidth = abs ($ box [4 ] - $ box [6 ]);
18561856 $ textwidth = abs (sqrt ((pow ($ textwidth , 2 ) / 2 )));
18571857
1858- $ lx = $ y_labels_width + $ index1 * $ x_bar + ($ width_bar / 2.5 );
1858+ $ lx = round ( $ y_labels_width + $ index1 * $ x_bar + ($ width_bar / 2.5 ) );
18591859 imagettftext (
18601860 $ image ,
18611861 $ this ->fontsize - 1 ,
@@ -2030,7 +2030,7 @@ public function showArea($params, $dashboard = false, $width = false)
20302030 $ nb = count ($ datas );
20312031 $ width = $ this ->width ;
20322032 $ height = 350 ;
2033- $ width_line = ($ width - 45 ) / $ nb ;
2033+ $ width_line = (int ) round (( $ width - 45 ) / $ nb) ;
20342034 $ step = ceil ($ nb / 20 );
20352035
20362036 //create image
@@ -2125,9 +2125,9 @@ public function showArea($params, $dashboard = false, $width = false)
21252125
21262126 // determine coords
21272127 $ x1 = $ index * $ width_line - $ width_line + 30 ;
2128- $ y1 = $ height - 30 - $ old_data * ($ height - 85 ) / $ max ;
2128+ $ y1 = floor ( $ height - 30 - $ old_data * ($ height - 85 ) / $ max) ;
21292129 $ x2 = $ x1 + $ width_line ;
2130- $ y2 = $ height - 30 - $ data * ($ height - 85 ) / $ max ;
2130+ $ y2 = floor ( $ height - 30 - $ data * ($ height - 85 ) / $ max) ;
21312131 $ aCoords [$ x1 ] = $ y1 ;
21322132
21332133 //in case of area chart fill under point space
@@ -2170,9 +2170,9 @@ public function showArea($params, $dashboard = false, $width = false)
21702170
21712171 // determine coords
21722172 $ x1 = $ index * $ width_line - $ width_line + 30 ;
2173- $ y1 = $ height - 30 - $ old_data * ($ height - 85 ) / $ max ;
2173+ $ y1 = ( int ) floor ( $ height - 30 - $ old_data * ($ height - 85 ) / $ max) ;
21742174 $ x2 = $ x1 + $ width_line ;
2175- $ y2 = $ height - 30 - $ data * ($ height - 85 ) / $ max ;
2175+ $ y2 = ( int ) floor ( $ height - 30 - $ data * ($ height - 85 ) / $ max) ;
21762176
21772177 //trace dots
21782178 $ color_rbg = self ::colorHexToRGB ($ darkerpalette [0 ]);
@@ -2372,7 +2372,7 @@ public function showGArea($params, $dashboard = false, $width = false)
23722372 $ nb_bar = count ($ labels2 );
23732373 $ nb_labels2 = count ($ datas );
23742374
2375- $ width_line = ($ this ->width - 45 ) / $ nb ;
2375+ $ width_line = (int ) floor (( $ this ->width - 45 ) / $ nb) ;
23762376 $ index1 = 0 ;
23772377 $ index3 = 1 ;
23782378 $ step = ceil ($ nb / 21 );
@@ -2479,10 +2479,10 @@ public function showGArea($params, $dashboard = false, $width = false)
24792479 }
24802480
24812481 // determine coords
2482- $ x1 = $ index2 * $ width_line - $ width_line + $ x_bar ;
2483- $ y1 = $ height - $ x_labels_height - $ old_data * ($ height - $ legend_height - $ x_labels_height ) / $ max ;
2482+ $ x1 = $ index2 * $ width_line - $ width_line + $ x_bar ;
2483+ $ y1 = ( int ) round ( $ height - $ x_labels_height - $ old_data * ($ height - $ legend_height - $ x_labels_height ) / $ max) ;
24842484 $ x2 = $ x1 + $ width_line ;
2485- $ y2 = $ height - $ x_labels_height - $ subdata * ($ height - $ legend_height - $ x_labels_height ) / $ max ;
2485+ $ y2 = ( int ) round ( $ height - $ x_labels_height - $ subdata * ($ height - $ legend_height - $ x_labels_height ) / $ max) ;
24862486
24872487 //in case of area chart fill under point space
24882488 if ($ area > 0 ) {
0 commit comments