1<?php 2// Copyright (c) 2011-2011 Ártica Soluciones Tecnológicas 3// http://www.artica.es <info@artica.es> 4 5// This program is free software; you can redistribute it and/or 6// modify it under the terms of the GNU General Public License 7// as published by the Free Software Foundation; version 2 8// This program is distributed in the hope that it will be useful, 9// but WITHOUT ANY WARRANTY; without even the implied warranty of 10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11// GNU General Public License for more details. 12 13$ttl = 1; 14$homeurl = ''; 15 16if (isset($_GET['homeurl'])) { 17 $homeurl = $_GET['homeurl']; 18} 19else $homeurl = ''; 20 21$homeurl = ((bool)filter_var($homeurl, FILTER_VALIDATE_URL) == 1) ? '' : $homeurl; 22 23if (isset($_GET['ttl'])) { 24 $ttl = $_GET['ttl']; 25} 26else $ttl_param = 1; 27 28if (isset($_GET['graph_type'])) { 29 $graph_type = $_GET['graph_type']; 30} 31else $graph_type = ''; 32 33//$graph_type = get_parameter('graph_type', ''); 34//$ttl_param = get_parameter('ttl', 1); 35//$homeurl_param = get_parameter('homeurl', ''); 36 37// Turn on output buffering. 38// The entire buffer will be discarded later so that any accidental output 39// does not corrupt images generated by fgraph. 40ob_start (); 41 42if (!empty($graph_type)) { 43 include_once($homeurl . 'include/functions.php'); 44 include_once($homeurl . 'include/functions_html.php'); 45 46 include_once($homeurl . 'include/graphs/functions_gd.php'); 47 include_once($homeurl . 'include/graphs/functions_utils.php'); 48 include_once($homeurl . 'include/graphs/functions_d3.php'); 49} 50 51// Clean the output buffer and turn off output buffering 52ob_end_clean (); 53 54switch($graph_type) { 55 case 'histogram': 56 $width = get_parameter('width'); 57 $height = get_parameter('height'); 58 $font = get_parameter('font'); 59 $data = json_decode(io_safe_output(get_parameter('data')), true); 60 61 $max = get_parameter('max'); 62 $title = get_parameter('title'); 63 $mode = get_parameter ('mode', 1); 64 gd_histogram ($width, $height, $mode, $data, $max, $font, $title); 65 break; 66 case 'progressbar': 67 $width = get_parameter('width'); 68 $height = get_parameter('height'); 69 $progress = get_parameter('progress'); 70 71 $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false)); 72 $out_of_lim_image = get_parameter('out_of_lim_image', false); 73 74 $font = get_parameter('font'); 75 $title = get_parameter('title'); 76 77 $mode = get_parameter('mode', 1); 78 79 $fontsize = get_parameter('fontsize', 10); 80 81 $value_text = get_parameter('value_text', ''); 82 $colorRGB = get_parameter('colorRGB', ''); 83 84 gd_progress_bar ($width, $height, $progress, $title, $font, 85 $out_of_lim_str, $out_of_lim_image, $mode, $fontsize, 86 $value_text, $colorRGB); 87 break; 88 case 'progressbubble': 89 $width = get_parameter('width'); 90 $height = get_parameter('height'); 91 $progress = get_parameter('progress'); 92 93 $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false)); 94 $out_of_lim_image = get_parameter('out_of_lim_image', false); 95 96 $font = get_parameter('font'); 97 $title = get_parameter('title'); 98 99 $mode = get_parameter('mode', 1); 100 101 $fontsize = get_parameter('fontsize', 7); 102 103 $value_text = get_parameter('value_text', ''); 104 $colorRGB = get_parameter('colorRGB', ''); 105 106 gd_progress_bubble ($width, $height, $progress, $title, $font, 107 $out_of_lim_str, $out_of_lim_image, $mode, $fontsize, 108 $value_text, $colorRGB); 109 break; 110} 111 112function histogram($chart_data, $width, $height, $font, $max, $title, 113 $mode, $ttl = 1) { 114 115 $graph = array(); 116 $graph['data'] = $chart_data; 117 $graph['width'] = $width; 118 $graph['height'] = $height; 119 $graph['font'] = $font; 120 $graph['max'] = $max; 121 $graph['title'] = $title; 122 $graph['mode'] = $mode; 123 124 $id_graph = serialize_in_temp($graph, null, $ttl); 125 126 return "<img src='include/graphs/functions_gd.php?static_graph=1&graph_type=histogram&ttl=".$ttl."&id_graph=".$id_graph."'>"; 127} 128 129function progressbar($progress, $width, $height, $title, $font, 130 $mode = 1, $out_of_lim_str = false, $out_of_lim_image = false, 131 $ttl = 1) { 132 133 $graph = array(); 134 135 $graph['progress'] = $progress; 136 $graph['width'] = $width; 137 $graph['height'] = $height; 138 $graph['out_of_lim_str'] = $out_of_lim_str; 139 $graph['out_of_lim_image'] = $out_of_lim_image; 140 $graph['title'] = $title; 141 $graph['font'] = $font; 142 $graph['mode'] = $mode; 143 144 $id_graph = serialize_in_temp($graph, null, $ttl); 145 146 return "<img src='include/graphs/functions_gd.php?static_graph=1&graph_type=progressbar&ttl=".$ttl."&id_graph=".$id_graph."'>"; 147} 148 149 150function slicesbar_graph($chart_data, $period, $width, $height, $colors, 151 $font, $round_corner, $home_url = '', $ttl = 1) { 152 153 $graph = array(); 154 $graph['data'] = $chart_data; 155 $graph['period'] = $period; 156 $graph['width'] = $width; 157 $graph['height'] = $height; 158 $graph['font'] = $font; 159 $graph['round_corner'] = $round_corner; 160 $graph['color'] = $colors; 161 162 $id_graph = serialize_in_temp($graph, null, $ttl); 163 164 return "<img src='".$home_url."include/graphs/functions_pchart.php?static_graph=1&graph_type=slicebar&ttl=".$ttl."&id_graph=".$id_graph."'>"; 165} 166 167function vbar_graph($flash_chart, $chart_data, $width, $height, 168 $color, $legend, $long_index, $no_data_image, $xaxisname = "", 169 $yaxisname = "", $water_mark = "", $font = '', $font_size = '', 170 $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') { 171 172 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 173 174 if (empty($chart_data)) { 175 return '<img src="' . $no_data_image . '" />'; 176 } 177 178 if ($flash_chart) { 179 return flot_vcolumn_chart ($chart_data, $width, $height, $color, 180 $legend, $long_index, $homeurl, $unit, $water_mark_url, 181 $homedir); 182 } 183 else { 184 $graph = array(); 185 $graph['data'] = $chart_data; 186 $graph['width'] = $width; 187 $graph['height'] = $height; 188 $graph['color'] = $color; 189 $graph['legend'] = $legend; 190 $graph['xaxisname'] = $xaxisname; 191 $graph['yaxisname'] = $yaxisname; 192 $graph['water_mark'] = $water_mark_file; 193 $graph['font'] = $font; 194 $graph['font_size'] = $font_size; 195 196 $id_graph = serialize_in_temp($graph, null, $ttl); 197 198 return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=vbar&ttl=".$ttl."&id_graph=".$id_graph."'>"; 199 } 200} 201 202// NOT USED ACTUALLY 203function threshold_graph($flash_chart, $chart_data, $width, $height, 204 $ttl = 1) { 205 206 if ($flash_chart) { 207 return flot_area_simple_graph($chart_data, $width, $height); 208 } 209 else { 210 echo "<img src='include/graphs/functions_pchart.php?static_graph=1&graph_type=threshold&ttl=".$ttl."&data=".json_encode($chart_data)."&width=".$width."&height=".$height."'>"; 211 } 212} 213 214function area_graph($flash_chart, $chart_data, $width, $height, $color, 215 $legend, $long_index, $no_data_image, $xaxisname = "", 216 $yaxisname = "", $homeurl="", $water_mark = "", $font = '', 217 $font_size = '', $unit = '', $ttl = 1, $series_type = array(), 218 $chart_extra_data = array(), $yellow_threshold = 0, 219 $red_threshold = 0, $adapt_key = '', $force_integer = false, 220 $series_suffix_str = '', $menu = true, $backgroundColor = 'white', 221 $dashboard = false, $vconsole = false, $agent_module_id = 0) { 222 223 224 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 225 226 // ATTENTION: The min size is in constants.php 227 // It's not the same minsize for all graphs, but we are choosed a prudent minsize for all 228 if ($height <= CHART_DEFAULT_HEIGHT) { 229 $height = CHART_DEFAULT_HEIGHT; 230 } 231 if ($width < CHART_DEFAULT_WIDTH) { 232 $width = CHART_DEFAULT_WIDTH; 233 } 234 235 if (empty($chart_data)) { 236 return graph_nodata_image($width, $height); 237 return '<img src="' . $no_data_image . '" />'; 238 } 239 240 if ($flash_chart) { 241 return flot_area_simple_graph( 242 $chart_data, 243 $width, 244 $height, 245 $color, 246 $legend, 247 $long_index, 248 $homeurl, 249 $unit, 250 $water_mark_url, 251 $series_type, 252 $chart_extra_data, 253 $yellow_threshold, 254 $red_threshold, 255 $adapt_key, 256 $force_integer, 257 $series_suffix_str, 258 $menu, 259 $backgroundColor, 260 $dashboard, 261 false, 262 $agent_module_id); 263 } 264 else { 265 if ($vconsole) { 266 return flot_area_simple_graph( 267 $chart_data, 268 $width, 269 $height, 270 $color, 271 $legend, 272 $long_index, 273 $homeurl, 274 $unit, 275 $water_mark_url, 276 $series_type, 277 $chart_extra_data, 278 $yellow_threshold, 279 $red_threshold, 280 $adapt_key, 281 $force_integer, 282 $series_suffix_str, 283 $menu, 284 $backgroundColor, 285 $dashboard, 286 $vconsole, 287 $agent_module_id); 288 } 289 else { 290 $graph = array(); 291 $graph['data'] = $chart_data; 292 $graph['width'] = $width; 293 $graph['height'] = $height; 294 $graph['color'] = $color; 295 $graph['legend'] = $legend; 296 $graph['xaxisname'] = $xaxisname; 297 $graph['yaxisname'] = $yaxisname; 298 $graph['water_mark'] = $water_mark_file; 299 $graph['font'] = $font; 300 $graph['font_size'] = $font_size; 301 $graph['backgroundColor'] = $backgroundColor; 302 $graph['unit'] = $unit; 303 $graph['series_type'] = $series_type; 304 305 $id_graph = serialize_in_temp($graph, null, $ttl); 306 // Warning: This string is used in the function "api_get_module_graph" from 'functions_api.php' with the regec patern "/<img src='(.+)'>/" 307 return "<img src='" . 308 ui_get_full_url (false, false, false, false) . 309 "include/graphs/functions_pchart.php?" . 310 "static_graph=1&" . 311 "graph_type=area&" . 312 "ttl=" . $ttl . "&" . 313 "id_graph=" . $id_graph . "'>"; 314 } 315 } 316} 317 318function stacked_area_graph($flash_chart, $chart_data, $width, $height, 319 $color, $legend, $long_index, $no_data_image, $xaxisname = "", 320 $yaxisname = "", $water_mark = "", $font = '', $font_size = '', 321 $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white', 322 $dashboard = false, $vconsole = false, $agent_module_id) { 323 324 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 325 326 if (empty($chart_data)) { 327 return '<img src="' . $no_data_image . '" />'; 328 } 329 330 if ($flash_chart) { 331 return flot_area_stacked_graph( 332 $chart_data, 333 $width, 334 $height, 335 $color, 336 $legend, 337 $long_index, 338 $homeurl, 339 $unit, 340 $water_mark_url, 341 array(), 342 array(), 343 0, 344 0, 345 '', 346 false, 347 '', 348 true, 349 $backgroundColor, 350 $dashboard); 351 } 352 else { 353 if ($vconsole) { 354 return flot_area_stacked_graph( 355 $chart_data, 356 $width, 357 $height, 358 $color, 359 $legend, 360 $long_index, 361 $homeurl, 362 $unit, 363 $water_mark_url, 364 array(), 365 array(), 366 0, 367 0, 368 '', 369 false, 370 '', 371 true, 372 $backgroundColor, 373 $dashboard, 374 $vconsole, 375 $agent_module_id); 376 } 377 else { 378 //Stack the data 379 stack_data($chart_data, $legend, $color); 380 381 $graph = array(); 382 $graph['data'] = $chart_data; 383 $graph['width'] = $width; 384 $graph['height'] = $height; 385 $graph['color'] = $color; 386 $graph['legend'] = $legend; 387 $graph['xaxisname'] = $xaxisname; 388 $graph['yaxisname'] = $yaxisname; 389 $graph['water_mark'] = $water_mark_file; 390 $graph['font'] = $font; 391 $graph['font_size'] = $font_size; 392 $graph['backgroundColor'] = $backgroundColor; 393 394 $id_graph = serialize_in_temp($graph, null, $ttl); 395 396 return "<img src='" . ui_get_full_url (false, false, false, false) . 397 "include/graphs/functions_pchart.php?static_graph=1&graph_type=stacked_area&ttl=".$ttl."&id_graph=" . $id_graph . "' />"; 398 } 399 } 400} 401 402function stacked_line_graph($flash_chart, $chart_data, $width, $height, 403 $color, $legend, $long_index, $no_data_image, $xaxisname = "", 404 $yaxisname = "", $water_mark = "", $font = '', $font_size = '', 405 $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white', 406 $dashboard = false, $vconsole = false) { 407 408 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 409 410 if (empty($chart_data)) { 411 return '<img src="' . $no_data_image . '" />'; 412 } 413 414 415 if ($flash_chart) { 416 return flot_line_stacked_graph( 417 $chart_data, 418 $width, 419 $height, 420 $color, 421 $legend, 422 $long_index, 423 $homeurl, 424 $unit, 425 $water_mark_url, 426 array(), 427 array(), 428 0, 429 0, 430 '', 431 false, 432 '', 433 true, 434 $background_color, 435 $dashboard); 436 } 437 else { 438 if ($vconsole) { 439 return flot_line_stacked_graph( 440 $chart_data, 441 $width, 442 $height, 443 $color, 444 $legend, 445 $long_index, 446 $homeurl, 447 $unit, 448 $water_mark_url, 449 array(), 450 array(), 451 0, 452 0, 453 '', 454 false, 455 '', 456 true, 457 $background_color, 458 $dashboard, 459 $vconsole); 460 } 461 else { 462 //Stack the data 463 stack_data($chart_data, $legend, $color); 464 465 $graph = array(); 466 $graph['data'] = $chart_data; 467 $graph['width'] = $width; 468 $graph['height'] = $height; 469 $graph['color'] = $color; 470 $graph['legend'] = $legend; 471 $graph['xaxisname'] = $xaxisname; 472 $graph['yaxisname'] = $yaxisname; 473 $graph['water_mark'] = $water_mark_file; 474 $graph['font'] = $font; 475 $graph['font_size'] = $font_size; 476 $graph['backgroundColor'] = $backgroundColor; 477 478 $id_graph = serialize_in_temp($graph, null, $ttl); 479 480 return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />"; 481 } 482 } 483} 484 485function stacked_bullet_chart($flash_chart, $chart_data, $width, $height, 486 $color, $legend, $long_index, $no_data_image, $xaxisname = "", 487 $yaxisname = "", $water_mark = "", $font = '', $font_size = '', 488 $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') { 489 490 include_once('functions_d3.php'); 491 492 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 493 494 if (empty($chart_data)) { 495 return '<img src="' . $no_data_image . '" />'; 496 } 497 498 return d3_bullet_chart( 499 $chart_data, 500 $width, 501 $height, 502 $color, 503 $legend, 504 $homeurl, 505 $unit, 506 $font, 507 $font_size 508 ); 509} 510 511function stacked_gauge($flash_chart, $chart_data, $width, $height, 512 $color, $legend, $long_index, $no_data_image, $xaxisname = "", 513 $yaxisname = "", $water_mark = "", $font = '', $font_size = '', 514 $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') { 515 516 include_once('functions_d3.php'); 517 518 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 519 520 if (empty($chart_data)) { 521 return '<img src="' . $no_data_image . '" />'; 522 } 523 524 return d3_gauges( 525 $chart_data, 526 $width, 527 $height, 528 $color, 529 $legend, 530 $homeurl, 531 $unit, 532 $font, 533 $font_size + 2, 534 $no_data_image 535 ); 536} 537 538function line_graph($flash_chart, $chart_data, $width, $height, $color, 539 $legend, $long_index, $no_data_image, $xaxisname = "", 540 $yaxisname = "", $water_mark = "", $font = '', $font_size = '', 541 $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white', 542 $dashboard = false, $vconsole = false) { 543 544 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 545 546 if (empty($chart_data)) { 547 return '<img src="' . $no_data_image . '" />'; 548 } 549 550 if ($flash_chart) { 551 return flot_line_simple_graph( 552 $chart_data, 553 $width, 554 $height, 555 $color, 556 $legend, 557 $long_index, 558 $homeurl, 559 $unit, 560 $water_mark_url, 561 array(), 562 array(), 563 0, 564 0, 565 '', 566 false, 567 '', 568 true, 569 $backgroundColor, 570 $dashboard); 571 } 572 else { 573 if ($vconsole) { 574 return flot_line_simple_graph( 575 $chart_data, 576 $width, 577 $height, 578 $color, 579 $legend, 580 $long_index, 581 $homeurl, 582 $unit, 583 $water_mark_url, 584 array(), 585 array(), 586 0, 587 0, 588 '', 589 false, 590 '', 591 true, 592 $backgroundColor, 593 $dashboard, 594 $vconsole); 595 } 596 else { 597 $graph = array(); 598 $graph['data'] = $chart_data; 599 $graph['width'] = $width; 600 $graph['height'] = $height; 601 $graph['color'] = $color; 602 $graph['legend'] = $legend; 603 $graph['xaxisname'] = $xaxisname; 604 $graph['yaxisname'] = $yaxisname; 605 $graph['water_mark'] = $water_mark_file; 606 $graph['font'] = $font; 607 $graph['font_size'] = $font_size; 608 $graph['backgroundColor'] = $backgroundColor; 609 610 $id_graph = serialize_in_temp($graph, null, $ttl); 611 612 return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=line&ttl=".$ttl."&id_graph=" . $id_graph . "' />"; 613 } 614 } 615} 616 617function kiviat_graph($graph_type, $flash_chart, $chart_data, $width, 618 $height, $no_data_image, $ttl = 1, $homedir="") { 619 620 if (empty($chart_data)) { 621 return '<img src="' . $no_data_image . '" />'; 622 } 623 624 $graph = array(); 625 $graph['data'] = $chart_data; 626 $graph['width'] = $width; 627 $graph['height'] = $height; 628 629 $id_graph = serialize_in_temp($graph, null, $ttl); 630 631 return "<img src='".$homedir."include/graphs/functions_pchart.php?static_graph=1&graph_type=".$graph_type."&ttl=".$ttl."&id_graph=" . $id_graph . "' />"; 632} 633 634function radar_graph($flash_chart, $chart_data, $width, $height, 635 $no_data_image, $ttl = 1, $homedir="") { 636 637 return kiviat_graph('radar', $flash_chart, $chart_data, $width, 638 $height, $no_data_image, $ttl, $homedir); 639} 640 641function polar_graph($flash_chart, $chart_data, $width, $height, 642 $no_data_image, $ttl = 1, $homedir="") { 643 644 return kiviat_graph('polar', $flash_chart, $chart_data, $width, 645 $height, $no_data_image, $ttl, $homedir=""); 646} 647 648 649function hbar_graph($flash_chart, $chart_data, $width, $height, 650 $color, $legend, $long_index, $no_data_image, $xaxisname = "", 651 $yaxisname = "", $water_mark = "", $font = '', $font_size = '', 652 $unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white') { 653 654 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 655 656 if (empty($chart_data)) { 657 return '<img src="' . $no_data_image . '" />'; 658 } 659 660 if ($flash_chart) { 661 return flot_hcolumn_chart( 662 $chart_data, $width, $height, $water_mark_url); 663 } 664 else { 665 $graph = array(); 666 $graph['data'] = $chart_data; 667 $graph['width'] = $width; 668 $graph['height'] = $height; 669 $graph['color'] = $color; 670 $graph['legend'] = $legend; 671 $graph['xaxisname'] = $xaxisname; 672 $graph['yaxisname'] = $yaxisname; 673 $graph['force_height'] = $force_height; 674 $graph['water_mark'] = $water_mark_file; 675 $graph['font'] = $font; 676 $graph['font_size'] = $font_size; 677 $graph['force_steps'] = $force_steps; 678 679 $id_graph = serialize_in_temp($graph, null, $ttl); 680 681 return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=hbar&ttl=".$ttl."&id_graph=".$id_graph."'>"; 682 } 683} 684 685function pie3d_graph($flash_chart, $chart_data, $width, $height, 686 $others_str = "other", $homedir = "", $water_mark = "", $font = '', 687 $font_size = '', $ttl = 1, $legend_position = false, $colors = '') { 688 689 return pie_graph('3d', $flash_chart, $chart_data, $width, $height, 690 $others_str, $homedir, $water_mark, $font, $font_size, $ttl, 691 $legend_position, $colors); 692} 693 694function pie2d_graph($flash_chart, $chart_data, $width, $height, 695 $others_str = "other", $homedir="", $water_mark = "", $font = '', 696 $font_size = '', $ttl = 1, $legend_position = false, $colors = '') { 697 698 return pie_graph('2d', $flash_chart, $chart_data, $width, $height, 699 $others_str, $homedir, $water_mark, $font, $font_size, $ttl, 700 $legend_position, $colors); 701} 702 703function pie_graph($graph_type, $flash_chart, $chart_data, $width, 704 $height, $others_str = "other", $homedir="", $water_mark = "", 705 $font = '', $font_size = '', $ttl = 1, $legend_position = false, 706 $colors = '') { 707 708 if (empty($chart_data)) { 709 return graph_nodata_image($width, $height, 'pie'); 710 } 711 712 setup_watermark($water_mark, $water_mark_file, $water_mark_url); 713 714 // This library allows only 8 colors 715 $max_values = 5; 716 717 //Remove the html_entities 718 $temp = array(); 719 foreach ($chart_data as $key => $value) { 720 $temp[io_safe_output($key)] = $value; 721 } 722 $chart_data = $temp; 723 724 if (count($chart_data) > $max_values) { 725 $chart_data_trunc = array(); 726 $n = 1; 727 foreach ($chart_data as $key => $value) { 728 if ($n < $max_values) { 729 $chart_data_trunc[$key] = $value; 730 } 731 else { 732 if (!isset($chart_data_trunc[$others_str])) { 733 $chart_data_trunc[$others_str] = 0; 734 } 735 $chart_data_trunc[$others_str] += $value; 736 } 737 $n++; 738 } 739 $chart_data = $chart_data_trunc; 740 } 741 742 if ($flash_chart) { 743 return flot_pie_chart(array_values($chart_data), 744 array_keys($chart_data), $width, $height, $water_mark_url, 745 $font, $font_size, $legend_position, $colors); 746 } 747 else { 748 //TODO SET THE LEGEND POSITION 749 750 $graph = array(); 751 $graph['data'] = $chart_data; 752 $graph['width'] = $width; 753 $graph['height'] = $height; 754 $graph['water_mark'] = $water_mark_file; 755 $graph['font'] = $font; 756 $graph['font_size'] = $font_size; 757 $graph['legend_position'] = $legend_position; 758 $graph['color'] = $colors; 759 760 $id_graph = serialize_in_temp($graph, null, $ttl); 761 762 switch ($graph_type) { 763 case "2d": 764 return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=pie2d&ttl=".$ttl."&id_graph=".$id_graph."'>"; 765 break; 766 case "3d": 767 return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=pie3d&ttl=".$ttl."&id_graph=".$id_graph."'>"; 768 break; 769 } 770 } 771} 772 773?> 774