@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param $breadcrumb |
| 33 | 33 | * An array containing the breadcrumb links. |
| 34 | 34 | * @return |
| 35 | - * A string containing the breadcrumb output. |
|
| 35 | + string A string containing the breadcrumb output. |
|
| 36 | 36 | */ |
| 37 | 37 | function zen_breadcrumb($breadcrumb) { |
| 38 | 38 | // Determine if we are to display the breadcrumb. |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * See http://juicystudio.com/article/screen-readers-display-none.php |
| 88 | 88 | * and http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. |
| 89 | 89 | * @return |
| 90 | - * A string containing an unordered list of links. |
|
| 90 | + string A string containing an unordered list of links. |
|
| 91 | 91 | */ |
| 92 | 92 | function zen_links($links, $attributes = array('class' => 'links'), $heading = '') { |
| 93 | 93 | global $language; |
@@ -600,10 +600,10 @@ discard block |
||
| 600 | 600 | * Do not pass one string containing multiple classes as they will be |
| 601 | 601 | * incorrectly concatenated with dashes, i.e. "one two" will become "one-two". |
| 602 | 602 | * |
| 603 | - * @param $class |
|
| 603 | + * @param string $class |
|
| 604 | 604 | * The class name to clean. |
| 605 | 605 | * @return |
| 606 | - * The cleaned class name. |
|
| 606 | + string The cleaned class name. |
|
| 607 | 607 | */ |
| 608 | 608 | function drupal_html_class($class) { |
| 609 | 609 | // By default, we filter using Drupal's coding standards. |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | * @param $id |
| 634 | 634 | * The ID to clean. |
| 635 | 635 | * @return |
| 636 | - * The cleaned ID. |
|
| 636 | + string The cleaned ID. |
|
| 637 | 637 | */ |
| 638 | 638 | function drupal_html_id($id) { |
| 639 | 639 | $id = strtr(drupal_strtolower($id), array(' ' => '-', '_' => '-', '[' => '-', ']' => '')); |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | if ($title = drupal_get_title()) { |
| 54 | 54 | $trailing_separator = $breadcrumb_separator; |
| 55 | 55 | } |
| 56 | - } |
|
| 57 | - elseif (theme_get_setting('zen_breadcrumb_trailing')) { |
|
| 56 | + } elseif (theme_get_setting('zen_breadcrumb_trailing')) { |
|
| 58 | 57 | $trailing_separator = $breadcrumb_separator; |
| 59 | 58 | } |
| 60 | 59 | return '<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title</div>"; |
@@ -137,8 +136,7 @@ discard block |
||
| 137 | 136 | if (isset($link['href'])) { |
| 138 | 137 | // Pass in $link as $options, they share the same keys. |
| 139 | 138 | $output .= l($link['title'], $link['href'], $link); |
| 140 | - } |
|
| 141 | - else if (!empty($link['title'])) { |
|
| 139 | + } else if (!empty($link['title'])) { |
|
| 142 | 140 | // Some links are actually not links, but we wrap these in <span> for adding title and class attributes |
| 143 | 141 | if (empty($link['html'])) { |
| 144 | 142 | $link['title'] = check_plain($link['title']); |
@@ -188,8 +186,7 @@ discard block |
||
| 188 | 186 | ctools_include('menu'); |
| 189 | 187 | $primary = ctools_menu_primary_local_tasks(); |
| 190 | 188 | $secondary = ctools_menu_secondary_local_tasks(); |
| 191 | - } |
|
| 192 | - else { |
|
| 189 | + } else { |
|
| 193 | 190 | $primary = menu_primary_local_tasks(); |
| 194 | 191 | $secondary = menu_secondary_local_tasks(); |
| 195 | 192 | } |
@@ -237,8 +234,7 @@ discard block |
||
| 237 | 234 | // Allow context module to set blocks. |
| 238 | 235 | if (function_exists('context_blocks')) { |
| 239 | 236 | $output = context_blocks($region); |
| 240 | - } |
|
| 241 | - else { |
|
| 237 | + } else { |
|
| 242 | 238 | foreach (block_list($region) as $key => $block) { |
| 243 | 239 | // $key == module_delta |
| 244 | 240 | $output .= theme('block', $block); |
@@ -298,8 +294,7 @@ discard block |
||
| 298 | 294 | $vars['classes_array'] = explode(' ', $hook . ' ' . $vars[$key]); |
| 299 | 295 | unset($vars[$key]); |
| 300 | 296 | } |
| 301 | - } |
|
| 302 | - else { |
|
| 297 | + } else { |
|
| 303 | 298 | $vars['classes_array'] = array($hook); |
| 304 | 299 | } |
| 305 | 300 | // Add support for Skinr |
@@ -344,8 +339,7 @@ discard block |
||
| 344 | 339 | if (arg(0) == 'node') { |
| 345 | 340 | if (arg(1) == 'add') { |
| 346 | 341 | $section = 'node-add'; |
| 347 | - } |
|
| 348 | - elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { |
|
| 342 | + } elseif (is_numeric(arg(1)) && (arg(2) == 'edit' || arg(2) == 'delete')) { |
|
| 349 | 343 | $section = 'node-' . arg(2); |
| 350 | 344 | } |
| 351 | 345 | } |
@@ -373,8 +367,7 @@ discard block |
||
| 373 | 367 | // Set the proper layout body classes. |
| 374 | 368 | if ($vars['layout'] == 'both') { |
| 375 | 369 | $vars['classes_array'][] = 'two-sidebars'; |
| 376 | - } |
|
| 377 | - else { |
|
| 370 | + } else { |
|
| 378 | 371 | $vars['classes_array'][] = 'one-sidebar'; |
| 379 | 372 | $vars['classes_array'][] = 'sidebar-' . $vars['layout']; |
| 380 | 373 | } |
@@ -431,8 +424,7 @@ discard block |
||
| 431 | 424 | case NODE_BUILD_NORMAL: |
| 432 | 425 | if ($vars['node']->build_mode === NODE_BUILD_NORMAL) { |
| 433 | 426 | $vars['build_mode'] = $vars['teaser'] ? 'teaser' : 'full'; |
| 434 | - } |
|
| 435 | - else { |
|
| 427 | + } else { |
|
| 436 | 428 | $vars['build_mode'] = $vars['node']->build_mode; |
| 437 | 429 | } |
| 438 | 430 | break; |
@@ -473,8 +465,7 @@ discard block |
||
| 473 | 465 | if (!$vars['status']) { |
| 474 | 466 | $vars['classes_array'][] = 'node-unpublished'; |
| 475 | 467 | $vars['unpublished'] = TRUE; |
| 476 | - } |
|
| 477 | - else { |
|
| 468 | + } else { |
|
| 478 | 469 | $vars['unpublished'] = FALSE; |
| 479 | 470 | } |
| 480 | 471 | if ($vars['uid'] && $vars['uid'] == $GLOBALS['user']->uid) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * Set database connection for boincimport |
| 133 | 133 | * |
| 134 | 134 | * @return |
| 135 | - * 1 if can connect to BOINC database. |
|
| 135 | + integer 1 if can connect to BOINC database. |
|
| 136 | 136 | * |
| 137 | 137 | * BEWARE: if you test using db_connect and the connection |
| 138 | 138 | * fails, the process will die() which is a bit too much since we only |
@@ -162,6 +162,7 @@ discard block |
||
| 162 | 162 | /** |
| 163 | 163 | * Check if the module is enabled. |
| 164 | 164 | * |
| 165 | + * @param string $module |
|
| 165 | 166 | * @return array |
| 166 | 167 | * $out['html'] = formatted html. |
| 167 | 168 | * $out['result'] = boolean. |
@@ -172,8 +172,7 @@ discard block |
||
| 172 | 172 | $out['result'] = $result; |
| 173 | 173 | if ($result == 1) { |
| 174 | 174 | $out['html'] .= '<li>'. t('Module %module is enabled. OK!', array('%module' => $module)) .'</li>'; |
| 175 | - } |
|
| 176 | - else { |
|
| 175 | + } else { |
|
| 177 | 176 | $out['html'] .= '<li><span class="marker">'. t('Module %module is disabled.', array('%module' => $module)) .'</span></li>'; |
| 178 | 177 | } |
| 179 | 178 | $out['html'] .= '</ul>'; |
@@ -201,16 +200,14 @@ discard block |
||
| 201 | 200 | if ($GLOBALS['db_type'] == 'pgsql') { |
| 202 | 201 | // adapt from db_table_exists in database.pgsql.inc |
| 203 | 202 | $result = (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '%s'", $table)); |
| 204 | - } |
|
| 205 | - else { |
|
| 203 | + } else { |
|
| 206 | 204 | // adapt from db_table_exists in database.mysql.inc |
| 207 | 205 | $result = (bool) db_fetch_object(db_query("SHOW TABLES LIKE '%s'", $table)); |
| 208 | 206 | } |
| 209 | 207 | db_set_active('default'); |
| 210 | 208 | if ($result) { |
| 211 | 209 | $out['html'] .= '<li>'. t('Table %table: OK!', array('%table' => $table)) .'</li>'; |
| 212 | - } |
|
| 213 | - else { |
|
| 210 | + } else { |
|
| 214 | 211 | $out['html'] .= '<li><span class="marker">'. t('Table <strong>%table</strong> does not exist!', array('%table' => $table)) .'</span></li>'; |
| 215 | 212 | $out['result']= 0; |
| 216 | 213 | } |
@@ -257,8 +254,7 @@ discard block |
||
| 257 | 254 | array('!unlock_it' => l(t('release the lock'), |
| 258 | 255 | 'admin/boinc/import/unlock') |
| 259 | 256 | ), WATCHDOG_WARNING); |
| 260 | - } |
|
| 261 | - else { |
|
| 257 | + } else { |
|
| 262 | 258 | $boincimport_functions = array( |
| 263 | 259 | 'users' => t('Import users'), |
| 264 | 260 | 'teams' => t('Import teams'), |
@@ -293,8 +289,7 @@ discard block |
||
| 293 | 289 | // Lock the import process |
| 294 | 290 | if (!variable_get('boincimport_process_locked', 0)) { |
| 295 | 291 | variable_set('boincimport_process_locked', 1); |
| 296 | - } |
|
| 297 | - else { |
|
| 292 | + } else { |
|
| 298 | 293 | watchdog('boincimport', 'The import process is locked, but another process |
| 299 | 294 | is trying to access it...', array(), WATCHDOG_WARNING); |
| 300 | 295 | } |
@@ -308,8 +303,7 @@ discard block |
||
| 308 | 303 | boincimport_teams(); |
| 309 | 304 | if (!variable_get('boincimport_import_team_successful', 0)) { |
| 310 | 305 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 311 | - } |
|
| 312 | - else { |
|
| 306 | + } else { |
|
| 313 | 307 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 314 | 308 | } |
| 315 | 309 | break; |
@@ -318,8 +312,7 @@ discard block |
||
| 318 | 312 | boincimport_friends(); |
| 319 | 313 | if (!variable_get('boincimport_import_friend_successful', 0)) { |
| 320 | 314 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 321 | - } |
|
| 322 | - else { |
|
| 315 | + } else { |
|
| 323 | 316 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 324 | 317 | } |
| 325 | 318 | break; |
@@ -328,8 +321,7 @@ discard block |
||
| 328 | 321 | boincimport_preferences(); |
| 329 | 322 | if (!variable_get('boincimport_import_preferences_successful', 0)) { |
| 330 | 323 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 331 | - } |
|
| 332 | - else { |
|
| 324 | + } else { |
|
| 333 | 325 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 334 | 326 | } |
| 335 | 327 | break; |
@@ -338,8 +330,7 @@ discard block |
||
| 338 | 330 | boincimport_private_msgs(); |
| 339 | 331 | if (!variable_get('boincimport_import_private_msg_successful', 0)) { |
| 340 | 332 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 341 | - } |
|
| 342 | - else { |
|
| 333 | + } else { |
|
| 343 | 334 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 344 | 335 | } |
| 345 | 336 | break; |
@@ -348,8 +339,7 @@ discard block |
||
| 348 | 339 | boincimport_forum_categories(); |
| 349 | 340 | if (!variable_get('boincimport_import_category_successful', 0)) { |
| 350 | 341 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 351 | - } |
|
| 352 | - else { |
|
| 342 | + } else { |
|
| 353 | 343 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 354 | 344 | } |
| 355 | 345 | break; |
@@ -358,8 +348,7 @@ discard block |
||
| 358 | 348 | boincimport_forum_topics(); |
| 359 | 349 | if (!variable_get('boincimport_import_topic_successful', 0)) { |
| 360 | 350 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 361 | - } |
|
| 362 | - else { |
|
| 351 | + } else { |
|
| 363 | 352 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 364 | 353 | } |
| 365 | 354 | break; |
@@ -368,8 +357,7 @@ discard block |
||
| 368 | 357 | boincimport_forum_posts(); |
| 369 | 358 | if (!variable_get('boincimport_import_post_successful', 0)) { |
| 370 | 359 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 371 | - } |
|
| 372 | - else { |
|
| 360 | + } else { |
|
| 373 | 361 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 374 | 362 | } |
| 375 | 363 | break; |
@@ -378,8 +366,7 @@ discard block |
||
| 378 | 366 | boincimport_team_forums(); |
| 379 | 367 | if (!variable_get('boincimport_team_forum_successful', 0)) { |
| 380 | 368 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
| 381 | - } |
|
| 382 | - else { |
|
| 369 | + } else { |
|
| 383 | 370 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 384 | 371 | } |
| 385 | 372 | break; |
@@ -388,8 +375,7 @@ discard block |
||
| 388 | 375 | boincimport_team_forum_topics(); |
| 389 | 376 | if (!variable_get('boincimport_team_topic_successful', 0)) { |
| 390 | 377 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 391 | - } |
|
| 392 | - else { |
|
| 378 | + } else { |
|
| 393 | 379 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 394 | 380 | } |
| 395 | 381 | break; |
@@ -398,8 +384,7 @@ discard block |
||
| 398 | 384 | boincimport_team_forum_posts(); |
| 399 | 385 | if (!variable_get('boincimport_team_post_successful', 0)) { |
| 400 | 386 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 401 | - } |
|
| 402 | - else { |
|
| 387 | + } else { |
|
| 403 | 388 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 404 | 389 | } |
| 405 | 390 | break; |
@@ -408,8 +393,7 @@ discard block |
||
| 408 | 393 | boincimport_replace_urls(); |
| 409 | 394 | if (!variable_get('boincimport_replace_url_successful', 0)) { |
| 410 | 395 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 411 | - } |
|
| 412 | - else { |
|
| 396 | + } else { |
|
| 413 | 397 | drupal_set_message('Congratulations. Import Finished'); |
| 414 | 398 | drupal_set_message('Please visit the '. l('Post migration configuration', 'admin/boinc/import/post_configuration') .' page'); |
| 415 | 399 | watchdog('boincimport', 'Import process is complete', array(), WATCHDOG_INFO); |
@@ -478,8 +462,7 @@ discard block |
||
| 478 | 462 | ORDER BY id ASC' |
| 479 | 463 | ); |
| 480 | 464 | $user_count = mysql_num_rows($boinc_accounts); |
| 481 | - } |
|
| 482 | - else { |
|
| 465 | + } else { |
|
| 483 | 466 | // Need to import any user who is currently ignored in order to keep them |
| 484 | 467 | // ignored... not particularly clean (ignored users are stored in a string) |
| 485 | 468 | $ignored_user_list = array(0); |
@@ -555,8 +538,7 @@ discard block |
||
| 555 | 538 | if (isset($existing_users[$boinc_account->id])) { |
| 556 | 539 | // This user has already been imported |
| 557 | 540 | $duplicates[] = $boinc_account->id; |
| 558 | - } |
|
| 559 | - else { |
|
| 541 | + } else { |
|
| 560 | 542 | $operations[] = array( |
| 561 | 543 | 'boincimport_users_op', array( |
| 562 | 544 | $boinc_account->id |
@@ -612,8 +594,7 @@ discard block |
||
| 612 | 594 | // Store some result for post-processing in the finished callback. |
| 613 | 595 | $context['results']['success'][] = $boinc_id; |
| 614 | 596 | $message = "Successfully imported user {$boinc_id}"; |
| 615 | - } |
|
| 616 | - else { |
|
| 597 | + } else { |
|
| 617 | 598 | $context['results']['failure'][] = $boinc_id; |
| 618 | 599 | $message = "Failed to import user {$boinc_id}!"; |
| 619 | 600 | watchdog('boincimport', |
@@ -630,8 +611,7 @@ discard block |
||
| 630 | 611 | // Update the progress for the batch engine |
| 631 | 612 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 632 | 613 | $context['finished'] = 1; |
| 633 | - } |
|
| 634 | - else { |
|
| 614 | + } else { |
|
| 635 | 615 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 636 | 616 | } |
| 637 | 617 | } |
@@ -656,8 +636,7 @@ discard block |
||
| 656 | 636 | // Set the user import successful flag in the variable table |
| 657 | 637 | variable_set('boincimport_import_user_successful', '1'); |
| 658 | 638 | $_SESSION['boincimport_stage_selected'] = 'teams'; |
| 659 | - } |
|
| 660 | - else { |
|
| 639 | + } else { |
|
| 661 | 640 | // An error occurred. |
| 662 | 641 | // $operations contains the operations that remained unprocessed. |
| 663 | 642 | $error_operation = reset($operations); |
@@ -719,8 +698,7 @@ discard block |
||
| 719 | 698 | $team_type = array( |
| 720 | 699 | 'tid' => $team_type_id |
| 721 | 700 | ); |
| 722 | - } |
|
| 723 | - else { |
|
| 701 | + } else { |
|
| 724 | 702 | if (!$name) continue; |
| 725 | 703 | $team_type = array( |
| 726 | 704 | 'name' => strip_tags($name), |
@@ -783,8 +761,7 @@ discard block |
||
| 783 | 761 | if (isset($existing_teams[$boinc_team->id])) { |
| 784 | 762 | // This team has already been imported |
| 785 | 763 | $duplicates[] = $boinc_team->id; |
| 786 | - } |
|
| 787 | - else { |
|
| 764 | + } else { |
|
| 788 | 765 | $operations[] = array( |
| 789 | 766 | 'boincimport_teams_op', array( |
| 790 | 767 | $boinc_team |
@@ -825,8 +802,7 @@ discard block |
||
| 825 | 802 | // Store some result for post-processing in the finished callback. |
| 826 | 803 | $context['results']['success'][] = $boincteam->id; |
| 827 | 804 | $message = "Successfully imported team {$boincteam->id}"; |
| 828 | - } |
|
| 829 | - else { |
|
| 805 | + } else { |
|
| 830 | 806 | $context['results']['failure'][] = $boincteam->id; |
| 831 | 807 | $message = "Failed to import team {$boincteam->id}!"; |
| 832 | 808 | watchdog('boincimport', |
@@ -843,8 +819,7 @@ discard block |
||
| 843 | 819 | // Update the progress for the batch engine |
| 844 | 820 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 845 | 821 | $context['finished'] = 1; |
| 846 | - } |
|
| 847 | - else { |
|
| 822 | + } else { |
|
| 848 | 823 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 849 | 824 | } |
| 850 | 825 | } |
@@ -867,8 +842,7 @@ discard block |
||
| 867 | 842 | // Set the team import successful flag in the variable table |
| 868 | 843 | variable_set('boincimport_import_team_successful', '1'); |
| 869 | 844 | $_SESSION['boincimport_stage_selected'] = 'friends'; |
| 870 | - } |
|
| 871 | - else { |
|
| 845 | + } else { |
|
| 872 | 846 | // An error occurred. |
| 873 | 847 | // $operations contains the operations that remained unprocessed. |
| 874 | 848 | $error_operation = reset($operations); |
@@ -989,8 +963,7 @@ discard block |
||
| 989 | 963 | SET uid = '%d', friend_uid = '%d', created = '%d'", |
| 990 | 964 | $uid, $friend_uid, $friendship->create_time |
| 991 | 965 | ); |
| 992 | - } |
|
| 993 | - else { |
|
| 966 | + } else { |
|
| 994 | 967 | $boinc_id = ($uid) ? $friendship->user_dest : $friendship->user_src; |
| 995 | 968 | $message = "No Drupal account exists for BOINC user {$boinc_id}!"; |
| 996 | 969 | } |
@@ -999,8 +972,7 @@ discard block |
||
| 999 | 972 | // Store some result for post-processing in the finished callback. |
| 1000 | 973 | $context['results']['success'][] = $uid; |
| 1001 | 974 | $message = "Successfully made users {$uid} and {$friend_uid} friends"; |
| 1002 | - } |
|
| 1003 | - else { |
|
| 975 | + } else { |
|
| 1004 | 976 | $context['results']['failure'][] = $uid; |
| 1005 | 977 | if (!$message) { |
| 1006 | 978 | $message = "Failed to make users {$uid} and {$friend_uid} friends!"; |
@@ -1016,8 +988,7 @@ discard block |
||
| 1016 | 988 | // Update the progress for the batch engine |
| 1017 | 989 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1018 | 990 | $context['finished'] = 1; |
| 1019 | - } |
|
| 1020 | - else { |
|
| 991 | + } else { |
|
| 1021 | 992 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1022 | 993 | } |
| 1023 | 994 | } |
@@ -1041,8 +1012,7 @@ discard block |
||
| 1041 | 1012 | // Set the friend import successful flag in the variable table |
| 1042 | 1013 | variable_set('boincimport_import_friend_successful', '1'); |
| 1043 | 1014 | $_SESSION['boincimport_stage_selected'] = 'preferences'; |
| 1044 | - } |
|
| 1045 | - else { |
|
| 1015 | + } else { |
|
| 1046 | 1016 | // An error occurred. |
| 1047 | 1017 | // $operations contains the operations that remained unprocessed. |
| 1048 | 1018 | $error_operation = reset($operations); |
@@ -1166,8 +1136,7 @@ discard block |
||
| 1166 | 1136 | ); |
| 1167 | 1137 | if ($user_ignored) { |
| 1168 | 1138 | $success = TRUE; |
| 1169 | - } |
|
| 1170 | - else { |
|
| 1139 | + } else { |
|
| 1171 | 1140 | $context['results']['warning'][] = "{$uid}:{$ignored_user_uid}"; |
| 1172 | 1141 | watchdog('boincimport', |
| 1173 | 1142 | 'Could not add user @ignored_uid to the ignore list of user @uid', |
@@ -1182,8 +1151,7 @@ discard block |
||
| 1182 | 1151 | // Store some result for post-processing in the finished callback. |
| 1183 | 1152 | $context['results']['success'][] = $uid; |
| 1184 | 1153 | $message = "Successfully imported ignored users for user {$uid}"; |
| 1185 | - } |
|
| 1186 | - else { |
|
| 1154 | + } else { |
|
| 1187 | 1155 | $context['results']['failure'][] = $uid; |
| 1188 | 1156 | $message = "Failed to import any user filter preferences for user {$uid}!"; |
| 1189 | 1157 | watchdog('boincimport', |
@@ -1200,8 +1168,7 @@ discard block |
||
| 1200 | 1168 | // Update the progress for the batch engine |
| 1201 | 1169 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1202 | 1170 | $context['finished'] = 1; |
| 1203 | - } |
|
| 1204 | - else { |
|
| 1171 | + } else { |
|
| 1205 | 1172 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1206 | 1173 | } |
| 1207 | 1174 | } |
@@ -1226,8 +1193,7 @@ discard block |
||
| 1226 | 1193 | // Set the preference import successful flag in the variable table |
| 1227 | 1194 | variable_set('boincimport_import_preferences_successful', '1'); |
| 1228 | 1195 | $_SESSION['boincimport_stage_selected'] = 'private messages'; |
| 1229 | - } |
|
| 1230 | - else { |
|
| 1196 | + } else { |
|
| 1231 | 1197 | // An error occurred. |
| 1232 | 1198 | // $operations contains the operations that remained unprocessed. |
| 1233 | 1199 | $error_operation = reset($operations); |
@@ -1361,8 +1327,7 @@ discard block |
||
| 1361 | 1327 | // Store some result for post-processing in the finished callback. |
| 1362 | 1328 | $context['results']['success'][] = $pm->id; |
| 1363 | 1329 | $message = "Successfully imported private message {$pm->id}"; |
| 1364 | - } |
|
| 1365 | - else { |
|
| 1330 | + } else { |
|
| 1366 | 1331 | $context['results']['failure'][] = $pm->id; |
| 1367 | 1332 | $message = "Failed to import private message {$pm->id}!"; |
| 1368 | 1333 | watchdog('boincimport', |
@@ -1379,8 +1344,7 @@ discard block |
||
| 1379 | 1344 | // Update the progress for the batch engine |
| 1380 | 1345 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1381 | 1346 | $context['finished'] = 1; |
| 1382 | - } |
|
| 1383 | - else { |
|
| 1347 | + } else { |
|
| 1384 | 1348 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1385 | 1349 | } |
| 1386 | 1350 | } |
@@ -1403,8 +1367,7 @@ discard block |
||
| 1403 | 1367 | // Set the private message import successful flag in the variable table |
| 1404 | 1368 | variable_set('boincimport_import_private_msg_successful', '1'); |
| 1405 | 1369 | $_SESSION['boincimport_stage_selected'] = 'categories'; |
| 1406 | - } |
|
| 1407 | - else { |
|
| 1370 | + } else { |
|
| 1408 | 1371 | // An error occurred. |
| 1409 | 1372 | // $operations contains the operations that remained unprocessed. |
| 1410 | 1373 | $error_operation = reset($operations); |
@@ -1557,8 +1520,7 @@ discard block |
||
| 1557 | 1520 | if (in_array($boinc_forum_category->name, $existing_categories)) { |
| 1558 | 1521 | // This category has already been imported |
| 1559 | 1522 | $duplicate_categories[] = $boinc_forum_category->name; |
| 1560 | - } |
|
| 1561 | - else { |
|
| 1523 | + } else { |
|
| 1562 | 1524 | $operations[] = array( |
| 1563 | 1525 | 'boincimport_forum_categories_op', array( |
| 1564 | 1526 | $boinc_forum_category, $forum_vid, $pre, FALSE |
@@ -1572,8 +1534,7 @@ discard block |
||
| 1572 | 1534 | if (isset($existing_forums[$boinc_forum->id])) { |
| 1573 | 1535 | // This forum has already been imported |
| 1574 | 1536 | $duplicates[] = $boinc_forum->id; |
| 1575 | - } |
|
| 1576 | - else { |
|
| 1537 | + } else { |
|
| 1577 | 1538 | $operations[] = array( |
| 1578 | 1539 | 'boincimport_forums_op', array( |
| 1579 | 1540 | $boinc_forum, $forum_vid, $pre |
@@ -1640,8 +1601,7 @@ discard block |
||
| 1640 | 1601 | $category->name = 'Hidden'; |
| 1641 | 1602 | $category->id = 0; |
| 1642 | 1603 | $hidden = TRUE; |
| 1643 | - } |
|
| 1644 | - else { |
|
| 1604 | + } else { |
|
| 1645 | 1605 | // If this container is empty, put it into the hidden container |
| 1646 | 1606 | db_set_active('boinc_rw'); |
| 1647 | 1607 | $forums_contained = db_result(db_query(' |
@@ -1684,13 +1644,11 @@ discard block |
||
| 1684 | 1644 | // Store some result for post-processing in the finished callback. |
| 1685 | 1645 | if (!$category AND $create_hidden) { |
| 1686 | 1646 | $message = "Created special hidden container"; |
| 1687 | - } |
|
| 1688 | - else { |
|
| 1647 | + } else { |
|
| 1689 | 1648 | $context['results']['categories']['success'][] = $category->id; |
| 1690 | 1649 | $message = "Successfully imported container {$category->id}"; |
| 1691 | 1650 | } |
| 1692 | - } |
|
| 1693 | - else { |
|
| 1651 | + } else { |
|
| 1694 | 1652 | $context['results']['categories']['failure'][] = $category->id; |
| 1695 | 1653 | $message = "Failed to import container {$category->id}!"; |
| 1696 | 1654 | watchdog('boincimport', |
@@ -1707,8 +1665,7 @@ discard block |
||
| 1707 | 1665 | // Update the progress for the batch engine |
| 1708 | 1666 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1709 | 1667 | $context['finished'] = 1; |
| 1710 | - } |
|
| 1711 | - else { |
|
| 1668 | + } else { |
|
| 1712 | 1669 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1713 | 1670 | } |
| 1714 | 1671 | } |
@@ -1744,8 +1701,7 @@ discard block |
||
| 1744 | 1701 | // Save the ID of the News forum for later import |
| 1745 | 1702 | variable_set('boincimport_news_forum_id', $forum_id); |
| 1746 | 1703 | $success = TRUE; |
| 1747 | - } |
|
| 1748 | - else { |
|
| 1704 | + } else { |
|
| 1749 | 1705 | // Save all other forums as taxonomy terms |
| 1750 | 1706 | $forum = array( |
| 1751 | 1707 | 'name' => $name, |
@@ -1771,8 +1727,7 @@ discard block |
||
| 1771 | 1727 | // Store some result for post-processing in the finished callback. |
| 1772 | 1728 | $context['results']['forums']['success'][] = $forum_id; |
| 1773 | 1729 | $message = "Successfully imported forum {$forum_id}"; |
| 1774 | - } |
|
| 1775 | - else { |
|
| 1730 | + } else { |
|
| 1776 | 1731 | $context['results']['forums']['failure'][] = $forum_id; |
| 1777 | 1732 | $message = "Failed to import forum {$forum_id}!"; |
| 1778 | 1733 | } |
@@ -1785,8 +1740,7 @@ discard block |
||
| 1785 | 1740 | // Update the progress for the batch engine |
| 1786 | 1741 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 1787 | 1742 | $context['finished'] = 1; |
| 1788 | - } |
|
| 1789 | - else { |
|
| 1743 | + } else { |
|
| 1790 | 1744 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 1791 | 1745 | } |
| 1792 | 1746 | } |
@@ -1887,8 +1841,7 @@ discard block |
||
| 1887 | 1841 | // Set the forum import successful flag in the variable table |
| 1888 | 1842 | variable_set('boincimport_import_forum_successful', '1'); |
| 1889 | 1843 | $_SESSION['boincimport_stage_selected'] = 'topics'; |
| 1890 | - } |
|
| 1891 | - else { |
|
| 1844 | + } else { |
|
| 1892 | 1845 | // An error occurred. |
| 1893 | 1846 | // $operations contains the operations that remained unprocessed. |
| 1894 | 1847 | $error_operation = reset($operations); |
@@ -2042,9 +1995,7 @@ discard block |
||
| 2042 | 1995 | |
| 2043 | 1996 | if ($duplicate OR !$post) { |
| 2044 | 1997 | $success = FALSE; |
| 2045 | - } |
|
| 2046 | - |
|
| 2047 | - else { |
|
| 1998 | + } else { |
|
| 2048 | 1999 | // Get the user and term IDs along with other data to define the topic |
| 2049 | 2000 | $uid = boincuser_lookup_uid($topic->owner); |
| 2050 | 2001 | $tid = db_result(db_query(' |
@@ -2108,12 +2059,10 @@ discard block |
||
| 2108 | 2059 | if (!$success) { |
| 2109 | 2060 | $error_detail = 'topic imported, but failed to set last comment timestamp'; |
| 2110 | 2061 | } |
| 2111 | - } |
|
| 2112 | - else { |
|
| 2062 | + } else { |
|
| 2113 | 2063 | $error_detail = 'topic node saved, but failed to link in boincimport_temp_topic table'; |
| 2114 | 2064 | } |
| 2115 | - } |
|
| 2116 | - else { |
|
| 2065 | + } else { |
|
| 2117 | 2066 | $error_detail = 'failed to save topic node to database'; |
| 2118 | 2067 | } |
| 2119 | 2068 | } |
@@ -2124,16 +2073,13 @@ discard block |
||
| 2124 | 2073 | // Store some result for post-processing in the finished callback. |
| 2125 | 2074 | $context['results']['success'][] = $topic->id; |
| 2126 | 2075 | $message = "Successfully imported topic {$topic->id}"; |
| 2127 | - } |
|
| 2128 | - elseif ($duplicate) { |
|
| 2076 | + } elseif ($duplicate) { |
|
| 2129 | 2077 | $context['results']['duplicate'][] = $topic->id; |
| 2130 | 2078 | $message = "Topic {$topic->id} was already imported"; |
| 2131 | - } |
|
| 2132 | - elseif (!$post) { |
|
| 2079 | + } elseif (!$post) { |
|
| 2133 | 2080 | $context['results']['empty'][] = $topic->id; |
| 2134 | 2081 | $message = "Skipping topic {$topic->id} as empty"; |
| 2135 | - } |
|
| 2136 | - else { |
|
| 2082 | + } else { |
|
| 2137 | 2083 | $context['results']['failure'][] = $topic->id; |
| 2138 | 2084 | $message = "Failed to import topic {$topic->id}!"; |
| 2139 | 2085 | watchdog('boincimport', |
@@ -2154,8 +2100,7 @@ discard block |
||
| 2154 | 2100 | // Update the progress for the batch engine |
| 2155 | 2101 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2156 | 2102 | $context['finished'] = 1; |
| 2157 | - } |
|
| 2158 | - else { |
|
| 2103 | + } else { |
|
| 2159 | 2104 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2160 | 2105 | } |
| 2161 | 2106 | } |
@@ -2189,8 +2134,7 @@ discard block |
||
| 2189 | 2134 | // Set the topic import successful flag in the variable table |
| 2190 | 2135 | variable_set('boincimport_import_topic_successful', '1'); |
| 2191 | 2136 | $_SESSION['boincimport_stage_selected'] = 'posts'; |
| 2192 | - } |
|
| 2193 | - else { |
|
| 2137 | + } else { |
|
| 2194 | 2138 | // An error occurred. |
| 2195 | 2139 | // $operations contains the operations that remained unprocessed. |
| 2196 | 2140 | $error_operation = reset($operations); |
@@ -2438,18 +2382,15 @@ discard block |
||
| 2438 | 2382 | if ($success) { |
| 2439 | 2383 | $posts_imported++; |
| 2440 | 2384 | $context['results']['posts']['success'][] = $post->id; |
| 2441 | - } |
|
| 2442 | - else { |
|
| 2385 | + } else { |
|
| 2443 | 2386 | $context['results']['posts']['failure'][] = $post->id; |
| 2444 | 2387 | $error_posts++; |
| 2445 | 2388 | } |
| 2446 | - } |
|
| 2447 | - else { |
|
| 2389 | + } else { |
|
| 2448 | 2390 | $context['results']['posts']['failure'][] = $post->id; |
| 2449 | 2391 | $error_posts++; |
| 2450 | 2392 | } |
| 2451 | - } |
|
| 2452 | - else { |
|
| 2393 | + } else { |
|
| 2453 | 2394 | $context['results']['posts']['empty'][] = $post->id; |
| 2454 | 2395 | $empty_posts++; |
| 2455 | 2396 | } |
@@ -2460,8 +2401,7 @@ discard block |
||
| 2460 | 2401 | // Store some result for post-processing in the finished callback. |
| 2461 | 2402 | $context['results']['success'][] = $boinc_topic->id; |
| 2462 | 2403 | $message = "Imported {$posts_imported} post(s) for topic {$boinc_topic->id}"; |
| 2463 | - } |
|
| 2464 | - else { |
|
| 2404 | + } else { |
|
| 2465 | 2405 | $context['results']['failure'][] = $boinc_topic->id; |
| 2466 | 2406 | $message = "Failed to import any posts for topic {$boinc_topic->id} (excluded {$error_posts} errors, {$duplicate_posts} duplicates, and {$empty_posts} empty)"; |
| 2467 | 2407 | watchdog('boincimport', 'Failed to import any posts for topic @id (excluded @error_posts errors, @duplicate_posts duplicates, and @empty_posts empty)', |
@@ -2482,8 +2422,7 @@ discard block |
||
| 2482 | 2422 | // Update the progress for the batch engine |
| 2483 | 2423 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2484 | 2424 | $context['finished'] = 1; |
| 2485 | - } |
|
| 2486 | - else { |
|
| 2425 | + } else { |
|
| 2487 | 2426 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2488 | 2427 | } |
| 2489 | 2428 | } |
@@ -2523,8 +2462,7 @@ discard block |
||
| 2523 | 2462 | // Set the post import successful flag in the variable table |
| 2524 | 2463 | variable_set('boincimport_import_post_successful', '1'); |
| 2525 | 2464 | $_SESSION['boincimport_stage_selected'] = 'team forums'; |
| 2526 | - } |
|
| 2527 | - else { |
|
| 2465 | + } else { |
|
| 2528 | 2466 | // An error occurred. |
| 2529 | 2467 | // $operations contains the operations that remained unprocessed. |
| 2530 | 2468 | $error_operation = reset($operations); |
@@ -2611,8 +2549,7 @@ discard block |
||
| 2611 | 2549 | if (isset($existing_team_forums[$boincteam_forum->id])) { |
| 2612 | 2550 | // This team has already been imported |
| 2613 | 2551 | $duplicates[] = $boincteam_forum->id; |
| 2614 | - } |
|
| 2615 | - else { |
|
| 2552 | + } else { |
|
| 2616 | 2553 | $operations[] = array( |
| 2617 | 2554 | 'boincimport_team_forums_op', array( |
| 2618 | 2555 | $boincteam_forum |
@@ -2678,8 +2615,7 @@ discard block |
||
| 2678 | 2615 | // Store some result for post-processing in the finished callback. |
| 2679 | 2616 | $context['results']['success'][] = $forum_id; |
| 2680 | 2617 | $message = "Successfully imported team forum {$forum_id}"; |
| 2681 | - } |
|
| 2682 | - else { |
|
| 2618 | + } else { |
|
| 2683 | 2619 | $context['results']['failure'][] = $forum_id; |
| 2684 | 2620 | $message = "Failed to import team forum {$forum_id}!"; |
| 2685 | 2621 | watchdog('boincimport', |
@@ -2696,8 +2632,7 @@ discard block |
||
| 2696 | 2632 | // Update the progress for the batch engine |
| 2697 | 2633 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2698 | 2634 | $context['finished'] = 1; |
| 2699 | - } |
|
| 2700 | - else { |
|
| 2635 | + } else { |
|
| 2701 | 2636 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2702 | 2637 | } |
| 2703 | 2638 | } |
@@ -2720,8 +2655,7 @@ discard block |
||
| 2720 | 2655 | // Set the team forum import successful flag in the variable table |
| 2721 | 2656 | variable_set('boincimport_import_team_forum_successful', '1'); |
| 2722 | 2657 | $_SESSION['boincimport_stage_selected'] = 'team topics'; |
| 2723 | - } |
|
| 2724 | - else { |
|
| 2658 | + } else { |
|
| 2725 | 2659 | // An error occurred. |
| 2726 | 2660 | // $operations contains the operations that remained unprocessed. |
| 2727 | 2661 | $error_operation = reset($operations); |
@@ -2816,8 +2750,7 @@ discard block |
||
| 2816 | 2750 | if (isset($existing_team_topics[$boincteam_topic->id])) { |
| 2817 | 2751 | // This team topic has already been imported |
| 2818 | 2752 | $duplicates[] = $boincteam_topic->id; |
| 2819 | - } |
|
| 2820 | - else { |
|
| 2753 | + } else { |
|
| 2821 | 2754 | $operations[] = array( |
| 2822 | 2755 | 'boincimport_team_topics_op', array( |
| 2823 | 2756 | $boincteam_topic |
@@ -2864,8 +2797,7 @@ discard block |
||
| 2864 | 2797 | )); |
| 2865 | 2798 | if (!$team_forum_id) { |
| 2866 | 2799 | $missing_parent[] = $topic->id; |
| 2867 | - } |
|
| 2868 | - else { |
|
| 2800 | + } else { |
|
| 2869 | 2801 | // Get the content of the post that started the topic |
| 2870 | 2802 | db_set_active('boinc_rw'); |
| 2871 | 2803 | $query = db_query(' |
@@ -2882,8 +2814,7 @@ discard block |
||
| 2882 | 2814 | // Empty topics should have already been filtered out of the import, so |
| 2883 | 2815 | // consider this an error condition |
| 2884 | 2816 | $empty_topics[] = $topic->id; |
| 2885 | - } |
|
| 2886 | - else { |
|
| 2817 | + } else { |
|
| 2887 | 2818 | // Get the user ID along with other data to define the topic |
| 2888 | 2819 | $uid = boincuser_lookup_uid($topic->owner); |
| 2889 | 2820 | if (!$topic->owner) { |
@@ -2947,8 +2878,7 @@ discard block |
||
| 2947 | 2878 | // Store some result for post-processing in the finished callback. |
| 2948 | 2879 | $context['results']['success'][] = $topic->id; |
| 2949 | 2880 | $message = "Successfully imported team topic {$topic->id}"; |
| 2950 | - } |
|
| 2951 | - else { |
|
| 2881 | + } else { |
|
| 2952 | 2882 | $context['results']['failure'][] = $topic->id; |
| 2953 | 2883 | $message = "Failed to import team topic {$topic->id}!"; |
| 2954 | 2884 | watchdog('boincimport', |
@@ -2965,8 +2895,7 @@ discard block |
||
| 2965 | 2895 | // Update the progress for the batch engine |
| 2966 | 2896 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 2967 | 2897 | $context['finished'] = 1; |
| 2968 | - } |
|
| 2969 | - else { |
|
| 2898 | + } else { |
|
| 2970 | 2899 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 2971 | 2900 | } |
| 2972 | 2901 | } |
@@ -2989,8 +2918,7 @@ discard block |
||
| 2989 | 2918 | // Set the BLAH import successful flag in the variable table |
| 2990 | 2919 | variable_set('boincimport_import_team_topic_successful', '1'); |
| 2991 | 2920 | $_SESSION['boincimport_stage_selected'] = 'team posts'; |
| 2992 | - } |
|
| 2993 | - else { |
|
| 2921 | + } else { |
|
| 2994 | 2922 | // An error occurred. |
| 2995 | 2923 | // $operations contains the operations that remained unprocessed. |
| 2996 | 2924 | $error_operation = reset($operations); |
@@ -3112,8 +3040,7 @@ discard block |
||
| 3112 | 3040 | if (isset($existing_posts[$boincteam_post->id])) { |
| 3113 | 3041 | // This post has already been imported |
| 3114 | 3042 | $duplicates[] = $boincteam_post->id; |
| 3115 | - } |
|
| 3116 | - else { |
|
| 3043 | + } else { |
|
| 3117 | 3044 | $operations[] = array( |
| 3118 | 3045 | 'boincimport_team_posts_op', array( |
| 3119 | 3046 | $boincteam_post |
@@ -3229,8 +3156,7 @@ discard block |
||
| 3229 | 3156 | // Store some result for post-processing in the finished callback. |
| 3230 | 3157 | $context['results']['success'][] = $post->id; |
| 3231 | 3158 | $message = "Successfully imported team post {$post->id}"; |
| 3232 | - } |
|
| 3233 | - else { |
|
| 3159 | + } else { |
|
| 3234 | 3160 | $context['results']['failure'][] = $post->id; |
| 3235 | 3161 | $message = "Failed to import team post {$post->id}!"; |
| 3236 | 3162 | watchdog('boincimport', |
@@ -3247,8 +3173,7 @@ discard block |
||
| 3247 | 3173 | // Update the progress for the batch engine |
| 3248 | 3174 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3249 | 3175 | $context['finished'] = 1; |
| 3250 | - } |
|
| 3251 | - else { |
|
| 3176 | + } else { |
|
| 3252 | 3177 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3253 | 3178 | } |
| 3254 | 3179 | } |
@@ -3271,8 +3196,7 @@ discard block |
||
| 3271 | 3196 | // Set the team post import successful flag in the variable table |
| 3272 | 3197 | variable_set('boincimport_import_team_post_successful', '1'); |
| 3273 | 3198 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 3274 | - } |
|
| 3275 | - else { |
|
| 3199 | + } else { |
|
| 3276 | 3200 | // An error occurred. |
| 3277 | 3201 | // $operations contains the operations that remained unprocessed. |
| 3278 | 3202 | $error_operation = reset($operations); |
@@ -3378,8 +3302,7 @@ discard block |
||
| 3378 | 3302 | $context['results']['success'][] = $boincuser_id; |
| 3379 | 3303 | $context['results']['subscriptions'][$boincuser_id] = $count; |
| 3380 | 3304 | $message = "Successfully imported {$count} subscriptions for user {$boincuser_id}"; |
| 3381 | - } |
|
| 3382 | - else { |
|
| 3305 | + } else { |
|
| 3383 | 3306 | $context['results']['failure'][] = $boincuser_id; |
| 3384 | 3307 | $message = "Failed to import subscriptions for user {$boincuser_id}!"; |
| 3385 | 3308 | watchdog('boincimport', |
@@ -3396,8 +3319,7 @@ discard block |
||
| 3396 | 3319 | // Update the progress for the batch engine |
| 3397 | 3320 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3398 | 3321 | $context['finished'] = 1; |
| 3399 | - } |
|
| 3400 | - else { |
|
| 3322 | + } else { |
|
| 3401 | 3323 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3402 | 3324 | } |
| 3403 | 3325 | } |
@@ -3422,8 +3344,7 @@ discard block |
||
| 3422 | 3344 | // Set the subscription import successful flag in the variable table |
| 3423 | 3345 | variable_set('boincimport_import_subscription_successful', '1'); |
| 3424 | 3346 | $_SESSION['boincimport_stage_selected'] = 'url'; |
| 3425 | - } |
|
| 3426 | - else { |
|
| 3347 | + } else { |
|
| 3427 | 3348 | // An error occurred. |
| 3428 | 3349 | // $operations contains the operations that remained unprocessed. |
| 3429 | 3350 | $error_operation = reset($operations); |
@@ -3601,8 +3522,7 @@ discard block |
||
| 3601 | 3522 | // Store some result for post-processing in the finished callback. |
| 3602 | 3523 | $context['results']['nodes']['updated'][] = $node->nid; |
| 3603 | 3524 | $message = "Successfully updated node {$node->nid}"; |
| 3604 | - } |
|
| 3605 | - else { |
|
| 3525 | + } else { |
|
| 3606 | 3526 | $message = "No changes made to node {$node->nid}!"; |
| 3607 | 3527 | } |
| 3608 | 3528 | |
@@ -3614,8 +3534,7 @@ discard block |
||
| 3614 | 3534 | // Update the progress for the batch engine |
| 3615 | 3535 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3616 | 3536 | $context['finished'] = 1; |
| 3617 | - } |
|
| 3618 | - else { |
|
| 3537 | + } else { |
|
| 3619 | 3538 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3620 | 3539 | } |
| 3621 | 3540 | } |
@@ -3665,8 +3584,7 @@ discard block |
||
| 3665 | 3584 | // Store some result for post-processing in the finished callback. |
| 3666 | 3585 | $context['results']['comments']['updated'][] = $comment->cid; |
| 3667 | 3586 | $message = "Successfully updated comment {$comment->cid}"; |
| 3668 | - } |
|
| 3669 | - else { |
|
| 3587 | + } else { |
|
| 3670 | 3588 | $message = "No changes made to comment {$comment->cid}!"; |
| 3671 | 3589 | } |
| 3672 | 3590 | |
@@ -3678,8 +3596,7 @@ discard block |
||
| 3678 | 3596 | // Update the progress for the batch engine |
| 3679 | 3597 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3680 | 3598 | $context['finished'] = 1; |
| 3681 | - } |
|
| 3682 | - else { |
|
| 3599 | + } else { |
|
| 3683 | 3600 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3684 | 3601 | } |
| 3685 | 3602 | } |
@@ -3728,8 +3645,7 @@ discard block |
||
| 3728 | 3645 | // Store some result for post-processing in the finished callback. |
| 3729 | 3646 | $context['results']['pm']['updated'][] = $pm->mid; |
| 3730 | 3647 | $message = "Successfully updated private message {$pm->mid}"; |
| 3731 | - } |
|
| 3732 | - else { |
|
| 3648 | + } else { |
|
| 3733 | 3649 | $message = "No changes made to private message {$pm->mid}!"; |
| 3734 | 3650 | } |
| 3735 | 3651 | |
@@ -3741,8 +3657,7 @@ discard block |
||
| 3741 | 3657 | // Update the progress for the batch engine |
| 3742 | 3658 | if ($context['sandbox']['progress'] >= $context['sandbox']['max']) { |
| 3743 | 3659 | $context['finished'] = 1; |
| 3744 | - } |
|
| 3745 | - else { |
|
| 3660 | + } else { |
|
| 3746 | 3661 | $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max']; |
| 3747 | 3662 | } |
| 3748 | 3663 | } |
@@ -3807,8 +3722,7 @@ discard block |
||
| 3807 | 3722 | // Set the replace URLs successful flag in the variable table |
| 3808 | 3723 | variable_set('boincimport_replace_urls_successful', '1'); |
| 3809 | 3724 | $_SESSION['boincimport_stage_selected'] = 'users'; |
| 3810 | - } |
|
| 3811 | - else { |
|
| 3725 | + } else { |
|
| 3812 | 3726 | // An error occurred. |
| 3813 | 3727 | // $operations contains the operations that remained unprocessed. |
| 3814 | 3728 | $error_operation = reset($operations); |
@@ -3910,7 +3824,8 @@ discard block |
||
| 3910 | 3824 | $score = 0; // 0 default value, comments get higher score depending on the author's roles |
| 3911 | 3825 | $users = serialize(array(0 => 1)); // default value for everybody!! |
| 3912 | 3826 | |
| 3913 | - if ($edit['uid'] === $user->uid) { // '===' because we want to modify anonymous users too |
|
| 3827 | + if ($edit['uid'] === $user->uid) { |
|
| 3828 | +// '===' because we want to modify anonymous users too |
|
| 3914 | 3829 | $edit['name'] = $user->name; |
| 3915 | 3830 | } |
| 3916 | 3831 | |
@@ -4028,13 +3943,11 @@ discard block |
||
| 4028 | 3943 | if (isset($this->boincDomains[$domain])) { |
| 4029 | 3944 | // This is a URL configured to be transformed |
| 4030 | 3945 | return "{$http}://{$this->drupalDomain}{$this->basePath}"; |
| 4031 | - } |
|
| 4032 | - else { |
|
| 3946 | + } else { |
|
| 4033 | 3947 | // This URL should not be transformed |
| 4034 | 3948 | return NULL; |
| 4035 | 3949 | } |
| 4036 | - } |
|
| 4037 | - else { |
|
| 3950 | + } else { |
|
| 4038 | 3951 | // This is a relative URL |
| 4039 | 3952 | return $this->basePath; |
| 4040 | 3953 | } |
@@ -4056,8 +3969,7 @@ discard block |
||
| 4056 | 3969 | )); |
| 4057 | 3970 | if ($id) { |
| 4058 | 3971 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
| 4059 | - } |
|
| 4060 | - else { |
|
| 3972 | + } else { |
|
| 4061 | 3973 | // This post is not in the post import table, so it's probably a topic |
| 4062 | 3974 | $link = $this->transformTopicLinks($matches); |
| 4063 | 3975 | } |
@@ -4081,8 +3993,7 @@ discard block |
||
| 4081 | 3993 | )); |
| 4082 | 3994 | if ($id) { |
| 4083 | 3995 | $link = "{$newBaseUrl}goto/comment/{$id}"; |
| 4084 | - } |
|
| 4085 | - else { |
|
| 3996 | + } else { |
|
| 4086 | 3997 | // This post is not in the post import table, so it's probably a topic |
| 4087 | 3998 | $link = $this->transformTopicLinks($matches); |
| 4088 | 3999 | } |
@@ -422,6 +422,9 @@ |
||
| 422 | 422 | /* |
| 423 | 423 | * |
| 424 | 424 | */ |
| 425 | +/** |
|
| 426 | + * @param integer $credit |
|
| 427 | + */ |
|
| 425 | 428 | function boincstats_credit_to_ghours($credit) { |
| 426 | 429 | return $credit / (100 * 365); |
| 427 | 430 | } |
@@ -104,8 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | if ($myCache->isInCache($cache_name)) { |
| 106 | 106 | $myCache->strokeFromCache($cache_name); |
| 107 | - } |
|
| 108 | - else { |
|
| 107 | + } else { |
|
| 109 | 108 | // Initialize dataset |
| 110 | 109 | $dataset = array(); |
| 111 | 110 | $stats_xml = boincstats_get_project_stats('daily', $cpid); |
@@ -114,9 +113,10 @@ discard block |
||
| 114 | 113 | for ($j = 30; $j < 90; $j++) { |
| 115 | 114 | $dataset[] = (int) $stats_xml->records->record[$j]; |
| 116 | 115 | } |
| 117 | - } |
|
| 118 | - else { |
|
| 119 | - for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0; |
|
| 116 | + } else { |
|
| 117 | + for ($i = 0; $i <= $dataset_size; $i++) { |
|
| 118 | + $dataset[] = 0; |
|
| 119 | + } |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // Get color configuration |
@@ -226,8 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | if ($myCache->isInCache($cache_name)) { |
| 228 | 228 | $myCache->strokeFromCache($cache_name); |
| 229 | - } |
|
| 230 | - else { |
|
| 229 | + } else { |
|
| 231 | 230 | // Initialize dataset |
| 232 | 231 | $dataset = array(); |
| 233 | 232 | $stats_xml = boincstats_get_project_stats('daily'); |
@@ -236,9 +235,10 @@ discard block |
||
| 236 | 235 | for ($j = 30; $j < 90; $j++) { |
| 237 | 236 | $dataset[] = (int) $stats_xml->records->record[$j]; |
| 238 | 237 | } |
| 239 | - } |
|
| 240 | - else { |
|
| 241 | - for ($i = 0; $i <= 30; $i++) $dataset[] = 0; |
|
| 238 | + } else { |
|
| 239 | + for ($i = 0; $i <= 30; $i++) { |
|
| 240 | + $dataset[] = 0; |
|
| 241 | + } |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // Create and populate the pData object |
@@ -316,8 +316,7 @@ discard block |
||
| 316 | 316 | directory must be writeable by the web server.', |
| 317 | 317 | array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR); |
| 318 | 318 | return FALSE; |
| 319 | - } |
|
| 320 | - else { |
|
| 319 | + } else { |
|
| 321 | 320 | // Create the cache dir |
| 322 | 321 | if (!mkdir($cache_dir, 0775)) { |
| 323 | 322 | watchdog('boincstats', 'Failed to create @cache_dir directory. Check |
@@ -326,8 +325,7 @@ discard block |
||
| 326 | 325 | return FALSE; |
| 327 | 326 | } |
| 328 | 327 | } |
| 329 | - } |
|
| 330 | - else { |
|
| 328 | + } else { |
|
| 331 | 329 | watchdog('boincstats', 'Cache directory at @cache_dir is not writeable. |
| 332 | 330 | Please allow webserver write access.', |
| 333 | 331 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
@@ -370,8 +368,7 @@ discard block |
||
| 370 | 368 | foreach ($get as $arg => $value) { |
| 371 | 369 | if ($value !== NULL) { |
| 372 | 370 | $args[] = "{$arg}=" . rawurlencode($value); |
| 373 | - } |
|
| 374 | - else { |
|
| 371 | + } else { |
|
| 375 | 372 | $args[] = $arg; |
| 376 | 373 | } |
| 377 | 374 | } |
@@ -467,8 +464,7 @@ discard block |
||
| 467 | 464 | drupal_set_message(t('The BOINC stats system is not configured. Please |
| 468 | 465 | !configure_it', array('!configure_it' => l(t('configure it now'), |
| 469 | 466 | 'admin/boinc/stats'))), 'error', FALSE); |
| 470 | - } |
|
| 471 | - else { |
|
| 467 | + } else { |
|
| 472 | 468 | drupal_set_message(t('There is a problem with the site. Please contact |
| 473 | 469 | the system administrator.'), 'error', FALSE); |
| 474 | 470 | } |
@@ -179,6 +179,10 @@ |
||
| 179 | 179 | |
| 180 | 180 | function left($value,$NbChar) { return substr($value,0,$NbChar); } |
| 181 | 181 | function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); } |
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * @param integer $NbChar |
|
| 185 | + */ |
|
| 182 | 186 | function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); } |
| 183 | 187 | } |
| 184 | 188 | ?> |
| 185 | 189 | \ No newline at end of file |
@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | /* pData class definition */ |
| 17 | - class pBarcode128 |
|
| 18 | - { |
|
| 17 | + class pBarcode128 { |
|
| 19 | 18 | var $Codes; |
| 20 | 19 | var $Reverse; |
| 21 | 20 | var $Result; |
@@ -23,8 +22,7 @@ discard block |
||
| 23 | 22 | var $CRC; |
| 24 | 23 | |
| 25 | 24 | /* Class creator */ |
| 26 | - function pBarcode128($BasePath="") |
|
| 27 | - { |
|
| 25 | + function pBarcode128($BasePath="") { |
|
| 28 | 26 | $this->Codes = ""; |
| 29 | 27 | $this->Reverse = ""; |
| 30 | 28 | |
@@ -32,8 +30,7 @@ discard block |
||
| 32 | 30 | |
| 33 | 31 | if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."128B.db)."); } |
| 34 | 32 | |
| 35 | - while (!feof($FileHandle)) |
|
| 36 | - { |
|
| 33 | + while (!feof($FileHandle)) { |
|
| 37 | 34 | $Buffer = fgets($FileHandle,4096); |
| 38 | 35 | $Buffer = str_replace(chr(10),"",$Buffer); |
| 39 | 36 | $Buffer = str_replace(chr(13),"",$Buffer); |
@@ -48,8 +45,7 @@ discard block |
||
| 48 | 45 | } |
| 49 | 46 | |
| 50 | 47 | /* Return the projected size of a barcode */ |
| 51 | - function getSize($TextString,$Format="") |
|
| 52 | - { |
|
| 48 | + function getSize($TextString,$Format="") { |
|
| 53 | 49 | $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; |
| 54 | 50 | $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
| 55 | 51 | $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
@@ -76,17 +72,14 @@ discard block |
||
| 76 | 72 | return(array("Width"=>$AreaWidth,"Height"=>$AreaHeight)); |
| 77 | 73 | } |
| 78 | 74 | |
| 79 | - function encode128($Value,$Format="") |
|
| 80 | - { |
|
| 75 | + function encode128($Value,$Format="") { |
|
| 81 | 76 | $this->Result = "11010010000"; |
| 82 | 77 | $this->CRC = 104; |
| 83 | 78 | $TextString = ""; |
| 84 | 79 | |
| 85 | - for($i=1;$i<=strlen($Value);$i++) |
|
| 86 | - { |
|
| 80 | + for($i=1;$i<=strlen($Value);$i++) { |
|
| 87 | 81 | $CharCode = ord($this->mid($Value,$i,1)); |
| 88 | - if ( isset($this->Codes[$CharCode]) ) |
|
| 89 | - { |
|
| 82 | + if ( isset($this->Codes[$CharCode]) ) { |
|
| 90 | 83 | $this->Result = $this->Result.$this->Codes[$CharCode]["Code"]; |
| 91 | 84 | $this->CRC = $this->CRC + $i*$this->Codes[$CharCode]["ID"]; |
| 92 | 85 | $TextString = $TextString.chr($CharCode); |
@@ -101,8 +94,7 @@ discard block |
||
| 101 | 94 | } |
| 102 | 95 | |
| 103 | 96 | /* Create the encoded string */ |
| 104 | - function draw($Object,$Value,$X,$Y,$Format="") |
|
| 105 | - { |
|
| 97 | + function draw($Object,$Value,$X,$Y,$Format="") { |
|
| 106 | 98 | $this->pChartObject = $Object; |
| 107 | 99 | |
| 108 | 100 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -123,21 +115,17 @@ discard block |
||
| 123 | 115 | |
| 124 | 116 | $TextString = $this->encode128($Value); |
| 125 | 117 | |
| 126 | - if ( $DrawArea ) |
|
| 127 | - { |
|
| 118 | + if ( $DrawArea ) { |
|
| 128 | 119 | $X1 = $X + cos(($Angle-135) * PI / 180) * 10; |
| 129 | 120 | $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10; |
| 130 | 121 | |
| 131 | 122 | $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20); |
| 132 | 123 | $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20); |
| 133 | 124 | |
| 134 | - if ( $ShowLegend ) |
|
| 135 | - { |
|
| 125 | + if ( $ShowLegend ) { |
|
| 136 | 126 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
| 137 | 127 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
| 138 | - } |
|
| 139 | - else |
|
| 140 | - { |
|
| 128 | + } else { |
|
| 141 | 129 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20); |
| 142 | 130 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20); |
| 143 | 131 | } |
@@ -150,10 +138,8 @@ discard block |
||
| 150 | 138 | $this->pChartObject->drawPolygon($Polygon,$Settings); |
| 151 | 139 | } |
| 152 | 140 | |
| 153 | - for($i=1;$i<=strlen($this->Result);$i++) |
|
| 154 | - { |
|
| 155 | - if ( $this->mid($this->Result,$i,1) == 1 ) |
|
| 156 | - { |
|
| 141 | + for($i=1;$i<=strlen($this->Result);$i++) { |
|
| 142 | + if ( $this->mid($this->Result,$i,1) == 1 ) { |
|
| 157 | 143 | $X1 = $X + cos($Angle * PI / 180) * $i; |
| 158 | 144 | $Y1 = $Y + sin($Angle * PI / 180) * $i; |
| 159 | 145 | $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height; |
@@ -164,8 +150,7 @@ discard block |
||
| 164 | 150 | } |
| 165 | 151 | } |
| 166 | 152 | |
| 167 | - if ( $ShowLegend ) |
|
| 168 | - { |
|
| 153 | + if ( $ShowLegend ) { |
|
| 169 | 154 | $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2); |
| 170 | 155 | $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2); |
| 171 | 156 | |
@@ -181,6 +181,9 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | + /** |
|
| 185 | + * @param string $string |
|
| 186 | + */ |
|
| 184 | 187 | function checksum( $string ) |
| 185 | 188 | { |
| 186 | 189 | $checksum = 0; |
@@ -195,6 +198,11 @@ discard block |
||
| 195 | 198 | |
| 196 | 199 | function left($value,$NbChar) { return substr($value,0,$NbChar); } |
| 197 | 200 | function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); } |
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * @param integer $Depart |
|
| 204 | + * @param integer $NbChar |
|
| 205 | + */ |
|
| 198 | 206 | function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); } |
| 199 | 207 | } |
| 200 | 208 | ?> |
| 201 | 209 | \ No newline at end of file |
@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | /* pData class definition */ |
| 17 | - class pBarcode39 |
|
| 18 | - { |
|
| 17 | + class pBarcode39 { |
|
| 19 | 18 | var $Codes; |
| 20 | 19 | var $Reverse; |
| 21 | 20 | var $Result; |
@@ -24,8 +23,7 @@ discard block |
||
| 24 | 23 | var $MOD43; |
| 25 | 24 | |
| 26 | 25 | /* Class creator */ |
| 27 | - function pBarcode39($BasePath="",$EnableMOD43=FALSE) |
|
| 28 | - { |
|
| 26 | + function pBarcode39($BasePath="",$EnableMOD43=FALSE) { |
|
| 29 | 27 | $this->MOD43 = $EnableMOD43; |
| 30 | 28 | $this->Codes = ""; |
| 31 | 29 | $this->Reverse = ""; |
@@ -34,8 +32,7 @@ discard block |
||
| 34 | 32 | |
| 35 | 33 | if (!$FileHandle) { die("Cannot find barcode database (".$BasePath."data/39.db)."); } |
| 36 | 34 | |
| 37 | - while (!feof($FileHandle)) |
|
| 38 | - { |
|
| 35 | + while (!feof($FileHandle)) { |
|
| 39 | 36 | $Buffer = fgets($FileHandle,4096); |
| 40 | 37 | $Buffer = str_replace(chr(10),"",$Buffer); |
| 41 | 38 | $Buffer = str_replace(chr(13),"",$Buffer); |
@@ -47,8 +44,7 @@ discard block |
||
| 47 | 44 | } |
| 48 | 45 | |
| 49 | 46 | /* Return the projected size of a barcode */ |
| 50 | - function getSize($TextString,$Format="") |
|
| 51 | - { |
|
| 47 | + function getSize($TextString,$Format="") { |
|
| 52 | 48 | $Angle = isset($Format["Angle"]) ? $Format["Angle"] : 0; |
| 53 | 49 | $ShowLegend = isset($Format["ShowLegend"]) ? $Format["ShowLegend"] : FALSE; |
| 54 | 50 | $LegendOffset = isset($Format["LegendOffset"]) ? $Format["LegendOffset"] : 5; |
@@ -76,24 +72,20 @@ discard block |
||
| 76 | 72 | } |
| 77 | 73 | |
| 78 | 74 | /* Create the encoded string */ |
| 79 | - function encode39($Value) |
|
| 80 | - { |
|
| 75 | + function encode39($Value) { |
|
| 81 | 76 | $this->Result = "100101101101"."0"; |
| 82 | 77 | $TextString = ""; |
| 83 | - for($i=1;$i<=strlen($Value);$i++) |
|
| 84 | - { |
|
| 78 | + for($i=1;$i<=strlen($Value);$i++) { |
|
| 85 | 79 | $CharCode = ord($this->mid($Value,$i,1)); |
| 86 | 80 | if ( $CharCode >= 97 && $CharCode <= 122 ) { $CharCode = $CharCode - 32; } |
| 87 | 81 | |
| 88 | - if ( isset($this->Codes[chr($CharCode)]) ) |
|
| 89 | - { |
|
| 82 | + if ( isset($this->Codes[chr($CharCode)]) ) { |
|
| 90 | 83 | $this->Result = $this->Result.$this->Codes[chr($CharCode)]."0"; |
| 91 | 84 | $TextString = $TextString.chr($CharCode); |
| 92 | 85 | } |
| 93 | 86 | } |
| 94 | 87 | |
| 95 | - if ( $this->MOD43 ) |
|
| 96 | - { |
|
| 88 | + if ( $this->MOD43 ) { |
|
| 97 | 89 | $Checksum = $this->checksum($TextString); |
| 98 | 90 | $this->Result = $this->Result.$this->Codes[$Checksum]."0"; |
| 99 | 91 | } |
@@ -105,8 +97,7 @@ discard block |
||
| 105 | 97 | } |
| 106 | 98 | |
| 107 | 99 | /* Create the encoded string */ |
| 108 | - function draw($Object,$Value,$X,$Y,$Format="") |
|
| 109 | - { |
|
| 100 | + function draw($Object,$Value,$X,$Y,$Format="") { |
|
| 110 | 101 | $this->pChartObject = $Object; |
| 111 | 102 | |
| 112 | 103 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -127,21 +118,17 @@ discard block |
||
| 127 | 118 | |
| 128 | 119 | $TextString = $this->encode39($Value); |
| 129 | 120 | |
| 130 | - if ( $DrawArea ) |
|
| 131 | - { |
|
| 121 | + if ( $DrawArea ) { |
|
| 132 | 122 | $X1 = $X + cos(($Angle-135) * PI / 180) * 10; |
| 133 | 123 | $Y1 = $Y + sin(($Angle-135) * PI / 180) * 10; |
| 134 | 124 | |
| 135 | 125 | $X2 = $X1 + cos($Angle * PI / 180) * (strlen($this->Result)+20); |
| 136 | 126 | $Y2 = $Y1 + sin($Angle * PI / 180) * (strlen($this->Result)+20); |
| 137 | 127 | |
| 138 | - if ( $ShowLegend ) |
|
| 139 | - { |
|
| 128 | + if ( $ShowLegend ) { |
|
| 140 | 129 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
| 141 | 130 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+$LegendOffset+$this->pChartObject->FontSize+10); |
| 142 | - } |
|
| 143 | - else |
|
| 144 | - { |
|
| 131 | + } else { |
|
| 145 | 132 | $X3 = $X2 + cos(($Angle+90) * PI / 180) * ($Height+20); |
| 146 | 133 | $Y3 = $Y2 + sin(($Angle+90) * PI / 180) * ($Height+20); |
| 147 | 134 | } |
@@ -154,10 +141,8 @@ discard block |
||
| 154 | 141 | $this->pChartObject->drawPolygon($Polygon,$Settings); |
| 155 | 142 | } |
| 156 | 143 | |
| 157 | - for($i=1;$i<=strlen($this->Result);$i++) |
|
| 158 | - { |
|
| 159 | - if ( $this->mid($this->Result,$i,1) == 1 ) |
|
| 160 | - { |
|
| 144 | + for($i=1;$i<=strlen($this->Result);$i++) { |
|
| 145 | + if ( $this->mid($this->Result,$i,1) == 1 ) { |
|
| 161 | 146 | $X1 = $X + cos($Angle * PI / 180) * $i; |
| 162 | 147 | $Y1 = $Y + sin($Angle * PI / 180) * $i; |
| 163 | 148 | $X2 = $X1 + cos(($Angle+90) * PI / 180) * $Height; |
@@ -168,8 +153,7 @@ discard block |
||
| 168 | 153 | } |
| 169 | 154 | } |
| 170 | 155 | |
| 171 | - if ( $ShowLegend ) |
|
| 172 | - { |
|
| 156 | + if ( $ShowLegend ) { |
|
| 173 | 157 | $X1 = $X + cos($Angle * PI / 180) * (strlen($this->Result)/2); |
| 174 | 158 | $Y1 = $Y + sin($Angle * PI / 180) * (strlen($this->Result)/2); |
| 175 | 159 | |
@@ -181,14 +165,14 @@ discard block |
||
| 181 | 165 | } |
| 182 | 166 | } |
| 183 | 167 | |
| 184 | - function checksum( $string ) |
|
| 185 | - { |
|
| 168 | + function checksum( $string ) { |
|
| 186 | 169 | $checksum = 0; |
| 187 | 170 | $length = strlen( $string ); |
| 188 | 171 | $charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%'; |
| 189 | 172 | |
| 190 | - for( $i=0; $i < $length; ++$i ) |
|
| 191 | - $checksum += strpos( $charset, $string[$i] ); |
|
| 173 | + for( $i=0; $i < $length; ++$i ) { |
|
| 174 | + $checksum += strpos( $charset, $string[$i] ); |
|
| 175 | + } |
|
| 192 | 176 | |
| 193 | 177 | return substr( $charset, ($checksum % 43), 1 ); |
| 194 | 178 | } |
@@ -47,6 +47,10 @@ discard block |
||
| 47 | 47 | { return(md5($Marker.serialize($Data->Data))); } |
| 48 | 48 | |
| 49 | 49 | /* Write the generated picture to the cache */ |
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @param pImage $pChartObject |
|
| 53 | + */ |
|
| 50 | 54 | function writeToCache($ID,$pChartObject) |
| 51 | 55 | { |
| 52 | 56 | /* Compute the paths */ |
@@ -81,6 +85,10 @@ discard block |
||
| 81 | 85 | } |
| 82 | 86 | |
| 83 | 87 | /* Remove object older than the specified TS */ |
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @param integer $Expiry |
|
| 91 | + */ |
|
| 84 | 92 | function removeOlderThan($Expiry) |
| 85 | 93 | { $this->dbRemoval(array("Expiry"=>$Expiry)); } |
| 86 | 94 | |
@@ -235,6 +243,9 @@ discard block |
||
| 235 | 243 | return(TRUE); |
| 236 | 244 | } |
| 237 | 245 | |
| 246 | + /** |
|
| 247 | + * @param string $Destination |
|
| 248 | + */ |
|
| 238 | 249 | function saveFromCache($ID,$Destination) |
| 239 | 250 | { |
| 240 | 251 | /* Get the raw picture from the cache */ |
@@ -14,15 +14,13 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | /* pData class definition */ |
| 17 | - class pCache |
|
| 18 | - { |
|
| 17 | + class pCache { |
|
| 19 | 18 | var $CacheFolder; |
| 20 | 19 | var $CacheIndex; |
| 21 | 20 | var $CacheDB; |
| 22 | 21 | |
| 23 | 22 | /* Class creator */ |
| 24 | - function pCache($Settings="") |
|
| 25 | - { |
|
| 23 | + function pCache($Settings="") { |
|
| 26 | 24 | $CacheFolder = isset($Settings["CacheFolder"]) ? $Settings["CacheFolder"] : "cache"; |
| 27 | 25 | $CacheIndex = isset($Settings["CacheIndex"]) ? $Settings["CacheIndex"] : "index.db"; |
| 28 | 26 | $CacheDB = isset($Settings["CacheDB"]) ? $Settings["CacheDB"] : "cache.db"; |
@@ -36,8 +34,7 @@ discard block |
||
| 36 | 34 | } |
| 37 | 35 | |
| 38 | 36 | /* Flush the cache contents */ |
| 39 | - function flush() |
|
| 40 | - { |
|
| 37 | + function flush() { |
|
| 41 | 38 | if (file_exists($this->CacheFolder."/".$this->CacheIndex)) { unlink($this->CacheFolder."/".$this->CacheIndex); touch($this->CacheFolder."/".$this->CacheIndex); } |
| 42 | 39 | if (file_exists($this->CacheFolder."/".$this->CacheDB)) { unlink($this->CacheFolder."/".$this->CacheDB); touch($this->CacheFolder."/".$this->CacheDB); } |
| 43 | 40 | } |
@@ -47,8 +44,7 @@ discard block |
||
| 47 | 44 | { return(md5($Marker.serialize($Data->Data))); } |
| 48 | 45 | |
| 49 | 46 | /* Write the generated picture to the cache */ |
| 50 | - function writeToCache($ID,$pChartObject) |
|
| 51 | - { |
|
| 47 | + function writeToCache($ID,$pChartObject) { |
|
| 52 | 48 | /* Compute the paths */ |
| 53 | 49 | $TemporaryFile = $this->CacheFolder."/tmp_".rand(0,1000).".png"; |
| 54 | 50 | $Database = $this->CacheFolder."/".$this->CacheDB; |
@@ -89,8 +85,7 @@ discard block |
||
| 89 | 85 | { $this->dbRemoval(array("Name"=>$ID)); } |
| 90 | 86 | |
| 91 | 87 | /* Remove with specified criterias */ |
| 92 | - function dbRemoval($Settings) |
|
| 93 | - { |
|
| 88 | + function dbRemoval($Settings) { |
|
| 94 | 89 | $ID = isset($Settings["Name"]) ? $Settings["Name"] : NULL; |
| 95 | 90 | $Expiry = isset($Settings["Expiry"]) ? $Settings["Expiry"] : -(24*60*60); |
| 96 | 91 | $TS = time()-$Expiry; |
@@ -102,8 +97,7 @@ discard block |
||
| 102 | 97 | $IndexTemp = $this->CacheFolder."/".$this->CacheIndex.".tmp"; |
| 103 | 98 | |
| 104 | 99 | /* Single file removal */ |
| 105 | - if ( $ID != NULL ) |
|
| 106 | - { |
|
| 100 | + if ( $ID != NULL ) { |
|
| 107 | 101 | /* Retrieve object informations */ |
| 108 | 102 | $Object = $this->isInCache($ID,TRUE); |
| 109 | 103 | |
@@ -122,23 +116,20 @@ discard block |
||
| 122 | 116 | $DBTempHandle = @fopen($DatabaseTemp, "w"); |
| 123 | 117 | |
| 124 | 118 | /* Remove the selected ID from the database */ |
| 125 | - while (!feof($IndexHandle)) |
|
| 126 | - { |
|
| 119 | + while (!feof($IndexHandle)) { |
|
| 127 | 120 | $Entry = fgets($IndexHandle, 4096); |
| 128 | 121 | $Entry = str_replace("\r","",$Entry); |
| 129 | 122 | $Entry = str_replace("\n","",$Entry); |
| 130 | 123 | $Settings = preg_split("/,/",$Entry); |
| 131 | 124 | |
| 132 | - if ( $Entry != "" ) |
|
| 133 | - { |
|
| 125 | + if ( $Entry != "" ) { |
|
| 134 | 126 | $PicID = $Settings[0]; |
| 135 | 127 | $DBPos = $Settings[1]; |
| 136 | 128 | $PicSize = $Settings[2]; |
| 137 | 129 | $GeneratedTS = $Settings[3]; |
| 138 | 130 | $Hits = $Settings[4]; |
| 139 | 131 | |
| 140 | - if ( $Settings[0] != $ID && $GeneratedTS > $TS) |
|
| 141 | - { |
|
| 132 | + if ( $Settings[0] != $ID && $GeneratedTS > $TS) { |
|
| 142 | 133 | $CurrentPos = ftell($DBTempHandle); |
| 143 | 134 | fwrite($IndexTempHandle, $PicID.",".$CurrentPos.",".$PicSize.",".$GeneratedTS.",".$Hits."\r\n"); |
| 144 | 135 | |
@@ -164,23 +155,19 @@ discard block |
||
| 164 | 155 | rename($IndexTemp,$Index); |
| 165 | 156 | } |
| 166 | 157 | |
| 167 | - function isInCache($ID,$Verbose=FALSE,$UpdateHitsCount=FALSE) |
|
| 168 | - { |
|
| 158 | + function isInCache($ID,$Verbose=FALSE,$UpdateHitsCount=FALSE) { |
|
| 169 | 159 | /* Compute the paths */ |
| 170 | 160 | $Index = $this->CacheFolder."/".$this->CacheIndex; |
| 171 | 161 | |
| 172 | 162 | /* Search the picture in the index file */ |
| 173 | 163 | $Handle = @fopen($Index, "r"); |
| 174 | - while (!feof($Handle)) |
|
| 175 | - { |
|
| 164 | + while (!feof($Handle)) { |
|
| 176 | 165 | $IndexPos = ftell($Handle); |
| 177 | 166 | $Entry = fgets($Handle, 4096); |
| 178 | - if ( $Entry != "" ) |
|
| 179 | - { |
|
| 167 | + if ( $Entry != "" ) { |
|
| 180 | 168 | $Settings = preg_split("/,/",$Entry); |
| 181 | 169 | $PicID = $Settings[0]; |
| 182 | - if ( $PicID == $ID ) |
|
| 183 | - { |
|
| 170 | + if ( $PicID == $ID ) { |
|
| 184 | 171 | fclose($Handle); |
| 185 | 172 | |
| 186 | 173 | $DBPos = $Settings[1]; |
@@ -188,8 +175,7 @@ discard block |
||
| 188 | 175 | $GeneratedTS = $Settings[3]; |
| 189 | 176 | $Hits = intval($Settings[4]); |
| 190 | 177 | |
| 191 | - if ( $UpdateHitsCount ) |
|
| 192 | - { |
|
| 178 | + if ( $UpdateHitsCount ) { |
|
| 193 | 179 | $Hits++; |
| 194 | 180 | if ( strlen($Hits) < 7 ) { $Hits = $Hits.str_repeat(" ",7-strlen($Hits)); } |
| 195 | 181 | |
@@ -200,8 +186,7 @@ discard block |
||
| 200 | 186 | } |
| 201 | 187 | |
| 202 | 188 | if ($Verbose) |
| 203 | - { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); } |
|
| 204 | - else |
|
| 189 | + { return(array("DBPos"=>$DBPos,"PicSize"=>$PicSize,"GeneratedTS"=>$GeneratedTS,"Hits"=>$Hits)); } else |
|
| 205 | 190 | { return(TRUE); } |
| 206 | 191 | } |
| 207 | 192 | } |
@@ -213,16 +198,14 @@ discard block |
||
| 213 | 198 | } |
| 214 | 199 | |
| 215 | 200 | /* Automatic output method based on the calling interface */ |
| 216 | - function autoOutput($ID,$Destination="output.png") |
|
| 217 | - { |
|
| 201 | + function autoOutput($ID,$Destination="output.png") { |
|
| 218 | 202 | if (php_sapi_name() == "cli") |
| 219 | 203 | $this->saveFromCache($ID,$Destination); |
| 220 | 204 | else |
| 221 | 205 | $this->strokeFromCache($ID); |
| 222 | 206 | } |
| 223 | 207 | |
| 224 | - function strokeFromCache($ID) |
|
| 225 | - { |
|
| 208 | + function strokeFromCache($ID) { |
|
| 226 | 209 | /* Get the raw picture from the cache */ |
| 227 | 210 | $Picture = $this->getFromCache($ID); |
| 228 | 211 | |
@@ -235,8 +218,7 @@ discard block |
||
| 235 | 218 | return(TRUE); |
| 236 | 219 | } |
| 237 | 220 | |
| 238 | - function saveFromCache($ID,$Destination) |
|
| 239 | - { |
|
| 221 | + function saveFromCache($ID,$Destination) { |
|
| 240 | 222 | /* Get the raw picture from the cache */ |
| 241 | 223 | $Picture = $this->getFromCache($ID); |
| 242 | 224 | |
@@ -252,8 +234,7 @@ discard block |
||
| 252 | 234 | return(TRUE); |
| 253 | 235 | } |
| 254 | 236 | |
| 255 | - function getFromCache($ID) |
|
| 256 | - { |
|
| 237 | + function getFromCache($ID) { |
|
| 257 | 238 | /* Compute the path */ |
| 258 | 239 | $Database = $this->CacheFolder."/".$this->CacheDB; |
| 259 | 240 | |
@@ -105,6 +105,10 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /* Strip VOID values */ |
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @param string $Values |
|
| 111 | + */ |
|
| 108 | 112 | function stripVOID($Values) |
| 109 | 113 | { if (!is_array($Values)) { return(array()); } $Result = array(); foreach($Values as $Key => $Value) { if ( $Value != VOID ) { $Result[] = $Value; } } return($Result); } |
| 110 | 114 | |
@@ -414,6 +418,11 @@ discard block |
||
| 414 | 418 | } |
| 415 | 419 | |
| 416 | 420 | /* Set the position of an Axis */ |
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * @param integer $AxisID |
|
| 424 | + * @param integer $Position |
|
| 425 | + */ |
|
| 417 | 426 | function setAxisPosition($AxisID,$Position=AXIS_POSITION_LEFT) |
| 418 | 427 | { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Position"] = $Position; } } |
| 419 | 428 | |
@@ -497,6 +506,10 @@ discard block |
||
| 497 | 506 | } |
| 498 | 507 | |
| 499 | 508 | /* Set the color of one serie */ |
| 509 | + |
|
| 510 | + /** |
|
| 511 | + * @param string $Series |
|
| 512 | + */ |
|
| 500 | 513 | function setPalette($Series,$Format=NULL) |
| 501 | 514 | { |
| 502 | 515 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
@@ -559,6 +572,10 @@ discard block |
||
| 559 | 572 | } |
| 560 | 573 | |
| 561 | 574 | /* Initialise a given scatter serie */ |
| 575 | + |
|
| 576 | + /** |
|
| 577 | + * @param integer $ID |
|
| 578 | + */ |
|
| 562 | 579 | function initScatterSerie($ID) |
| 563 | 580 | { |
| 564 | 581 | if ( isset($this->Data["ScatterSeries"][$ID]) ) { return(0); } |
@@ -581,6 +598,10 @@ discard block |
||
| 581 | 598 | } |
| 582 | 599 | |
| 583 | 600 | /* Initialise a given serie */ |
| 601 | + |
|
| 602 | + /** |
|
| 603 | + * @param string $Serie |
|
| 604 | + */ |
|
| 584 | 605 | function initialise($Serie) |
| 585 | 606 | { |
| 586 | 607 | if ( isset($this->Data["Series"]) ) { $ID = count($this->Data["Series"]); } else { $ID = 0; } |
@@ -781,6 +802,10 @@ discard block |
||
| 781 | 802 | { return("pData object."); } |
| 782 | 803 | |
| 783 | 804 | function left($value,$NbChar) { return substr($value,0,$NbChar); } |
| 805 | + |
|
| 806 | + /** |
|
| 807 | + * @param integer $NbChar |
|
| 808 | + */ |
|
| 784 | 809 | function right($value,$NbChar) { return substr($value,strlen($value)-$NbChar,$NbChar); } |
| 785 | 810 | function mid($value,$Depart,$NbChar) { return substr($value,$Depart-1,$NbChar); } |
| 786 | 811 | } |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | define("EURO_SYMBOL" , utf8_encode("€")); |
| 53 | 53 | |
| 54 | 54 | /* pData class definition */ |
| 55 | - class pData |
|
| 56 | - { |
|
| 55 | + class pData { |
|
| 57 | 56 | var $Data; |
| 58 | 57 | |
| 59 | 58 | var $Palette = array("0"=>array("R"=>188,"G"=>224,"B"=>46,"Alpha"=>100), |
@@ -66,8 +65,7 @@ discard block |
||
| 66 | 65 | "7"=>array("R"=>224,"G"=>176,"B"=>46,"Alpha"=>100)); |
| 67 | 66 | |
| 68 | 67 | /* Class creator */ |
| 69 | - function pData() |
|
| 70 | - { |
|
| 68 | + function pData() { |
|
| 71 | 69 | $this->Data = ""; |
| 72 | 70 | $this->Data["XAxisDisplay"] = AXIS_FORMAT_DEFAULT; |
| 73 | 71 | $this->Data["XAxisFormat"] = NULL; |
@@ -82,21 +80,17 @@ discard block |
||
| 82 | 80 | } |
| 83 | 81 | |
| 84 | 82 | /* Add a single point or an array to the given serie */ |
| 85 | - function addPoints($Values,$SerieName="Serie1") |
|
| 86 | - { |
|
| 83 | + function addPoints($Values,$SerieName="Serie1") { |
|
| 87 | 84 | if (!isset($this->Data["Series"][$SerieName])) |
| 88 | 85 | $this->initialise($SerieName); |
| 89 | 86 | |
| 90 | - if ( is_array($Values) ) |
|
| 91 | - { |
|
| 87 | + if ( is_array($Values) ) { |
|
| 92 | 88 | foreach($Values as $Key => $Value) |
| 93 | 89 | { $this->Data["Series"][$SerieName]["Data"][] = $Value; } |
| 94 | - } |
|
| 95 | - else |
|
| 90 | + } else |
|
| 96 | 91 | $this->Data["Series"][$SerieName]["Data"][] = $Values; |
| 97 | 92 | |
| 98 | - if ( $Values != VOID ) |
|
| 99 | - { |
|
| 93 | + if ( $Values != VOID ) { |
|
| 100 | 94 | $StrippedData = $this->stripVOID($this->Data["Series"][$SerieName]["Data"]); |
| 101 | 95 | if ( empty($StrippedData) ) { $this->Data["Series"][$SerieName]["Max"] = 0; $this->Data["Series"][$SerieName]["Min"] =0; return(0); } |
| 102 | 96 | $this->Data["Series"][$SerieName]["Max"] = max($StrippedData); |
@@ -113,8 +107,7 @@ discard block |
||
| 113 | 107 | { if (isset($this->Data["Series"][$Serie]["Data"])) { return(sizeof($this->Data["Series"][$Serie]["Data"])); } else { return(0); } } |
| 114 | 108 | |
| 115 | 109 | /* Remove a serie from the pData object */ |
| 116 | - function removeSerie($Series) |
|
| 117 | - { |
|
| 110 | + function removeSerie($Series) { |
|
| 118 | 111 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 119 | 112 | foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie])) { unset($this->Data["Series"][$Serie]); } } |
| 120 | 113 | } |
@@ -128,8 +121,7 @@ discard block |
||
| 128 | 121 | { if (isset($this->Data["Series"][$Serie]["Data"])) { return($this->Data["Series"][$Serie]["Data"]); } else { return(NULL); } } |
| 129 | 122 | |
| 130 | 123 | /* Reverse the values in the given serie */ |
| 131 | - function reverseSerie($Series) |
|
| 132 | - { |
|
| 124 | + function reverseSerie($Series) { |
|
| 133 | 125 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 134 | 126 | foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]["Data"])) { $this->Data["Series"][$Serie]["Data"] = array_reverse($this->Data["Series"][$Serie]["Data"]); } } |
| 135 | 127 | } |
@@ -147,29 +139,25 @@ discard block |
||
| 147 | 139 | { if (isset($this->Data["Series"][$Serie]["Min"])) { return($this->Data["Series"][$Serie]["Min"]); } else { return(NULL); } } |
| 148 | 140 | |
| 149 | 141 | /* Set the description of a given serie */ |
| 150 | - function setSerieShape($Series,$Shape=SERIE_SHAPE_FILLEDCIRCLE) |
|
| 151 | - { |
|
| 142 | + function setSerieShape($Series,$Shape=SERIE_SHAPE_FILLEDCIRCLE) { |
|
| 152 | 143 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 153 | 144 | foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Shape"] = $Shape; } } |
| 154 | 145 | } |
| 155 | 146 | |
| 156 | 147 | /* Set the description of a given serie */ |
| 157 | - function setSerieDescription($Series,$Description="My serie") |
|
| 158 | - { |
|
| 148 | + function setSerieDescription($Series,$Description="My serie") { |
|
| 159 | 149 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 160 | 150 | foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Description"] = $Description; } } |
| 161 | 151 | } |
| 162 | 152 | |
| 163 | 153 | /* Set a serie as "drawable" while calling a rendering function */ |
| 164 | - function setSerieDrawable($Series,$Drawable=TRUE) |
|
| 165 | - { |
|
| 154 | + function setSerieDrawable($Series,$Drawable=TRUE) { |
|
| 166 | 155 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 167 | 156 | foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["isDrawable"] = $Drawable; } } |
| 168 | 157 | } |
| 169 | 158 | |
| 170 | 159 | /* Set the icon associated to a given serie */ |
| 171 | - function setSeriePicture($Series,$Picture=NULL) |
|
| 172 | - { |
|
| 160 | + function setSeriePicture($Series,$Picture=NULL) { |
|
| 173 | 161 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 174 | 162 | foreach($Series as $Key => $Serie) { if (isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Picture"] = $Picture; } } |
| 175 | 163 | } |
@@ -226,15 +214,13 @@ discard block |
||
| 226 | 214 | { if ( isset($this->Data["ScatterSeries"][$ID]) ) { $this->Data["ScatterSeries"][$ID]["Weight"] = $Weight; } } |
| 227 | 215 | |
| 228 | 216 | /* Associate a color to a scatter serie */ |
| 229 | - function setScatterSerieColor($ID,$Format) |
|
| 230 | - { |
|
| 217 | + function setScatterSerieColor($ID,$Format) { |
|
| 231 | 218 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 232 | 219 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 233 | 220 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
| 234 | 221 | $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; |
| 235 | 222 | |
| 236 | - if ( isset($this->Data["ScatterSeries"][$ID]) ) |
|
| 237 | - { |
|
| 223 | + if ( isset($this->Data["ScatterSeries"][$ID]) ) { |
|
| 238 | 224 | $this->Data["ScatterSeries"][$ID]["Color"]["R"] = $R; |
| 239 | 225 | $this->Data["ScatterSeries"][$ID]["Color"]["G"] = $G; |
| 240 | 226 | $this->Data["ScatterSeries"][$ID]["Color"]["B"] = $B; |
@@ -243,15 +229,12 @@ discard block |
||
| 243 | 229 | } |
| 244 | 230 | |
| 245 | 231 | /* Compute the series limits for an individual and global point of view */ |
| 246 | - function limits() |
|
| 247 | - { |
|
| 232 | + function limits() { |
|
| 248 | 233 | $GlobalMin = ABSOLUTE_MAX; |
| 249 | 234 | $GlobalMax = ABSOLUTE_MIN; |
| 250 | 235 | |
| 251 | - foreach($this->Data["Series"] as $Key => $Value) |
|
| 252 | - { |
|
| 253 | - if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE) |
|
| 254 | - { |
|
| 236 | + foreach($this->Data["Series"] as $Key => $Value) { |
|
| 237 | + if ( $this->Data["Abscissa"] != $Key && $this->Data["Series"][$Key]["isDrawable"] == TRUE) { |
|
| 255 | 238 | if ( $GlobalMin > $this->Data["Series"][$Key]["Min"] ) { $GlobalMin = $this->Data["Series"][$Key]["Min"]; } |
| 256 | 239 | if ( $GlobalMax < $this->Data["Series"][$Key]["Max"] ) { $GlobalMax = $this->Data["Series"][$Key]["Max"]; } |
| 257 | 240 | } |
@@ -267,68 +250,55 @@ discard block |
||
| 267 | 250 | { foreach($this->Data["Series"] as $Key => $Value) { if ( $this->Data["Abscissa"] != $Key ) { $this->Data["Series"][$Key]["isDrawable"]=TRUE; } } } |
| 268 | 251 | |
| 269 | 252 | /* Return the average value of the given serie */ |
| 270 | - function getSerieAverage($Serie) |
|
| 271 | - { |
|
| 272 | - if ( isset($this->Data["Series"][$Serie]) ) |
|
| 273 | - { |
|
| 253 | + function getSerieAverage($Serie) { |
|
| 254 | + if ( isset($this->Data["Series"][$Serie]) ) { |
|
| 274 | 255 | $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]); |
| 275 | 256 | return(array_sum($SerieData)/sizeof($SerieData)); |
| 276 | - } |
|
| 277 | - else |
|
| 257 | + } else |
|
| 278 | 258 | return(NULL); |
| 279 | 259 | } |
| 280 | 260 | |
| 281 | 261 | /* Return the geometric mean of the given serie */ |
| 282 | - function getGeometricMean($Serie) |
|
| 283 | - { |
|
| 284 | - if ( isset($this->Data["Series"][$Serie]) ) |
|
| 285 | - { |
|
| 262 | + function getGeometricMean($Serie) { |
|
| 263 | + if ( isset($this->Data["Series"][$Serie]) ) { |
|
| 286 | 264 | $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]); |
| 287 | 265 | $Seriesum = 1; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum * $Value; } |
| 288 | 266 | return(pow($Seriesum,1/sizeof($SerieData))); |
| 289 | - } |
|
| 290 | - else |
|
| 267 | + } else |
|
| 291 | 268 | return(NULL); |
| 292 | 269 | } |
| 293 | 270 | |
| 294 | 271 | /* Return the harmonic mean of the given serie */ |
| 295 | - function getHarmonicMean($Serie) |
|
| 296 | - { |
|
| 297 | - if ( isset($this->Data["Series"][$Serie]) ) |
|
| 298 | - { |
|
| 272 | + function getHarmonicMean($Serie) { |
|
| 273 | + if ( isset($this->Data["Series"][$Serie]) ) { |
|
| 299 | 274 | $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]); |
| 300 | 275 | $Seriesum = 0; foreach($SerieData as $Key => $Value) { $Seriesum = $Seriesum + 1/$Value; } |
| 301 | 276 | return(sizeof($SerieData)/$Seriesum); |
| 302 | - } |
|
| 303 | - else |
|
| 277 | + } else |
|
| 304 | 278 | return(NULL); |
| 305 | 279 | } |
| 306 | 280 | |
| 307 | 281 | /* Return the standard deviation of the given serie */ |
| 308 | - function getStandardDeviation($Serie) |
|
| 309 | - { |
|
| 310 | - if ( isset($this->Data["Series"][$Serie]) ) |
|
| 311 | - { |
|
| 282 | + function getStandardDeviation($Serie) { |
|
| 283 | + if ( isset($this->Data["Series"][$Serie]) ) { |
|
| 312 | 284 | $Average = $this->getSerieAverage($Serie); |
| 313 | 285 | $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]); |
| 314 | 286 | |
| 315 | 287 | $DeviationSum = 0; |
| 316 | - foreach($SerieData as $Key => $Value) |
|
| 317 | - $DeviationSum = $DeviationSum + ($Value-$Average)*($Value-$Average); |
|
| 288 | + foreach($SerieData as $Key => $Value) { |
|
| 289 | + $DeviationSum = $DeviationSum + ($Value-$Average)*($Value-$Average); |
|
| 290 | + } |
|
| 318 | 291 | |
| 319 | 292 | $Deviation = sqrt($DeviationSum/count($SerieData)); |
| 320 | 293 | |
| 321 | 294 | return($Deviation); |
| 322 | - } |
|
| 323 | - else |
|
| 295 | + } else |
|
| 324 | 296 | return(NULL); |
| 325 | 297 | } |
| 326 | 298 | |
| 327 | 299 | /* Return the Coefficient of variation of the given serie */ |
| 328 | - function getCoefficientOfVariation($Serie) |
|
| 329 | - { |
|
| 330 | - if ( isset($this->Data["Series"][$Serie]) ) |
|
| 331 | - { |
|
| 300 | + function getCoefficientOfVariation($Serie) { |
|
| 301 | + if ( isset($this->Data["Series"][$Serie]) ) { |
|
| 332 | 302 | $Average = $this->getSerieAverage($Serie); |
| 333 | 303 | $StandardDeviation = $this->getStandardDeviation($Serie); |
| 334 | 304 | |
@@ -336,16 +306,13 @@ discard block |
||
| 336 | 306 | return($StandardDeviation/$Average); |
| 337 | 307 | else |
| 338 | 308 | return(NULL); |
| 339 | - } |
|
| 340 | - else |
|
| 309 | + } else |
|
| 341 | 310 | return(NULL); |
| 342 | 311 | } |
| 343 | 312 | |
| 344 | 313 | /* Return the median value of the given serie */ |
| 345 | - function getSerieMedian($Serie) |
|
| 346 | - { |
|
| 347 | - if ( isset($this->Data["Series"][$Serie]) ) |
|
| 348 | - { |
|
| 314 | + function getSerieMedian($Serie) { |
|
| 315 | + if ( isset($this->Data["Series"][$Serie]) ) { |
|
| 349 | 316 | $SerieData = $this->stripVOID($this->Data["Series"][$Serie]["Data"]); |
| 350 | 317 | sort($SerieData); |
| 351 | 318 | $SerieCenter = floor(sizeof($SerieData)/2); |
@@ -354,14 +321,12 @@ discard block |
||
| 354 | 321 | return($SerieData[$SerieCenter]); |
| 355 | 322 | else |
| 356 | 323 | return(NULL); |
| 357 | - } |
|
| 358 | - else |
|
| 324 | + } else |
|
| 359 | 325 | return(NULL); |
| 360 | 326 | } |
| 361 | 327 | |
| 362 | 328 | /* Return the x th percentil of the given serie */ |
| 363 | - function getSeriePercentile($Serie="Serie1",$Percentil=95) |
|
| 364 | - { |
|
| 329 | + function getSeriePercentile($Serie="Serie1",$Percentil=95) { |
|
| 365 | 330 | if (!isset($this->Data["Series"][$Serie]["Data"])) { return(NULL); } |
| 366 | 331 | |
| 367 | 332 | $Values = count($this->Data["Series"][$Serie]["Data"])-1; |
@@ -378,23 +343,20 @@ discard block |
||
| 378 | 343 | } |
| 379 | 344 | |
| 380 | 345 | /* Add random values to a given serie */ |
| 381 | - function addRandomValues($SerieName="Serie1",$Options="") |
|
| 382 | - { |
|
| 346 | + function addRandomValues($SerieName="Serie1",$Options="") { |
|
| 383 | 347 | $Values = isset($Options["Values"]) ? $Options["Values"] : 20; |
| 384 | 348 | $Min = isset($Options["Min"]) ? $Options["Min"] : 0; |
| 385 | 349 | $Max = isset($Options["Max"]) ? $Options["Max"] : 100; |
| 386 | 350 | $withFloat = isset($Options["withFloat"]) ? $Options["withFloat"] : FALSE; |
| 387 | 351 | |
| 388 | - for ($i=0;$i<=$Values;$i++) |
|
| 389 | - { |
|
| 352 | + for ($i=0;$i<=$Values;$i++) { |
|
| 390 | 353 | if ( $withFloat ) { $Value = rand($Min*100,$Max*100)/100; } else { $Value = rand($Min,$Max); } |
| 391 | 354 | $this->addPoints($Value,$SerieName); |
| 392 | 355 | } |
| 393 | 356 | } |
| 394 | 357 | |
| 395 | 358 | /* Test if we have valid data */ |
| 396 | - function containsData() |
|
| 397 | - { |
|
| 359 | + function containsData() { |
|
| 398 | 360 | if (!isset($this->Data["Series"])) { return(FALSE); } |
| 399 | 361 | |
| 400 | 362 | $Result = FALSE; |
@@ -404,10 +366,8 @@ discard block |
||
| 404 | 366 | } |
| 405 | 367 | |
| 406 | 368 | /* Set the display mode of an Axis */ |
| 407 | - function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=NULL) |
|
| 408 | - { |
|
| 409 | - if ( isset($this->Data["Axis"][$AxisID] ) ) |
|
| 410 | - { |
|
| 369 | + function setAxisDisplay($AxisID,$Mode=AXIS_FORMAT_DEFAULT,$Format=NULL) { |
|
| 370 | + if ( isset($this->Data["Axis"][$AxisID] ) ) { |
|
| 411 | 371 | $this->Data["Axis"][$AxisID]["Display"] = $Mode; |
| 412 | 372 | if ( $Format != NULL ) { $this->Data["Axis"][$AxisID]["Format"] = $Format; } |
| 413 | 373 | } |
@@ -426,15 +386,13 @@ discard block |
||
| 426 | 386 | { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Name"] = $Name; } } |
| 427 | 387 | |
| 428 | 388 | /* Associate a color to an axis */ |
| 429 | - function setAxisColor($AxisID,$Format) |
|
| 430 | - { |
|
| 389 | + function setAxisColor($AxisID,$Format) { |
|
| 431 | 390 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 432 | 391 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 433 | 392 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
| 434 | 393 | $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; |
| 435 | 394 | |
| 436 | - if ( isset($this->Data["Axis"][$AxisID] ) ) |
|
| 437 | - { |
|
| 395 | + if ( isset($this->Data["Axis"][$AxisID] ) ) { |
|
| 438 | 396 | $this->Data["Axis"][$AxisID]["Color"]["R"] = $R; |
| 439 | 397 | $this->Data["Axis"][$AxisID]["Color"]["G"] = $G; |
| 440 | 398 | $this->Data["Axis"][$AxisID]["Color"]["B"] = $B; |
@@ -448,11 +406,9 @@ discard block |
||
| 448 | 406 | { if ( isset($this->Data["Axis"][$AxisID] ) ) { $this->Data["Axis"][$AxisID]["Identity"] = $Identity; } } |
| 449 | 407 | |
| 450 | 408 | /* Associate one data serie with one axis */ |
| 451 | - function setSerieOnAxis($Series,$AxisID) |
|
| 452 | - { |
|
| 409 | + function setSerieOnAxis($Series,$AxisID) { |
|
| 453 | 410 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 454 | - foreach($Series as $Key => $Serie) |
|
| 455 | - { |
|
| 411 | + foreach($Series as $Key => $Serie) { |
|
| 456 | 412 | $PreviousAxis = $this->Data["Series"][$Serie]["Axis"]; |
| 457 | 413 | |
| 458 | 414 | /* Create missing axis */ |
@@ -469,22 +425,19 @@ discard block |
||
| 469 | 425 | } |
| 470 | 426 | |
| 471 | 427 | /* Define if a serie should be draw with ticks */ |
| 472 | - function setSerieTicks($Series,$Width=0) |
|
| 473 | - { |
|
| 428 | + function setSerieTicks($Series,$Width=0) { |
|
| 474 | 429 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 475 | 430 | foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Ticks"] = $Width; } } |
| 476 | 431 | } |
| 477 | 432 | |
| 478 | 433 | /* Define if a serie should be draw with a special weight */ |
| 479 | - function setSerieWeight($Series,$Weight=0) |
|
| 480 | - { |
|
| 434 | + function setSerieWeight($Series,$Weight=0) { |
|
| 481 | 435 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 482 | 436 | foreach($Series as $Key => $Serie) { if ( isset($this->Data["Series"][$Serie]) ) { $this->Data["Series"][$Serie]["Weight"] = $Weight; } } |
| 483 | 437 | } |
| 484 | 438 | |
| 485 | 439 | /* Returns the palette of the given serie */ |
| 486 | - function getSeriePalette($Serie) |
|
| 487 | - { |
|
| 440 | + function getSeriePalette($Serie) { |
|
| 488 | 441 | if ( !isset($this->Data["Series"][$Serie]) ) { return(NULL); } |
| 489 | 442 | |
| 490 | 443 | $Result = ""; |
@@ -497,19 +450,16 @@ discard block |
||
| 497 | 450 | } |
| 498 | 451 | |
| 499 | 452 | /* Set the color of one serie */ |
| 500 | - function setPalette($Series,$Format=NULL) |
|
| 501 | - { |
|
| 453 | + function setPalette($Series,$Format=NULL) { |
|
| 502 | 454 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 503 | 455 | |
| 504 | - foreach($Series as $Key => $Serie) |
|
| 505 | - { |
|
| 456 | + foreach($Series as $Key => $Serie) { |
|
| 506 | 457 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 507 | 458 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 508 | 459 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
| 509 | 460 | $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100; |
| 510 | 461 | |
| 511 | - if ( isset($this->Data["Series"][$Serie]) ) |
|
| 512 | - { |
|
| 462 | + if ( isset($this->Data["Series"][$Serie]) ) { |
|
| 513 | 463 | $OldR = $this->Data["Series"][$Serie]["Color"]["R"]; $OldG = $this->Data["Series"][$Serie]["Color"]["G"]; $OldB = $this->Data["Series"][$Serie]["Color"]["B"]; |
| 514 | 464 | $this->Data["Series"][$Serie]["Color"]["R"] = $R; |
| 515 | 465 | $this->Data["Series"][$Serie]["Color"]["G"] = $G; |
@@ -524,18 +474,15 @@ discard block |
||
| 524 | 474 | } |
| 525 | 475 | |
| 526 | 476 | /* Load a palette file */ |
| 527 | - function loadPalette($FileName,$Overwrite=FALSE) |
|
| 528 | - { |
|
| 477 | + function loadPalette($FileName,$Overwrite=FALSE) { |
|
| 529 | 478 | if ( !file_exists($FileName) ) { return(-1); } |
| 530 | 479 | if ( $Overwrite ) { $this->Palette = ""; } |
| 531 | 480 | |
| 532 | 481 | $fileHandle = @fopen($FileName, "r"); |
| 533 | 482 | if (!$fileHandle) { return(-1); } |
| 534 | - while (!feof($fileHandle)) |
|
| 535 | - { |
|
| 483 | + while (!feof($fileHandle)) { |
|
| 536 | 484 | $buffer = fgets($fileHandle, 4096); |
| 537 | - if ( preg_match("/,/",$buffer) ) |
|
| 538 | - { |
|
| 485 | + if ( preg_match("/,/",$buffer) ) { |
|
| 539 | 486 | list($R,$G,$B,$Alpha) = preg_split("/,/",$buffer); |
| 540 | 487 | if ( $this->Palette == "" ) { $ID = 0; } else { $ID = count($this->Palette); } |
| 541 | 488 | $this->Palette[$ID] = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
@@ -545,10 +492,8 @@ discard block |
||
| 545 | 492 | |
| 546 | 493 | /* Apply changes to current series */ |
| 547 | 494 | $ID = 0; |
| 548 | - if ( isset($this->Data["Series"])) |
|
| 549 | - { |
|
| 550 | - foreach($this->Data["Series"] as $Key => $Value) |
|
| 551 | - { |
|
| 495 | + if ( isset($this->Data["Series"])) { |
|
| 496 | + foreach($this->Data["Series"] as $Key => $Value) { |
|
| 552 | 497 | if ( !isset($this->Palette[$ID]) ) |
| 553 | 498 | $this->Data["Series"][$Key]["Color"] = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>0); |
| 554 | 499 | else |
@@ -559,8 +504,7 @@ discard block |
||
| 559 | 504 | } |
| 560 | 505 | |
| 561 | 506 | /* Initialise a given scatter serie */ |
| 562 | - function initScatterSerie($ID) |
|
| 563 | - { |
|
| 507 | + function initScatterSerie($ID) { |
|
| 564 | 508 | if ( isset($this->Data["ScatterSeries"][$ID]) ) { return(0); } |
| 565 | 509 | |
| 566 | 510 | $this->Data["ScatterSeries"][$ID]["Description"] = "Scatter ".$ID; |
@@ -571,8 +515,7 @@ discard block |
||
| 571 | 515 | |
| 572 | 516 | if ( isset($this->Palette[$ID]) ) |
| 573 | 517 | $this->Data["ScatterSeries"][$ID]["Color"] = $this->Palette[$ID]; |
| 574 | - else |
|
| 575 | - { |
|
| 518 | + else { |
|
| 576 | 519 | $this->Data["ScatterSeries"][$ID]["Color"]["R"] = rand(0,255); |
| 577 | 520 | $this->Data["ScatterSeries"][$ID]["Color"]["G"] = rand(0,255); |
| 578 | 521 | $this->Data["ScatterSeries"][$ID]["Color"]["B"] = rand(0,255); |
@@ -581,8 +524,7 @@ discard block |
||
| 581 | 524 | } |
| 582 | 525 | |
| 583 | 526 | /* Initialise a given serie */ |
| 584 | - function initialise($Serie) |
|
| 585 | - { |
|
| 527 | + function initialise($Serie) { |
|
| 586 | 528 | if ( isset($this->Data["Series"]) ) { $ID = count($this->Data["Series"]); } else { $ID = 0; } |
| 587 | 529 | |
| 588 | 530 | $this->Data["Series"][$Serie]["Description"] = $Serie; |
@@ -597,8 +539,7 @@ discard block |
||
| 597 | 539 | |
| 598 | 540 | if ( isset($this->Palette[$ID]) ) |
| 599 | 541 | $this->Data["Series"][$Serie]["Color"] = $this->Palette[$ID]; |
| 600 | - else |
|
| 601 | - { |
|
| 542 | + else { |
|
| 602 | 543 | $this->Data["Series"][$Serie]["Color"]["R"] = rand(0,255); |
| 603 | 544 | $this->Data["Series"][$Serie]["Color"]["G"] = rand(0,255); |
| 604 | 545 | $this->Data["Series"][$Serie]["Color"]["B"] = rand(0,255); |
@@ -606,20 +547,16 @@ discard block |
||
| 606 | 547 | } |
| 607 | 548 | } |
| 608 | 549 | |
| 609 | - function normalize($NormalizationFactor=100,$UnitChange=NULL,$Round=1) |
|
| 610 | - { |
|
| 550 | + function normalize($NormalizationFactor=100,$UnitChange=NULL,$Round=1) { |
|
| 611 | 551 | $Abscissa = $this->Data["Abscissa"]; |
| 612 | 552 | |
| 613 | 553 | $SelectedSeries = ""; |
| 614 | 554 | $MaxVal = 0; |
| 615 | - foreach($this->Data["Axis"] as $AxisID => $Axis) |
|
| 616 | - { |
|
| 555 | + foreach($this->Data["Axis"] as $AxisID => $Axis) { |
|
| 617 | 556 | if ( $UnitChange != NULL ) { $this->Data["Axis"][$AxisID]["Unit"] = $UnitChange; } |
| 618 | 557 | |
| 619 | - foreach($this->Data["Series"] as $SerieName => $Serie) |
|
| 620 | - { |
|
| 621 | - if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == TRUE && $SerieName != $Abscissa) |
|
| 622 | - { |
|
| 558 | + foreach($this->Data["Series"] as $SerieName => $Serie) { |
|
| 559 | + if ($Serie["Axis"] == $AxisID && $Serie["isDrawable"] == TRUE && $SerieName != $Abscissa) { |
|
| 623 | 560 | $SelectedSeries[$SerieName] = $SerieName; |
| 624 | 561 | |
| 625 | 562 | if ( count($Serie["Data"] ) > $MaxVal ) { $MaxVal = count($Serie["Data"]); } |
@@ -627,22 +564,18 @@ discard block |
||
| 627 | 564 | } |
| 628 | 565 | } |
| 629 | 566 | |
| 630 | - for($i=0;$i<=$MaxVal-1;$i++) |
|
| 631 | - { |
|
| 567 | + for($i=0;$i<=$MaxVal-1;$i++) { |
|
| 632 | 568 | $Factor = 0; |
| 633 | - foreach ($SelectedSeries as $Key => $SerieName ) |
|
| 634 | - { |
|
| 569 | + foreach ($SelectedSeries as $Key => $SerieName ) { |
|
| 635 | 570 | $Value = $this->Data["Series"][$SerieName]["Data"][$i]; |
| 636 | 571 | if ( $Value != VOID ) |
| 637 | 572 | $Factor = $Factor + abs($Value); |
| 638 | 573 | } |
| 639 | 574 | |
| 640 | - if ( $Factor != 0 ) |
|
| 641 | - { |
|
| 575 | + if ( $Factor != 0 ) { |
|
| 642 | 576 | $Factor = $NormalizationFactor / $Factor; |
| 643 | 577 | |
| 644 | - foreach ($SelectedSeries as $Key => $SerieName ) |
|
| 645 | - { |
|
| 578 | + foreach ($SelectedSeries as $Key => $SerieName ) { |
|
| 646 | 579 | $Value = $this->Data["Series"][$SerieName]["Data"][$i]; |
| 647 | 580 | |
| 648 | 581 | if ( $Value != VOID && $Factor != $NormalizationFactor ) |
@@ -655,41 +588,33 @@ discard block |
||
| 655 | 588 | } |
| 656 | 589 | } |
| 657 | 590 | |
| 658 | - foreach ($SelectedSeries as $Key => $SerieName ) |
|
| 659 | - { |
|
| 591 | + foreach ($SelectedSeries as $Key => $SerieName ) { |
|
| 660 | 592 | $this->Data["Series"][$SerieName]["Max"] = max($this->stripVOID($this->Data["Series"][$SerieName]["Data"])); |
| 661 | 593 | $this->Data["Series"][$SerieName]["Min"] = min($this->stripVOID($this->Data["Series"][$SerieName]["Data"])); |
| 662 | 594 | } |
| 663 | 595 | } |
| 664 | 596 | |
| 665 | 597 | /* Load data from a CSV (or similar) data source */ |
| 666 | - function importFromCSV($FileName,$Options="") |
|
| 667 | - { |
|
| 598 | + function importFromCSV($FileName,$Options="") { |
|
| 668 | 599 | $Delimiter = isset($Options["Delimiter"]) ? $Options["Delimiter"] : ","; |
| 669 | 600 | $GotHeader = isset($Options["GotHeader"]) ? $Options["GotHeader"] : FALSE; |
| 670 | 601 | $SkipColumns = isset($Options["SkipColumns"]) ? $Options["SkipColumns"] : array(-1); |
| 671 | 602 | $DefaultSerieName = isset($Options["DefaultSerieName"]) ? $Options["DefaultSerieName"] : "Serie"; |
| 672 | 603 | |
| 673 | 604 | $Handle = @fopen($FileName,"r"); |
| 674 | - if ($Handle) |
|
| 675 | - { |
|
| 605 | + if ($Handle) { |
|
| 676 | 606 | $HeaderParsed = FALSE; $SerieNames = ""; |
| 677 | - while (!feof($Handle)) |
|
| 678 | - { |
|
| 607 | + while (!feof($Handle)) { |
|
| 679 | 608 | $Buffer = fgets($Handle, 4096); |
| 680 | 609 | $Buffer = str_replace(chr(10),"",$Buffer); |
| 681 | 610 | $Buffer = str_replace(chr(13),"",$Buffer); |
| 682 | 611 | $Values = preg_split("/".$Delimiter."/",$Buffer); |
| 683 | 612 | |
| 684 | - if ( $Buffer != "" ) |
|
| 685 | - { |
|
| 686 | - if ( $GotHeader && !$HeaderParsed ) |
|
| 687 | - { |
|
| 613 | + if ( $Buffer != "" ) { |
|
| 614 | + if ( $GotHeader && !$HeaderParsed ) { |
|
| 688 | 615 | foreach($Values as $Key => $Name) { if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $Name; } } |
| 689 | 616 | $HeaderParsed = TRUE; |
| 690 | - } |
|
| 691 | - else |
|
| 692 | - { |
|
| 617 | + } else { |
|
| 693 | 618 | if ($SerieNames == "" ) { foreach($Values as $Key => $Name) { if ( !in_array($Key,$SkipColumns) ) { $SerieNames[$Key] = $DefaultSerieName.$Key; } } } |
| 694 | 619 | foreach($Values as $Key => $Value) { if ( !in_array($Key,$SkipColumns) ) { $this->addPoints($Value,$SerieNames[$Key]); } } |
| 695 | 620 | } |
@@ -700,8 +625,7 @@ discard block |
||
| 700 | 625 | } |
| 701 | 626 | |
| 702 | 627 | /* Create a dataset based on a formula */ |
| 703 | - function createFunctionSerie($SerieName,$Formula="",$Options="") |
|
| 704 | - { |
|
| 628 | + function createFunctionSerie($SerieName,$Formula="",$Options="") { |
|
| 705 | 629 | $MinX = isset($Options["MinX"]) ? $Options["MinX"] : -10; |
| 706 | 630 | $MaxX = isset($Options["MaxX"]) ? $Options["MaxX"] : 10; |
| 707 | 631 | $XStep = isset($Options["XStep"]) ? $Options["XStep"] : 1; |
@@ -712,8 +636,7 @@ discard block |
||
| 712 | 636 | if ( $Formula == "" ) { return(0); } |
| 713 | 637 | |
| 714 | 638 | $Result = ""; $Abscissa = ""; |
| 715 | - for($i=$MinX; $i<=$MaxX; $i=$i+$XStep) |
|
| 716 | - { |
|
| 639 | + for($i=$MinX; $i<=$MaxX; $i=$i+$XStep) { |
|
| 717 | 640 | $Expression = "\$return = '!'.(".str_replace("z",$i,$Formula).");"; |
| 718 | 641 | if ( @eval($Expression) === FALSE ) { $return = VOID; } |
| 719 | 642 | if ( $return == "!" ) { $return = VOID; } else { $return = $this->right($return,strlen($return)-1); } |
@@ -730,13 +653,10 @@ discard block |
||
| 730 | 653 | if ( $RecordAbscissa ) { $this->addPoints($Abscissa,$AbscissaSerie); } |
| 731 | 654 | } |
| 732 | 655 | |
| 733 | - function negateValues($Series) |
|
| 734 | - { |
|
| 656 | + function negateValues($Series) { |
|
| 735 | 657 | if ( !is_array($Series) ) { $Series = $this->convertToArray($Series); } |
| 736 | - foreach($Series as $Key => $SerieName) |
|
| 737 | - { |
|
| 738 | - if (isset($this->Data["Series"][$SerieName])) |
|
| 739 | - { |
|
| 658 | + foreach($Series as $Key => $SerieName) { |
|
| 659 | + if (isset($this->Data["Series"][$SerieName])) { |
|
| 740 | 660 | $Data = ""; |
| 741 | 661 | foreach($this->Data["Series"][$SerieName]["Data"] as $Key => $Value) |
| 742 | 662 | { if ( $Value == VOID ) { $Data[] = VOID; } else { $Data[] = -$Value; } } |
@@ -124,6 +124,10 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /* Draw a polygon */ |
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * @param string $Points |
|
| 130 | + */ |
|
| 127 | 131 | function drawPolygon($Points,$Format="") |
| 128 | 132 | { |
| 129 | 133 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -573,6 +577,10 @@ discard block |
||
| 573 | 577 | } |
| 574 | 578 | |
| 575 | 579 | /* Drawn a spline based on the bezier function */ |
| 580 | + |
|
| 581 | + /** |
|
| 582 | + * @param string $Coordinates |
|
| 583 | + */ |
|
| 576 | 584 | function drawSpline($Coordinates,$Format="") |
| 577 | 585 | { |
| 578 | 586 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -1028,6 +1036,10 @@ discard block |
||
| 1028 | 1036 | } |
| 1029 | 1037 | |
| 1030 | 1038 | /* Draw a gradient within a defined area */ |
| 1039 | + |
|
| 1040 | + /** |
|
| 1041 | + * @param integer $Direction |
|
| 1042 | + */ |
|
| 1031 | 1043 | function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="") |
| 1032 | 1044 | { |
| 1033 | 1045 | $StartR = isset($Format["StartR"]) ? $Format["StartR"] : 90; |
@@ -1109,6 +1121,11 @@ discard block |
||
| 1109 | 1121 | } |
| 1110 | 1122 | |
| 1111 | 1123 | /* Draw an aliased pixel */ |
| 1124 | + |
|
| 1125 | + /** |
|
| 1126 | + * @param double $X |
|
| 1127 | + * @param double $Y |
|
| 1128 | + */ |
|
| 1112 | 1129 | function drawAntialiasPixel($X,$Y,$Format="") |
| 1113 | 1130 | { |
| 1114 | 1131 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -1188,6 +1205,10 @@ discard block |
||
| 1188 | 1205 | } |
| 1189 | 1206 | |
| 1190 | 1207 | /* Convert apha to base 10 */ |
| 1208 | + |
|
| 1209 | + /** |
|
| 1210 | + * @param integer $AlphaValue |
|
| 1211 | + */ |
|
| 1191 | 1212 | function convertAlpha($AlphaValue) |
| 1192 | 1213 | { return((127/100)*(100-$AlphaValue)); } |
| 1193 | 1214 | |
@@ -1205,6 +1226,11 @@ discard block |
||
| 1205 | 1226 | } |
| 1206 | 1227 | |
| 1207 | 1228 | /* Load a PNG file and draw it over the chart */ |
| 1229 | + |
|
| 1230 | + /** |
|
| 1231 | + * @param double $X |
|
| 1232 | + * @param double $Y |
|
| 1233 | + */ |
|
| 1208 | 1234 | function drawFromPNG($X,$Y,$FileName) |
| 1209 | 1235 | { $this->drawFromPicture(1,$FileName,$X,$Y); } |
| 1210 | 1236 | |
@@ -2483,6 +2509,9 @@ discard block |
||
| 2483 | 2509 | } |
| 2484 | 2510 | } |
| 2485 | 2511 | |
| 2512 | + /** |
|
| 2513 | + * @param integer $ID |
|
| 2514 | + */ |
|
| 2486 | 2515 | function isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) |
| 2487 | 2516 | { |
| 2488 | 2517 | if ( $LabelingMethod == LABELING_DIFFERENT && $Value != $LastValue ) { return(TRUE); } |
@@ -2494,6 +2523,10 @@ discard block |
||
| 2494 | 2523 | } |
| 2495 | 2524 | |
| 2496 | 2525 | /* Compute the scale, check for the best visual factors */ |
| 2526 | + |
|
| 2527 | + /** |
|
| 2528 | + * @param double $MaxDivs |
|
| 2529 | + */ |
|
| 2497 | 2530 | function computeScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID=0) |
| 2498 | 2531 | { |
| 2499 | 2532 | /* Compute each factors */ |
@@ -2522,6 +2555,10 @@ discard block |
||
| 2522 | 2555 | } |
| 2523 | 2556 | |
| 2524 | 2557 | /* Compute the best matching scale based on size & factors */ |
| 2558 | + |
|
| 2559 | + /** |
|
| 2560 | + * @param integer $AxisID |
|
| 2561 | + */ |
|
| 2525 | 2562 | function processScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID) |
| 2526 | 2563 | { |
| 2527 | 2564 | $ScaleHeight = abs(ceil($XMax)-floor($XMin)); |
@@ -2602,6 +2639,9 @@ discard block |
||
| 2602 | 2639 | return($Scale); |
| 2603 | 2640 | } |
| 2604 | 2641 | |
| 2642 | + /** |
|
| 2643 | + * @param double $Value2 |
|
| 2644 | + */ |
|
| 2605 | 2645 | function modulo($Value1,$Value2) |
| 2606 | 2646 | { |
| 2607 | 2647 | if (floor($Value2) == 0) { return(0); } |
@@ -5772,6 +5812,10 @@ discard block |
||
| 5772 | 5812 | } |
| 5773 | 5813 | |
| 5774 | 5814 | /* Draw a label box */ |
| 5815 | + |
|
| 5816 | + /** |
|
| 5817 | + * @param string $Captions |
|
| 5818 | + */ |
|
| 5775 | 5819 | function drawLabelBox($X,$Y,$Title,$Captions,$Format="") |
| 5776 | 5820 | { |
| 5777 | 5821 | $NoTitle = isset($Format["NoTitle"]) ? $Format["NoTitle"] : NULL; |
@@ -100,11 +100,9 @@ discard block |
||
| 100 | 100 | define("AUTO" , 690000); |
| 101 | 101 | define("OUT_OF_SIGHT" , -10000000000000); |
| 102 | 102 | |
| 103 | - class pDraw |
|
| 104 | - { |
|
| 103 | + class pDraw { |
|
| 105 | 104 | /* Returns the number of drawable series */ |
| 106 | - function countDrawableSeries() |
|
| 107 | - { |
|
| 105 | + function countDrawableSeries() { |
|
| 108 | 106 | $Results = 0; |
| 109 | 107 | $Data = $this->DataSet->getData(); |
| 110 | 108 | |
@@ -115,8 +113,7 @@ discard block |
||
| 115 | 113 | } |
| 116 | 114 | |
| 117 | 115 | /* Fix box coordinates */ |
| 118 | - function fixBoxCoordinates($Xa,$Ya,$Xb,$Yb) |
|
| 119 | - { |
|
| 116 | + function fixBoxCoordinates($Xa,$Ya,$Xb,$Yb) { |
|
| 120 | 117 | $X1 = min($Xa,$Xb); $Y1 = min($Ya,$Yb); |
| 121 | 118 | $X2 = max($Xa,$Xb); $Y2 = max($Ya,$Yb); |
| 122 | 119 | |
@@ -124,8 +121,7 @@ discard block |
||
| 124 | 121 | } |
| 125 | 122 | |
| 126 | 123 | /* Draw a polygon */ |
| 127 | - function drawPolygon($Points,$Format="") |
|
| 128 | - { |
|
| 124 | + function drawPolygon($Points,$Format="") { |
|
| 129 | 125 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 130 | 126 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 131 | 127 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -149,10 +145,8 @@ discard block |
||
| 149 | 145 | if ( $SkipY != OUT_OF_SIGHT ) { $SkipY = floor($SkipY); } |
| 150 | 146 | |
| 151 | 147 | $RestoreShadow = $this->Shadow; |
| 152 | - if ( !$NoFill ) |
|
| 153 | - { |
|
| 154 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 155 | - { |
|
| 148 | + if ( !$NoFill ) { |
|
| 149 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 156 | 150 | $this->Shadow = FALSE; |
| 157 | 151 | for($i=0;$i<=count($Points)-1;$i=$i+2) |
| 158 | 152 | { $Shadow[] = $Points[$i] + $this->ShadowX; $Shadow[] = $Points[$i+1] + $this->ShadowY; } |
@@ -165,8 +159,7 @@ discard block |
||
| 165 | 159 | { ImageFilledPolygon($this->Picture,$Points,count($Points)/2,$FillColor); } |
| 166 | 160 | } |
| 167 | 161 | |
| 168 | - if ( !$NoBorder ) |
|
| 169 | - { |
|
| 162 | + if ( !$NoBorder ) { |
|
| 170 | 163 | $Points = $Backup; |
| 171 | 164 | |
| 172 | 165 | if ( $NoFill ) |
@@ -174,15 +167,11 @@ discard block |
||
| 174 | 167 | else |
| 175 | 168 | $BorderSettings = array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha); |
| 176 | 169 | |
| 177 | - for($i=0;$i<=count($Points)-1;$i=$i+2) |
|
| 178 | - { |
|
| 179 | - if ( isset($Points[$i+2]) ) |
|
| 180 | - { |
|
| 170 | + for($i=0;$i<=count($Points)-1;$i=$i+2) { |
|
| 171 | + if ( isset($Points[$i+2]) ) { |
|
| 181 | 172 | if ( !($Points[$i] == $Points[$i+2] && $Points[$i] == $SkipX ) && !($Points[$i+1] == $Points[$i+3] && $Points[$i+1] == $SkipY ) ) |
| 182 | 173 | $this->drawLine($Points[$i],$Points[$i+1],$Points[$i+2],$Points[$i+3],$BorderSettings); |
| 183 | - } |
|
| 184 | - else |
|
| 185 | - { |
|
| 174 | + } else { |
|
| 186 | 175 | if ( !($Points[$i] == $Points[0] && $Points[$i] == $SkipX ) && !($Points[$i+1] == $Points[1] && $Points[$i+1] == $SkipY ) ) |
| 187 | 176 | $this->drawLine($Points[$i],$Points[$i+1],$Points[0],$Points[1],$BorderSettings); |
| 188 | 177 | } |
@@ -193,8 +182,7 @@ discard block |
||
| 193 | 182 | } |
| 194 | 183 | |
| 195 | 184 | /* Apply AALias correction to the rounded box boundaries */ |
| 196 | - function offsetCorrection($Value,$Mode) |
|
| 197 | - { |
|
| 185 | + function offsetCorrection($Value,$Mode) { |
|
| 198 | 186 | $Value = round($Value,1); |
| 199 | 187 | |
| 200 | 188 | if ( $Value == 0 && $Mode == 1 ) { return(.9); } |
@@ -214,8 +202,7 @@ discard block |
||
| 214 | 202 | } |
| 215 | 203 | |
| 216 | 204 | /* Draw a rectangle with rounded corners */ |
| 217 | - function drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="") |
|
| 218 | - { |
|
| 205 | + function drawRoundedRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="") { |
|
| 219 | 206 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 220 | 207 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 221 | 208 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -230,15 +217,12 @@ discard block |
||
| 230 | 217 | |
| 231 | 218 | if ( $Radius <= 0 ) { $this->drawRectangle($X1,$Y1,$X2,$Y2,$Color); return(0); } |
| 232 | 219 | |
| 233 | - if ( $this->Antialias ) |
|
| 234 | - { |
|
| 220 | + if ( $this->Antialias ) { |
|
| 235 | 221 | $this->drawLine($X1+$Radius,$Y1,$X2-$Radius,$Y1,$Color); |
| 236 | 222 | $this->drawLine($X2,$Y1+$Radius,$X2,$Y2-$Radius,$Color); |
| 237 | 223 | $this->drawLine($X2-$Radius,$Y2,$X1+$Radius,$Y2,$Color); |
| 238 | 224 | $this->drawLine($X1,$Y1+$Radius,$X1,$Y2-$Radius,$Color); |
| 239 | - } |
|
| 240 | - else |
|
| 241 | - { |
|
| 225 | + } else { |
|
| 242 | 226 | $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha); |
| 243 | 227 | imageline($this->Picture,$X1+$Radius,$Y1,$X2-$Radius,$Y1,$Color); |
| 244 | 228 | imageline($this->Picture,$X2,$Y1+$Radius,$X2,$Y2-$Radius,$Color); |
@@ -247,8 +231,7 @@ discard block |
||
| 247 | 231 | } |
| 248 | 232 | |
| 249 | 233 | $Step = 360 / (2 * PI * $Radius); |
| 250 | - for($i=0;$i<=90;$i=$i+$Step) |
|
| 251 | - { |
|
| 234 | + for($i=0;$i<=90;$i=$i+$Step) { |
|
| 252 | 235 | $X = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius; |
| 253 | 236 | $Y = sin(($i+180)*PI/180) * $Radius + $Y1 + $Radius; |
| 254 | 237 | $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
@@ -268,8 +251,7 @@ discard block |
||
| 268 | 251 | } |
| 269 | 252 | |
| 270 | 253 | /* Draw a rectangle with rounded corners */ |
| 271 | - function drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="") |
|
| 272 | - { |
|
| 254 | + function drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$Radius,$Format="") { |
|
| 273 | 255 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 274 | 256 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 275 | 257 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -291,8 +273,7 @@ discard block |
||
| 291 | 273 | if ( $Y2 - $Y1 < $Radius*2 ) { $Radius = floor((($Y2-$Y1))/4); } |
| 292 | 274 | |
| 293 | 275 | $RestoreShadow = $this->Shadow; |
| 294 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 295 | - { |
|
| 276 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 296 | 277 | $this->Shadow = FALSE; |
| 297 | 278 | $this->drawRoundedFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa)); |
| 298 | 279 | } |
@@ -306,8 +287,7 @@ discard block |
||
| 306 | 287 | |
| 307 | 288 | $Step = 360 / (2 * PI * $Radius); |
| 308 | 289 | $Positions = ""; $Radius--; $MinY = ""; $MaxY = ""; |
| 309 | - for($i=0;$i<=90;$i=$i+$Step) |
|
| 310 | - { |
|
| 290 | + for($i=0;$i<=90;$i=$i+$Step) { |
|
| 311 | 291 | $Xp1 = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius; |
| 312 | 292 | $Xp2 = cos(((90-$i)+270)*PI/180) * $Radius + $X2 - $Radius; |
| 313 | 293 | $Yp = floor(sin(($i+180)*PI/180) * $Radius + $YTop); |
@@ -318,8 +298,7 @@ discard block |
||
| 318 | 298 | $Xp1++; |
| 319 | 299 | |
| 320 | 300 | if ( !isset($Positions[$Yp]) ) |
| 321 | - { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; } |
|
| 322 | - else |
|
| 301 | + { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; } else |
|
| 323 | 302 | { $Positions[$Yp]["X1"] = ($Positions[$Yp]["X1"]+$Xp1)/2; $Positions[$Yp]["X2"] = ($Positions[$Yp]["X2"]+$Xp2)/2; } |
| 324 | 303 | |
| 325 | 304 | $Xp1 = cos(($i+90)*PI/180) * $Radius + $X1 + $Radius; |
@@ -332,14 +311,12 @@ discard block |
||
| 332 | 311 | $Xp1++; |
| 333 | 312 | |
| 334 | 313 | if ( !isset($Positions[$Yp]) ) |
| 335 | - { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; } |
|
| 336 | - else |
|
| 314 | + { $Positions[$Yp]["X1"] = $Xp1; $Positions[$Yp]["X2"] = $Xp2; } else |
|
| 337 | 315 | { $Positions[$Yp]["X1"] = ($Positions[$Yp]["X1"]+$Xp1)/2; $Positions[$Yp]["X2"] = ($Positions[$Yp]["X2"]+$Xp2)/2; } |
| 338 | 316 | } |
| 339 | 317 | |
| 340 | 318 | $ManualColor = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha); |
| 341 | - foreach($Positions as $Yp => $Bounds) |
|
| 342 | - { |
|
| 319 | + foreach($Positions as $Yp => $Bounds) { |
|
| 343 | 320 | $X1 = $Bounds["X1"]; $X1Dec = $this->getFirstDecimal($X1); if ( $X1Dec != 0 ) { $X1 = floor($X1)+1; } |
| 344 | 321 | $X2 = $Bounds["X2"]; $X2Dec = $this->getFirstDecimal($X2); if ( $X2Dec != 0 ) { $X2 = floor($X2)-1; } |
| 345 | 322 | imageline($this->Picture,$X1,$Yp,$X2,$Yp,$ManualColor); |
@@ -353,8 +330,7 @@ discard block |
||
| 353 | 330 | } |
| 354 | 331 | |
| 355 | 332 | /* Draw a rectangle with rounded corners */ |
| 356 | - function drawRoundedFilledRectangle_deprecated($X1,$Y1,$X2,$Y2,$Radius,$Format="") |
|
| 357 | - { |
|
| 333 | + function drawRoundedFilledRectangle_deprecated($X1,$Y1,$X2,$Y2,$Radius,$Format="") { |
|
| 358 | 334 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 359 | 335 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 360 | 336 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -373,8 +349,7 @@ discard block |
||
| 373 | 349 | if ( $Y2 - $Y1 < $Radius ) { $Radius = floor((($Y2-$Y1)+2)/2); } |
| 374 | 350 | |
| 375 | 351 | $RestoreShadow = $this->Shadow; |
| 376 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 377 | - { |
|
| 352 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 378 | 353 | $this->Shadow = FALSE; |
| 379 | 354 | $this->drawRoundedFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa)); |
| 380 | 355 | } |
@@ -397,8 +372,7 @@ discard block |
||
| 397 | 372 | if ( $Alpha < 100 ) { $Drawn[$YTop] = FALSE; } |
| 398 | 373 | if ( $Alpha < 100 ) { $Drawn[$YBottom] = TRUE; } |
| 399 | 374 | |
| 400 | - for($i=0;$i<=90;$i=$i+$Step) |
|
| 401 | - { |
|
| 375 | + for($i=0;$i<=90;$i=$i+$Step) { |
|
| 402 | 376 | $Xp1 = cos(($i+180)*PI/180) * $Radius + $X1 + $Radius; |
| 403 | 377 | $Xp2 = cos(((90-$i)+270)*PI/180) * $Radius + $X2 - $Radius; |
| 404 | 378 | $Yp = sin(($i+180)*PI/180) * $Radius + $YTop; |
@@ -432,8 +406,7 @@ discard block |
||
| 432 | 406 | } |
| 433 | 407 | |
| 434 | 408 | /* Draw a rectangle */ |
| 435 | - function drawRectangle($X1,$Y1,$X2,$Y2,$Format="") |
|
| 436 | - { |
|
| 409 | + function drawRectangle($X1,$Y1,$X2,$Y2,$Format="") { |
|
| 437 | 410 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 438 | 411 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 439 | 412 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -444,33 +417,26 @@ discard block |
||
| 444 | 417 | if ($X1 > $X2) { list($X1, $X2) = array($X2, $X1); } |
| 445 | 418 | if ($Y1 > $Y2) { list($Y1, $Y2) = array($Y2, $Y1); } |
| 446 | 419 | |
| 447 | - if ( $this->Antialias ) |
|
| 448 | - { |
|
| 449 | - if ( $NoAngle ) |
|
| 450 | - { |
|
| 420 | + if ( $this->Antialias ) { |
|
| 421 | + if ( $NoAngle ) { |
|
| 451 | 422 | $this->drawLine($X1+1,$Y1,$X2-1,$Y1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 452 | 423 | $this->drawLine($X2,$Y1+1,$X2,$Y2-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 453 | 424 | $this->drawLine($X2-1,$Y2,$X1+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 454 | 425 | $this->drawLine($X1,$Y1+1,$X1,$Y2-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 455 | - } |
|
| 456 | - else |
|
| 457 | - { |
|
| 426 | + } else { |
|
| 458 | 427 | $this->drawLine($X1+1,$Y1,$X2-1,$Y1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 459 | 428 | $this->drawLine($X2,$Y1,$X2,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 460 | 429 | $this->drawLine($X2-1,$Y2,$X1+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 461 | 430 | $this->drawLine($X1,$Y1,$X1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 462 | 431 | } |
| 463 | - } |
|
| 464 | - else |
|
| 465 | - { |
|
| 432 | + } else { |
|
| 466 | 433 | $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha); |
| 467 | 434 | imagerectangle($this->Picture,$X1,$Y1,$X2,$Y2,$Color); |
| 468 | 435 | } |
| 469 | 436 | } |
| 470 | 437 | |
| 471 | 438 | /* Draw a filled rectangle */ |
| 472 | - function drawFilledRectangle($X1,$Y1,$X2,$Y2,$Format="") |
|
| 473 | - { |
|
| 439 | + function drawFilledRectangle($X1,$Y1,$X2,$Y2,$Format="") { |
|
| 474 | 440 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 475 | 441 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 476 | 442 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -495,30 +461,25 @@ discard block |
||
| 495 | 461 | if ($Y1 > $Y2) { list($Y1, $Y2) = array($Y2, $Y1); } |
| 496 | 462 | |
| 497 | 463 | $RestoreShadow = $this->Shadow; |
| 498 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 499 | - { |
|
| 464 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 500 | 465 | $this->Shadow = FALSE; |
| 501 | 466 | $this->drawFilledRectangle($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks,"NoAngle"=>$NoAngle)); |
| 502 | 467 | } |
| 503 | 468 | |
| 504 | 469 | $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha); |
| 505 | - if ( $NoAngle ) |
|
| 506 | - { |
|
| 470 | + if ( $NoAngle ) { |
|
| 507 | 471 | imagefilledrectangle($this->Picture,ceil($X1)+1,ceil($Y1),floor($X2)-1,floor($Y2),$Color); |
| 508 | 472 | imageline($this->Picture,ceil($X1),ceil($Y1)+1,ceil($X1),floor($Y2)-1,$Color); |
| 509 | 473 | imageline($this->Picture,floor($X2),ceil($Y1)+1,floor($X2),floor($Y2)-1,$Color); |
| 510 | - } |
|
| 511 | - else |
|
| 474 | + } else |
|
| 512 | 475 | imagefilledrectangle($this->Picture,ceil($X1),ceil($Y1),floor($X2),floor($Y2),$Color); |
| 513 | 476 | |
| 514 | - if ( $Dash ) |
|
| 515 | - { |
|
| 477 | + if ( $Dash ) { |
|
| 516 | 478 | if ( $BorderR != -1 ) { $iX1=$X1+1; $iY1=$Y1+1; $iX2=$X2-1; $iY2=$Y2-1; } else { $iX1=$X1; $iY1=$Y1; $iX2=$X2; $iY2=$Y2; } |
| 517 | 479 | |
| 518 | 480 | $Color = $this->allocateColor($this->Picture,$DashR,$DashG,$DashB,$Alpha); |
| 519 | 481 | $Y=$iY1-$DashStep; |
| 520 | - for($X=$iX1; $X<=$iX2+($iY2-$iY1); $X=$X+$DashStep) |
|
| 521 | - { |
|
| 482 | + for($X=$iX1; $X<=$iX2+($iY2-$iY1); $X=$X+$DashStep) { |
|
| 522 | 483 | $Y=$Y+$DashStep; |
| 523 | 484 | if ( $X > $iX2 ) { $Xa = $X-($X-$iX2); $Ya = $iY1+($X-$iX2); } else { $Xa = $X; $Ya = $iY1; } |
| 524 | 485 | if ( $Y > $iY2 ) { $Xb = $iX1+($Y-$iY2); $Yb = $Y-($Y-$iY2); } else { $Xb = $iX1; $Yb = $Y; } |
@@ -526,31 +487,26 @@ discard block |
||
| 526 | 487 | } |
| 527 | 488 | } |
| 528 | 489 | |
| 529 | - if ( $this->Antialias && !$NoBorder ) |
|
| 530 | - { |
|
| 531 | - if ( $X1 < ceil($X1) ) |
|
| 532 | - { |
|
| 490 | + if ( $this->Antialias && !$NoBorder ) { |
|
| 491 | + if ( $X1 < ceil($X1) ) { |
|
| 533 | 492 | $AlphaA = $Alpha * (ceil($X1) - $X1); |
| 534 | 493 | $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA); |
| 535 | 494 | imageline($this->Picture,ceil($X1)-1,ceil($Y1),ceil($X1)-1,floor($Y2),$Color); |
| 536 | 495 | } |
| 537 | 496 | |
| 538 | - if ( $Y1 < ceil($Y1) ) |
|
| 539 | - { |
|
| 497 | + if ( $Y1 < ceil($Y1) ) { |
|
| 540 | 498 | $AlphaA = $Alpha * (ceil($Y1) - $Y1); |
| 541 | 499 | $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA); |
| 542 | 500 | imageline($this->Picture,ceil($X1),ceil($Y1)-1,floor($X2),ceil($Y1)-1,$Color); |
| 543 | 501 | } |
| 544 | 502 | |
| 545 | - if ( $X2 > floor($X2) ) |
|
| 546 | - { |
|
| 503 | + if ( $X2 > floor($X2) ) { |
|
| 547 | 504 | $AlphaA = $Alpha * (.5-($X2 - floor($X2))); |
| 548 | 505 | $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA); |
| 549 | 506 | imageline($this->Picture,floor($X2)+1,ceil($Y1),floor($X2)+1,floor($Y2),$Color); |
| 550 | 507 | } |
| 551 | 508 | |
| 552 | - if ( $Y2 > floor($Y2) ) |
|
| 553 | - { |
|
| 509 | + if ( $Y2 > floor($Y2) ) { |
|
| 554 | 510 | $AlphaA = $Alpha * (.5-($Y2 - floor($Y2))); |
| 555 | 511 | $Color = $this->allocateColor($this->Picture,$R,$G,$B,$AlphaA); |
| 556 | 512 | imageline($this->Picture,ceil($X1),floor($Y2)+1,floor($X2),floor($Y2)+1,$Color); |
@@ -564,8 +520,7 @@ discard block |
||
| 564 | 520 | } |
| 565 | 521 | |
| 566 | 522 | /* Draw a rectangular marker of the specified size */ |
| 567 | - function drawRectangleMarker($X,$Y,$Format="") |
|
| 568 | - { |
|
| 523 | + function drawRectangleMarker($X,$Y,$Format="") { |
|
| 569 | 524 | $Size = isset($Format["Size"]) ? $Format["Size"] : 4; |
| 570 | 525 | |
| 571 | 526 | $HalfSize = floor($Size/2); |
@@ -573,8 +528,7 @@ discard block |
||
| 573 | 528 | } |
| 574 | 529 | |
| 575 | 530 | /* Drawn a spline based on the bezier function */ |
| 576 | - function drawSpline($Coordinates,$Format="") |
|
| 577 | - { |
|
| 531 | + function drawSpline($Coordinates,$Format="") { |
|
| 578 | 532 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 579 | 533 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 580 | 534 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -587,8 +541,7 @@ discard block |
||
| 587 | 541 | $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; |
| 588 | 542 | |
| 589 | 543 | $Cpt = NULL; $Mode = NULL; $Result = ""; |
| 590 | - for($i=1;$i<=count($Coordinates)-1;$i++) |
|
| 591 | - { |
|
| 544 | + for($i=1;$i<=count($Coordinates)-1;$i++) { |
|
| 592 | 545 | $X1 = $Coordinates[$i-1][0]; $Y1 = $Coordinates[$i-1][1]; |
| 593 | 546 | $X2 = $Coordinates[$i][0]; $Y2 = $Coordinates[$i][1]; |
| 594 | 547 | |
@@ -596,9 +549,7 @@ discard block |
||
| 596 | 549 | |
| 597 | 550 | /* First segment */ |
| 598 | 551 | if ( $i == 1 ) |
| 599 | - { $Xv1 = $X1; $Yv1 = $Y1; } |
|
| 600 | - else |
|
| 601 | - { |
|
| 552 | + { $Xv1 = $X1; $Yv1 = $Y1; } else { |
|
| 602 | 553 | $Angle1 = $this->getAngle($XLast,$YLast,$X1,$Y1); |
| 603 | 554 | $Angle2 = $this->getAngle($X1,$Y1,$X2,$Y2); |
| 604 | 555 | $XOff = cos($Angle2 * PI / 180) * $Force + $X1; |
@@ -610,9 +561,7 @@ discard block |
||
| 610 | 561 | |
| 611 | 562 | /* Last segment */ |
| 612 | 563 | if ( $i == count($Coordinates)-1 ) |
| 613 | - { $Xv2 = $X2; $Yv2 = $Y2; } |
|
| 614 | - else |
|
| 615 | - { |
|
| 564 | + { $Xv2 = $X2; $Yv2 = $Y2; } else { |
|
| 616 | 565 | $Angle1 = $this->getAngle($X2,$Y2,$Coordinates[$i+1][0],$Coordinates[$i+1][1]); |
| 617 | 566 | $Angle2 = $this->getAngle($X1,$Y1,$X2,$Y2); |
| 618 | 567 | $XOff = cos(($Angle2+180) * PI / 180) * $Force + $X2; |
@@ -632,8 +581,7 @@ discard block |
||
| 632 | 581 | } |
| 633 | 582 | |
| 634 | 583 | /* Draw a bezier curve with two controls points */ |
| 635 | - function drawBezier($X1,$Y1,$X2,$Y2,$Xv1,$Yv1,$Xv2,$Yv2,$Format="") |
|
| 636 | - { |
|
| 584 | + function drawBezier($X1,$Y1,$X2,$Y2,$Xv1,$Yv1,$Xv2,$Yv2,$Format="") { |
|
| 637 | 585 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 638 | 586 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 639 | 587 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -649,12 +597,10 @@ discard block |
||
| 649 | 597 | $ArrowRatio = isset($Format["ArrowRatio"]) ? $Format["ArrowRatio"] : .5; |
| 650 | 598 | $ArrowTwoHeads = isset($Format["ArrowTwoHeads"]) ? $Format["ArrowTwoHeads"] : FALSE; |
| 651 | 599 | |
| 652 | - if ( $Segments == NULL ) |
|
| 653 | - { |
|
| 600 | + if ( $Segments == NULL ) { |
|
| 654 | 601 | $Length = $this->getLength($X1,$Y1,$X2,$Y2); |
| 655 | 602 | $Precision = ($Length*125)/1000; |
| 656 | - } |
|
| 657 | - else |
|
| 603 | + } else |
|
| 658 | 604 | $Precision = $Segments; |
| 659 | 605 | |
| 660 | 606 | $P[0]["X"] = $X1; $P[0]["Y"] = $Y1; |
@@ -664,8 +610,7 @@ discard block |
||
| 664 | 610 | |
| 665 | 611 | /* Compute the bezier points */ |
| 666 | 612 | $Q = ""; $ID = 0; $Path = ""; |
| 667 | - for($i=0;$i<=$Precision;$i=$i+1) |
|
| 668 | - { |
|
| 613 | + for($i=0;$i<=$Precision;$i=$i+1) { |
|
| 669 | 614 | $u = $i / $Precision; |
| 670 | 615 | |
| 671 | 616 | $C = ""; |
@@ -674,8 +619,7 @@ discard block |
||
| 674 | 619 | $C[2] = 3 * $u * $u * (1 - $u); |
| 675 | 620 | $C[3] = $u * $u * $u; |
| 676 | 621 | |
| 677 | - for($j=0;$j<=3;$j++) |
|
| 678 | - { |
|
| 622 | + for($j=0;$j<=3;$j++) { |
|
| 679 | 623 | if ( !isset($Q[$ID]) ) { $Q[$ID] = ""; } |
| 680 | 624 | if ( !isset($Q[$ID]["X"]) ) { $Q[$ID]["X"] = 0; } |
| 681 | 625 | if ( !isset($Q[$ID]["Y"]) ) { $Q[$ID]["Y"] = 0; } |
@@ -687,11 +631,9 @@ discard block |
||
| 687 | 631 | } |
| 688 | 632 | $Q[$ID]["X"] = $X2; $Q[$ID]["Y"] = $Y2; |
| 689 | 633 | |
| 690 | - if ( !$NoDraw ) |
|
| 691 | - { |
|
| 634 | + if ( !$NoDraw ) { |
|
| 692 | 635 | /* Display the control points */ |
| 693 | - if ( $ShowC && !$PathOnly ) |
|
| 694 | - { |
|
| 636 | + if ( $ShowC && !$PathOnly ) { |
|
| 695 | 637 | $Xv1 = floor($Xv1); $Yv1 = floor($Yv1); $Xv2 = floor($Xv2); $Yv2 = floor($Yv2); |
| 696 | 638 | |
| 697 | 639 | $this->drawLine($X1,$Y1,$X2,$Y2,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>30)); |
@@ -706,8 +648,7 @@ discard block |
||
| 706 | 648 | |
| 707 | 649 | /* Draw the bezier */ |
| 708 | 650 | $LastX = NULL; $LastY = NULL; $Cpt = NULL; $Mode = NULL; $ArrowS = NULL; |
| 709 | - foreach ($Q as $Key => $Point) |
|
| 710 | - { |
|
| 651 | + foreach ($Q as $Key => $Point) { |
|
| 711 | 652 | $X = $Point["X"]; $Y = $Point["Y"]; |
| 712 | 653 | |
| 713 | 654 | /* Get the first segment */ |
@@ -723,8 +664,7 @@ discard block |
||
| 723 | 664 | $LastX = $X; $LastY = $Y; |
| 724 | 665 | } |
| 725 | 666 | |
| 726 | - if ( $DrawArrow && !$PathOnly ) |
|
| 727 | - { |
|
| 667 | + if ( $DrawArrow && !$PathOnly ) { |
|
| 728 | 668 | $ArrowSettings = array("FillR"=>$R,"FillG"=>$G,"FillB"=>$B,"Alpha"=>$Alpha,"Size"=>$ArrowSize,"Ratio"=>$ArrowRatio); |
| 729 | 669 | if ( $ArrowTwoHeads ) |
| 730 | 670 | $this->drawArrow($ArrowS["X1"],$ArrowS["Y1"],$ArrowS["X2"],$ArrowS["Y2"],$ArrowSettings); |
@@ -736,8 +676,7 @@ discard block |
||
| 736 | 676 | } |
| 737 | 677 | |
| 738 | 678 | /* Draw a line between two points */ |
| 739 | - function drawLine($X1,$Y1,$X2,$Y2,$Format="") |
|
| 740 | - { |
|
| 679 | + function drawLine($X1,$Y1,$X2,$Y2,$Format="") { |
|
| 741 | 680 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 742 | 681 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 743 | 682 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -748,10 +687,8 @@ discard block |
||
| 748 | 687 | $Weight = isset($Format["Weight"]) ? $Format["Weight"] : NULL; |
| 749 | 688 | $Threshold = isset($Format["Threshold"]) ? $Format["Threshold"] : NULL; |
| 750 | 689 | |
| 751 | - if ( $this->Antialias == FALSE && $Ticks == NULL ) |
|
| 752 | - { |
|
| 753 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 754 | - { |
|
| 690 | + if ( $this->Antialias == FALSE && $Ticks == NULL ) { |
|
| 691 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 755 | 692 | $ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa); |
| 756 | 693 | imageline($this->Picture,$X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,$ShadowColor); |
| 757 | 694 | } |
@@ -765,13 +702,11 @@ discard block |
||
| 765 | 702 | if ( $Distance == 0 ) { return(-1); } |
| 766 | 703 | |
| 767 | 704 | /* Derivative algorithm for overweighted lines, re-route to polygons primitives */ |
| 768 | - if ( $Weight != NULL ) |
|
| 769 | - { |
|
| 705 | + if ( $Weight != NULL ) { |
|
| 770 | 706 | $Angle = $this->getAngle($X1,$Y1,$X2,$Y2); |
| 771 | 707 | $PolySettings = array ("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderAlpha"=>$Alpha); |
| 772 | 708 | |
| 773 | - if ( $Ticks == NULL ) |
|
| 774 | - { |
|
| 709 | + if ( $Ticks == NULL ) { |
|
| 775 | 710 | $Points = ""; |
| 776 | 711 | $Points[] = cos(deg2rad($Angle-90)) * $Weight + $X1; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Y1; |
| 777 | 712 | $Points[] = cos(deg2rad($Angle+90)) * $Weight + $X1; $Points[] = sin(deg2rad($Angle+90)) * $Weight + $Y1; |
@@ -779,11 +714,8 @@ discard block |
||
| 779 | 714 | $Points[] = cos(deg2rad($Angle-90)) * $Weight + $X2; $Points[] = sin(deg2rad($Angle-90)) * $Weight + $Y2; |
| 780 | 715 | |
| 781 | 716 | $this->drawPolygon($Points,$PolySettings); |
| 782 | - } |
|
| 783 | - else |
|
| 784 | - { |
|
| 785 | - for($i=0;$i<=$Distance;$i=$i+$Ticks*2) |
|
| 786 | - { |
|
| 717 | + } else { |
|
| 718 | + for($i=0;$i<=$Distance;$i=$i+$Ticks*2) { |
|
| 787 | 719 | $Xa = (($X2-$X1)/$Distance) * $i + $X1; $Ya = (($Y2-$Y1)/$Distance) * $i + $Y1; |
| 788 | 720 | $Xb = (($X2-$X1)/$Distance) * ($i+$Ticks) + $X1; $Yb = (($Y2-$Y1)/$Distance) * ($i+$Ticks) + $Y1; |
| 789 | 721 | |
@@ -803,19 +735,15 @@ discard block |
||
| 803 | 735 | $XStep = ($X2-$X1) / $Distance; |
| 804 | 736 | $YStep = ($Y2-$Y1) / $Distance; |
| 805 | 737 | |
| 806 | - for($i=0;$i<=$Distance;$i++) |
|
| 807 | - { |
|
| 738 | + for($i=0;$i<=$Distance;$i++) { |
|
| 808 | 739 | $X = $i * $XStep + $X1; |
| 809 | 740 | $Y = $i * $YStep + $Y1; |
| 810 | 741 | |
| 811 | 742 | $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
| 812 | 743 | |
| 813 | - if ( $Threshold != NULL ) |
|
| 814 | - { |
|
| 815 | - foreach($Threshold as $Key => $Parameters) |
|
| 816 | - { |
|
| 817 | - if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"]) |
|
| 818 | - { |
|
| 744 | + if ( $Threshold != NULL ) { |
|
| 745 | + foreach($Threshold as $Key => $Parameters) { |
|
| 746 | + if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"]) { |
|
| 819 | 747 | if ( isset($Parameters["R"]) ) { $RT = $Parameters["R"]; } else { $RT = 0; } |
| 820 | 748 | if ( isset($Parameters["G"]) ) { $GT = $Parameters["G"]; } else { $GT = 0; } |
| 821 | 749 | if ( isset($Parameters["B"]) ) { $BT = $Parameters["B"]; } else { $BT = 0; } |
@@ -825,8 +753,7 @@ discard block |
||
| 825 | 753 | } |
| 826 | 754 | } |
| 827 | 755 | |
| 828 | - if ( $Ticks != NULL ) |
|
| 829 | - { |
|
| 756 | + if ( $Ticks != NULL ) { |
|
| 830 | 757 | if ( $Cpt % $Ticks == 0 ) |
| 831 | 758 | { $Cpt = 0; if ( $Mode == 1 ) { $Mode = 0; } else { $Mode = 1; } } |
| 832 | 759 | |
@@ -834,8 +761,7 @@ discard block |
||
| 834 | 761 | $this->drawAntialiasPixel($X,$Y,$Color); |
| 835 | 762 | |
| 836 | 763 | $Cpt++; |
| 837 | - } |
|
| 838 | - else |
|
| 764 | + } else |
|
| 839 | 765 | $this->drawAntialiasPixel($X,$Y,$Color); |
| 840 | 766 | } |
| 841 | 767 | |
@@ -843,8 +769,7 @@ discard block |
||
| 843 | 769 | } |
| 844 | 770 | |
| 845 | 771 | /* Draw a circle */ |
| 846 | - function drawCircle($Xc,$Yc,$Height,$Width,$Format="") |
|
| 847 | - { |
|
| 772 | + function drawCircle($Xc,$Yc,$Height,$Width,$Format="") { |
|
| 848 | 773 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 849 | 774 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 850 | 775 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -859,8 +784,7 @@ discard block |
||
| 859 | 784 | $Xc = floor($Xc); $Yc = floor($Yc); |
| 860 | 785 | |
| 861 | 786 | $RestoreShadow = $this->Shadow; |
| 862 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 863 | - { |
|
| 787 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 864 | 788 | $this->Shadow = FALSE; |
| 865 | 789 | $this->drawCircle($Xc+$this->ShadowX,$Yc+$this->ShadowY,$Height,$Width,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks)); |
| 866 | 790 | } |
@@ -872,13 +796,11 @@ discard block |
||
| 872 | 796 | |
| 873 | 797 | $Step = 360 / (2 * PI * max($Width,$Height)); |
| 874 | 798 | $Mode = 1; $Cpt = 1; |
| 875 | - for($i=0;$i<=360;$i=$i+$Step) |
|
| 876 | - { |
|
| 799 | + for($i=0;$i<=360;$i=$i+$Step) { |
|
| 877 | 800 | $X = cos($i*PI/180) * $Height + $Xc; |
| 878 | 801 | $Y = sin($i*PI/180) * $Width + $Yc; |
| 879 | 802 | |
| 880 | - if ( $Ticks != NULL ) |
|
| 881 | - { |
|
| 803 | + if ( $Ticks != NULL ) { |
|
| 882 | 804 | if ( $Cpt % $Ticks == 0 ) |
| 883 | 805 | { $Cpt = 0; if ( $Mode == 1 ) { $Mode = 0; } else { $Mode = 1; } } |
| 884 | 806 | |
@@ -886,8 +808,7 @@ discard block |
||
| 886 | 808 | $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 887 | 809 | |
| 888 | 810 | $Cpt++; |
| 889 | - } |
|
| 890 | - else |
|
| 811 | + } else |
|
| 891 | 812 | $this->drawAntialiasPixel($X,$Y,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 892 | 813 | |
| 893 | 814 | } |
@@ -895,8 +816,7 @@ discard block |
||
| 895 | 816 | } |
| 896 | 817 | |
| 897 | 818 | /* Draw a filled circle */ |
| 898 | - function drawFilledCircle($X,$Y,$Radius,$Format="") |
|
| 899 | - { |
|
| 819 | + function drawFilledCircle($X,$Y,$Radius,$Format="") { |
|
| 900 | 820 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 901 | 821 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 902 | 822 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -915,16 +835,14 @@ discard block |
||
| 915 | 835 | $Radius = abs($Radius); |
| 916 | 836 | |
| 917 | 837 | $RestoreShadow = $this->Shadow; |
| 918 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 919 | - { |
|
| 838 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 920 | 839 | $this->Shadow = FALSE; |
| 921 | 840 | $this->drawFilledCircle($X+$this->ShadowX,$Y+$this->ShadowY,$Radius,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Ticks"=>$Ticks)); |
| 922 | 841 | } |
| 923 | 842 | |
| 924 | 843 | $this->Mask = ""; |
| 925 | 844 | $Color = $this->allocateColor($this->Picture,$R,$G,$B,$Alpha); |
| 926 | - for ($i=0; $i<=$Radius*2; $i++) |
|
| 927 | - { |
|
| 845 | + for ($i=0; $i<=$Radius*2; $i++) { |
|
| 928 | 846 | $Slice = sqrt($Radius * $Radius - ($Radius - $i) * ($Radius - $i)); |
| 929 | 847 | $XPos = floor($Slice); |
| 930 | 848 | $YPos = $Y + $i - $Radius; |
@@ -946,8 +864,7 @@ discard block |
||
| 946 | 864 | } |
| 947 | 865 | |
| 948 | 866 | /* Write text */ |
| 949 | - function drawText($X,$Y,$Text,$Format="") |
|
| 950 | - { |
|
| 867 | + function drawText($X,$Y,$Text,$Format="") { |
|
| 951 | 868 | $R = isset($Format["R"]) ? $Format["R"] : $this->FontColorR; |
| 952 | 869 | $G = isset($Format["G"]) ? $Format["G"] : $this->FontColorG; |
| 953 | 870 | $B = isset($Format["B"]) ? $Format["B"] : $this->FontColorB; |
@@ -979,16 +896,14 @@ discard block |
||
| 979 | 896 | |
| 980 | 897 | if ( $BoxSurrounding != "" ) { $BoxBorderR = $BoxR - $BoxSurrounding; $BoxBorderG = $BoxG - $BoxSurrounding; $BoxBorderB = $BoxB - $BoxSurrounding; $BoxBorderAlpha = $BoxAlpha; } |
| 981 | 898 | |
| 982 | - if ( $ShowOrigine ) |
|
| 983 | - { |
|
| 899 | + if ( $ShowOrigine ) { |
|
| 984 | 900 | $MyMarkerSettings = array("R"=>255,"G"=>0,"B"=>0,"BorderR"=>255,"BorderB"=>255,"BorderG"=>255,"Size"=>4); |
| 985 | 901 | $this->drawRectangleMarker($X,$Y,$MyMarkerSettings); |
| 986 | 902 | } |
| 987 | 903 | |
| 988 | 904 | $TxtPos = $this->getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text); |
| 989 | 905 | |
| 990 | - if ( $DrawBox && ($Angle == 0 || $Angle == 90 || $Angle == 180 || $Angle == 270)) |
|
| 991 | - { |
|
| 906 | + if ( $DrawBox && ($Angle == 0 || $Angle == 90 || $Angle == 180 || $Angle == 270)) { |
|
| 992 | 907 | $T[0]["X"]=0;$T[0]["Y"]=0;$T[1]["X"]=0;$T[1]["Y"]=0;$T[2]["X"]=0;$T[2]["Y"]=0;$T[3]["X"]=0;$T[3]["Y"]=0; |
| 993 | 908 | if ( $Angle == 0 ) { $T[0]["X"]=-$TOffset;$T[0]["Y"]=$TOffset;$T[1]["X"]=$TOffset;$T[1]["Y"]=$TOffset;$T[2]["X"]=$TOffset;$T[2]["Y"]=-$TOffset;$T[3]["X"]=-$TOffset;$T[3]["Y"]=-$TOffset; } |
| 994 | 909 | |
@@ -1005,16 +920,14 @@ discard block |
||
| 1005 | 920 | $Settings = array("R"=>$BoxR,"G"=>$BoxG,"B"=>$BoxB,"Alpha"=>$BoxAlpha,"BorderR"=>$BoxBorderR,"BorderG"=>$BoxBorderG,"BorderB"=>$BoxBorderB,"BorderAlpha"=>$BoxBorderAlpha); |
| 1006 | 921 | |
| 1007 | 922 | if ( $BoxRounded ) |
| 1008 | - { $this->drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$RoundedRadius,$Settings); } |
|
| 1009 | - else |
|
| 923 | + { $this->drawRoundedFilledRectangle($X1,$Y1,$X2,$Y2,$RoundedRadius,$Settings); } else |
|
| 1010 | 924 | { $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Settings); } |
| 1011 | 925 | } |
| 1012 | 926 | |
| 1013 | 927 | $X = $X - $TxtPos[$Align]["X"] + $X; |
| 1014 | 928 | $Y = $Y - $TxtPos[$Align]["Y"] + $Y; |
| 1015 | 929 | |
| 1016 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 1017 | - { |
|
| 930 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 1018 | 931 | $C_ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa); |
| 1019 | 932 | imagettftext($this->Picture,$FontSize,$Angle,$X+$this->ShadowX,$Y+$this->ShadowY,$C_ShadowColor,$FontName,$Text); |
| 1020 | 933 | } |
@@ -1028,8 +941,7 @@ discard block |
||
| 1028 | 941 | } |
| 1029 | 942 | |
| 1030 | 943 | /* Draw a gradient within a defined area */ |
| 1031 | - function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="") |
|
| 1032 | - { |
|
| 944 | + function drawGradientArea($X1,$Y1,$X2,$Y2,$Direction,$Format="") { |
|
| 1033 | 945 | $StartR = isset($Format["StartR"]) ? $Format["StartR"] : 90; |
| 1034 | 946 | $StartG = isset($Format["StartG"]) ? $Format["StartG"] : 90; |
| 1035 | 947 | $StartB = isset($Format["StartB"]) ? $Format["StartB"] : 90; |
@@ -1042,8 +954,7 @@ discard block |
||
| 1042 | 954 | $Shadow = $this->Shadow; |
| 1043 | 955 | $this->Shadow = FALSE; |
| 1044 | 956 | |
| 1045 | - if ( $StartR == $EndR && $StartG == $EndG && $StartB == $EndB ) |
|
| 1046 | - { |
|
| 957 | + if ( $StartR == $EndR && $StartG == $EndG && $StartB == $EndB ) { |
|
| 1047 | 958 | $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,array("R"=>$StartR,"G"=>$StartG,"B"=>$StartB,"Alpha"=>$Alpha)); |
| 1048 | 959 | return(0); |
| 1049 | 960 | } |
@@ -1064,17 +975,14 @@ discard block |
||
| 1064 | 975 | $BStep = ($EndB-$StartB)/$Step; |
| 1065 | 976 | |
| 1066 | 977 | $R=$StartR;$G=$StartG;$B=$StartB; |
| 1067 | - switch($Direction) |
|
| 1068 | - { |
|
| 978 | + switch($Direction) { |
|
| 1069 | 979 | case DIRECTION_VERTICAL: |
| 1070 | 980 | $StartY = $Y1; $EndY = floor($Y2)+1; $LastY2 = $StartY; |
| 1071 | - for($i=0;$i<=$Step;$i++) |
|
| 1072 | - { |
|
| 981 | + for($i=0;$i<=$Step;$i++) { |
|
| 1073 | 982 | $Y2 = floor($StartY + ($i * $StepSize)); |
| 1074 | 983 | |
| 1075 | 984 | if ($Y2 > $EndY) { $Y2 = $EndY; } |
| 1076 | - if (($Y1 != $Y2 && $Y1 < $Y2) || $Y2 == $EndY) |
|
| 1077 | - { |
|
| 985 | + if (($Y1 != $Y2 && $Y1 < $Y2) || $Y2 == $EndY) { |
|
| 1078 | 986 | $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
| 1079 | 987 | $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color); |
| 1080 | 988 | $LastY2 = max($LastY2,$Y2); |
@@ -1087,13 +995,11 @@ discard block |
||
| 1087 | 995 | |
| 1088 | 996 | case DIRECTION_HORIZONTAL: |
| 1089 | 997 | $StartX = $X1; $EndX = $X2; |
| 1090 | - for($i=0;$i<=$Step;$i++) |
|
| 1091 | - { |
|
| 998 | + for($i=0;$i<=$Step;$i++) { |
|
| 1092 | 999 | $X2 = floor($StartX + ($i * $StepSize)); |
| 1093 | 1000 | |
| 1094 | 1001 | if ($X2 > $EndX) { $X2 = $EndX; } |
| 1095 | - if (($X1 != $X2 && $X1 < $X2) || $X2 == $EndX) |
|
| 1096 | - { |
|
| 1002 | + if (($X1 != $X2 && $X1 < $X2) || $X2 == $EndX) { |
|
| 1097 | 1003 | $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha); |
| 1098 | 1004 | $this->drawFilledRectangle($X1,$Y1,$X2,$Y2,$Color); |
| 1099 | 1005 | $X1 = $X2+1; |
@@ -1109,8 +1015,7 @@ discard block |
||
| 1109 | 1015 | } |
| 1110 | 1016 | |
| 1111 | 1017 | /* Draw an aliased pixel */ |
| 1112 | - function drawAntialiasPixel($X,$Y,$Format="") |
|
| 1113 | - { |
|
| 1018 | + function drawAntialiasPixel($X,$Y,$Format="") { |
|
| 1114 | 1019 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 1115 | 1020 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 1116 | 1021 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -1123,10 +1028,8 @@ discard block |
||
| 1123 | 1028 | if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; } |
| 1124 | 1029 | if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; } |
| 1125 | 1030 | |
| 1126 | - if ( !$this->Antialias ) |
|
| 1127 | - { |
|
| 1128 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 1129 | - { |
|
| 1031 | + if ( !$this->Antialias ) { |
|
| 1032 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 1130 | 1033 | $ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$this->Shadowa); |
| 1131 | 1034 | imagesetpixel($this->Picture,$X+$this->ShadowX,$Y+$this->ShadowY,$ShadowColor); |
| 1132 | 1035 | } |
@@ -1141,15 +1044,12 @@ discard block |
||
| 1141 | 1044 | $Xi = floor($X); |
| 1142 | 1045 | $Yi = floor($Y); |
| 1143 | 1046 | |
| 1144 | - if ( $Xi == $X && $Yi == $Y) |
|
| 1145 | - { |
|
| 1047 | + if ( $Xi == $X && $Yi == $Y) { |
|
| 1146 | 1048 | if ( $Alpha == 100 ) |
| 1147 | 1049 | $this->drawAlphaPixel($X,$Y,100,$R,$G,$B); |
| 1148 | 1050 | else |
| 1149 | 1051 | $this->drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B); |
| 1150 | - } |
|
| 1151 | - else |
|
| 1152 | - { |
|
| 1052 | + } else { |
|
| 1153 | 1053 | $Alpha1 = (((1 - ($X - floor($X))) * (1 - ($Y - floor($Y))) * 100) / 100) * $Alpha; |
| 1154 | 1054 | if ( $Alpha1 > $this->AntialiasQuality ) { $this->drawAlphaPixel($Xi,$Yi,$Alpha1,$R,$G,$B); } |
| 1155 | 1055 | |
@@ -1165,8 +1065,7 @@ discard block |
||
| 1165 | 1065 | } |
| 1166 | 1066 | |
| 1167 | 1067 | /* Draw a semi-transparent pixel */ |
| 1168 | - function drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B) |
|
| 1169 | - { |
|
| 1068 | + function drawAlphaPixel($X,$Y,$Alpha,$R,$G,$B) { |
|
| 1170 | 1069 | if ( isset($this->Mask[$X])) { if ( isset($this->Mask[$X][$Y]) ) { return(0); } } |
| 1171 | 1070 | |
| 1172 | 1071 | if ( $X < 0 || $Y < 0 || $X >= $this->XSize || $Y >= $this->YSize ) |
@@ -1176,8 +1075,7 @@ discard block |
||
| 1176 | 1075 | if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; } |
| 1177 | 1076 | if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; } |
| 1178 | 1077 | |
| 1179 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 1180 | - { |
|
| 1078 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 1181 | 1079 | $AlphaFactor = floor(($Alpha / 100) * $this->Shadowa); |
| 1182 | 1080 | $ShadowColor = $this->allocateColor($this->Picture,$this->ShadowR,$this->ShadowG,$this->ShadowB,$AlphaFactor); |
| 1183 | 1081 | imagesetpixel($this->Picture,$X+$this->ShadowX,$Y+$this->ShadowY,$ShadowColor); |
@@ -1192,8 +1090,7 @@ discard block |
||
| 1192 | 1090 | { return((127/100)*(100-$AlphaValue)); } |
| 1193 | 1091 | |
| 1194 | 1092 | /* Allocate a color with transparency */ |
| 1195 | - function allocateColor($Picture,$R,$G,$B,$Alpha=100) |
|
| 1196 | - { |
|
| 1093 | + function allocateColor($Picture,$R,$G,$B,$Alpha=100) { |
|
| 1197 | 1094 | if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; } |
| 1198 | 1095 | if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; } |
| 1199 | 1096 | if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; } |
@@ -1216,8 +1113,7 @@ discard block |
||
| 1216 | 1113 | function drawFromJPG($X,$Y,$FileName) |
| 1217 | 1114 | { $this->drawFromPicture(3,$FileName,$X,$Y); } |
| 1218 | 1115 | |
| 1219 | - function getPicInfo($FileName) |
|
| 1220 | - { |
|
| 1116 | + function getPicInfo($FileName) { |
|
| 1221 | 1117 | $Infos = getimagesize($FileName); |
| 1222 | 1118 | $Width = $Infos[0]; |
| 1223 | 1119 | $Height = $Infos[1]; |
@@ -1231,39 +1127,29 @@ discard block |
||
| 1231 | 1127 | } |
| 1232 | 1128 | |
| 1233 | 1129 | /* Generic loader function for external pictures */ |
| 1234 | - function drawFromPicture($PicType,$FileName,$X,$Y) |
|
| 1235 | - { |
|
| 1236 | - if ( file_exists($FileName)) |
|
| 1237 | - { |
|
| 1130 | + function drawFromPicture($PicType,$FileName,$X,$Y) { |
|
| 1131 | + if ( file_exists($FileName)) { |
|
| 1238 | 1132 | list($Width,$Height) = $this->getPicInfo($FileName); |
| 1239 | 1133 | |
| 1240 | 1134 | if ( $PicType == 1 ) |
| 1241 | - { $Raster = imagecreatefrompng($FileName); } |
|
| 1242 | - elseif ( $PicType == 2 ) |
|
| 1243 | - { $Raster = imagecreatefromgif($FileName); } |
|
| 1244 | - elseif ( $PicType == 3 ) |
|
| 1245 | - { $Raster = imagecreatefromjpeg($FileName); } |
|
| 1246 | - else |
|
| 1135 | + { $Raster = imagecreatefrompng($FileName); } elseif ( $PicType == 2 ) |
|
| 1136 | + { $Raster = imagecreatefromgif($FileName); } elseif ( $PicType == 3 ) |
|
| 1137 | + { $Raster = imagecreatefromjpeg($FileName); } else |
|
| 1247 | 1138 | { return(0); } |
| 1248 | 1139 | |
| 1249 | 1140 | |
| 1250 | 1141 | $RestoreShadow = $this->Shadow; |
| 1251 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 1252 | - { |
|
| 1142 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 1253 | 1143 | $this->Shadow = FALSE; |
| 1254 | 1144 | if ( $PicType == 3 ) |
| 1255 | 1145 | $this->drawFilledRectangle($X+$this->ShadowX,$Y+$this->ShadowY,$X+$Width+$this->ShadowX,$Y+$Height+$this->ShadowY,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa)); |
| 1256 | - else |
|
| 1257 | - { |
|
| 1146 | + else { |
|
| 1258 | 1147 | $TranparentID = imagecolortransparent($Raster); |
| 1259 | - for ($Xc=0;$Xc<=$Width-1;$Xc++) |
|
| 1260 | - { |
|
| 1261 | - for ($Yc=0;$Yc<=$Height-1;$Yc++) |
|
| 1262 | - { |
|
| 1148 | + for ($Xc=0;$Xc<=$Width-1;$Xc++) { |
|
| 1149 | + for ($Yc=0;$Yc<=$Height-1;$Yc++) { |
|
| 1263 | 1150 | $RGBa = imagecolorat($Raster,$Xc,$Yc); |
| 1264 | 1151 | $Values = imagecolorsforindex($Raster,$RGBa); |
| 1265 | - if ( $Values["alpha"] < 120 ) |
|
| 1266 | - { |
|
| 1152 | + if ( $Values["alpha"] < 120 ) { |
|
| 1267 | 1153 | $AlphaFactor = floor(($this->Shadowa / 100) * ((100 / 127) * (127-$Values["alpha"]))); |
| 1268 | 1154 | $this->drawAlphaPixel($X+$Xc+$this->ShadowX,$Y+$Yc+$this->ShadowY,$AlphaFactor,$this->ShadowR,$this->ShadowG,$this->ShadowB); |
| 1269 | 1155 | } |
@@ -1279,8 +1165,7 @@ discard block |
||
| 1279 | 1165 | } |
| 1280 | 1166 | |
| 1281 | 1167 | /* Draw an arrow */ |
| 1282 | - function drawArrow($X1,$Y1,$X2,$Y2,$Format="") |
|
| 1283 | - { |
|
| 1168 | + function drawArrow($X1,$Y1,$X2,$Y2,$Format="") { |
|
| 1284 | 1169 | $FillR = isset($Format["FillR"]) ? $Format["FillR"] : 0; |
| 1285 | 1170 | $FillG = isset($Format["FillG"]) ? $Format["FillG"] : 0; |
| 1286 | 1171 | $FillB = isset($Format["FillB"]) ? $Format["FillB"] : 0; |
@@ -1298,8 +1183,7 @@ discard block |
||
| 1298 | 1183 | |
| 1299 | 1184 | /* Override Shadow support, this will be managed internally */ |
| 1300 | 1185 | $RestoreShadow = $this->Shadow; |
| 1301 | - if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) |
|
| 1302 | - { |
|
| 1186 | + if ( $this->Shadow && $this->ShadowX != 0 && $this->ShadowY != 0 ) { |
|
| 1303 | 1187 | $this->Shadow = FALSE; |
| 1304 | 1188 | $this->drawArrow($X1+$this->ShadowX,$Y1+$this->ShadowY,$X2+$this->ShadowX,$Y2+$this->ShadowY,array("FillR"=>$this->ShadowR,"FillG"=>$this->ShadowG,"FillB"=>$this->ShadowB,"Alpha"=>$this->Shadowa,"Size"=>$Size,"Ratio"=>$Ratio,"TwoHeads"=>$TwoHeads,"Ticks"=>$Ticks)); |
| 1305 | 1189 | } |
@@ -1326,8 +1210,7 @@ discard block |
||
| 1326 | 1210 | $this->drawLine($Points[0],$Points[1],$Points[4],$Points[5],array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha)); |
| 1327 | 1211 | |
| 1328 | 1212 | /* Draw the second head */ |
| 1329 | - if ( $TwoHeads ) |
|
| 1330 | - { |
|
| 1213 | + if ( $TwoHeads ) { |
|
| 1331 | 1214 | $Angle = $this->getAngle($X2,$Y2,$X1,$Y1); |
| 1332 | 1215 | |
| 1333 | 1216 | $TailX2 = cos(($Angle-180)*PI/180)*$Size+$X1; |
@@ -1351,8 +1234,7 @@ discard block |
||
| 1351 | 1234 | $this->drawLine($Points[0],$Points[1],$Points[4],$Points[5],array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha)); |
| 1352 | 1235 | |
| 1353 | 1236 | $this->drawLine($TailX,$TailY,$TailX2,$TailY2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 1354 | - } |
|
| 1355 | - else |
|
| 1237 | + } else |
|
| 1356 | 1238 | $this->drawLine($X1,$Y1,$TailX,$TailY,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 1357 | 1239 | |
| 1358 | 1240 | /* Re-enable shadows */ |
@@ -1360,8 +1242,7 @@ discard block |
||
| 1360 | 1242 | } |
| 1361 | 1243 | |
| 1362 | 1244 | /* Draw a label with associated arrow */ |
| 1363 | - function drawArrowLabel($X1,$Y1,$Text,$Format="") |
|
| 1364 | - { |
|
| 1245 | + function drawArrowLabel($X1,$Y1,$Text,$Format="") { |
|
| 1365 | 1246 | $FillR = isset($Format["FillR"]) ? $Format["FillR"] : 0; |
| 1366 | 1247 | $FillG = isset($Format["FillG"]) ? $Format["FillG"] : 0; |
| 1367 | 1248 | $FillB = isset($Format["FillB"]) ? $Format["FillB"] : 0; |
@@ -1392,16 +1273,13 @@ discard block |
||
| 1392 | 1273 | $TxtWidth = max(abs($Size[2]-$Size[0]),abs($Size[0]-$Size[6])); |
| 1393 | 1274 | $TxtHeight = max(abs($Size[1]-$Size[7]),abs($Size[3]-$Size[1])); |
| 1394 | 1275 | |
| 1395 | - if ( $Angle > 0 && $Angle < 180 ) |
|
| 1396 | - { |
|
| 1276 | + if ( $Angle > 0 && $Angle < 180 ) { |
|
| 1397 | 1277 | $this->drawLine($X2,$Y2,$X2-$TxtWidth,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 1398 | 1278 | if ( $Position == POSITION_TOP ) |
| 1399 | 1279 | $this->drawText($X2,$Y2-2,$Text,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Align"=>TEXT_ALIGN_BOTTOMRIGHT)); |
| 1400 | 1280 | else |
| 1401 | 1281 | $this->drawText($X2,$Y2+4,$Text,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Align"=>TEXT_ALIGN_TOPRIGHT)); |
| 1402 | - } |
|
| 1403 | - else |
|
| 1404 | - { |
|
| 1282 | + } else { |
|
| 1405 | 1283 | $this->drawLine($X2,$Y2,$X2+$TxtWidth,$Y2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 1406 | 1284 | if ( $Position == POSITION_TOP ) |
| 1407 | 1285 | $this->drawText($X2,$Y2-2,$Text,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$Alpha)); |
@@ -1411,8 +1289,7 @@ discard block |
||
| 1411 | 1289 | } |
| 1412 | 1290 | |
| 1413 | 1291 | /* Draw a progress bar filled with specified % */ |
| 1414 | - function drawProgress($X,$Y,$Percent,$Format="") |
|
| 1415 | - { |
|
| 1292 | + function drawProgress($X,$Y,$Percent,$Format="") { |
|
| 1416 | 1293 | if ( $Percent > 100 ) { $Percent = 100; } |
| 1417 | 1294 | if ( $Percent < 0 ) { $Percent = 0; } |
| 1418 | 1295 | |
@@ -1442,8 +1319,7 @@ discard block |
||
| 1442 | 1319 | $BoxSurrounding = isset($Format["BoxSurrounding"]) ? $Format["BoxSurrounding"] : NULL; |
| 1443 | 1320 | $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : FALSE; |
| 1444 | 1321 | |
| 1445 | - if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) |
|
| 1446 | - { |
|
| 1322 | + if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) { |
|
| 1447 | 1323 | $RFade = (($RFade-$R)/100)*$Percent+$R; |
| 1448 | 1324 | $GFade = (($GFade-$G)/100)*$Percent+$G; |
| 1449 | 1325 | $BFade = (($BFade-$B)/100)*$Percent+$B; |
@@ -1452,21 +1328,18 @@ discard block |
||
| 1452 | 1328 | if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; } |
| 1453 | 1329 | if ( $BoxSurrounding != NULL ) { $BoxBorderR = $BoxBackR + $Surrounding; $BoxBorderG = $BoxBackG + $Surrounding; $BoxBorderB = $BoxBackB + $Surrounding; } |
| 1454 | 1330 | |
| 1455 | - if ( $Orientation == ORIENTATION_VERTICAL ) |
|
| 1456 | - { |
|
| 1331 | + if ( $Orientation == ORIENTATION_VERTICAL ) { |
|
| 1457 | 1332 | $InnerHeight = (($Height-2)/100)*$Percent; |
| 1458 | 1333 | $this->drawFilledRectangle($X,$Y,$X+$Width,$Y-$Height,array("R"=>$BoxBackR,"G"=>$BoxBackG,"B"=>$BoxBackB,"BorderR"=>$BoxBorderR,"BorderG"=>$BoxBorderG,"BorderB"=>$BoxBorderB,"NoAngle"=>$NoAngle)); |
| 1459 | 1334 | |
| 1460 | 1335 | $RestoreShadow = $this->Shadow; $this->Shadow = FALSE; |
| 1461 | - if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) |
|
| 1462 | - { |
|
| 1336 | + if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) { |
|
| 1463 | 1337 | $GradientOptions = array("StartR"=>$RFade,"StartG"=>$GFade,"StartB"=>$BFade,"EndR"=>$R,"EndG"=>$G,"EndB"=>$B); |
| 1464 | 1338 | $this->drawGradientArea($X+1,$Y-1,$X+$Width-1,$Y-$InnerHeight,DIRECTION_VERTICAL,$GradientOptions); |
| 1465 | 1339 | |
| 1466 | 1340 | if ( $Surrounding ) |
| 1467 | 1341 | $this->drawRectangle($X+1,$Y-1,$X+$Width-1,$Y-$InnerHeight,array("R"=>255,"G"=>255,"B"=>255,"Alpha"=>$Surrounding)); |
| 1468 | - } |
|
| 1469 | - else |
|
| 1342 | + } else |
|
| 1470 | 1343 | $this->drawFilledRectangle($X+1,$Y-1,$X+$Width-1,$Y-$InnerHeight,array("R"=>$R,"G"=>$G,"B"=>$B,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB)); |
| 1471 | 1344 | |
| 1472 | 1345 | $this->Shadow = $RestoreShadow; |
@@ -1475,9 +1348,7 @@ discard block |
||
| 1475 | 1348 | if ( $ShowLabel && $LabelPos == LABEL_POS_TOP ) { $this->drawText($X+($Width/2),$Y-$Height-$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); } |
| 1476 | 1349 | if ( $ShowLabel && $LabelPos == LABEL_POS_INSIDE ) { $this->drawText($X+($Width/2),$Y-$InnerHeight-$Margin,$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLELEFT,"Angle"=>90)); } |
| 1477 | 1350 | if ( $ShowLabel && $LabelPos == LABEL_POS_CENTER ) { $this->drawText($X+($Width/2),$Y-($Height/2),$Percent."%",array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"Angle"=>90)); } |
| 1478 | - } |
|
| 1479 | - else |
|
| 1480 | - { |
|
| 1351 | + } else { |
|
| 1481 | 1352 | if ( $Percent == 100 ) |
| 1482 | 1353 | $InnerWidth = $Width-1; |
| 1483 | 1354 | else |
@@ -1486,15 +1357,13 @@ discard block |
||
| 1486 | 1357 | $this->drawFilledRectangle($X,$Y,$X+$Width,$Y+$Height,array("R"=>$BoxBackR,"G"=>$BoxBackG,"B"=>$BoxBackB,"BorderR"=>$BoxBorderR,"BorderG"=>$BoxBorderG,"BorderB"=>$BoxBorderB,"NoAngle"=>$NoAngle)); |
| 1487 | 1358 | |
| 1488 | 1359 | $RestoreShadow = $this->Shadow; $this->Shadow = FALSE; |
| 1489 | - if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) |
|
| 1490 | - { |
|
| 1360 | + if ( $RFade != -1 && $GFade != -1 && $BFade != -1 ) { |
|
| 1491 | 1361 | $GradientOptions = array("StartR"=>$R,"StartG"=>$G,"StartB"=>$B,"EndR"=>$RFade,"EndG"=>$GFade,"EndB"=>$BFade); |
| 1492 | 1362 | $this->drawGradientArea($X+1,$Y+1,$X+$InnerWidth,$Y+$Height-1,DIRECTION_HORIZONTAL,$GradientOptions); |
| 1493 | 1363 | |
| 1494 | 1364 | if ( $Surrounding ) |
| 1495 | 1365 | $this->drawRectangle($X+1,$Y+1,$X+$InnerWidth,$Y+$Height-1,array("R"=>255,"G"=>255,"B"=>255,"Alpha"=>$Surrounding)); |
| 1496 | - } |
|
| 1497 | - else |
|
| 1366 | + } else |
|
| 1498 | 1367 | $this->drawFilledRectangle($X+1,$Y+1,$X+$InnerWidth,$Y+$Height-1,array("R"=>$R,"G"=>$G,"B"=>$B,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB)); |
| 1499 | 1368 | |
| 1500 | 1369 | $this->Shadow = $RestoreShadow; |
@@ -1507,8 +1376,7 @@ discard block |
||
| 1507 | 1376 | } |
| 1508 | 1377 | |
| 1509 | 1378 | /* Get the legend box size */ |
| 1510 | - function getLegendSize($Format="") |
|
| 1511 | - { |
|
| 1379 | + function getLegendSize($Format="") { |
|
| 1512 | 1380 | $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; |
| 1513 | 1381 | $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; |
| 1514 | 1382 | $BoxSize = isset($Format["BoxSize"]) ? $Format["BoxSize"] : 5; |
@@ -1523,10 +1391,8 @@ discard block |
||
| 1523 | 1391 | |
| 1524 | 1392 | $Data = $this->DataSet->getData(); |
| 1525 | 1393 | |
| 1526 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 1527 | - { |
|
| 1528 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && isset($Serie["Picture"])) |
|
| 1529 | - { |
|
| 1394 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 1395 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && isset($Serie["Picture"])) { |
|
| 1530 | 1396 | list($PicWidth,$PicHeight) = $this->getPicInfo($Serie["Picture"]); |
| 1531 | 1397 | if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; } |
| 1532 | 1398 | if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; } |
@@ -1540,12 +1406,9 @@ discard block |
||
| 1540 | 1406 | $X=100; $Y=100; |
| 1541 | 1407 | |
| 1542 | 1408 | $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X; |
| 1543 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 1544 | - { |
|
| 1545 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 1546 | - { |
|
| 1547 | - if ( $Mode == LEGEND_VERTICAL ) |
|
| 1548 | - { |
|
| 1409 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 1410 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 1411 | + if ( $Mode == LEGEND_VERTICAL ) { |
|
| 1549 | 1412 | $BoxArray = $this->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Serie["Description"]); |
| 1550 | 1413 | |
| 1551 | 1414 | if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; } |
@@ -1554,13 +1417,10 @@ discard block |
||
| 1554 | 1417 | |
| 1555 | 1418 | $Lines = preg_split("/\n/",$Serie["Description"]); |
| 1556 | 1419 | $vY = $vY + max($this->FontSize*count($Lines),$IconAreaHeight) + 5; |
| 1557 | - } |
|
| 1558 | - elseif ( $Mode == LEGEND_HORIZONTAL ) |
|
| 1559 | - { |
|
| 1420 | + } elseif ( $Mode == LEGEND_HORIZONTAL ) { |
|
| 1560 | 1421 | $Lines = preg_split("/\n/",$Serie["Description"]); |
| 1561 | 1422 | $Width = ""; |
| 1562 | - foreach($Lines as $Key => $Value) |
|
| 1563 | - { |
|
| 1423 | + foreach($Lines as $Key => $Value) { |
|
| 1564 | 1424 | $BoxArray = $this->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$FontName,$FontSize,0,$Value); |
| 1565 | 1425 | |
| 1566 | 1426 | if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; } |
@@ -1586,8 +1446,7 @@ discard block |
||
| 1586 | 1446 | } |
| 1587 | 1447 | |
| 1588 | 1448 | /* Draw the legend of the active series */ |
| 1589 | - function drawLegend($X,$Y,$Format="") |
|
| 1590 | - { |
|
| 1449 | + function drawLegend($X,$Y,$Format="") { |
|
| 1591 | 1450 | $Family = isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX; |
| 1592 | 1451 | $FontName = isset($Format["FontName"]) ? $Format["FontName"] : $this->FontName; |
| 1593 | 1452 | $FontSize = isset($Format["FontSize"]) ? $Format["FontSize"] : $this->FontSize; |
@@ -1615,10 +1474,8 @@ discard block |
||
| 1615 | 1474 | |
| 1616 | 1475 | $Data = $this->DataSet->getData(); |
| 1617 | 1476 | |
| 1618 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 1619 | - { |
|
| 1620 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && isset($Serie["Picture"])) |
|
| 1621 | - { |
|
| 1477 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 1478 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && isset($Serie["Picture"])) { |
|
| 1622 | 1479 | list($PicWidth,$PicHeight) = $this->getPicInfo($Serie["Picture"]); |
| 1623 | 1480 | if ( $IconAreaWidth < $PicWidth ) { $IconAreaWidth = $PicWidth; } |
| 1624 | 1481 | if ( $IconAreaHeight < $PicHeight ) { $IconAreaHeight = $PicHeight; } |
@@ -1630,12 +1487,9 @@ discard block |
||
| 1630 | 1487 | $XStep = $XSpacing; |
| 1631 | 1488 | |
| 1632 | 1489 | $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X; |
| 1633 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 1634 | - { |
|
| 1635 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 1636 | - { |
|
| 1637 | - if ( $Mode == LEGEND_VERTICAL ) |
|
| 1638 | - { |
|
| 1490 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 1491 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 1492 | + if ( $Mode == LEGEND_VERTICAL ) { |
|
| 1639 | 1493 | $BoxArray = $this->getTextBox($vX+$IconAreaWidth+4,$vY+$IconAreaHeight/2,$FontName,$FontSize,0,$Serie["Description"]); |
| 1640 | 1494 | |
| 1641 | 1495 | if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; } |
@@ -1644,13 +1498,10 @@ discard block |
||
| 1644 | 1498 | |
| 1645 | 1499 | $Lines = preg_split("/\n/",$Serie["Description"]); |
| 1646 | 1500 | $vY = $vY + max($this->FontSize*count($Lines),$IconAreaHeight) + 5; |
| 1647 | - } |
|
| 1648 | - elseif ( $Mode == LEGEND_HORIZONTAL ) |
|
| 1649 | - { |
|
| 1501 | + } elseif ( $Mode == LEGEND_HORIZONTAL ) { |
|
| 1650 | 1502 | $Lines = preg_split("/\n/",$Serie["Description"]); |
| 1651 | 1503 | $Width = ""; |
| 1652 | - foreach($Lines as $Key => $Value) |
|
| 1653 | - { |
|
| 1504 | + foreach($Lines as $Key => $Value) { |
|
| 1654 | 1505 | $BoxArray = $this->getTextBox($vX+$IconAreaWidth+6,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$FontName,$FontSize,0,$Value); |
| 1655 | 1506 | |
| 1656 | 1507 | if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$IconAreaHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$IconAreaHeight/2; } |
@@ -1675,57 +1526,44 @@ discard block |
||
| 1675 | 1526 | $this->drawFilledRectangle($Boundaries["L"]-$Margin,$Boundaries["T"]-$Margin,$Boundaries["R"]+$Margin,$Boundaries["B"]+$Margin,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB)); |
| 1676 | 1527 | |
| 1677 | 1528 | $RestoreShadow = $this->Shadow; $this->Shadow = FALSE; |
| 1678 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 1679 | - { |
|
| 1680 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 1681 | - { |
|
| 1529 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 1530 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 1682 | 1531 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; |
| 1683 | 1532 | $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"]; |
| 1684 | 1533 | |
| 1685 | - if ( isset($Serie["Picture"]) ) |
|
| 1686 | - { |
|
| 1534 | + if ( isset($Serie["Picture"]) ) { |
|
| 1687 | 1535 | $Picture = $Serie["Picture"]; |
| 1688 | 1536 | list($PicWidth,$PicHeight) = $this->getPicInfo($Picture); |
| 1689 | 1537 | $PicX = $X+$IconAreaWidth/2; $PicY = $Y+$IconAreaHeight/2; |
| 1690 | 1538 | |
| 1691 | 1539 | $this->drawFromPNG($PicX-$PicWidth/2,$PicY-$PicHeight/2,$Picture); |
| 1692 | - } |
|
| 1693 | - else |
|
| 1694 | - { |
|
| 1695 | - if ( $Family == LEGEND_FAMILY_BOX ) |
|
| 1696 | - { |
|
| 1540 | + } else { |
|
| 1541 | + if ( $Family == LEGEND_FAMILY_BOX ) { |
|
| 1697 | 1542 | if ( $BoxWidth != $IconAreaWidth ) { $XOffset = floor(($IconAreaWidth-$BoxWidth)/2); } else { $XOffset = 0; } |
| 1698 | 1543 | if ( $BoxHeight != $IconAreaHeight ) { $YOffset = floor(($IconAreaHeight-$BoxHeight)/2); } else { $YOffset = 0; } |
| 1699 | 1544 | |
| 1700 | 1545 | $this->drawFilledRectangle($X+1+$XOffset,$Y+1+$YOffset,$X+$BoxWidth+$XOffset+1,$Y+$BoxHeight+1+$YOffset,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); |
| 1701 | 1546 | $this->drawFilledRectangle($X+$XOffset,$Y+$YOffset,$X+$BoxWidth+$XOffset,$Y+$BoxHeight+$YOffset,array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20)); |
| 1702 | - } |
|
| 1703 | - elseif ( $Family == LEGEND_FAMILY_CIRCLE ) |
|
| 1704 | - { |
|
| 1547 | + } elseif ( $Family == LEGEND_FAMILY_CIRCLE ) { |
|
| 1705 | 1548 | $this->drawFilledCircle($X+1+$IconAreaWidth/2,$Y+1+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20)); |
| 1706 | 1549 | $this->drawFilledCircle($X+$IconAreaWidth/2,$Y+$IconAreaHeight/2,min($IconAreaHeight/2,$IconAreaWidth/2),array("R"=>$R,"G"=>$G,"B"=>$B,"Surrounding"=>20)); |
| 1707 | - } |
|
| 1708 | - elseif ( $Family == LEGEND_FAMILY_LINE ) |
|
| 1709 | - { |
|
| 1550 | + } elseif ( $Family == LEGEND_FAMILY_LINE ) { |
|
| 1710 | 1551 | $this->drawLine($X+1,$Y+1+$IconAreaHeight/2,$X+1+$IconAreaWidth,$Y+1+$IconAreaHeight/2,array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20,"Ticks"=>$Ticks,"Weight"=>$Weight)); |
| 1711 | 1552 | $this->drawLine($X,$Y+$IconAreaHeight/2,$X+$IconAreaWidth,$Y+$IconAreaHeight/2,array("R"=>$R,"G"=>$G,"B"=>$B,"Ticks"=>$Ticks,"Weight"=>$Weight)); |
| 1712 | 1553 | } |
| 1713 | 1554 | } |
| 1714 | 1555 | |
| 1715 | - if ( $Mode == LEGEND_VERTICAL ) |
|
| 1716 | - { |
|
| 1556 | + if ( $Mode == LEGEND_VERTICAL ) { |
|
| 1717 | 1557 | $Lines = preg_split("/\n/",$Serie["Description"]); |
| 1718 | - foreach($Lines as $Key => $Value) |
|
| 1719 | - $this->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontSize"=>$FontSize,"FontName"=>$FontName)); |
|
| 1558 | + foreach($Lines as $Key => $Value) { |
|
| 1559 | + $this->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontSize"=>$FontSize,"FontName"=>$FontName)); |
|
| 1560 | + } |
|
| 1720 | 1561 | |
| 1721 | 1562 | $Y=$Y+max($this->FontSize*count($Lines),$IconAreaHeight) + 5; |
| 1722 | - } |
|
| 1723 | - elseif ( $Mode == LEGEND_HORIZONTAL ) |
|
| 1724 | - { |
|
| 1563 | + } elseif ( $Mode == LEGEND_HORIZONTAL ) { |
|
| 1725 | 1564 | $Lines = preg_split("/\n/",$Serie["Description"]); |
| 1726 | 1565 | $Width = ""; |
| 1727 | - foreach($Lines as $Key => $Value) |
|
| 1728 | - { |
|
| 1566 | + foreach($Lines as $Key => $Value) { |
|
| 1729 | 1567 | $BoxArray = $this->drawText($X+$IconAreaWidth+4,$Y+$IconAreaHeight/2+(($this->FontSize+3)*$Key),$Value,array("R"=>$FontR,"G"=>$FontG,"B"=>$FontB,"Align"=>TEXT_ALIGN_MIDDLELEFT,"FontSize"=>$FontSize,"FontName"=>$FontName)); |
| 1730 | 1568 | $Width[] = $BoxArray[1]["X"]; |
| 1731 | 1569 | } |
@@ -1738,8 +1576,7 @@ discard block |
||
| 1738 | 1576 | $this->Shadow = $RestoreShadow; |
| 1739 | 1577 | } |
| 1740 | 1578 | |
| 1741 | - function drawScale($Format="") |
|
| 1742 | - { |
|
| 1579 | + function drawScale($Format="") { |
|
| 1743 | 1580 | $Pos = isset($Format["Pos"]) ? $Format["Pos"] : SCALE_POS_LEFTRIGHT; |
| 1744 | 1581 | $Floating = isset($Format["Floating"]) ? $Format["Floating"] : FALSE; |
| 1745 | 1582 | $Mode = isset($Format["Mode"]) ? $Format["Mode"] : SCALE_MODE_FLOATING; |
@@ -1816,34 +1653,26 @@ discard block |
||
| 1816 | 1653 | if ( isset($Data["Abscissa"]) ) { $Abscissa = $Data["Abscissa"]; } else { $Abscissa = NULL; } |
| 1817 | 1654 | |
| 1818 | 1655 | /* Unset the abscissa axis, needed if we display multiple charts on the same picture */ |
| 1819 | - if ( $Abscissa != NULL ) |
|
| 1820 | - { |
|
| 1656 | + if ( $Abscissa != NULL ) { |
|
| 1821 | 1657 | foreach($Data["Axis"] as $AxisID => $Parameters) |
| 1822 | 1658 | { if ($Parameters["Identity"] == AXIS_X) { unset($Data["Axis"][$AxisID]); } } |
| 1823 | 1659 | } |
| 1824 | 1660 | |
| 1825 | 1661 | /* Build the scale settings */ |
| 1826 | 1662 | $GotXAxis = FALSE; |
| 1827 | - foreach($Data["Axis"] as $AxisID => $AxisParameter) |
|
| 1828 | - { |
|
| 1663 | + foreach($Data["Axis"] as $AxisID => $AxisParameter) { |
|
| 1829 | 1664 | if ( $AxisParameter["Identity"] == AXIS_X ) { $GotXAxis = TRUE; } |
| 1830 | 1665 | |
| 1831 | 1666 | if ( $Pos == SCALE_POS_LEFTRIGHT && $AxisParameter["Identity"] == AXIS_Y) |
| 1832 | - { $Height = $this->GraphAreaY2-$this->GraphAreaY1 - $YMargin*2; } |
|
| 1833 | - elseif ( $Pos == SCALE_POS_LEFTRIGHT && $AxisParameter["Identity"] == AXIS_X) |
|
| 1834 | - { $Height = $this->GraphAreaX2-$this->GraphAreaX1; } |
|
| 1835 | - elseif ( $Pos == SCALE_POS_TOPBOTTOM && $AxisParameter["Identity"] == AXIS_Y) |
|
| 1836 | - { $Height = $this->GraphAreaX2-$this->GraphAreaX1 - $YMargin*2;; } |
|
| 1837 | - else |
|
| 1667 | + { $Height = $this->GraphAreaY2-$this->GraphAreaY1 - $YMargin*2; } elseif ( $Pos == SCALE_POS_LEFTRIGHT && $AxisParameter["Identity"] == AXIS_X) |
|
| 1668 | + { $Height = $this->GraphAreaX2-$this->GraphAreaX1; } elseif ( $Pos == SCALE_POS_TOPBOTTOM && $AxisParameter["Identity"] == AXIS_Y) |
|
| 1669 | + { $Height = $this->GraphAreaX2-$this->GraphAreaX1 - $YMargin*2;; } else |
|
| 1838 | 1670 | { $Height = $this->GraphAreaY2-$this->GraphAreaY1; } |
| 1839 | 1671 | |
| 1840 | 1672 | $AxisMin = ABSOLUTE_MAX; $AxisMax = OUT_OF_SIGHT; |
| 1841 | - if ( $Mode == SCALE_MODE_FLOATING || $Mode == SCALE_MODE_START0 ) |
|
| 1842 | - { |
|
| 1843 | - foreach($Data["Series"] as $SerieID => $SerieParameter) |
|
| 1844 | - { |
|
| 1845 | - if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] && $Data["Abscissa"] != $SerieID) |
|
| 1846 | - { |
|
| 1673 | + if ( $Mode == SCALE_MODE_FLOATING || $Mode == SCALE_MODE_START0 ) { |
|
| 1674 | + foreach($Data["Series"] as $SerieID => $SerieParameter) { |
|
| 1675 | + if ( $SerieParameter["Axis"] == $AxisID && $Data["Series"][$SerieID]["isDrawable"] && $Data["Abscissa"] != $SerieID) { |
|
| 1847 | 1676 | $AxisMax = max($AxisMax,$Data["Series"][$SerieID]["Max"]); |
| 1848 | 1677 | $AxisMin = min($AxisMin,$Data["Series"][$SerieID]["Min"]); |
| 1849 | 1678 | } |
@@ -1852,30 +1681,21 @@ discard block |
||
| 1852 | 1681 | |
| 1853 | 1682 | $Data["Axis"][$AxisID]["Min"] = $AxisMin-$AutoMargin; $Data["Axis"][$AxisID]["Max"] = $AxisMax+$AutoMargin; |
| 1854 | 1683 | if ( $Mode == SCALE_MODE_START0 ) { $Data["Axis"][$AxisID]["Min"] = 0; } |
| 1855 | - } |
|
| 1856 | - elseif ( $Mode == SCALE_MODE_MANUAL ) |
|
| 1857 | - { |
|
| 1858 | - if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) ) |
|
| 1859 | - { |
|
| 1684 | + } elseif ( $Mode == SCALE_MODE_MANUAL ) { |
|
| 1685 | + if ( isset($ManualScale[$AxisID]["Min"]) && isset($ManualScale[$AxisID]["Max"]) ) { |
|
| 1860 | 1686 | $Data["Axis"][$AxisID]["Min"] = $ManualScale[$AxisID]["Min"]; |
| 1861 | 1687 | $Data["Axis"][$AxisID]["Max"] = $ManualScale[$AxisID]["Max"]; |
| 1862 | - } |
|
| 1863 | - else |
|
| 1688 | + } else |
|
| 1864 | 1689 | { echo "Manual scale boundaries not set."; exit(); } |
| 1865 | - } |
|
| 1866 | - elseif ( $Mode == SCALE_MODE_ADDALL || $Mode == SCALE_MODE_ADDALL_START0 ) |
|
| 1867 | - { |
|
| 1690 | + } elseif ( $Mode == SCALE_MODE_ADDALL || $Mode == SCALE_MODE_ADDALL_START0 ) { |
|
| 1868 | 1691 | $Series = ""; |
| 1869 | 1692 | foreach($Data["Series"] as $SerieID => $SerieParameter) |
| 1870 | 1693 | { if ( $SerieParameter["Axis"] == $AxisID && $SerieParameter["isDrawable"] && $Data["Abscissa"] != $SerieID ) { $Series[$SerieID] = count($Data["Series"][$SerieID]["Data"]); } } |
| 1871 | 1694 | |
| 1872 | - for ($ID=0;$ID<=max($Series)-1;$ID++) |
|
| 1873 | - { |
|
| 1695 | + for ($ID=0;$ID<=max($Series)-1;$ID++) { |
|
| 1874 | 1696 | $PointMin = 0; $PointMax = 0; |
| 1875 | - foreach($Series as $SerieID => $ValuesCount ) |
|
| 1876 | - { |
|
| 1877 | - if (isset($Data["Series"][$SerieID]["Data"][$ID]) && $Data["Series"][$SerieID]["Data"][$ID] != NULL ) |
|
| 1878 | - { |
|
| 1697 | + foreach($Series as $SerieID => $ValuesCount ) { |
|
| 1698 | + if (isset($Data["Series"][$SerieID]["Data"][$ID]) && $Data["Series"][$SerieID]["Data"][$ID] != NULL ) { |
|
| 1879 | 1699 | $Value = $Data["Series"][$SerieID]["Data"][$ID]; |
| 1880 | 1700 | if ( $Value > 0 ) { $PointMax = $PointMax + $Value; } else { $PointMin = $PointMin + $Value; } |
| 1881 | 1701 | } |
@@ -1906,18 +1726,14 @@ discard block |
||
| 1906 | 1726 | } |
| 1907 | 1727 | |
| 1908 | 1728 | /* Still no X axis */ |
| 1909 | - if ( $GotXAxis == FALSE ) |
|
| 1910 | - { |
|
| 1911 | - if ( $Abscissa != NULL ) |
|
| 1912 | - { |
|
| 1729 | + if ( $GotXAxis == FALSE ) { |
|
| 1730 | + if ( $Abscissa != NULL ) { |
|
| 1913 | 1731 | $Points = count($Data["Series"][$Abscissa]["Data"]); |
| 1914 | 1732 | if ( $AutoAxisLabels ) |
| 1915 | 1733 | $AxisName = isset($Data["Series"][$Abscissa]["Description"]) ? $Data["Series"][$Abscissa]["Description"] : NULL; |
| 1916 | 1734 | else |
| 1917 | 1735 | $AxisName = NULL; |
| 1918 | - } |
|
| 1919 | - else |
|
| 1920 | - { |
|
| 1736 | + } else { |
|
| 1921 | 1737 | $Points = 0; |
| 1922 | 1738 | $AxisName = isset($Data["XAxisName"]) ? $Data["XAxisName"] : NULL; |
| 1923 | 1739 | foreach($Data["Series"] as $SerieID => $SerieParameter) |
@@ -1928,19 +1744,16 @@ discard block |
||
| 1928 | 1744 | $Data["Axis"][$AxisID]["Identity"] = AXIS_X; |
| 1929 | 1745 | if ( $Pos == SCALE_POS_LEFTRIGHT ) { $Data["Axis"][$AxisID]["Position"] = AXIS_POSITION_BOTTOM; } else { $Data["Axis"][$AxisID]["Position"] = AXIS_POSITION_LEFT; } |
| 1930 | 1746 | if ( isset($Data["AbscissaName"]) ) { $Data["Axis"][$AxisID]["Name"] = $Data["AbscissaName"]; } |
| 1931 | - if ( $XMargin == AUTO ) |
|
| 1932 | - { |
|
| 1747 | + if ( $XMargin == AUTO ) { |
|
| 1933 | 1748 | if ( $Pos == SCALE_POS_LEFTRIGHT ) |
| 1934 | - { $Height = $this->GraphAreaX2-$this->GraphAreaX1; } |
|
| 1935 | - else |
|
| 1749 | + { $Height = $this->GraphAreaX2-$this->GraphAreaX1; } else |
|
| 1936 | 1750 | { $Height = $this->GraphAreaY2-$this->GraphAreaY1; } |
| 1937 | 1751 | |
| 1938 | 1752 | if ( $Points == 1 ) |
| 1939 | 1753 | $Data["Axis"][$AxisID]["Margin"] = $Height / 2; |
| 1940 | 1754 | else |
| 1941 | 1755 | $Data["Axis"][$AxisID]["Margin"] = ($Height/$Points) / 2; |
| 1942 | - } |
|
| 1943 | - else |
|
| 1756 | + } else |
|
| 1944 | 1757 | { $Data["Axis"][$AxisID]["Margin"] = $XMargin; } |
| 1945 | 1758 | $Data["Axis"][$AxisID]["Rows"] = $Points-1; |
| 1946 | 1759 | if ( !isset($Data["Axis"][$AxisID]["Display"]) ) { $Data["Axis"][$AxisID]["Display"] = NULL; } |
@@ -1949,11 +1762,9 @@ discard block |
||
| 1949 | 1762 | } |
| 1950 | 1763 | |
| 1951 | 1764 | /* Do we need to reverse the abscissa position? */ |
| 1952 | - if ( $Pos != SCALE_POS_LEFTRIGHT ) |
|
| 1953 | - { |
|
| 1765 | + if ( $Pos != SCALE_POS_LEFTRIGHT ) { |
|
| 1954 | 1766 | if ( $Data["AbsicssaPosition"] == AXIS_POSITION_BOTTOM ) |
| 1955 | - { $Data["AbsicssaPosition"] = AXIS_POSITION_LEFT; } |
|
| 1956 | - else |
|
| 1767 | + { $Data["AbsicssaPosition"] = AXIS_POSITION_LEFT; } else |
|
| 1957 | 1768 | { $Data["AbsicssaPosition"] = AXIS_POSITION_RIGHT; } |
| 1958 | 1769 | } |
| 1959 | 1770 | $Data["Axis"][$AxisID]["Position"] = $Data["AbsicssaPosition"]; |
@@ -1965,38 +1776,29 @@ discard block |
||
| 1965 | 1776 | $FontColorRo = $this->FontColorR; $FontColorGo = $this->FontColorG; $FontColorBo = $this->FontColorB; |
| 1966 | 1777 | |
| 1967 | 1778 | $AxisPos["L"] = $this->GraphAreaX1; $AxisPos["R"] = $this->GraphAreaX2; $AxisPos["T"] = $this->GraphAreaY1; $AxisPos["B"] = $this->GraphAreaY2; |
| 1968 | - foreach($Data["Axis"] as $AxisID => $Parameters) |
|
| 1969 | - { |
|
| 1970 | - if ( isset($Parameters["Color"]) ) |
|
| 1971 | - { |
|
| 1779 | + foreach($Data["Axis"] as $AxisID => $Parameters) { |
|
| 1780 | + if ( isset($Parameters["Color"]) ) { |
|
| 1972 | 1781 | $AxisR = $Parameters["Color"]["R"]; $AxisG = $Parameters["Color"]["G"]; $AxisB = $Parameters["Color"]["B"]; |
| 1973 | 1782 | $TickR = $Parameters["Color"]["R"]; $TickG = $Parameters["Color"]["G"]; $TickB = $Parameters["Color"]["B"]; |
| 1974 | 1783 | $this->setFontProperties(array("R"=>$Parameters["Color"]["R"],"G"=>$Parameters["Color"]["G"],"B"=>$Parameters["Color"]["B"])); |
| 1975 | - } |
|
| 1976 | - else |
|
| 1977 | - { |
|
| 1784 | + } else { |
|
| 1978 | 1785 | $AxisR = $AxisRo; $AxisG = $AxisGo; $AxisB = $AxisBo; |
| 1979 | 1786 | $TickR = $TickRo; $TickG = $TickGo; $TickB = $TickBo; |
| 1980 | 1787 | $this->setFontProperties(array("R"=>$FontColorRo,"G"=>$FontColorGo,"B"=>$FontColorBo)); |
| 1981 | 1788 | } |
| 1982 | 1789 | |
| 1983 | 1790 | $LastValue = "w00t"; $ID = 1; |
| 1984 | - if ( $Parameters["Identity"] == AXIS_X ) |
|
| 1985 | - { |
|
| 1986 | - if ( $Pos == SCALE_POS_LEFTRIGHT ) |
|
| 1987 | - { |
|
| 1988 | - if ( $Parameters["Position"] == AXIS_POSITION_BOTTOM ) |
|
| 1989 | - { |
|
| 1791 | + if ( $Parameters["Identity"] == AXIS_X ) { |
|
| 1792 | + if ( $Pos == SCALE_POS_LEFTRIGHT ) { |
|
| 1793 | + if ( $Parameters["Position"] == AXIS_POSITION_BOTTOM ) { |
|
| 1990 | 1794 | if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 2; } |
| 1991 | 1795 | if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $YLabelOffset = 5; } |
| 1992 | 1796 | if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $YLabelOffset = 5; } |
| 1993 | 1797 | if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $YLabelOffset = 2; } |
| 1994 | 1798 | |
| 1995 | - if ( !$RemoveXAxis ) |
|
| 1996 | - { |
|
| 1799 | + if ( !$RemoveXAxis ) { |
|
| 1997 | 1800 | if ( $Floating ) |
| 1998 | - { $FloatingOffset = $YMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
|
| 1999 | - else |
|
| 1801 | + { $FloatingOffset = $YMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else |
|
| 2000 | 1802 | { $FloatingOffset = 0; $this->drawLine($this->GraphAreaX1,$AxisPos["B"],$this->GraphAreaX2,$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
| 2001 | 1803 | |
| 2002 | 1804 | if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); } |
@@ -2007,15 +1809,12 @@ discard block |
||
| 2007 | 1809 | if ($Parameters["Rows"] == 0 ) { $Step = $Width; } else { $Step = $Width / ($Parameters["Rows"]); } |
| 2008 | 1810 | |
| 2009 | 1811 | $MaxBottom = $AxisPos["B"]; |
| 2010 | - for($i=0;$i<=$Parameters["Rows"];$i++) |
|
| 2011 | - { |
|
| 1812 | + for($i=0;$i<=$Parameters["Rows"];$i++) { |
|
| 2012 | 1813 | $XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i; |
| 2013 | 1814 | $YPos = $AxisPos["B"]; |
| 2014 | 1815 | |
| 2015 | 1816 | if ( $Abscissa != NULL ) |
| 2016 | - { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } |
|
| 2017 | - else |
|
| 2018 | - { |
|
| 1817 | + { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } else { |
|
| 2019 | 1818 | if ( isset($Parameters["ScaleMin"]) && isset ($Parameters["RowHeight"]) ) |
| 2020 | 1819 | $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); |
| 2021 | 1820 | else |
@@ -2023,8 +1822,7 @@ discard block |
||
| 2023 | 1822 | } |
| 2024 | 1823 | |
| 2025 | 1824 | $ID++; $Skipped = TRUE; |
| 2026 | - if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) |
|
| 2027 | - { |
|
| 1825 | + if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) { |
|
| 2028 | 1826 | $Bounds = $this->drawText($XPos,$YPos+$OuterTickWidth+$YLabelOffset,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign)); |
| 2029 | 1827 | $TxtBottom = $YPos+$OuterTickWidth+2+($Bounds[0]["Y"]-$Bounds[2]["Y"]); |
| 2030 | 1828 | $MaxBottom = max($MaxBottom,$TxtBottom); |
@@ -2034,20 +1832,16 @@ discard block |
||
| 2034 | 1832 | |
| 2035 | 1833 | if ( $RemoveXAxis ) { $Skipped = FALSE; } |
| 2036 | 1834 | |
| 2037 | - if ( $Skipped ) |
|
| 2038 | - { |
|
| 1835 | + if ( $Skipped ) { |
|
| 2039 | 1836 | if ( $DrawXLines ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,$SkippedAxisColor); } |
| 2040 | 1837 | if ( ($SkippedInnerTickWidth !=0 || $SkippedOuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos,$YPos-$SkippedInnerTickWidth,$XPos,$YPos+$SkippedOuterTickWidth,$SkippedTickColor); } |
| 2041 | - } |
|
| 2042 | - else |
|
| 2043 | - { |
|
| 1838 | + } else { |
|
| 2044 | 1839 | if ( $DrawXLines && ($XPos != $this->GraphAreaX1 && $XPos != $this->GraphAreaX2) ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); } |
| 2045 | 1840 | if ( ($InnerTickWidth !=0 || $OuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos,$YPos-$InnerTickWidth,$XPos,$YPos+$OuterTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha)); } |
| 2046 | 1841 | } |
| 2047 | 1842 | } |
| 2048 | 1843 | |
| 2049 | - if ( isset($Parameters["Name"]) && !$RemoveXAxis) |
|
| 2050 | - { |
|
| 1844 | + if ( isset($Parameters["Name"]) && !$RemoveXAxis) { |
|
| 2051 | 1845 | $YPos = $MaxBottom+2; |
| 2052 | 1846 | $XPos = $this->GraphAreaX1+($this->GraphAreaX2-$this->GraphAreaX1)/2; |
| 2053 | 1847 | $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_TOPMIDDLE)); |
@@ -2057,19 +1851,15 @@ discard block |
||
| 2057 | 1851 | } |
| 2058 | 1852 | |
| 2059 | 1853 | $AxisPos["B"] = $MaxBottom + $ScaleSpacing; |
| 2060 | - } |
|
| 2061 | - elseif ( $Parameters["Position"] == AXIS_POSITION_TOP ) |
|
| 2062 | - { |
|
| 1854 | + } elseif ( $Parameters["Position"] == AXIS_POSITION_TOP ) { |
|
| 2063 | 1855 | if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_BOTTOMMIDDLE; $YLabelOffset = 2; } |
| 2064 | 1856 | if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $YLabelOffset = 2; } |
| 2065 | 1857 | if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_TOPMIDDLE; $YLabelOffset = 5; } |
| 2066 | 1858 | if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $YLabelOffset = 5; } |
| 2067 | 1859 | |
| 2068 | - if ( !$RemoveXAxis ) |
|
| 2069 | - { |
|
| 1860 | + if ( !$RemoveXAxis ) { |
|
| 2070 | 1861 | if ( $Floating ) |
| 2071 | - { $FloatingOffset = $YMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
|
| 2072 | - else |
|
| 1862 | + { $FloatingOffset = $YMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else |
|
| 2073 | 1863 | { $FloatingOffset = 0; $this->drawLine($this->GraphAreaX1,$AxisPos["T"],$this->GraphAreaX2,$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
| 2074 | 1864 | |
| 2075 | 1865 | if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); } |
@@ -2080,15 +1870,12 @@ discard block |
||
| 2080 | 1870 | if ($Parameters["Rows"] == 0 ) { $Step = $Width; } else { $Step = $Width / $Parameters["Rows"]; } |
| 2081 | 1871 | |
| 2082 | 1872 | $MinTop = $AxisPos["T"]; |
| 2083 | - for($i=0;$i<=$Parameters["Rows"];$i++) |
|
| 2084 | - { |
|
| 1873 | + for($i=0;$i<=$Parameters["Rows"];$i++) { |
|
| 2085 | 1874 | $XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i; |
| 2086 | 1875 | $YPos = $AxisPos["T"]; |
| 2087 | 1876 | |
| 2088 | 1877 | if ( $Abscissa != NULL ) |
| 2089 | - { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } |
|
| 2090 | - else |
|
| 2091 | - { |
|
| 1878 | + { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } else { |
|
| 2092 | 1879 | if ( isset($Parameters["ScaleMin"]) && isset ($Parameters["RowHeight"]) ) |
| 2093 | 1880 | $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); |
| 2094 | 1881 | else |
@@ -2096,8 +1883,7 @@ discard block |
||
| 2096 | 1883 | } |
| 2097 | 1884 | |
| 2098 | 1885 | $ID++; $Skipped = TRUE; |
| 2099 | - if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) |
|
| 2100 | - { |
|
| 1886 | + if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) { |
|
| 2101 | 1887 | $Bounds = $this->drawText($XPos,$YPos-$OuterTickWidth-$YLabelOffset,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign)); |
| 2102 | 1888 | $TxtBox = $YPos-$OuterTickWidth-2-($Bounds[0]["Y"]-$Bounds[2]["Y"]); |
| 2103 | 1889 | $MinTop = min($MinTop,$TxtBox); |
@@ -2107,21 +1893,17 @@ discard block |
||
| 2107 | 1893 | |
| 2108 | 1894 | if ( $RemoveXAxis ) { $Skipped = FALSE; } |
| 2109 | 1895 | |
| 2110 | - if ( $Skipped ) |
|
| 2111 | - { |
|
| 1896 | + if ( $Skipped ) { |
|
| 2112 | 1897 | if ( $DrawXLines ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,$SkippedAxisColor); } |
| 2113 | 1898 | if ( ($SkippedInnerTickWidth !=0 || $SkippedOuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos,$YPos+$SkippedInnerTickWidth,$XPos,$YPos-$SkippedOuterTickWidth,$SkippedTickColor); } |
| 2114 | - } |
|
| 2115 | - else |
|
| 2116 | - { |
|
| 1899 | + } else { |
|
| 2117 | 1900 | if ( $DrawXLines ) { $this->drawLine($XPos,$this->GraphAreaY1+$FloatingOffset,$XPos,$this->GraphAreaY2-$FloatingOffset,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); } |
| 2118 | 1901 | if ( ($InnerTickWidth !=0 || $OuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos,$YPos+$InnerTickWidth,$XPos,$YPos-$OuterTickWidth,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha)); } |
| 2119 | 1902 | } |
| 2120 | 1903 | |
| 2121 | 1904 | } |
| 2122 | 1905 | |
| 2123 | - if ( isset($Parameters["Name"]) && !$RemoveXAxis ) |
|
| 2124 | - { |
|
| 1906 | + if ( isset($Parameters["Name"]) && !$RemoveXAxis ) { |
|
| 2125 | 1907 | $YPos = $MinTop-2; |
| 2126 | 1908 | $XPos = $this->GraphAreaX1+($this->GraphAreaX2-$this->GraphAreaX1)/2; |
| 2127 | 1909 | $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); |
@@ -2132,21 +1914,16 @@ discard block |
||
| 2132 | 1914 | |
| 2133 | 1915 | $AxisPos["T"] = $MinTop - $ScaleSpacing; |
| 2134 | 1916 | } |
| 2135 | - } |
|
| 2136 | - elseif ( $Pos == SCALE_POS_TOPBOTTOM ) |
|
| 2137 | - { |
|
| 2138 | - if ( $Parameters["Position"] == AXIS_POSITION_LEFT ) |
|
| 2139 | - { |
|
| 1917 | + } elseif ( $Pos == SCALE_POS_TOPBOTTOM ) { |
|
| 1918 | + if ( $Parameters["Position"] == AXIS_POSITION_LEFT ) { |
|
| 2140 | 1919 | if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -2; } |
| 2141 | 1920 | if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = -6; } |
| 2142 | 1921 | if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = -2; } |
| 2143 | 1922 | if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = -5; } |
| 2144 | 1923 | |
| 2145 | - if ( !$RemoveXAxis ) |
|
| 2146 | - { |
|
| 1924 | + if ( !$RemoveXAxis ) { |
|
| 2147 | 1925 | if ( $Floating ) |
| 2148 | - { $FloatingOffset = $YMargin; $this->drawLine($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
|
| 2149 | - else |
|
| 1926 | + { $FloatingOffset = $YMargin; $this->drawLine($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else |
|
| 2150 | 1927 | { $FloatingOffset = 0; $this->drawLine($AxisPos["L"],$this->GraphAreaY1,$AxisPos["L"],$this->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
| 2151 | 1928 | |
| 2152 | 1929 | if ( $DrawArrows ) { $this->drawArrow($AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2+($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); } |
@@ -2157,15 +1934,12 @@ discard block |
||
| 2157 | 1934 | if ($Parameters["Rows"] == 0 ) { $Step = $Height; } else { $Step = $Height / $Parameters["Rows"]; } |
| 2158 | 1935 | |
| 2159 | 1936 | $MinLeft = $AxisPos["L"]; |
| 2160 | - for($i=0;$i<=$Parameters["Rows"];$i++) |
|
| 2161 | - { |
|
| 1937 | + for($i=0;$i<=$Parameters["Rows"];$i++) { |
|
| 2162 | 1938 | $YPos = $this->GraphAreaY1 + $Parameters["Margin"] + $Step*$i; |
| 2163 | 1939 | $XPos = $AxisPos["L"]; |
| 2164 | 1940 | |
| 2165 | 1941 | if ( $Abscissa != NULL ) |
| 2166 | - { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } |
|
| 2167 | - else |
|
| 2168 | - { |
|
| 1942 | + { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } else { |
|
| 2169 | 1943 | if ( isset($Parameters["ScaleMin"]) && isset ($Parameters["RowHeight"]) ) |
| 2170 | 1944 | $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); |
| 2171 | 1945 | else |
@@ -2173,8 +1947,7 @@ discard block |
||
| 2173 | 1947 | } |
| 2174 | 1948 | |
| 2175 | 1949 | $ID++; $Skipped = TRUE; |
| 2176 | - if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) |
|
| 2177 | - { |
|
| 1950 | + if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) { |
|
| 2178 | 1951 | $Bounds = $this->drawText($XPos-$OuterTickWidth+$XLabelOffset,$YPos,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign)); |
| 2179 | 1952 | $TxtBox = $XPos-$OuterTickWidth-2-($Bounds[1]["X"]-$Bounds[0]["X"]); |
| 2180 | 1953 | $MinLeft = min($MinLeft,$TxtBox); |
@@ -2184,20 +1957,16 @@ discard block |
||
| 2184 | 1957 | |
| 2185 | 1958 | if ( $RemoveXAxis ) { $Skipped = FALSE; } |
| 2186 | 1959 | |
| 2187 | - if ( $Skipped ) |
|
| 2188 | - { |
|
| 1960 | + if ( $Skipped ) { |
|
| 2189 | 1961 | if ( $DrawXLines ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,$SkippedAxisColor); } |
| 2190 | 1962 | if ( ($SkippedInnerTickWidth !=0 || $SkippedOuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos-$SkippedOuterTickWidth,$YPos,$XPos+$SkippedInnerTickWidth,$YPos,$SkippedTickColor); } |
| 2191 | - } |
|
| 2192 | - else |
|
| 2193 | - { |
|
| 1963 | + } else { |
|
| 2194 | 1964 | if ( $DrawXLines && ($YPos != $this->GraphAreaY1 && $YPos != $this->GraphAreaY2) ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); } |
| 2195 | 1965 | if ( ($InnerTickWidth !=0 || $OuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos-$OuterTickWidth,$YPos,$XPos+$InnerTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha)); } |
| 2196 | 1966 | } |
| 2197 | 1967 | |
| 2198 | 1968 | } |
| 2199 | - if ( isset($Parameters["Name"]) && !$RemoveXAxis ) |
|
| 2200 | - { |
|
| 1969 | + if ( isset($Parameters["Name"]) && !$RemoveXAxis ) { |
|
| 2201 | 1970 | $XPos = $MinLeft-2; |
| 2202 | 1971 | $YPos = $this->GraphAreaY1+($this->GraphAreaY2-$this->GraphAreaY1)/2; |
| 2203 | 1972 | $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>90)); |
@@ -2207,19 +1976,15 @@ discard block |
||
| 2207 | 1976 | } |
| 2208 | 1977 | |
| 2209 | 1978 | $AxisPos["L"] = $MinLeft - $ScaleSpacing; |
| 2210 | - } |
|
| 2211 | - elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT ) |
|
| 2212 | - { |
|
| 1979 | + } elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT ) { |
|
| 2213 | 1980 | if ( $LabelRotation == 0 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = 2; } |
| 2214 | 1981 | if ( $LabelRotation > 0 && $LabelRotation < 190 ) { $LabelAlign = TEXT_ALIGN_MIDDLELEFT; $XLabelOffset = 6; } |
| 2215 | 1982 | if ( $LabelRotation == 180 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = 5; } |
| 2216 | 1983 | if ( $LabelRotation > 180 && $LabelRotation < 360 ) { $LabelAlign = TEXT_ALIGN_MIDDLERIGHT; $XLabelOffset = 7; } |
| 2217 | 1984 | |
| 2218 | - if ( !$RemoveXAxis ) |
|
| 2219 | - { |
|
| 1985 | + if ( !$RemoveXAxis ) { |
|
| 2220 | 1986 | if ( $Floating ) |
| 2221 | - { $FloatingOffset = $YMargin; $this->drawLine($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
|
| 2222 | - else |
|
| 1987 | + { $FloatingOffset = $YMargin; $this->drawLine($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else |
|
| 2223 | 1988 | { $FloatingOffset = 0; $this->drawLine($AxisPos["R"],$this->GraphAreaY1,$AxisPos["R"],$this->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
| 2224 | 1989 | |
| 2225 | 1990 | if ( $DrawArrows ) { $this->drawArrow($AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2+($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); } |
@@ -2230,15 +1995,12 @@ discard block |
||
| 2230 | 1995 | if ($Parameters["Rows"] == 0 ) { $Step = $Height; } else { $Step = $Height / $Parameters["Rows"]; } |
| 2231 | 1996 | |
| 2232 | 1997 | $MaxRight = $AxisPos["R"]; |
| 2233 | - for($i=0;$i<=$Parameters["Rows"];$i++) |
|
| 2234 | - { |
|
| 1998 | + for($i=0;$i<=$Parameters["Rows"];$i++) { |
|
| 2235 | 1999 | $YPos = $this->GraphAreaY1 + $Parameters["Margin"] + $Step*$i; |
| 2236 | 2000 | $XPos = $AxisPos["R"]; |
| 2237 | 2001 | |
| 2238 | 2002 | if ( $Abscissa != NULL ) |
| 2239 | - { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } |
|
| 2240 | - else |
|
| 2241 | - { |
|
| 2003 | + { if ( isset($Data["Series"][$Abscissa]["Data"][$i]) ) { $Value = $this->scaleFormat($Data["Series"][$Abscissa]["Data"][$i],$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); } else { $Value = ""; } } else { |
|
| 2242 | 2004 | if ( isset($Parameters["ScaleMin"]) && isset ($Parameters["RowHeight"]) ) |
| 2243 | 2005 | $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Data["XAxisDisplay"],$Data["XAxisFormat"],$Data["XAxisUnit"]); |
| 2244 | 2006 | else |
@@ -2246,8 +2008,7 @@ discard block |
||
| 2246 | 2008 | } |
| 2247 | 2009 | |
| 2248 | 2010 | $ID++; $Skipped = TRUE; |
| 2249 | - if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) |
|
| 2250 | - { |
|
| 2011 | + if ( $this->isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) && !$RemoveXAxis) { |
|
| 2251 | 2012 | $Bounds = $this->drawText($XPos+$OuterTickWidth+$XLabelOffset,$YPos,$Value,array("Angle"=>$LabelRotation,"Align"=>$LabelAlign)); |
| 2252 | 2013 | $TxtBox = $XPos+$OuterTickWidth+2+($Bounds[1]["X"]-$Bounds[0]["X"]); |
| 2253 | 2014 | $MaxRight = max($MaxRight,$TxtBox); |
@@ -2257,21 +2018,17 @@ discard block |
||
| 2257 | 2018 | |
| 2258 | 2019 | if ( $RemoveXAxis ) { $Skipped = FALSE; } |
| 2259 | 2020 | |
| 2260 | - if ( $Skipped ) |
|
| 2261 | - { |
|
| 2021 | + if ( $Skipped ) { |
|
| 2262 | 2022 | if ( $DrawXLines ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,$SkippedAxisColor); } |
| 2263 | 2023 | if ( ($SkippedInnerTickWidth != 0 || $SkippedOuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos+$SkippedOuterTickWidth,$YPos,$XPos-$SkippedInnerTickWidth,$YPos,$SkippedTickColor); } |
| 2264 | - } |
|
| 2265 | - else |
|
| 2266 | - { |
|
| 2024 | + } else { |
|
| 2267 | 2025 | if ( $DrawXLines ) { $this->drawLine($this->GraphAreaX1+$FloatingOffset,$YPos,$this->GraphAreaX2-$FloatingOffset,$YPos,array("R"=>$GridR,"G"=>$GridG,"B"=>$GridB,"Alpha"=>$GridAlpha,"Ticks"=>$GridTicks)); } |
| 2268 | 2026 | if ( ($InnerTickWidth != 0 || $OuterTickWidth != 0) && !$RemoveXAxis ) { $this->drawLine($XPos+$OuterTickWidth,$YPos,$XPos-$InnerTickWidth,$YPos,array("R"=>$TickR,"G"=>$TickG,"B"=>$TickB,"Alpha"=>$TickAlpha)); } |
| 2269 | 2027 | } |
| 2270 | 2028 | |
| 2271 | 2029 | } |
| 2272 | 2030 | |
| 2273 | - if ( isset($Parameters["Name"]) && !$RemoveXAxis) |
|
| 2274 | - { |
|
| 2031 | + if ( isset($Parameters["Name"]) && !$RemoveXAxis) { |
|
| 2275 | 2032 | $XPos = $MaxRight+4; |
| 2276 | 2033 | $YPos = $this->GraphAreaY1+($this->GraphAreaY2-$this->GraphAreaY1)/2; |
| 2277 | 2034 | $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>270)); |
@@ -2287,16 +2044,12 @@ discard block |
||
| 2287 | 2044 | |
| 2288 | 2045 | |
| 2289 | 2046 | |
| 2290 | - if ( $Parameters["Identity"] == AXIS_Y ) |
|
| 2291 | - { |
|
| 2292 | - if ( $Pos == SCALE_POS_LEFTRIGHT ) |
|
| 2293 | - { |
|
| 2294 | - if ( $Parameters["Position"] == AXIS_POSITION_LEFT ) |
|
| 2295 | - { |
|
| 2047 | + if ( $Parameters["Identity"] == AXIS_Y ) { |
|
| 2048 | + if ( $Pos == SCALE_POS_LEFTRIGHT ) { |
|
| 2049 | + if ( $Parameters["Position"] == AXIS_POSITION_LEFT ) { |
|
| 2296 | 2050 | |
| 2297 | 2051 | if ( $Floating ) |
| 2298 | - { $FloatingOffset = $XMargin; $this->drawLine($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
|
| 2299 | - else |
|
| 2052 | + { $FloatingOffset = $XMargin; $this->drawLine($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else |
|
| 2300 | 2053 | { $FloatingOffset = 0; $this->drawLine($AxisPos["L"],$this->GraphAreaY1,$AxisPos["L"],$this->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
| 2301 | 2054 | |
| 2302 | 2055 | if ( $DrawArrows ) { $this->drawArrow($AxisPos["L"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["L"],$this->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); } |
@@ -2304,8 +2057,7 @@ discard block |
||
| 2304 | 2057 | $Height = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Parameters["Margin"]*2; |
| 2305 | 2058 | $Step = $Height / $Parameters["Rows"]; $SubTicksSize = $Step /2; $MinLeft = $AxisPos["L"]; |
| 2306 | 2059 | $LastY = NULL; |
| 2307 | - for($i=0;$i<=$Parameters["Rows"];$i++) |
|
| 2308 | - { |
|
| 2060 | + for($i=0;$i<=$Parameters["Rows"];$i++) { |
|
| 2309 | 2061 | $YPos = $this->GraphAreaY2 - $Parameters["Margin"] - $Step*$i; |
| 2310 | 2062 | $XPos = $AxisPos["L"]; |
| 2311 | 2063 | $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Parameters["Display"],$Parameters["Format"],$Parameters["Unit"]); |
@@ -2326,8 +2078,7 @@ discard block |
||
| 2326 | 2078 | $LastY = $YPos; |
| 2327 | 2079 | } |
| 2328 | 2080 | |
| 2329 | - if ( isset($Parameters["Name"]) ) |
|
| 2330 | - { |
|
| 2081 | + if ( isset($Parameters["Name"]) ) { |
|
| 2331 | 2082 | $XPos = $MinLeft-2; |
| 2332 | 2083 | $YPos = $this->GraphAreaY1+($this->GraphAreaY2-$this->GraphAreaY1)/2; |
| 2333 | 2084 | $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>90)); |
@@ -2337,12 +2088,9 @@ discard block |
||
| 2337 | 2088 | } |
| 2338 | 2089 | |
| 2339 | 2090 | $AxisPos["L"] = $MinLeft - $ScaleSpacing; |
| 2340 | - } |
|
| 2341 | - elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT ) |
|
| 2342 | - { |
|
| 2091 | + } elseif ( $Parameters["Position"] == AXIS_POSITION_RIGHT ) { |
|
| 2343 | 2092 | if ( $Floating ) |
| 2344 | - { $FloatingOffset = $XMargin; $this->drawLine($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
|
| 2345 | - else |
|
| 2093 | + { $FloatingOffset = $XMargin; $this->drawLine($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY2-$Parameters["Margin"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else |
|
| 2346 | 2094 | { $FloatingOffset = 0; $this->drawLine($AxisPos["R"],$this->GraphAreaY1,$AxisPos["R"],$this->GraphAreaY2,array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
| 2347 | 2095 | |
| 2348 | 2096 | if ( $DrawArrows ) { $this->drawArrow($AxisPos["R"],$this->GraphAreaY1+$Parameters["Margin"],$AxisPos["R"],$this->GraphAreaY1-($ArrowSize*2),array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); } |
@@ -2350,8 +2098,7 @@ discard block |
||
| 2350 | 2098 | $Height = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Parameters["Margin"]*2; |
| 2351 | 2099 | $Step = $Height / $Parameters["Rows"]; $SubTicksSize = $Step /2; $MaxLeft = $AxisPos["R"]; |
| 2352 | 2100 | $LastY = NULL; |
| 2353 | - for($i=0;$i<=$Parameters["Rows"];$i++) |
|
| 2354 | - { |
|
| 2101 | + for($i=0;$i<=$Parameters["Rows"];$i++) { |
|
| 2355 | 2102 | $YPos = $this->GraphAreaY2 - $Parameters["Margin"] - $Step*$i; |
| 2356 | 2103 | $XPos = $AxisPos["R"]; |
| 2357 | 2104 | $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Parameters["Display"],$Parameters["Format"],$Parameters["Unit"]); |
@@ -2372,8 +2119,7 @@ discard block |
||
| 2372 | 2119 | $LastY = $YPos; |
| 2373 | 2120 | } |
| 2374 | 2121 | |
| 2375 | - if ( isset($Parameters["Name"]) ) |
|
| 2376 | - { |
|
| 2122 | + if ( isset($Parameters["Name"]) ) { |
|
| 2377 | 2123 | $XPos = $MaxLeft+6; |
| 2378 | 2124 | $YPos = $this->GraphAreaY1+($this->GraphAreaY2-$this->GraphAreaY1)/2; |
| 2379 | 2125 | $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE,"Angle"=>270)); |
@@ -2383,14 +2129,10 @@ discard block |
||
| 2383 | 2129 | } |
| 2384 | 2130 | $AxisPos["R"] = $MaxLeft + $ScaleSpacing; |
| 2385 | 2131 | } |
| 2386 | - } |
|
| 2387 | - elseif ( $Pos == SCALE_POS_TOPBOTTOM ) |
|
| 2388 | - { |
|
| 2389 | - if ( $Parameters["Position"] == AXIS_POSITION_TOP ) |
|
| 2390 | - { |
|
| 2132 | + } elseif ( $Pos == SCALE_POS_TOPBOTTOM ) { |
|
| 2133 | + if ( $Parameters["Position"] == AXIS_POSITION_TOP ) { |
|
| 2391 | 2134 | if ( $Floating ) |
| 2392 | - { $FloatingOffset = $XMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
|
| 2393 | - else |
|
| 2135 | + { $FloatingOffset = $XMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else |
|
| 2394 | 2136 | { $FloatingOffset = 0; $this->drawLine($this->GraphAreaX1,$AxisPos["T"],$this->GraphAreaX2,$AxisPos["T"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
| 2395 | 2137 | |
| 2396 | 2138 | if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["T"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["T"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); } |
@@ -2398,8 +2140,7 @@ discard block |
||
| 2398 | 2140 | $Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Parameters["Margin"]*2; |
| 2399 | 2141 | $Step = $Width / $Parameters["Rows"]; $SubTicksSize = $Step /2; $MinTop = $AxisPos["T"]; |
| 2400 | 2142 | $LastX = NULL; |
| 2401 | - for($i=0;$i<=$Parameters["Rows"];$i++) |
|
| 2402 | - { |
|
| 2143 | + for($i=0;$i<=$Parameters["Rows"];$i++) { |
|
| 2403 | 2144 | $XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i; |
| 2404 | 2145 | $YPos = $AxisPos["T"]; |
| 2405 | 2146 | $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Parameters["Display"],$Parameters["Format"],$Parameters["Unit"]); |
@@ -2420,8 +2161,7 @@ discard block |
||
| 2420 | 2161 | $LastX = $XPos; |
| 2421 | 2162 | } |
| 2422 | 2163 | |
| 2423 | - if ( isset($Parameters["Name"]) ) |
|
| 2424 | - { |
|
| 2164 | + if ( isset($Parameters["Name"]) ) { |
|
| 2425 | 2165 | $YPos = $MinTop-2; |
| 2426 | 2166 | $XPos = $this->GraphAreaX1+($this->GraphAreaX2-$this->GraphAreaX1)/2; |
| 2427 | 2167 | $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); |
@@ -2431,12 +2171,9 @@ discard block |
||
| 2431 | 2171 | } |
| 2432 | 2172 | |
| 2433 | 2173 | $AxisPos["T"] = $MinTop - $ScaleSpacing; |
| 2434 | - } |
|
| 2435 | - elseif ( $Parameters["Position"] == AXIS_POSITION_BOTTOM ) |
|
| 2436 | - { |
|
| 2174 | + } elseif ( $Parameters["Position"] == AXIS_POSITION_BOTTOM ) { |
|
| 2437 | 2175 | if ( $Floating ) |
| 2438 | - { $FloatingOffset = $XMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
|
| 2439 | - else |
|
| 2176 | + { $FloatingOffset = $XMargin; $this->drawLine($this->GraphAreaX1+$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } else |
|
| 2440 | 2177 | { $FloatingOffset = 0; $this->drawLine($this->GraphAreaX1,$AxisPos["B"],$this->GraphAreaX2,$AxisPos["B"],array("R"=>$AxisR,"G"=>$AxisG,"B"=>$AxisB,"Alpha"=>$AxisAlpha)); } |
| 2441 | 2178 | |
| 2442 | 2179 | if ( $DrawArrows ) { $this->drawArrow($this->GraphAreaX2-$Parameters["Margin"],$AxisPos["B"],$this->GraphAreaX2+($ArrowSize*2),$AxisPos["B"],array("FillR"=>$AxisR,"FillG"=>$AxisG,"FillB"=>$AxisB,"Size"=>$ArrowSize)); } |
@@ -2444,8 +2181,7 @@ discard block |
||
| 2444 | 2181 | $Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Parameters["Margin"]*2; |
| 2445 | 2182 | $Step = $Width / $Parameters["Rows"]; $SubTicksSize = $Step /2; $MaxBottom = $AxisPos["B"]; |
| 2446 | 2183 | $LastX = NULL; |
| 2447 | - for($i=0;$i<=$Parameters["Rows"];$i++) |
|
| 2448 | - { |
|
| 2184 | + for($i=0;$i<=$Parameters["Rows"];$i++) { |
|
| 2449 | 2185 | $XPos = $this->GraphAreaX1 + $Parameters["Margin"] + $Step*$i; |
| 2450 | 2186 | $YPos = $AxisPos["B"]; |
| 2451 | 2187 | $Value = $this->scaleFormat($Parameters["ScaleMin"] + $Parameters["RowHeight"]*$i,$Parameters["Display"],$Parameters["Format"],$Parameters["Unit"]); |
@@ -2466,8 +2202,7 @@ discard block |
||
| 2466 | 2202 | $LastX = $XPos; |
| 2467 | 2203 | } |
| 2468 | 2204 | |
| 2469 | - if ( isset($Parameters["Name"]) ) |
|
| 2470 | - { |
|
| 2205 | + if ( isset($Parameters["Name"]) ) { |
|
| 2471 | 2206 | $YPos = $MaxBottom+2; |
| 2472 | 2207 | $XPos = $this->GraphAreaX1+($this->GraphAreaX2-$this->GraphAreaX1)/2; |
| 2473 | 2208 | $Bounds = $this->drawText($XPos,$YPos,$Parameters["Name"],array("Align"=>TEXT_ALIGN_TOPMIDDLE)); |
@@ -2483,8 +2218,7 @@ discard block |
||
| 2483 | 2218 | } |
| 2484 | 2219 | } |
| 2485 | 2220 | |
| 2486 | - function isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) |
|
| 2487 | - { |
|
| 2221 | + function isValidLabel($Value,$LastValue,$LabelingMethod,$ID,$LabelSkip) { |
|
| 2488 | 2222 | if ( $LabelingMethod == LABELING_DIFFERENT && $Value != $LastValue ) { return(TRUE); } |
| 2489 | 2223 | if ( $LabelingMethod == LABELING_DIFFERENT && $Value == $LastValue ) { return(FALSE); } |
| 2490 | 2224 | if ( $LabelingMethod == LABELING_ALL && $LabelSkip == 0 ) { return(TRUE); } |
@@ -2494,17 +2228,16 @@ discard block |
||
| 2494 | 2228 | } |
| 2495 | 2229 | |
| 2496 | 2230 | /* Compute the scale, check for the best visual factors */ |
| 2497 | - function computeScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID=0) |
|
| 2498 | - { |
|
| 2231 | + function computeScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID=0) { |
|
| 2499 | 2232 | /* Compute each factors */ |
| 2500 | 2233 | $Results = ""; |
| 2501 | - foreach ($Factors as $Key => $Factor) |
|
| 2502 | - $Results[$Factor] = $this->processScale($XMin,$XMax,$MaxDivs,array($Factor),$AxisID); |
|
| 2234 | + foreach ($Factors as $Key => $Factor) { |
|
| 2235 | + $Results[$Factor] = $this->processScale($XMin,$XMax,$MaxDivs,array($Factor),$AxisID); |
|
| 2236 | + } |
|
| 2503 | 2237 | |
| 2504 | 2238 | /* Remove scales that are creating to much decimals */ |
| 2505 | 2239 | $GoodScaleFactors = ""; |
| 2506 | - foreach ($Results as $Key => $Result) |
|
| 2507 | - { |
|
| 2240 | + foreach ($Results as $Key => $Result) { |
|
| 2508 | 2241 | $Decimals = preg_split("/\./",$Result["RowHeight"]); |
| 2509 | 2242 | if ( (!isset($Decimals[1])) || (strlen($Decimals[1]) < 6) ) { $GoodScaleFactors[] = $Key; } |
| 2510 | 2243 | } |
@@ -2522,8 +2255,7 @@ discard block |
||
| 2522 | 2255 | } |
| 2523 | 2256 | |
| 2524 | 2257 | /* Compute the best matching scale based on size & factors */ |
| 2525 | - function processScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID) |
|
| 2526 | - { |
|
| 2258 | + function processScale($XMin,$XMax,$MaxDivs,$Factors,$AxisID) { |
|
| 2527 | 2259 | $ScaleHeight = abs(ceil($XMax)-floor($XMin)); |
| 2528 | 2260 | |
| 2529 | 2261 | if ( isset($this->DataSet->Data["Axis"][$AxisID]["Format"]) ) |
@@ -2537,15 +2269,11 @@ discard block |
||
| 2537 | 2269 | $Mode = AXIS_FORMAT_DEFAULT; |
| 2538 | 2270 | |
| 2539 | 2271 | $Scale = ""; |
| 2540 | - if ( $XMin != $XMax ) |
|
| 2541 | - { |
|
| 2272 | + if ( $XMin != $XMax ) { |
|
| 2542 | 2273 | $Found = FALSE; $Rescaled = FALSE; $Scaled10Factor = .0001; $Result = 0; |
| 2543 | - while(!$Found) |
|
| 2544 | - { |
|
| 2545 | - foreach($Factors as $Key => $Factor) |
|
| 2546 | - { |
|
| 2547 | - if ( !$Found ) |
|
| 2548 | - { |
|
| 2274 | + while(!$Found) { |
|
| 2275 | + foreach($Factors as $Key => $Factor) { |
|
| 2276 | + if ( !$Found ) { |
|
| 2549 | 2277 | if ( !($this->modulo($XMin,$Factor*$Scaled10Factor) == 0) || ($XMin != floor($XMin))) { $XMinRescaled = floor($XMin/($Factor*$Scaled10Factor))*$Factor*$Scaled10Factor; } else { $XMinRescaled = $XMin; } |
| 2550 | 2278 | if ( !($this->modulo($XMax,$Factor*$Scaled10Factor) == 0) || ($XMax != floor($XMax))) { $XMaxRescaled = floor($XMax/($Factor*$Scaled10Factor))*$Factor*$Scaled10Factor+($Factor*$Scaled10Factor); } else { $XMaxRescaled = $XMax; } |
| 2551 | 2279 | $ScaleHeightRescaled = abs($XMaxRescaled-$XMinRescaled); |
@@ -2567,16 +2295,12 @@ discard block |
||
| 2567 | 2295 | $Scale["Rows"] = $Rows; $Scale["RowHeight"] = $RowHeight; $Scale["XMin"] = $XMin; $Scale["XMax"] = $XMax; |
| 2568 | 2296 | |
| 2569 | 2297 | /* Compute the needed decimals for the metric view to avoid repetition of the same X Axis labels */ |
| 2570 | - if ( $Mode == AXIS_FORMAT_METRIC && $Format == NULL ) |
|
| 2571 | - { |
|
| 2298 | + if ( $Mode == AXIS_FORMAT_METRIC && $Format == NULL ) { |
|
| 2572 | 2299 | $Done = FALSE; $GoodDecimals = 0; |
| 2573 | - for($Decimals=0;$Decimals<=10;$Decimals++) |
|
| 2574 | - { |
|
| 2575 | - if ( !$Done ) |
|
| 2576 | - { |
|
| 2300 | + for($Decimals=0;$Decimals<=10;$Decimals++) { |
|
| 2301 | + if ( !$Done ) { |
|
| 2577 | 2302 | $LastLabel = "zob"; $ScaleOK = TRUE; |
| 2578 | - for($i=0;$i<=$Rows;$i++) |
|
| 2579 | - { |
|
| 2303 | + for($i=0;$i<=$Rows;$i++) { |
|
| 2580 | 2304 | $Value = $XMin + $i*$RowHeight; |
| 2581 | 2305 | $Label = $this->scaleFormat($Value,AXIS_FORMAT_METRIC,$Decimals); |
| 2582 | 2306 | |
@@ -2589,9 +2313,7 @@ discard block |
||
| 2589 | 2313 | |
| 2590 | 2314 | $Scale["Format"] = $GoodDecimals; |
| 2591 | 2315 | } |
| 2592 | - } |
|
| 2593 | - else |
|
| 2594 | - { |
|
| 2316 | + } else { |
|
| 2595 | 2317 | /* If all values are the same we keep a +1/-1 scale */ |
| 2596 | 2318 | $Rows = 2; $XMin = $XMax-1; $XMax = $XMax+1; $RowHeight = 1; |
| 2597 | 2319 | |
@@ -2602,8 +2324,7 @@ discard block |
||
| 2602 | 2324 | return($Scale); |
| 2603 | 2325 | } |
| 2604 | 2326 | |
| 2605 | - function modulo($Value1,$Value2) |
|
| 2606 | - { |
|
| 2327 | + function modulo($Value1,$Value2) { |
|
| 2607 | 2328 | if (floor($Value2) == 0) { return(0); } |
| 2608 | 2329 | if (floor($Value2) != 0) { return($Value1 % $Value2); } |
| 2609 | 2330 | |
@@ -2615,8 +2336,7 @@ discard block |
||
| 2615 | 2336 | } |
| 2616 | 2337 | |
| 2617 | 2338 | /* Draw an X threshold */ |
| 2618 | - function drawXThreshold($Value,$Format="") |
|
| 2619 | - { |
|
| 2339 | + function drawXThreshold($Value,$Format="") { |
|
| 2620 | 2340 | $R = isset($Format["R"]) ? $Format["R"] : 255; |
| 2621 | 2341 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 2622 | 2342 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -2655,8 +2375,7 @@ discard block |
||
| 2655 | 2375 | |
| 2656 | 2376 | if ( is_array($Value) ) { foreach ($Value as $Key => $ID) { $this->drawXThreshold($ID,$Format); } return(0); } |
| 2657 | 2377 | |
| 2658 | - if ( $ValueIsLabel ) |
|
| 2659 | - { |
|
| 2378 | + if ( $ValueIsLabel ) { |
|
| 2660 | 2379 | $Format["ValueIsLabel"] = FALSE; |
| 2661 | 2380 | foreach($Data["Series"][$Data["Abscissa"]]["Data"] as $Key => $SerieValue) |
| 2662 | 2381 | { if ( $SerieValue == $Value ) { $this->drawXThreshold($Key,$Format); } } |
@@ -2669,41 +2388,33 @@ discard block |
||
| 2669 | 2388 | "BoxBorderR"=>$BoxBorderR,"BoxBorderG"=>$BoxBorderG,"BoxBorderB"=>$BoxBorderB,"BoxBorderAlpha"=>$BoxBorderAlpha, |
| 2670 | 2389 | "R"=>$CaptionR,"G"=>$CaptionG,"B"=>$CaptionB,"Alpha"=>$CaptionAlpha); |
| 2671 | 2390 | |
| 2672 | - if ( $Caption == NULL ) |
|
| 2673 | - { |
|
| 2674 | - if ( isset($Data["Abscissa"]) ) |
|
| 2675 | - { |
|
| 2391 | + if ( $Caption == NULL ) { |
|
| 2392 | + if ( isset($Data["Abscissa"]) ) { |
|
| 2676 | 2393 | if ( isset($Data["Series"][$Data["Abscissa"]]["Data"][$Value]) ) |
| 2677 | 2394 | $Caption = $Data["Series"][$Data["Abscissa"]]["Data"][$Value]; |
| 2678 | 2395 | else |
| 2679 | 2396 | $Caption = $Value; |
| 2680 | - } |
|
| 2681 | - else |
|
| 2397 | + } else |
|
| 2682 | 2398 | $Caption = $Value; |
| 2683 | 2399 | } |
| 2684 | 2400 | |
| 2685 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 2686 | - { |
|
| 2401 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 2687 | 2402 | $XStep = (($this->GraphAreaX2 - $this->GraphAreaX1) - $XScale[0] *2 ) / $XScale[1]; |
| 2688 | 2403 | $XPos = $this->GraphAreaX1 + $XScale[0] + $XStep * $Value; |
| 2689 | 2404 | $YPos1 = $this->GraphAreaY1 + $Data["YMargin"]; |
| 2690 | 2405 | $YPos2 = $this->GraphAreaY2 - $Data["YMargin"]; |
| 2691 | 2406 | |
| 2692 | - if ( $XPos >= $this->GraphAreaX1 + $AbscissaMargin && $XPos <= $this->GraphAreaX2 - $AbscissaMargin ) |
|
| 2693 | - { |
|
| 2407 | + if ( $XPos >= $this->GraphAreaX1 + $AbscissaMargin && $XPos <= $this->GraphAreaX2 - $AbscissaMargin ) { |
|
| 2694 | 2408 | $this->drawLine($XPos,$YPos1,$XPos,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight)); |
| 2695 | 2409 | |
| 2696 | - if ( $Wide ) |
|
| 2697 | - { |
|
| 2410 | + if ( $Wide ) { |
|
| 2698 | 2411 | $this->drawLine($XPos-1,$YPos1,$XPos-1,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks)); |
| 2699 | 2412 | $this->drawLine($XPos+1,$YPos1,$XPos+1,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks)); |
| 2700 | 2413 | } |
| 2701 | 2414 | |
| 2702 | - if ( $WriteCaption ) |
|
| 2703 | - { |
|
| 2415 | + if ( $WriteCaption ) { |
|
| 2704 | 2416 | if ( $CaptionAlign == CAPTION_LEFT_TOP ) |
| 2705 | - { $Y = $YPos1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; } |
|
| 2706 | - else |
|
| 2417 | + { $Y = $YPos1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; } else |
|
| 2707 | 2418 | { $Y = $YPos2 - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; } |
| 2708 | 2419 | |
| 2709 | 2420 | $this->drawText($XPos,$Y,$Caption,$CaptionSettings); |
@@ -2711,29 +2422,23 @@ discard block |
||
| 2711 | 2422 | |
| 2712 | 2423 | return(array("X"=>$XPos)); |
| 2713 | 2424 | } |
| 2714 | - } |
|
| 2715 | - elseif( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) |
|
| 2716 | - { |
|
| 2425 | + } elseif( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) { |
|
| 2717 | 2426 | $XStep = (($this->GraphAreaY2 - $this->GraphAreaY1) - $XScale[0] *2 ) / $XScale[1]; |
| 2718 | 2427 | $XPos = $this->GraphAreaY1 + $XScale[0] + $XStep * $Value; |
| 2719 | 2428 | $YPos1 = $this->GraphAreaX1 + $Data["YMargin"]; |
| 2720 | 2429 | $YPos2 = $this->GraphAreaX2 - $Data["YMargin"]; |
| 2721 | 2430 | |
| 2722 | - if ( $XPos >= $this->GraphAreaY1 + $AbscissaMargin && $XPos <= $this->GraphAreaY2 - $AbscissaMargin ) |
|
| 2723 | - { |
|
| 2431 | + if ( $XPos >= $this->GraphAreaY1 + $AbscissaMargin && $XPos <= $this->GraphAreaY2 - $AbscissaMargin ) { |
|
| 2724 | 2432 | $this->drawLine($YPos1,$XPos,$YPos2,$XPos,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight)); |
| 2725 | 2433 | |
| 2726 | - if ( $Wide ) |
|
| 2727 | - { |
|
| 2434 | + if ( $Wide ) { |
|
| 2728 | 2435 | $this->drawLine($YPos1,$XPos-1,$YPos2,$XPos-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks)); |
| 2729 | 2436 | $this->drawLine($YPos1,$XPos+1,$YPos2,$XPos+1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks)); |
| 2730 | 2437 | } |
| 2731 | 2438 | |
| 2732 | - if ( $WriteCaption ) |
|
| 2733 | - { |
|
| 2439 | + if ( $WriteCaption ) { |
|
| 2734 | 2440 | if ( $CaptionAlign == CAPTION_LEFT_TOP ) |
| 2735 | - { $Y = $YPos1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; } |
|
| 2736 | - else |
|
| 2441 | + { $Y = $YPos1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; } else |
|
| 2737 | 2442 | { $Y = $YPos2 - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLERIGHT; } |
| 2738 | 2443 | |
| 2739 | 2444 | $this->drawText($Y,$XPos,$Caption,$CaptionSettings); |
@@ -2745,8 +2450,7 @@ discard block |
||
| 2745 | 2450 | } |
| 2746 | 2451 | |
| 2747 | 2452 | /* Draw an X threshold area */ |
| 2748 | - function drawXThresholdArea($Value1,$Value2,$Format="") |
|
| 2749 | - { |
|
| 2453 | + function drawXThresholdArea($Value1,$Value2,$Format="") { |
|
| 2750 | 2454 | $R = isset($Format["R"]) ? $Format["R"] : 255; |
| 2751 | 2455 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 2752 | 2456 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -2774,8 +2478,7 @@ discard block |
||
| 2774 | 2478 | $XScale = $this->scaleGetXSettings(); |
| 2775 | 2479 | $AbscissaMargin = $this->getAbscissaMargin($Data); |
| 2776 | 2480 | |
| 2777 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 2778 | - { |
|
| 2481 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 2779 | 2482 | $XStep = (($this->GraphAreaX2 - $this->GraphAreaX1) - $XScale[0] *2 ) / $XScale[1]; |
| 2780 | 2483 | $XPos1 = $this->GraphAreaX1 + $XScale[0] + $XStep * $Value1; |
| 2781 | 2484 | $XPos2 = $this->GraphAreaX1 + $XScale[0] + $XStep * $Value2; |
@@ -2789,19 +2492,16 @@ discard block |
||
| 2789 | 2492 | |
| 2790 | 2493 | $this->drawFilledRectangle($XPos1,$YPos1,$XPos2,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 2791 | 2494 | |
| 2792 | - if ( $Border ) |
|
| 2793 | - { |
|
| 2495 | + if ( $Border ) { |
|
| 2794 | 2496 | $this->drawLine($XPos1,$YPos1,$XPos1,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks)); |
| 2795 | 2497 | $this->drawLine($XPos2,$YPos1,$XPos2,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks)); |
| 2796 | 2498 | } |
| 2797 | 2499 | |
| 2798 | - if ( $AreaName != NULL ) |
|
| 2799 | - { |
|
| 2500 | + if ( $AreaName != NULL ) { |
|
| 2800 | 2501 | $XPos = ($XPos2-$XPos1)/2 + $XPos1; |
| 2801 | 2502 | $YPos = ($YPos2-$YPos1)/2 + $YPos1; |
| 2802 | 2503 | |
| 2803 | - if ( $NameAngle == ZONE_NAME_ANGLE_AUTO ) |
|
| 2804 | - { |
|
| 2504 | + if ( $NameAngle == ZONE_NAME_ANGLE_AUTO ) { |
|
| 2805 | 2505 | $TxtPos = $this->getTextBox($XPos,$YPos,$this->FontName,$this->FontSize,0,$AreaName); |
| 2806 | 2506 | $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"]; |
| 2807 | 2507 | if ( abs($XPos2 - $XPos1) > $TxtWidth ) { $NameAngle = 0; } else { $NameAngle = 90; } |
@@ -2813,9 +2513,7 @@ discard block |
||
| 2813 | 2513 | |
| 2814 | 2514 | $this->Shadow = $RestoreShadow; |
| 2815 | 2515 | return(array("X1"=>$XPos1,"X2"=>$XPos2)); |
| 2816 | - } |
|
| 2817 | - elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) |
|
| 2818 | - { |
|
| 2516 | + } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) { |
|
| 2819 | 2517 | $XStep = (($this->GraphAreaY2 - $this->GraphAreaY1) - $XScale[0] *2 ) / $XScale[1]; |
| 2820 | 2518 | $XPos1 = $this->GraphAreaY1 + $XScale[0] + $XStep * $Value1; |
| 2821 | 2519 | $XPos2 = $this->GraphAreaY1 + $XScale[0] + $XStep * $Value2; |
@@ -2829,14 +2527,12 @@ discard block |
||
| 2829 | 2527 | |
| 2830 | 2528 | $this->drawFilledRectangle($YPos1,$XPos1,$YPos2,$XPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 2831 | 2529 | |
| 2832 | - if ( $Border ) |
|
| 2833 | - { |
|
| 2530 | + if ( $Border ) { |
|
| 2834 | 2531 | $this->drawLine($YPos1,$XPos1,$YPos2,$XPos1,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks)); |
| 2835 | 2532 | $this->drawLine($YPos1,$XPos2,$YPos2,$XPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks)); |
| 2836 | 2533 | } |
| 2837 | 2534 | |
| 2838 | - if ( $AreaName != NULL ) |
|
| 2839 | - { |
|
| 2535 | + if ( $AreaName != NULL ) { |
|
| 2840 | 2536 | $XPos = ($XPos2-$XPos1)/2 + $XPos1; |
| 2841 | 2537 | $YPos = ($YPos2-$YPos1)/2 + $YPos1; |
| 2842 | 2538 | |
@@ -2851,8 +2547,7 @@ discard block |
||
| 2851 | 2547 | } |
| 2852 | 2548 | |
| 2853 | 2549 | /* Draw an Y threshold with the computed scale */ |
| 2854 | - function drawThreshold($Value,$Format="") |
|
| 2855 | - { |
|
| 2550 | + function drawThreshold($Value,$Format="") { |
|
| 2856 | 2551 | $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; |
| 2857 | 2552 | $R = isset($Format["R"]) ? $Format["R"] : 255; |
| 2858 | 2553 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
@@ -2900,27 +2595,22 @@ discard block |
||
| 2900 | 2595 | if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); } |
| 2901 | 2596 | if ( $Caption == NULL ) { $Caption = $Value; } |
| 2902 | 2597 | |
| 2903 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 2904 | - { |
|
| 2598 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 2905 | 2599 | $YPos = $this->scaleComputeY($Value,array("AxisID"=>$AxisID)); |
| 2906 | - if ( $YPos >= $this->GraphAreaY1+$Data["Axis"][$AxisID]["Margin"] && $YPos <= $this->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"] ) |
|
| 2907 | - { |
|
| 2600 | + if ( $YPos >= $this->GraphAreaY1+$Data["Axis"][$AxisID]["Margin"] && $YPos <= $this->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"] ) { |
|
| 2908 | 2601 | $X1 = $this->GraphAreaX1 + $AbscissaMargin; |
| 2909 | 2602 | $X2 = $this->GraphAreaX2 - $AbscissaMargin; |
| 2910 | 2603 | |
| 2911 | 2604 | $this->drawLine($X1,$YPos,$X2,$YPos,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight)); |
| 2912 | 2605 | |
| 2913 | - if ( $Wide ) |
|
| 2914 | - { |
|
| 2606 | + if ( $Wide ) { |
|
| 2915 | 2607 | $this->drawLine($X1,$YPos-1,$X2,$YPos-1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks)); |
| 2916 | 2608 | $this->drawLine($X1,$YPos+1,$X2,$YPos+1,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks)); |
| 2917 | 2609 | } |
| 2918 | 2610 | |
| 2919 | - if ( $WriteCaption ) |
|
| 2920 | - { |
|
| 2611 | + if ( $WriteCaption ) { |
|
| 2921 | 2612 | if ( $CaptionAlign == CAPTION_LEFT_TOP ) |
| 2922 | - { $X = $X1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; } |
|
| 2923 | - else |
|
| 2613 | + { $X = $X1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLELEFT; } else |
|
| 2924 | 2614 | { $X = $X2 - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_MIDDLERIGHT; } |
| 2925 | 2615 | |
| 2926 | 2616 | $this->drawText($X,$YPos,$Caption,$CaptionSettings); |
@@ -2930,27 +2620,22 @@ discard block |
||
| 2930 | 2620 | return(array("Y"=>$YPos)); |
| 2931 | 2621 | } |
| 2932 | 2622 | |
| 2933 | - if ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) |
|
| 2934 | - { |
|
| 2623 | + if ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) { |
|
| 2935 | 2624 | $XPos = $this->scaleComputeY($Value,array("AxisID"=>$AxisID)); |
| 2936 | - if ( $XPos >= $this->GraphAreaX1+$Data["Axis"][$AxisID]["Margin"] && $XPos <= $this->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"] ) |
|
| 2937 | - { |
|
| 2625 | + if ( $XPos >= $this->GraphAreaX1+$Data["Axis"][$AxisID]["Margin"] && $XPos <= $this->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"] ) { |
|
| 2938 | 2626 | $Y1 = $this->GraphAreaY1 + $AbscissaMargin; |
| 2939 | 2627 | $Y2 = $this->GraphAreaY2 - $AbscissaMargin; |
| 2940 | 2628 | |
| 2941 | 2629 | $this->drawLine($XPos,$Y1,$XPos,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight)); |
| 2942 | 2630 | |
| 2943 | - if ( $Wide ) |
|
| 2944 | - { |
|
| 2631 | + if ( $Wide ) { |
|
| 2945 | 2632 | $this->drawLine($XPos-1,$Y1,$XPos-1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks)); |
| 2946 | 2633 | $this->drawLine($XPos+1,$Y1,$XPos+1,$Y2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha/$WideFactor,"Ticks"=>$Ticks)); |
| 2947 | 2634 | } |
| 2948 | 2635 | |
| 2949 | - if ( $WriteCaption ) |
|
| 2950 | - { |
|
| 2636 | + if ( $WriteCaption ) { |
|
| 2951 | 2637 | if ( $CaptionAlign == CAPTION_LEFT_TOP ) |
| 2952 | - { $Y = $Y1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; } |
|
| 2953 | - else |
|
| 2638 | + { $Y = $Y1 + $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; } else |
|
| 2954 | 2639 | { $Y = $Y2 - $CaptionOffset; $CaptionSettings["Align"] = TEXT_ALIGN_BOTTOMMIDDLE; } |
| 2955 | 2640 | |
| 2956 | 2641 | $CaptionSettings["Align"] = TEXT_ALIGN_TOPMIDDLE; |
@@ -2963,8 +2648,7 @@ discard block |
||
| 2963 | 2648 | } |
| 2964 | 2649 | |
| 2965 | 2650 | /* Draw a threshold with the computed scale */ |
| 2966 | - function drawThresholdArea($Value1,$Value2,$Format="") |
|
| 2967 | - { |
|
| 2651 | + function drawThresholdArea($Value1,$Value2,$Format="") { |
|
| 2968 | 2652 | $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; |
| 2969 | 2653 | $R = isset($Format["R"]) ? $Format["R"] : 255; |
| 2970 | 2654 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
@@ -2998,8 +2682,7 @@ discard block |
||
| 2998 | 2682 | if ( $NoMargin ) { $AbscissaMargin = 0; } |
| 2999 | 2683 | if ( !isset($Data["Axis"][$AxisID]) ) { return(-1); } |
| 3000 | 2684 | |
| 3001 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3002 | - { |
|
| 2685 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3003 | 2686 | $XPos1 = $this->GraphAreaX1 + $AbscissaMargin; |
| 3004 | 2687 | $XPos2 = $this->GraphAreaX2 - $AbscissaMargin; |
| 3005 | 2688 | $YPos1 = $this->scaleComputeY($Value1,array("AxisID"=>$AxisID)); |
@@ -3011,14 +2694,12 @@ discard block |
||
| 3011 | 2694 | if ( $YPos2 > $this->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"] ) { $YPos2 = $this->GraphAreaY2-$Data["Axis"][$AxisID]["Margin"]; } |
| 3012 | 2695 | |
| 3013 | 2696 | $this->drawFilledRectangle($XPos1,$YPos1,$XPos2,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 3014 | - if ( $Border ) |
|
| 3015 | - { |
|
| 2697 | + if ( $Border ) { |
|
| 3016 | 2698 | $this->drawLine($XPos1,$YPos1,$XPos2,$YPos1,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks)); |
| 3017 | 2699 | $this->drawLine($XPos1,$YPos2,$XPos2,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks)); |
| 3018 | 2700 | } |
| 3019 | 2701 | |
| 3020 | - if ( $AreaName != NULL ) |
|
| 3021 | - { |
|
| 2702 | + if ( $AreaName != NULL ) { |
|
| 3022 | 2703 | $XPos = ($XPos2-$XPos1)/2 + $XPos1; |
| 3023 | 2704 | $YPos = ($YPos2-$YPos1)/2 + $YPos1; |
| 3024 | 2705 | $this->Shadow = $RestoreShadow; |
@@ -3028,9 +2709,7 @@ discard block |
||
| 3028 | 2709 | |
| 3029 | 2710 | $this->Shadow = $RestoreShadow; |
| 3030 | 2711 | return(array("Y1"=>$YPos1,"Y2"=>$YPos2)); |
| 3031 | - } |
|
| 3032 | - elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) |
|
| 3033 | - { |
|
| 2712 | + } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) { |
|
| 3034 | 2713 | $YPos1 = $this->GraphAreaY1 + $AbscissaMargin; |
| 3035 | 2714 | $YPos2 = $this->GraphAreaY2 - $AbscissaMargin; |
| 3036 | 2715 | $XPos1 = $this->scaleComputeY($Value1,array("AxisID"=>$AxisID)); |
@@ -3042,19 +2721,16 @@ discard block |
||
| 3042 | 2721 | if ( $XPos2 > $this->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"] ) { $XPos2 = $this->GraphAreaX2-$Data["Axis"][$AxisID]["Margin"]; } |
| 3043 | 2722 | |
| 3044 | 2723 | $this->drawFilledRectangle($XPos1,$YPos1,$XPos2,$YPos2,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 3045 | - if ( $Border ) |
|
| 3046 | - { |
|
| 2724 | + if ( $Border ) { |
|
| 3047 | 2725 | $this->drawLine($XPos1,$YPos1,$XPos1,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks)); |
| 3048 | 2726 | $this->drawLine($XPos2,$YPos1,$XPos2,$YPos2,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Ticks"=>$BorderTicks)); |
| 3049 | 2727 | } |
| 3050 | 2728 | |
| 3051 | - if ( $AreaName != NULL ) |
|
| 3052 | - { |
|
| 2729 | + if ( $AreaName != NULL ) { |
|
| 3053 | 2730 | $XPos = ($YPos2-$YPos1)/2 + $YPos1; |
| 3054 | 2731 | $YPos = ($XPos2-$XPos1)/2 + $XPos1; |
| 3055 | 2732 | |
| 3056 | - if ( $NameAngle == ZONE_NAME_ANGLE_AUTO ) |
|
| 3057 | - { |
|
| 2733 | + if ( $NameAngle == ZONE_NAME_ANGLE_AUTO ) { |
|
| 3058 | 2734 | $TxtPos = $this->getTextBox($XPos,$YPos,$this->FontName,$this->FontSize,0,$AreaName); |
| 3059 | 2735 | $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"]; |
| 3060 | 2736 | if ( abs($XPos2 - $XPos1) > $TxtWidth ) { $NameAngle = 0; } else { $NameAngle = 90; } |
@@ -3069,13 +2745,10 @@ discard block |
||
| 3069 | 2745 | } |
| 3070 | 2746 | } |
| 3071 | 2747 | |
| 3072 | - function scaleGetXSettings() |
|
| 3073 | - { |
|
| 2748 | + function scaleGetXSettings() { |
|
| 3074 | 2749 | $Data = $this->DataSet->getData(); |
| 3075 | - foreach($Data["Axis"] as $AxisID => $Settings) |
|
| 3076 | - { |
|
| 3077 | - if ( $Settings["Identity"] == AXIS_X ) |
|
| 3078 | - { |
|
| 2750 | + foreach($Data["Axis"] as $AxisID => $Settings) { |
|
| 2751 | + if ( $Settings["Identity"] == AXIS_X ) { |
|
| 3079 | 2752 | $Rows = $Settings["Rows"]; |
| 3080 | 2753 | |
| 3081 | 2754 | return(array($Settings["Margin"],$Rows)); |
@@ -3083,8 +2756,7 @@ discard block |
||
| 3083 | 2756 | } |
| 3084 | 2757 | } |
| 3085 | 2758 | |
| 3086 | - function scaleComputeY($Values,$Option="",$ReturnOnly0Height=FALSE) |
|
| 3087 | - { |
|
| 2759 | + function scaleComputeY($Values,$Option="",$ReturnOnly0Height=FALSE) { |
|
| 3088 | 2760 | $AxisID = isset($Option["AxisID"]) ? $Option["AxisID"] : 0; |
| 3089 | 2761 | $SerieName = isset($Option["SerieName"]) ? $Option["SerieName"] : NULL; |
| 3090 | 2762 | |
@@ -3095,26 +2767,21 @@ discard block |
||
| 3095 | 2767 | if ( !is_array($Values) ) { $tmp = $Values; $Values = ""; $Values[0] = $tmp; } |
| 3096 | 2768 | |
| 3097 | 2769 | $Result = ""; |
| 3098 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3099 | - { |
|
| 2770 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3100 | 2771 | $Height = ($this->GraphAreaY2 - $this->GraphAreaY1) - $Data["Axis"][$AxisID]["Margin"]*2; |
| 3101 | 2772 | $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"]; |
| 3102 | 2773 | $Step = $Height / $ScaleHeight; |
| 3103 | 2774 | |
| 3104 | 2775 | if ( $ReturnOnly0Height ) |
| 3105 | - { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } } |
|
| 3106 | - else |
|
| 2776 | + { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } } else |
|
| 3107 | 2777 | { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $this->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"])); } } } |
| 3108 | - } |
|
| 3109 | - else |
|
| 3110 | - { |
|
| 2778 | + } else { |
|
| 3111 | 2779 | $Width = ($this->GraphAreaX2 - $this->GraphAreaX1) - $Data["Axis"][$AxisID]["Margin"]*2; |
| 3112 | 2780 | $ScaleWidth = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"]; |
| 3113 | 2781 | $Step = $Width / $ScaleWidth; |
| 3114 | 2782 | |
| 3115 | 2783 | if ( $ReturnOnly0Height ) |
| 3116 | - { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } } |
|
| 3117 | - else |
|
| 2784 | + { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $Step * $Value; } } } else |
|
| 3118 | 2785 | { foreach($Values as $Key => $Value) { if ( $Value == VOID ) { $Result[] = VOID; } else { $Result[] = $this->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + ($Step * ($Value-$Data["Axis"][$AxisID]["ScaleMin"])); } } } |
| 3119 | 2786 | } |
| 3120 | 2787 | |
@@ -3125,8 +2792,7 @@ discard block |
||
| 3125 | 2792 | } |
| 3126 | 2793 | |
| 3127 | 2794 | /* Format the axis values */ |
| 3128 | - function scaleFormat($Value,$Mode=NULL,$Format=NULL,$Unit=NULL) |
|
| 3129 | - { |
|
| 2795 | + function scaleFormat($Value,$Mode=NULL,$Format=NULL,$Unit=NULL) { |
|
| 3130 | 2796 | if ( $Value == VOID ) { return(""); } |
| 3131 | 2797 | |
| 3132 | 2798 | if ( $Mode == AXIS_FORMAT_CUSTOM ) |
@@ -3141,8 +2807,7 @@ discard block |
||
| 3141 | 2807 | if ( $Mode == AXIS_FORMAT_CURRENCY ) |
| 3142 | 2808 | { return($Format.number_format($Value,2)); } |
| 3143 | 2809 | |
| 3144 | - if ( $Mode == AXIS_FORMAT_METRIC ) |
|
| 3145 | - { |
|
| 2810 | + if ( $Mode == AXIS_FORMAT_METRIC ) { |
|
| 3146 | 2811 | if (abs($Value) > 1000000000) |
| 3147 | 2812 | return(round($Value/1000000000,$Format)."g".$Unit); |
| 3148 | 2813 | if (abs($Value) > 1000000) |
@@ -3155,8 +2820,7 @@ discard block |
||
| 3155 | 2820 | } |
| 3156 | 2821 | |
| 3157 | 2822 | /* Write Max value on a chart */ |
| 3158 | - function writeBounds($Type=BOUND_BOTH,$Format=NULL) |
|
| 3159 | - { |
|
| 2823 | + function writeBounds($Type=BOUND_BOTH,$Format=NULL) { |
|
| 3160 | 2824 | $MaxLabelTxt = isset($Format["MaxLabelTxt"]) ? $Format["MaxLabelTxt"] : "max="; |
| 3161 | 2825 | $MinLabelTxt = isset($Format["MinLabelTxt"]) ? $Format["MinLabelTxt"] : "min="; |
| 3162 | 2826 | $Decimals = isset($Format["Decimals"]) ? $Format["Decimals"] : 1; |
@@ -3193,10 +2857,8 @@ discard block |
||
| 3193 | 2857 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 3194 | 2858 | |
| 3195 | 2859 | $Data = $this->DataSet->getData(); |
| 3196 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 3197 | - { |
|
| 3198 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && !isset($ExcludedSeries[$SerieName])) |
|
| 3199 | - { |
|
| 2860 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 2861 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] && !isset($ExcludedSeries[$SerieName])) { |
|
| 3200 | 2862 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; |
| 3201 | 2863 | if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } |
| 3202 | 2864 | |
@@ -3204,8 +2866,7 @@ discard block |
||
| 3204 | 2866 | $MaxValue = $this->DataSet->getMax($SerieName); |
| 3205 | 2867 | |
| 3206 | 2868 | $MinPos = VOID; $MaxPos = VOID; |
| 3207 | - foreach($Serie["Data"] as $Key => $Value) |
|
| 3208 | - { |
|
| 2869 | + foreach($Serie["Data"] as $Key => $Value) { |
|
| 3209 | 2870 | if ( $Value == $MinValue && $MinPos == VOID ) { $MinPos = $Key; } |
| 3210 | 2871 | if ( $Value == $MaxValue ) { $MaxPos = $Key; } |
| 3211 | 2872 | } |
@@ -3217,14 +2878,12 @@ discard block |
||
| 3217 | 2878 | |
| 3218 | 2879 | $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); |
| 3219 | 2880 | |
| 3220 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3221 | - { |
|
| 2881 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3222 | 2882 | $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; |
| 3223 | 2883 | $X = $this->GraphAreaX1 + $XMargin; |
| 3224 | 2884 | $SerieOffset = isset($Serie["XOffset"]) ? $Serie["XOffset"] : 0; |
| 3225 | 2885 | |
| 3226 | - if ( $Type == BOUND_MAX || $Type == BOUND_BOTH ) |
|
| 3227 | - { |
|
| 2886 | + if ( $Type == BOUND_MAX || $Type == BOUND_BOTH ) { |
|
| 3228 | 2887 | if ( $MaxLabelPos == BOUND_LABEL_POS_TOP || ( $MaxLabelPos == BOUND_LABEL_POS_AUTO && $MaxValue >= 0) ) { $YPos = $PosArray[$MaxPos] - $DisplayOffset + 2; $Align = TEXT_ALIGN_BOTTOMMIDDLE; } |
| 3229 | 2888 | if ( $MaxLabelPos == BOUND_LABEL_POS_BOTTOM || ( $MaxLabelPos == BOUND_LABEL_POS_AUTO && $MaxValue < 0) ) { $YPos = $PosArray[$MaxPos] + $DisplayOffset + 2; $Align = TEXT_ALIGN_TOPMIDDLE; } |
| 3230 | 2889 | |
@@ -3244,8 +2903,7 @@ discard block |
||
| 3244 | 2903 | $this->drawText($XPos+$XOffset,$YPos+$YOffset,$Label,$CaptionSettings); |
| 3245 | 2904 | } |
| 3246 | 2905 | |
| 3247 | - if ( $Type == BOUND_MIN || $Type == BOUND_BOTH ) |
|
| 3248 | - { |
|
| 2906 | + if ( $Type == BOUND_MIN || $Type == BOUND_BOTH ) { |
|
| 3249 | 2907 | if ( $MinLabelPos == BOUND_LABEL_POS_TOP || ( $MinLabelPos == BOUND_LABEL_POS_AUTO && $MinValue >= 0) ) { $YPos = $PosArray[$MinPos] - $DisplayOffset + 2; $Align = TEXT_ALIGN_BOTTOMMIDDLE; } |
| 3250 | 2908 | if ( $MinLabelPos == BOUND_LABEL_POS_BOTTOM || ( $MinLabelPos == BOUND_LABEL_POS_AUTO && $MinValue < 0) ) { $YPos = $PosArray[$MinPos] + $DisplayOffset + 2; $Align = TEXT_ALIGN_TOPMIDDLE; } |
| 3251 | 2909 | |
@@ -3264,15 +2922,12 @@ discard block |
||
| 3264 | 2922 | |
| 3265 | 2923 | $this->drawText($XPos+$XOffset,$YPos-$DisplayOffset+$YOffset,$Label,$CaptionSettings); |
| 3266 | 2924 | } |
| 3267 | - } |
|
| 3268 | - else |
|
| 3269 | - { |
|
| 2925 | + } else { |
|
| 3270 | 2926 | $XStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; |
| 3271 | 2927 | $X = $this->GraphAreaY1 + $XMargin; |
| 3272 | 2928 | $SerieOffset = isset($Serie["XOffset"]) ? $Serie["XOffset"] : 0; |
| 3273 | 2929 | |
| 3274 | - if ( $Type == BOUND_MAX || $Type == BOUND_BOTH ) |
|
| 3275 | - { |
|
| 2930 | + if ( $Type == BOUND_MAX || $Type == BOUND_BOTH ) { |
|
| 3276 | 2931 | if ( $MaxLabelPos == BOUND_LABEL_POS_TOP || ( $MaxLabelPos == BOUND_LABEL_POS_AUTO && $MaxValue >= 0) ) { $YPos = $PosArray[$MaxPos] + $DisplayOffset + 2; $Align = TEXT_ALIGN_MIDDLELEFT; } |
| 3277 | 2932 | if ( $MaxLabelPos == BOUND_LABEL_POS_BOTTOM || ( $MaxLabelPos == BOUND_LABEL_POS_AUTO && $MaxValue < 0) ) { $YPos = $PosArray[$MaxPos] - $DisplayOffset + 2; $Align = TEXT_ALIGN_MIDDLERIGHT; } |
| 3278 | 2933 | |
@@ -3292,8 +2947,7 @@ discard block |
||
| 3292 | 2947 | $this->drawText($YPos+$XOffset,$XPos+$YOffset,$Label,$CaptionSettings); |
| 3293 | 2948 | } |
| 3294 | 2949 | |
| 3295 | - if ( $Type == BOUND_MIN || $Type == BOUND_BOTH ) |
|
| 3296 | - { |
|
| 2950 | + if ( $Type == BOUND_MIN || $Type == BOUND_BOTH ) { |
|
| 3297 | 2951 | if ( $MinLabelPos == BOUND_LABEL_POS_TOP || ( $MinLabelPos == BOUND_LABEL_POS_AUTO && $MinValue >= 0) ) { $YPos = $PosArray[$MinPos] + $DisplayOffset + 2; $Align = TEXT_ALIGN_MIDDLELEFT; } |
| 3298 | 2952 | if ( $MinLabelPos == BOUND_LABEL_POS_BOTTOM || ( $MinLabelPos == BOUND_LABEL_POS_AUTO && $MinValue < 0) ) { $YPos = $PosArray[$MinPos] - $DisplayOffset + 2; $Align = TEXT_ALIGN_MIDDLERIGHT; } |
| 3299 | 2953 | |
@@ -3318,8 +2972,7 @@ discard block |
||
| 3318 | 2972 | } |
| 3319 | 2973 | |
| 3320 | 2974 | /* Draw a plot chart */ |
| 3321 | - function drawPlotChart($Format=NULL) |
|
| 3322 | - { |
|
| 2975 | + function drawPlotChart($Format=NULL) { |
|
| 3323 | 2976 | $PlotSize = isset($Format["PlotSize"]) ? $Format["PlotSize"] : NULL; |
| 3324 | 2977 | $PlotBorder = isset($Format["PlotBorder"]) ? $Format["PlotBorder"] : FALSE; |
| 3325 | 2978 | $BorderR = isset($Format["BorderR"]) ? $Format["BorderR"] : 50; |
@@ -3341,18 +2994,15 @@ discard block |
||
| 3341 | 2994 | $Data = $this->DataSet->getData(); |
| 3342 | 2995 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 3343 | 2996 | |
| 3344 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 3345 | - { |
|
| 3346 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 3347 | - { |
|
| 2997 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 2998 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 3348 | 2999 | if ( isset($Serie["Weight"]) ) { $SerieWeight = $Serie["Weight"] + 2; } else { $SerieWeight = 2; } |
| 3349 | 3000 | if ( $PlotSize != NULL ) { $SerieWeight = $PlotSize; } |
| 3350 | 3001 | |
| 3351 | 3002 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; |
| 3352 | 3003 | if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; } |
| 3353 | 3004 | if ( isset($Serie["Picture"]) ) |
| 3354 | - { $Picture = $Serie["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->getPicInfo($Picture); } |
|
| 3355 | - else { $Picture = NULL; $PicOffset = 0; } |
|
| 3005 | + { $Picture = $Serie["Picture"]; list($PicWidth,$PicHeight,$PicType) = $this->getPicInfo($Picture); } else { $Picture = NULL; $PicOffset = 0; } |
|
| 3356 | 3006 | |
| 3357 | 3007 | if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } |
| 3358 | 3008 | |
@@ -3368,49 +3018,40 @@ discard block |
||
| 3368 | 3018 | |
| 3369 | 3019 | $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0; |
| 3370 | 3020 | |
| 3371 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3372 | - { |
|
| 3021 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3373 | 3022 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; } |
| 3374 | 3023 | if ( $Picture != NULL ) { $PicOffset = $PicHeight / 2; $SerieWeight = 0; } |
| 3375 | 3024 | $X = $this->GraphAreaX1 + $XMargin; |
| 3376 | 3025 | |
| 3377 | 3026 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3378 | - foreach($PosArray as $Key => $Y) |
|
| 3379 | - { |
|
| 3027 | + foreach($PosArray as $Key => $Y) { |
|
| 3380 | 3028 | if ( $DisplayValues ) |
| 3381 | 3029 | $this->drawText($X,$Y-$DisplayOffset-$SerieWeight-$BorderSize-$PicOffset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); |
| 3382 | 3030 | |
| 3383 | - if ( $Y != VOID ) |
|
| 3384 | - { |
|
| 3031 | + if ( $Y != VOID ) { |
|
| 3385 | 3032 | if ( $RecordImageMap ) { $this->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$SerieWeight,$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 3386 | 3033 | |
| 3387 | 3034 | if ( $Picture != NULL ) |
| 3388 | - { $this->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); } |
|
| 3389 | - else |
|
| 3035 | + { $this->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); } else |
|
| 3390 | 3036 | { $this->drawShape($X,$Y,$Shape,$SerieWeight,$PlotBorder,$BorderSize,$R,$G,$B,$Alpha,$BorderR,$BorderG,$BorderB,$BorderAlpha); } |
| 3391 | 3037 | } |
| 3392 | 3038 | $X = $X + $XStep; |
| 3393 | 3039 | } |
| 3394 | - } |
|
| 3395 | - else |
|
| 3396 | - { |
|
| 3040 | + } else { |
|
| 3397 | 3041 | if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; } |
| 3398 | 3042 | if ( $Picture != NULL ) { $PicOffset = $PicWidth / 2; $SerieWeight = 0; } |
| 3399 | 3043 | $Y = $this->GraphAreaY1 + $XMargin; |
| 3400 | 3044 | |
| 3401 | 3045 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3402 | - foreach($PosArray as $Key => $X) |
|
| 3403 | - { |
|
| 3046 | + foreach($PosArray as $Key => $X) { |
|
| 3404 | 3047 | if ( $DisplayValues ) |
| 3405 | 3048 | $this->drawText($X+$DisplayOffset+$SerieWeight+$BorderSize+$PicOffset,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); |
| 3406 | 3049 | |
| 3407 | - if ( $X != VOID ) |
|
| 3408 | - { |
|
| 3050 | + if ( $X != VOID ) { |
|
| 3409 | 3051 | if ( $RecordImageMap ) { $this->addToImageMap("CIRCLE",floor($X).",".floor($Y).",".$SerieWeight,$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 3410 | 3052 | |
| 3411 | 3053 | if ( $Picture != NULL ) |
| 3412 | - { $this->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); } |
|
| 3413 | - else |
|
| 3054 | + { $this->drawFromPicture($PicType,$Picture,$X-$PicWidth/2,$Y-$PicHeight/2); } else |
|
| 3414 | 3055 | { $this->drawShape($X,$Y,$Shape,$SerieWeight,$PlotBorder,$BorderSize,$R,$G,$B,$Alpha,$BorderR,$BorderG,$BorderB,$BorderAlpha); } |
| 3415 | 3056 | } |
| 3416 | 3057 | $Y = $Y + $YStep; |
@@ -3421,8 +3062,7 @@ discard block |
||
| 3421 | 3062 | } |
| 3422 | 3063 | |
| 3423 | 3064 | /* Draw a spline chart */ |
| 3424 | - function drawSplineChart($Format=NULL) |
|
| 3425 | - { |
|
| 3065 | + function drawSplineChart($Format=NULL) { |
|
| 3426 | 3066 | $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : TRUE; |
| 3427 | 3067 | $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; |
| 3428 | 3068 | $BreakR = isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; // 234 |
@@ -3441,10 +3081,8 @@ discard block |
||
| 3441 | 3081 | |
| 3442 | 3082 | $Data = $this->DataSet->getData(); |
| 3443 | 3083 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 3444 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 3445 | - { |
|
| 3446 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 3447 | - { |
|
| 3084 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 3085 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 3448 | 3086 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"]; |
| 3449 | 3087 | |
| 3450 | 3088 | if ( $BreakR == NULL ) |
@@ -3465,16 +3103,14 @@ discard block |
||
| 3465 | 3103 | |
| 3466 | 3104 | $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0; |
| 3467 | 3105 | |
| 3468 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3469 | - { |
|
| 3106 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3470 | 3107 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; } |
| 3471 | 3108 | $X = $this->GraphAreaX1 + $XMargin; $WayPoints = ""; |
| 3472 | 3109 | $Force = $XStep / 5; |
| 3473 | 3110 | |
| 3474 | 3111 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3475 | 3112 | $LastGoodY = NULL; $LastGoodX = NULL; $LastX = 1; $LastY = 1; |
| 3476 | - foreach($PosArray as $Key => $Y) |
|
| 3477 | - { |
|
| 3113 | + foreach($PosArray as $Key => $Y) { |
|
| 3478 | 3114 | if ( $DisplayValues ) |
| 3479 | 3115 | $this->drawText($X,$Y-$DisplayOffset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); |
| 3480 | 3116 | |
@@ -3496,17 +3132,14 @@ discard block |
||
| 3496 | 3132 | $X = $X + $XStep; |
| 3497 | 3133 | } |
| 3498 | 3134 | $this->drawSpline($WayPoints,array("Force"=>$Force,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight)); |
| 3499 | - } |
|
| 3500 | - else |
|
| 3501 | - { |
|
| 3135 | + } else { |
|
| 3502 | 3136 | if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; } |
| 3503 | 3137 | $Y = $this->GraphAreaY1 + $XMargin; $WayPoints = ""; |
| 3504 | 3138 | $Force = $YStep / 5; |
| 3505 | 3139 | |
| 3506 | 3140 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3507 | 3141 | $LastGoodY = NULL; $LastGoodX = NULL; $LastX = 1; $LastY = 1; |
| 3508 | - foreach($PosArray as $Key => $X) |
|
| 3509 | - { |
|
| 3142 | + foreach($PosArray as $Key => $X) { |
|
| 3510 | 3143 | if ( $DisplayValues ) |
| 3511 | 3144 | $this->drawText($X+$DisplayOffset,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); |
| 3512 | 3145 | |
@@ -3534,8 +3167,7 @@ discard block |
||
| 3534 | 3167 | } |
| 3535 | 3168 | |
| 3536 | 3169 | /* Draw a filled spline chart */ |
| 3537 | - function drawFilledSplineChart($Format=NULL) |
|
| 3538 | - { |
|
| 3170 | + function drawFilledSplineChart($Format=NULL) { |
|
| 3539 | 3171 | $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; |
| 3540 | 3172 | $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; |
| 3541 | 3173 | $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; |
@@ -3549,10 +3181,8 @@ discard block |
||
| 3549 | 3181 | |
| 3550 | 3182 | $Data = $this->DataSet->getData(); |
| 3551 | 3183 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 3552 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 3553 | - { |
|
| 3554 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 3555 | - { |
|
| 3184 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 3185 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 3556 | 3186 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; |
| 3557 | 3187 | if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } |
| 3558 | 3188 | |
@@ -3564,10 +3194,8 @@ discard block |
||
| 3564 | 3194 | $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); |
| 3565 | 3195 | if ( $AroundZero ) { $YZero = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"])); } |
| 3566 | 3196 | |
| 3567 | - if ( $Threshold != NULL ) |
|
| 3568 | - { |
|
| 3569 | - foreach($Threshold as $Key => $Params) |
|
| 3570 | - { |
|
| 3197 | + if ( $Threshold != NULL ) { |
|
| 3198 | + foreach($Threshold as $Key => $Params) { |
|
| 3571 | 3199 | $Threshold[$Key]["MinX"] = $this->scaleComputeY($Params["Min"],array("AxisID"=>$Serie["Axis"])); |
| 3572 | 3200 | $Threshold[$Key]["MaxX"] = $this->scaleComputeY($Params["Max"],array("AxisID"=>$Serie["Axis"])); |
| 3573 | 3201 | } |
@@ -3575,8 +3203,7 @@ discard block |
||
| 3575 | 3203 | |
| 3576 | 3204 | $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0; |
| 3577 | 3205 | |
| 3578 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3579 | - { |
|
| 3206 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3580 | 3207 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; } |
| 3581 | 3208 | $X = $this->GraphAreaX1 + $XMargin; $WayPoints = ""; |
| 3582 | 3209 | $Force = $XStep / 5; |
@@ -3587,22 +3214,17 @@ discard block |
||
| 3587 | 3214 | |
| 3588 | 3215 | $LastX = ""; $LastY = ""; |
| 3589 | 3216 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3590 | - foreach($PosArray as $Key => $Y) |
|
| 3591 | - { |
|
| 3217 | + foreach($PosArray as $Key => $Y) { |
|
| 3592 | 3218 | if ( $DisplayValues ) |
| 3593 | 3219 | $this->drawText($X,$Y-$DisplayOffset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); |
| 3594 | 3220 | |
| 3595 | - if ( $Y == VOID ) |
|
| 3596 | - { |
|
| 3221 | + if ( $Y == VOID ) { |
|
| 3597 | 3222 | $Area = $this->drawSpline($WayPoints,array("Force"=>$Force,"PathOnly"=>TRUE)); |
| 3598 | 3223 | |
| 3599 | - if ( $Area != "" ) |
|
| 3600 | - { |
|
| 3601 | - foreach ($Area as $key => $Points) |
|
| 3602 | - { |
|
| 3224 | + if ( $Area != "" ) { |
|
| 3225 | + foreach ($Area as $key => $Points) { |
|
| 3603 | 3226 | $Corners = ""; $Corners[] = $Area[$key][0]["X"]; $Corners[] = $YZero; |
| 3604 | - foreach($Points as $subKey => $Point) |
|
| 3605 | - { |
|
| 3227 | + foreach($Points as $subKey => $Point) { |
|
| 3606 | 3228 | if ( $subKey == count($Points)-1) { $Corners[] = $Point["X"]-1; } else { $Corners[] = $Point["X"]; } |
| 3607 | 3229 | $Corners[] = $Point["Y"]+1; |
| 3608 | 3230 | } |
@@ -3614,21 +3236,17 @@ discard block |
||
| 3614 | 3236 | } |
| 3615 | 3237 | |
| 3616 | 3238 | $WayPoints = ""; |
| 3617 | - } |
|
| 3618 | - else |
|
| 3239 | + } else |
|
| 3619 | 3240 | $WayPoints[] = array($X,$Y-.5); /* -.5 for AA visual fix */ |
| 3620 | 3241 | |
| 3621 | 3242 | $X = $X + $XStep; |
| 3622 | 3243 | } |
| 3623 | 3244 | $Area = $this->drawSpline($WayPoints,array("Force"=>$Force,"PathOnly"=>TRUE)); |
| 3624 | 3245 | |
| 3625 | - if ( $Area != "" ) |
|
| 3626 | - { |
|
| 3627 | - foreach ($Area as $key => $Points) |
|
| 3628 | - { |
|
| 3246 | + if ( $Area != "" ) { |
|
| 3247 | + foreach ($Area as $key => $Points) { |
|
| 3629 | 3248 | $Corners = ""; $Corners[] = $Area[$key][0]["X"]; $Corners[] = $YZero; |
| 3630 | - foreach($Points as $subKey => $Point) |
|
| 3631 | - { |
|
| 3249 | + foreach($Points as $subKey => $Point) { |
|
| 3632 | 3250 | if ( $subKey == count($Points)-1) { $Corners[] = $Point["X"]-1; } else { $Corners[] = $Point["X"]; } |
| 3633 | 3251 | $Corners[] = $Point["Y"]+1; |
| 3634 | 3252 | } |
@@ -3638,9 +3256,7 @@ discard block |
||
| 3638 | 3256 | } |
| 3639 | 3257 | $this->drawSpline($WayPoints,array("Force"=>$Force,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks)); |
| 3640 | 3258 | } |
| 3641 | - } |
|
| 3642 | - else |
|
| 3643 | - { |
|
| 3259 | + } else { |
|
| 3644 | 3260 | if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; } |
| 3645 | 3261 | $Y = $this->GraphAreaY1 + $XMargin; $WayPoints = ""; |
| 3646 | 3262 | $Force = $YStep / 5; |
@@ -3650,22 +3266,17 @@ discard block |
||
| 3650 | 3266 | if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; } |
| 3651 | 3267 | |
| 3652 | 3268 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3653 | - foreach($PosArray as $Key => $X) |
|
| 3654 | - { |
|
| 3269 | + foreach($PosArray as $Key => $X) { |
|
| 3655 | 3270 | if ( $DisplayValues ) |
| 3656 | 3271 | $this->drawText($X+$DisplayOffset,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); |
| 3657 | 3272 | |
| 3658 | - if ( $X == VOID ) |
|
| 3659 | - { |
|
| 3273 | + if ( $X == VOID ) { |
|
| 3660 | 3274 | $Area = $this->drawSpline($WayPoints,array("Force"=>$Force,"PathOnly"=>TRUE)); |
| 3661 | 3275 | |
| 3662 | - if ( $Area != "" ) |
|
| 3663 | - { |
|
| 3664 | - foreach ($Area as $key => $Points) |
|
| 3665 | - { |
|
| 3276 | + if ( $Area != "" ) { |
|
| 3277 | + foreach ($Area as $key => $Points) { |
|
| 3666 | 3278 | $Corners = ""; $Corners[] = $YZero; $Corners[] = $Area[$key][0]["Y"]; |
| 3667 | - foreach($Points as $subKey => $Point) |
|
| 3668 | - { |
|
| 3279 | + foreach($Points as $subKey => $Point) { |
|
| 3669 | 3280 | if ( $subKey == count($Points)-1) { $Corners[] = $Point["X"]-1; } else { $Corners[] = $Point["X"]; } |
| 3670 | 3281 | $Corners[] = $Point["Y"]; |
| 3671 | 3282 | } |
@@ -3677,21 +3288,17 @@ discard block |
||
| 3677 | 3288 | } |
| 3678 | 3289 | |
| 3679 | 3290 | $WayPoints = ""; |
| 3680 | - } |
|
| 3681 | - else |
|
| 3291 | + } else |
|
| 3682 | 3292 | $WayPoints[] = array($X,$Y); |
| 3683 | 3293 | |
| 3684 | 3294 | $Y = $Y + $YStep; |
| 3685 | 3295 | } |
| 3686 | 3296 | $Area = $this->drawSpline($WayPoints,array("Force"=>$Force,"PathOnly"=>TRUE)); |
| 3687 | 3297 | |
| 3688 | - if ( $Area != "" ) |
|
| 3689 | - { |
|
| 3690 | - foreach ($Area as $key => $Points) |
|
| 3691 | - { |
|
| 3298 | + if ( $Area != "" ) { |
|
| 3299 | + foreach ($Area as $key => $Points) { |
|
| 3692 | 3300 | $Corners = ""; $Corners[] = $YZero; $Corners[] = $Area[$key][0]["Y"]; |
| 3693 | - foreach($Points as $subKey => $Point) |
|
| 3694 | - { |
|
| 3301 | + foreach($Points as $subKey => $Point) { |
|
| 3695 | 3302 | if ( $subKey == count($Points)-1) { $Corners[] = $Point["X"]-1; } else { $Corners[] = $Point["X"]; } |
| 3696 | 3303 | $Corners[] = $Point["Y"]; |
| 3697 | 3304 | } |
@@ -3708,8 +3315,7 @@ discard block |
||
| 3708 | 3315 | } |
| 3709 | 3316 | |
| 3710 | 3317 | /* Draw a line chart */ |
| 3711 | - function drawLineChart($Format=NULL) |
|
| 3712 | - { |
|
| 3318 | + function drawLineChart($Format=NULL) { |
|
| 3713 | 3319 | $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : TRUE; |
| 3714 | 3320 | $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; |
| 3715 | 3321 | $BreakR = isset($Format["BreakR"]) ? $Format["BreakR"] : NULL; |
@@ -3733,10 +3339,8 @@ discard block |
||
| 3733 | 3339 | |
| 3734 | 3340 | $Data = $this->DataSet->getData(); |
| 3735 | 3341 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 3736 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 3737 | - { |
|
| 3738 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 3739 | - { |
|
| 3342 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 3343 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 3740 | 3344 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"]; |
| 3741 | 3345 | |
| 3742 | 3346 | if ( $ForceColor ) |
@@ -3760,17 +3364,14 @@ discard block |
||
| 3760 | 3364 | |
| 3761 | 3365 | $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0; |
| 3762 | 3366 | |
| 3763 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3764 | - { |
|
| 3367 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3765 | 3368 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; } |
| 3766 | 3369 | $X = $this->GraphAreaX1 + $XMargin; $LastX = NULL; $LastY = NULL; |
| 3767 | 3370 | |
| 3768 | 3371 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3769 | 3372 | $LastGoodY = NULL; $LastGoodX = NULL; |
| 3770 | - foreach($PosArray as $Key => $Y) |
|
| 3771 | - { |
|
| 3772 | - if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) |
|
| 3773 | - { |
|
| 3373 | + foreach($PosArray as $Key => $Y) { |
|
| 3374 | + if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) { |
|
| 3774 | 3375 | if ( $Serie["Data"][$Key] > 0 ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; } |
| 3775 | 3376 | $this->drawText($X,$Y-$Offset-$Weight,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align)); |
| 3776 | 3377 | } |
@@ -3789,16 +3390,13 @@ discard block |
||
| 3789 | 3390 | $LastX = $X; $LastY = $Y; |
| 3790 | 3391 | $X = $X + $XStep; |
| 3791 | 3392 | } |
| 3792 | - } |
|
| 3793 | - else |
|
| 3794 | - { |
|
| 3393 | + } else { |
|
| 3795 | 3394 | if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; } |
| 3796 | 3395 | $Y = $this->GraphAreaY1 + $XMargin; $LastX = NULL; $LastY = NULL; |
| 3797 | 3396 | |
| 3798 | 3397 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3799 | 3398 | $LastGoodY = NULL; $LastGoodX = NULL; |
| 3800 | - foreach($PosArray as $Key => $X) |
|
| 3801 | - { |
|
| 3399 | + foreach($PosArray as $Key => $X) { |
|
| 3802 | 3400 | if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) |
| 3803 | 3401 | { $this->drawText($X+$DisplayOffset+$Weight,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE)); } |
| 3804 | 3402 | |
@@ -3822,8 +3420,7 @@ discard block |
||
| 3822 | 3420 | } |
| 3823 | 3421 | |
| 3824 | 3422 | /* Draw a line chart */ |
| 3825 | - function drawZoneChart($SerieA,$SerieB,$Format=NULL) |
|
| 3826 | - { |
|
| 3423 | + function drawZoneChart($SerieA,$SerieB,$Format=NULL) { |
|
| 3827 | 3424 | $AxisID = isset($Format["AxisID"]) ? $Format["AxisID"] : 0; |
| 3828 | 3425 | $LineR = isset($Format["LineR"]) ? $Format["LineR"] : 150; |
| 3829 | 3426 | $LineG = isset($Format["LineG"]) ? $Format["LineG"] : 150; |
@@ -3852,15 +3449,13 @@ discard block |
||
| 3852 | 3449 | $PosArrayB = $this->scaleComputeY($SerieBData,array("AxisID"=>$AxisID)); |
| 3853 | 3450 | if ( count($PosArrayA) != count($PosArrayB) ) { return(0); } |
| 3854 | 3451 | |
| 3855 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3856 | - { |
|
| 3452 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3857 | 3453 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; } |
| 3858 | 3454 | $X = $this->GraphAreaX1 + $XMargin; $LastX = NULL; $LastY = NULL; |
| 3859 | 3455 | |
| 3860 | 3456 | $LastX = NULL; $LastY1 = NULL; $LastY2 = NULL; |
| 3861 | 3457 | $BoundsA = ""; $BoundsB = ""; |
| 3862 | - foreach($PosArrayA as $Key => $Y1) |
|
| 3863 | - { |
|
| 3458 | + foreach($PosArrayA as $Key => $Y1) { |
|
| 3864 | 3459 | $Y2 = $PosArrayB[$Key]; |
| 3865 | 3460 | |
| 3866 | 3461 | $BoundsA[] = $X; $BoundsA[] = $Y1; |
@@ -3874,21 +3469,17 @@ discard block |
||
| 3874 | 3469 | $Bounds = array_merge($BoundsA,$this->reversePlots($BoundsB)); |
| 3875 | 3470 | $this->drawPolygonChart($Bounds,array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"Alpha"=>$AreaAlpha)); |
| 3876 | 3471 | |
| 3877 | - for($i=0;$i<=count($BoundsA)-4;$i=$i+2) |
|
| 3878 | - { |
|
| 3472 | + for($i=0;$i<=count($BoundsA)-4;$i=$i+2) { |
|
| 3879 | 3473 | $this->drawLine($BoundsA[$i],$BoundsA[$i+1],$BoundsA[$i+2],$BoundsA[$i+3],array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha,"Ticks"=>$LineTicks)); |
| 3880 | 3474 | $this->drawLine($BoundsB[$i],$BoundsB[$i+1],$BoundsB[$i+2],$BoundsB[$i+3],array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha,"Ticks"=>$LineTicks)); |
| 3881 | 3475 | } |
| 3882 | - } |
|
| 3883 | - else |
|
| 3884 | - { |
|
| 3476 | + } else { |
|
| 3885 | 3477 | if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; } |
| 3886 | 3478 | $Y = $this->GraphAreaY1 + $XMargin; $LastX = NULL; $LastY = NULL; |
| 3887 | 3479 | |
| 3888 | 3480 | $LastY = NULL; $LastX1 = NULL; $LastX2 = NULL; |
| 3889 | 3481 | $BoundsA = ""; $BoundsB = ""; |
| 3890 | - foreach($PosArrayA as $Key => $X1) |
|
| 3891 | - { |
|
| 3482 | + foreach($PosArrayA as $Key => $X1) { |
|
| 3892 | 3483 | $X2 = $PosArrayB[$Key]; |
| 3893 | 3484 | |
| 3894 | 3485 | $BoundsA[] = $X1; $BoundsA[] = $Y; |
@@ -3902,8 +3493,7 @@ discard block |
||
| 3902 | 3493 | $Bounds = array_merge($BoundsA,$this->reversePlots($BoundsB)); |
| 3903 | 3494 | $this->drawPolygonChart($Bounds,array("R"=>$AreaR,"G"=>$AreaG,"B"=>$AreaB,"Alpha"=>$AreaAlpha)); |
| 3904 | 3495 | |
| 3905 | - for($i=0;$i<=count($BoundsA)-4;$i=$i+2) |
|
| 3906 | - { |
|
| 3496 | + for($i=0;$i<=count($BoundsA)-4;$i=$i+2) { |
|
| 3907 | 3497 | $this->drawLine($BoundsA[$i],$BoundsA[$i+1],$BoundsA[$i+2],$BoundsA[$i+3],array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha,"Ticks"=>$LineTicks)); |
| 3908 | 3498 | $this->drawLine($BoundsB[$i],$BoundsB[$i+1],$BoundsB[$i+2],$BoundsB[$i+3],array("R"=>$LineR,"G"=>$LineG,"B"=>$LineB,"Alpha"=>$LineAlpha,"Ticks"=>$LineTicks)); |
| 3909 | 3499 | } |
@@ -3911,8 +3501,7 @@ discard block |
||
| 3911 | 3501 | } |
| 3912 | 3502 | |
| 3913 | 3503 | /* Draw a step chart */ |
| 3914 | - function drawStepChart($Format=NULL) |
|
| 3915 | - { |
|
| 3504 | + function drawStepChart($Format=NULL) { |
|
| 3916 | 3505 | $BreakVoid = isset($Format["BreakVoid"]) ? $Format["BreakVoid"] : FALSE; |
| 3917 | 3506 | $ReCenter = isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE; |
| 3918 | 3507 | $VoidTicks = isset($Format["VoidTicks"]) ? $Format["VoidTicks"] : 4; |
@@ -3932,10 +3521,8 @@ discard block |
||
| 3932 | 3521 | |
| 3933 | 3522 | $Data = $this->DataSet->getData(); |
| 3934 | 3523 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 3935 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 3936 | - { |
|
| 3937 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 3938 | - { |
|
| 3524 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 3525 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 3939 | 3526 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"]; |
| 3940 | 3527 | |
| 3941 | 3528 | if (isset($Serie["Description"])) { $SerieDescription = $Serie["Description"]; } else { $SerieDescription = $SerieName; } |
@@ -3957,52 +3544,40 @@ discard block |
||
| 3957 | 3544 | |
| 3958 | 3545 | $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0; |
| 3959 | 3546 | |
| 3960 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 3961 | - { |
|
| 3547 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 3962 | 3548 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; } |
| 3963 | 3549 | $X = $this->GraphAreaX1 + $XMargin; $LastX = NULL; $LastY = NULL; |
| 3964 | 3550 | |
| 3965 | 3551 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 3966 | 3552 | $LastGoodY = NULL; $LastGoodX = NULL; $Init = FALSE; |
| 3967 | - foreach($PosArray as $Key => $Y) |
|
| 3968 | - { |
|
| 3969 | - if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) |
|
| 3970 | - { |
|
| 3553 | + foreach($PosArray as $Key => $Y) { |
|
| 3554 | + if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) { |
|
| 3971 | 3555 | if ( $Y <= $LastY ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; } |
| 3972 | 3556 | $this->drawText($X,$Y-$Offset-$Weight,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align)); |
| 3973 | 3557 | } |
| 3974 | 3558 | |
| 3975 | - if ( $Y != VOID && $LastX != NULL && $LastY != NULL ) |
|
| 3976 | - { |
|
| 3559 | + if ( $Y != VOID && $LastX != NULL && $LastY != NULL ) { |
|
| 3977 | 3560 | $this->drawLine($LastX,$LastY,$X,$LastY,$Color); |
| 3978 | 3561 | $this->drawLine($X,$LastY,$X,$Y,$Color); |
| 3979 | - if ( $ReCenter && $X+$XStep < $this->GraphAreaX2 - $XMargin ) |
|
| 3980 | - { |
|
| 3562 | + if ( $ReCenter && $X+$XStep < $this->GraphAreaX2 - $XMargin ) { |
|
| 3981 | 3563 | $this->drawLine($X,$Y,$X+$XStep,$Y,$Color); |
| 3982 | 3564 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X-$ImageMapPlotSize).",".floor($Y-$ImageMapPlotSize).",".floor($X+$XStep+$ImageMapPlotSize).",".floor($Y+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 3983 | - } |
|
| 3984 | - else |
|
| 3565 | + } else |
|
| 3985 | 3566 | { if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastX-$ImageMapPlotSize).",".floor($LastY-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($LastY+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } } |
| 3986 | 3567 | } |
| 3987 | 3568 | |
| 3988 | - if ( $Y != VOID && $LastY == NULL && $LastGoodY != NULL && !$BreakVoid ) |
|
| 3989 | - { |
|
| 3990 | - if ( $ReCenter ) |
|
| 3991 | - { |
|
| 3569 | + if ( $Y != VOID && $LastY == NULL && $LastGoodY != NULL && !$BreakVoid ) { |
|
| 3570 | + if ( $ReCenter ) { |
|
| 3992 | 3571 | $this->drawLine($LastGoodX+$XStep,$LastGoodY,$X,$LastGoodY,$BreakSettings); |
| 3993 | 3572 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastGoodX+$XStep-$ImageMapPlotSize).",".floor($LastGoodY-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($LastGoodY+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 3994 | - } |
|
| 3995 | - else |
|
| 3996 | - { |
|
| 3573 | + } else { |
|
| 3997 | 3574 | $this->drawLine($LastGoodX,$LastGoodY,$X,$LastGoodY,$BreakSettings); |
| 3998 | 3575 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastGoodX-$ImageMapPlotSize).",".floor($LastGoodY-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($LastGoodY+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 3999 | 3576 | } |
| 4000 | 3577 | |
| 4001 | 3578 | $this->drawLine($X,$LastGoodY,$X,$Y,$BreakSettings); |
| 4002 | 3579 | $LastGoodY = NULL; |
| 4003 | - } |
|
| 4004 | - elseif( !$BreakVoid && $LastGoodY == NULL && $Y != VOID ) |
|
| 4005 | - { |
|
| 3580 | + } elseif( !$BreakVoid && $LastGoodY == NULL && $Y != VOID ) { |
|
| 4006 | 3581 | $this->drawLine($this->GraphAreaX1 + $XMargin,$Y,$X,$Y,$BreakSettings); |
| 4007 | 3582 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($this->GraphAreaX1+$XMargin-$ImageMapPlotSize).",".floor($Y-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($Y+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4008 | 3583 | } |
@@ -4015,37 +3590,30 @@ discard block |
||
| 4015 | 3590 | if ( $LastX < $this->GraphAreaX1 + $XMargin ) { $LastX = $this->GraphAreaX1 + $XMargin; } |
| 4016 | 3591 | $X = $X + $XStep; |
| 4017 | 3592 | } |
| 4018 | - if ( $ReCenter ) |
|
| 4019 | - { |
|
| 3593 | + if ( $ReCenter ) { |
|
| 4020 | 3594 | $this->drawLine($LastX,$LastY,$this->GraphAreaX2 - $XMargin,$LastY,$Color); |
| 4021 | 3595 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastX-$ImageMapPlotSize).",".floor($LastY-$ImageMapPlotSize).",".floor($this->GraphAreaX2-$XMargin+$ImageMapPlotSize).",".floor($LastY+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4022 | 3596 | } |
| 4023 | - } |
|
| 4024 | - else |
|
| 4025 | - { |
|
| 3597 | + } else { |
|
| 4026 | 3598 | if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; } |
| 4027 | 3599 | $Y = $this->GraphAreaY1 + $XMargin; $LastX = NULL; $LastY = NULL; |
| 4028 | 3600 | |
| 4029 | 3601 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4030 | 3602 | $LastGoodY = NULL; $LastGoodX = NULL; $Init = FALSE; |
| 4031 | - foreach($PosArray as $Key => $X) |
|
| 4032 | - { |
|
| 4033 | - if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) |
|
| 4034 | - { |
|
| 3603 | + foreach($PosArray as $Key => $X) { |
|
| 3604 | + if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) { |
|
| 4035 | 3605 | if ( $X >= $LastX ) { $Align = TEXT_ALIGN_MIDDLELEFT; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_MIDDLERIGHT; $Offset = -$DisplayOffset; } |
| 4036 | 3606 | $this->drawText($X+$Offset+$Weight,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align)); |
| 4037 | 3607 | } |
| 4038 | 3608 | |
| 4039 | - if ( $X != VOID && $LastX != NULL && $LastY != NULL ) |
|
| 4040 | - { |
|
| 3609 | + if ( $X != VOID && $LastX != NULL && $LastY != NULL ) { |
|
| 4041 | 3610 | $this->drawLine($LastX,$LastY,$LastX,$Y,$Color); |
| 4042 | 3611 | $this->drawLine($LastX,$Y,$X,$Y,$Color); |
| 4043 | 3612 | |
| 4044 | 3613 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastX-$ImageMapPlotSize).",".floor($LastY-$ImageMapPlotSize).",".floor($LastX+$XStep+$ImageMapPlotSize).",".floor($Y+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4045 | 3614 | } |
| 4046 | 3615 | |
| 4047 | - if ( $X != VOID && $LastX == NULL && $LastGoodY != NULL && !$BreakVoid ) |
|
| 4048 | - { |
|
| 3616 | + if ( $X != VOID && $LastX == NULL && $LastGoodY != NULL && !$BreakVoid ) { |
|
| 4049 | 3617 | $this->drawLine($LastGoodX,$LastGoodY,$LastGoodX,$LastGoodY+$YStep,$Color); |
| 4050 | 3618 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastGoodX-$ImageMapPlotSize).",".floor($LastGoodY-$ImageMapPlotSize).",".floor($LastGoodX+$ImageMapPlotSize).",".floor($LastGoodY+$YStep+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4051 | 3619 | |
@@ -4054,9 +3622,7 @@ discard block |
||
| 4054 | 3622 | |
| 4055 | 3623 | $this->drawLine($LastGoodX,$Y,$X,$Y,$BreakSettings); |
| 4056 | 3624 | $LastGoodY = NULL; |
| 4057 | - } |
|
| 4058 | - elseif ( $X != VOID && $LastGoodY == NULL && !$BreakVoid ) |
|
| 4059 | - { |
|
| 3625 | + } elseif ( $X != VOID && $LastGoodY == NULL && !$BreakVoid ) { |
|
| 4060 | 3626 | $this->drawLine($X,$this->GraphAreaY1 + $XMargin,$X,$Y,$BreakSettings); |
| 4061 | 3627 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X-$ImageMapPlotSize).",".floor($this->GraphAreaY1+$XMargin-$ImageMapPlotSize).",".floor($X+$ImageMapPlotSize).",".floor($Y+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4062 | 3628 | } |
@@ -4069,8 +3635,7 @@ discard block |
||
| 4069 | 3635 | if ( $LastY < $this->GraphAreaY1 + $XMargin ) { $LastY = $this->GraphAreaY1 + $XMargin; } |
| 4070 | 3636 | $Y = $Y + $YStep; |
| 4071 | 3637 | } |
| 4072 | - if ( $ReCenter ) |
|
| 4073 | - { |
|
| 3638 | + if ( $ReCenter ) { |
|
| 4074 | 3639 | $this->drawLine($LastX,$LastY,$LastX,$this->GraphAreaY2 - $XMargin,$Color); |
| 4075 | 3640 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($LastX-$ImageMapPlotSize).",".floor($LastY-$ImageMapPlotSize).",".floor($LastX+$ImageMapPlotSize).",".floor($this->GraphAreaY2-$XMargin+$ImageMapPlotSize),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4076 | 3641 | } |
@@ -4080,8 +3645,7 @@ discard block |
||
| 4080 | 3645 | } |
| 4081 | 3646 | |
| 4082 | 3647 | /* Draw a step chart */ |
| 4083 | - function drawFilledStepChart($Format=NULL) |
|
| 4084 | - { |
|
| 3648 | + function drawFilledStepChart($Format=NULL) { |
|
| 4085 | 3649 | $ReCenter = isset($Format["ReCenter"]) ? $Format["ReCenter"] : TRUE; |
| 4086 | 3650 | $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] :FALSE; |
| 4087 | 3651 | $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; |
@@ -4096,10 +3660,8 @@ discard block |
||
| 4096 | 3660 | |
| 4097 | 3661 | $Data = $this->DataSet->getData(); |
| 4098 | 3662 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 4099 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 4100 | - { |
|
| 4101 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 4102 | - { |
|
| 3663 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 3664 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 4103 | 3665 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"]; |
| 4104 | 3666 | |
| 4105 | 3667 | if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } |
@@ -4117,8 +3679,7 @@ discard block |
||
| 4117 | 3679 | |
| 4118 | 3680 | $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0; |
| 4119 | 3681 | |
| 4120 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 4121 | - { |
|
| 3682 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 4122 | 3683 | if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; } |
| 4123 | 3684 | if ( $YZero < $this->GraphAreaY1+1 ) { $YZero = $this->GraphAreaY1+1; } |
| 4124 | 3685 | |
@@ -4129,10 +3690,8 @@ discard block |
||
| 4129 | 3690 | |
| 4130 | 3691 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4131 | 3692 | $LastGoodY = NULL; $LastGoodX = NULL; $Points = ""; $Init = FALSE; |
| 4132 | - foreach($PosArray as $Key => $Y) |
|
| 4133 | - { |
|
| 4134 | - if ( $Y == VOID && $LastX != NULL && $LastY != NULL && $Points !="" ) |
|
| 4135 | - { |
|
| 3693 | + foreach($PosArray as $Key => $Y) { |
|
| 3694 | + if ( $Y == VOID && $LastX != NULL && $LastY != NULL && $Points !="" ) { |
|
| 4136 | 3695 | $Points[] = $LastX; $Points[] = $LastY; |
| 4137 | 3696 | $Points[] = $X; $Points[] = $LastY; |
| 4138 | 3697 | $Points[] = $X; $Points[] = $YZero; |
@@ -4140,8 +3699,7 @@ discard block |
||
| 4140 | 3699 | $Points = ""; |
| 4141 | 3700 | } |
| 4142 | 3701 | |
| 4143 | - if ( $Y != VOID && $LastX != NULL && $LastY != NULL ) |
|
| 4144 | - { |
|
| 3702 | + if ( $Y != VOID && $LastX != NULL && $LastY != NULL ) { |
|
| 4145 | 3703 | if ( $Points == "") { $Points[] = $LastX; $Points[] = $YZero; } |
| 4146 | 3704 | $Points[] = $LastX; $Points[] = $LastY; |
| 4147 | 3705 | $Points[] = $X; $Points[] = $LastY; |
@@ -4157,18 +3715,14 @@ discard block |
||
| 4157 | 3715 | $X = $X + $XStep; |
| 4158 | 3716 | } |
| 4159 | 3717 | |
| 4160 | - if ( $ReCenter ) |
|
| 4161 | - { |
|
| 3718 | + if ( $ReCenter ) { |
|
| 4162 | 3719 | $Points[] = $LastX+$XStep/2; $Points[] = $LastY; |
| 4163 | 3720 | $Points[] = $LastX+$XStep/2; $Points[] = $YZero; |
| 4164 | - } |
|
| 4165 | - else |
|
| 3721 | + } else |
|
| 4166 | 3722 | { $Points[] = $LastX; $Points[] = $YZero; } |
| 4167 | 3723 | |
| 4168 | 3724 | $this->drawPolygon($Points,$Color); |
| 4169 | - } |
|
| 4170 | - else |
|
| 4171 | - { |
|
| 3725 | + } else { |
|
| 4172 | 3726 | if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; } |
| 4173 | 3727 | if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; } |
| 4174 | 3728 | |
@@ -4177,10 +3731,8 @@ discard block |
||
| 4177 | 3731 | |
| 4178 | 3732 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4179 | 3733 | $LastGoodY = NULL; $LastGoodX = NULL; $Points = ""; |
| 4180 | - foreach($PosArray as $Key => $X) |
|
| 4181 | - { |
|
| 4182 | - if ( $X == VOID && $LastX != NULL && $LastY != NULL && $Points !="" ) |
|
| 4183 | - { |
|
| 3734 | + foreach($PosArray as $Key => $X) { |
|
| 3735 | + if ( $X == VOID && $LastX != NULL && $LastY != NULL && $Points !="" ) { |
|
| 4184 | 3736 | $Points[] = $LastX; $Points[] = $LastY; |
| 4185 | 3737 | $Points[] = $LastX; $Points[] = $Y; |
| 4186 | 3738 | $Points[] = $YZero; $Points[] = $Y; |
@@ -4188,8 +3740,7 @@ discard block |
||
| 4188 | 3740 | $Points = ""; |
| 4189 | 3741 | } |
| 4190 | 3742 | |
| 4191 | - if ( $X != VOID && $LastX != NULL && $LastY != NULL ) |
|
| 4192 | - { |
|
| 3743 | + if ( $X != VOID && $LastX != NULL && $LastY != NULL ) { |
|
| 4193 | 3744 | if ( $Points == "") { $Points[] = $YZero; $Points[] = $LastY; } |
| 4194 | 3745 | $Points[] = $LastX; $Points[] = $LastY; |
| 4195 | 3746 | $Points[] = $LastX; $Points[] = $Y; |
@@ -4205,12 +3756,10 @@ discard block |
||
| 4205 | 3756 | $Y = $Y + $YStep; |
| 4206 | 3757 | } |
| 4207 | 3758 | |
| 4208 | - if ( $ReCenter ) |
|
| 4209 | - { |
|
| 3759 | + if ( $ReCenter ) { |
|
| 4210 | 3760 | $Points[] = $LastX; $Points[] = $LastY+$YStep/2; |
| 4211 | 3761 | $Points[] = $YZero; $Points[] = $LastY+$YStep/2; |
| 4212 | - } |
|
| 4213 | - else |
|
| 3762 | + } else |
|
| 4214 | 3763 | { $Points[] = $YZero; $Points[] = $LastY; } |
| 4215 | 3764 | |
| 4216 | 3765 | $this->drawPolygon($Points,$Color); |
@@ -4220,8 +3769,7 @@ discard block |
||
| 4220 | 3769 | } |
| 4221 | 3770 | |
| 4222 | 3771 | /* Draw an area chart */ |
| 4223 | - function drawAreaChart($Format=NULL) |
|
| 4224 | - { |
|
| 3772 | + function drawAreaChart($Format=NULL) { |
|
| 4225 | 3773 | $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; |
| 4226 | 3774 | $DisplayOffset = isset($Format["DisplayOffset"]) ? $Format["DisplayOffset"] : 2; |
| 4227 | 3775 | $DisplayColor = isset($Format["DisplayColor"]) ? $Format["DisplayColor"] : DISPLAY_MANUAL; |
@@ -4237,10 +3785,8 @@ discard block |
||
| 4237 | 3785 | $Data = $this->DataSet->getData(); |
| 4238 | 3786 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 4239 | 3787 | |
| 4240 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 4241 | - { |
|
| 4242 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 4243 | - { |
|
| 3788 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 3789 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 4244 | 3790 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; |
| 4245 | 3791 | if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } |
| 4246 | 3792 | |
@@ -4252,10 +3798,8 @@ discard block |
||
| 4252 | 3798 | $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); |
| 4253 | 3799 | $YZero = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"])); |
| 4254 | 3800 | |
| 4255 | - if ( $Threshold != NULL ) |
|
| 4256 | - { |
|
| 4257 | - foreach($Threshold as $Key => $Params) |
|
| 4258 | - { |
|
| 3801 | + if ( $Threshold != NULL ) { |
|
| 3802 | + foreach($Threshold as $Key => $Params) { |
|
| 4259 | 3803 | $Threshold[$Key]["MinX"] = $this->scaleComputeY($Params["Min"],array("AxisID"=>$Serie["Axis"])); |
| 4260 | 3804 | $Threshold[$Key]["MaxX"] = $this->scaleComputeY($Params["Max"],array("AxisID"=>$Serie["Axis"])); |
| 4261 | 3805 | } |
@@ -4263,8 +3807,7 @@ discard block |
||
| 4263 | 3807 | |
| 4264 | 3808 | $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0; |
| 4265 | 3809 | |
| 4266 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 4267 | - { |
|
| 3810 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 4268 | 3811 | if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; } |
| 4269 | 3812 | |
| 4270 | 3813 | $Areas = ""; $AreaID = 0; |
@@ -4275,28 +3818,21 @@ discard block |
||
| 4275 | 3818 | $X = $this->GraphAreaX1 + $XMargin; $LastX = NULL; $LastY = NULL; |
| 4276 | 3819 | |
| 4277 | 3820 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4278 | - foreach($PosArray as $Key => $Y) |
|
| 4279 | - { |
|
| 4280 | - if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) |
|
| 4281 | - { |
|
| 3821 | + foreach($PosArray as $Key => $Y) { |
|
| 3822 | + if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) { |
|
| 4282 | 3823 | if ( $Serie["Data"][$Key] > 0 ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; } |
| 4283 | 3824 | $this->drawText($X,$Y-$Offset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align)); |
| 4284 | 3825 | } |
| 4285 | 3826 | |
| 4286 | - if ( $Y == VOID && isset($Areas[$AreaID]) ) |
|
| 4287 | - { |
|
| 3827 | + if ( $Y == VOID && isset($Areas[$AreaID]) ) { |
|
| 4288 | 3828 | if($LastX == NULL) |
| 4289 | - { $Areas[$AreaID][] = $X; } |
|
| 4290 | - else |
|
| 3829 | + { $Areas[$AreaID][] = $X; } else |
|
| 4291 | 3830 | { $Areas[$AreaID][] = $LastX; } |
| 4292 | 3831 | |
| 4293 | 3832 | if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaY2-1; } |
| 4294 | 3833 | $AreaID++; |
| 4295 | - } |
|
| 4296 | - elseif ($Y != VOID) |
|
| 4297 | - { |
|
| 4298 | - if ( !isset($Areas[$AreaID]) ) |
|
| 4299 | - { |
|
| 3834 | + } elseif ($Y != VOID) { |
|
| 3835 | + if ( !isset($Areas[$AreaID]) ) { |
|
| 4300 | 3836 | $Areas[$AreaID][] = $X; |
| 4301 | 3837 | if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaY2-1; } |
| 4302 | 3838 | } |
@@ -4312,33 +3848,29 @@ discard block |
||
| 4312 | 3848 | if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaY2-1; } |
| 4313 | 3849 | |
| 4314 | 3850 | /* Handle shadows in the areas */ |
| 4315 | - if ( $this->Shadow ) |
|
| 4316 | - { |
|
| 3851 | + if ( $this->Shadow ) { |
|
| 4317 | 3852 | $ShadowArea = ""; |
| 4318 | - foreach($Areas as $Key => $Points) |
|
| 4319 | - { |
|
| 3853 | + foreach($Areas as $Key => $Points) { |
|
| 4320 | 3854 | $ShadowArea[$Key] = ""; |
| 4321 | - foreach($Points as $Key2 => $Value) |
|
| 4322 | - { |
|
| 3855 | + foreach($Points as $Key2 => $Value) { |
|
| 4323 | 3856 | if ( $Key2 % 2 == 0 ) |
| 4324 | - { $ShadowArea[$Key][] = $Value + $this->ShadowX; } |
|
| 4325 | - else |
|
| 3857 | + { $ShadowArea[$Key][] = $Value + $this->ShadowX; } else |
|
| 4326 | 3858 | { $ShadowArea[$Key][] = $Value + $this->ShadowY; } |
| 4327 | 3859 | } |
| 4328 | 3860 | } |
| 4329 | 3861 | |
| 4330 | - foreach($ShadowArea as $Key => $Points) |
|
| 4331 | - $this->drawPolygonChart($Points,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa)); |
|
| 3862 | + foreach($ShadowArea as $Key => $Points) { |
|
| 3863 | + $this->drawPolygonChart($Points,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa)); |
|
| 3864 | + } |
|
| 4332 | 3865 | } |
| 4333 | 3866 | |
| 4334 | 3867 | $Alpha = $ForceTransparency != NULL ? $ForceTransparency : $Alpha; |
| 4335 | 3868 | $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Threshold"=>$Threshold); |
| 4336 | 3869 | |
| 4337 | - foreach($Areas as $Key => $Points) |
|
| 4338 | - $this->drawPolygonChart($Points,$Color); |
|
| 4339 | - } |
|
| 4340 | - else |
|
| 4341 | - { |
|
| 3870 | + foreach($Areas as $Key => $Points) { |
|
| 3871 | + $this->drawPolygonChart($Points,$Color); |
|
| 3872 | + } |
|
| 3873 | + } else { |
|
| 4342 | 3874 | if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; } |
| 4343 | 3875 | if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; } |
| 4344 | 3876 | |
@@ -4350,29 +3882,22 @@ discard block |
||
| 4350 | 3882 | $Y = $this->GraphAreaY1 + $XMargin; $LastX = NULL; $LastY = NULL; |
| 4351 | 3883 | |
| 4352 | 3884 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4353 | - foreach($PosArray as $Key => $X) |
|
| 4354 | - { |
|
| 4355 | - if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) |
|
| 4356 | - { |
|
| 3885 | + foreach($PosArray as $Key => $X) { |
|
| 3886 | + if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) { |
|
| 4357 | 3887 | if ( $Serie["Data"][$Key] > 0 ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; } |
| 4358 | 3888 | $this->drawText($X+$Offset,$Y,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("Angle"=>270,"R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align)); |
| 4359 | 3889 | } |
| 4360 | 3890 | |
| 4361 | - if ( $X == VOID && isset($Areas[$AreaID]) ) |
|
| 4362 | - { |
|
| 3891 | + if ( $X == VOID && isset($Areas[$AreaID]) ) { |
|
| 4363 | 3892 | if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaX1+1; } |
| 4364 | 3893 | |
| 4365 | 3894 | if($LastY == NULL) |
| 4366 | - { $Areas[$AreaID][] = $Y; } |
|
| 4367 | - else |
|
| 3895 | + { $Areas[$AreaID][] = $Y; } else |
|
| 4368 | 3896 | { $Areas[$AreaID][] = $LastY; } |
| 4369 | 3897 | |
| 4370 | 3898 | $AreaID++; |
| 4371 | - } |
|
| 4372 | - elseif ($X != VOID) |
|
| 4373 | - { |
|
| 4374 | - if ( !isset($Areas[$AreaID]) ) |
|
| 4375 | - { |
|
| 3899 | + } elseif ($X != VOID) { |
|
| 3900 | + if ( !isset($Areas[$AreaID]) ) { |
|
| 4376 | 3901 | if ( $AroundZero ) { $Areas[$AreaID][] = $YZero; } else { $Areas[$AreaID][] = $this->GraphAreaX1+1; } |
| 4377 | 3902 | $Areas[$AreaID][] = $Y; |
| 4378 | 3903 | } |
@@ -4388,30 +3913,28 @@ discard block |
||
| 4388 | 3913 | $Areas[$AreaID][] = $LastY; |
| 4389 | 3914 | |
| 4390 | 3915 | /* Handle shadows in the areas */ |
| 4391 | - if ( $this->Shadow ) |
|
| 4392 | - { |
|
| 3916 | + if ( $this->Shadow ) { |
|
| 4393 | 3917 | $ShadowArea = ""; |
| 4394 | - foreach($Areas as $Key => $Points) |
|
| 4395 | - { |
|
| 3918 | + foreach($Areas as $Key => $Points) { |
|
| 4396 | 3919 | $ShadowArea[$Key] = ""; |
| 4397 | - foreach($Points as $Key2 => $Value) |
|
| 4398 | - { |
|
| 3920 | + foreach($Points as $Key2 => $Value) { |
|
| 4399 | 3921 | if ( $Key2 % 2 == 0 ) |
| 4400 | - { $ShadowArea[$Key][] = $Value + $this->ShadowX; } |
|
| 4401 | - else |
|
| 3922 | + { $ShadowArea[$Key][] = $Value + $this->ShadowX; } else |
|
| 4402 | 3923 | { $ShadowArea[$Key][] = $Value + $this->ShadowY; } |
| 4403 | 3924 | } |
| 4404 | 3925 | } |
| 4405 | 3926 | |
| 4406 | - foreach($ShadowArea as $Key => $Points) |
|
| 4407 | - $this->drawPolygonChart($Points,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa)); |
|
| 3927 | + foreach($ShadowArea as $Key => $Points) { |
|
| 3928 | + $this->drawPolygonChart($Points,array("R"=>$this->ShadowR,"G"=>$this->ShadowG,"B"=>$this->ShadowB,"Alpha"=>$this->Shadowa)); |
|
| 3929 | + } |
|
| 4408 | 3930 | } |
| 4409 | 3931 | |
| 4410 | 3932 | $Alpha = $ForceTransparency != NULL ? $ForceTransparency : $Alpha; |
| 4411 | 3933 | $Color = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Threshold"=>$Threshold); |
| 4412 | 3934 | |
| 4413 | - foreach($Areas as $Key => $Points) |
|
| 4414 | - $this->drawPolygonChart($Points,$Color); |
|
| 3935 | + foreach($Areas as $Key => $Points) { |
|
| 3936 | + $this->drawPolygonChart($Points,$Color); |
|
| 3937 | + } |
|
| 4415 | 3938 | } |
| 4416 | 3939 | } |
| 4417 | 3940 | } |
@@ -4419,8 +3942,7 @@ discard block |
||
| 4419 | 3942 | |
| 4420 | 3943 | |
| 4421 | 3944 | /* Draw a bar chart */ |
| 4422 | - function drawBarChart($Format=NULL) |
|
| 4423 | - { |
|
| 3945 | + function drawBarChart($Format=NULL) { |
|
| 4424 | 3946 | $Floating0Serie = isset($Format["Floating0Serie"]) ? $Format["Floating0Serie"] : NULL; |
| 4425 | 3947 | $Floating0Value = isset($Format["Floating0Value"]) ? $Format["Floating0Value"] : NULL; |
| 4426 | 3948 | $Draw0Line = isset($Format["Draw0Line"]) ? $Format["Draw0Line"] : FALSE; |
@@ -4466,8 +3988,7 @@ discard block |
||
| 4466 | 3988 | $Data = $this->DataSet->getData(); |
| 4467 | 3989 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 4468 | 3990 | |
| 4469 | - if ( $OverrideColors != NULL ) |
|
| 4470 | - { |
|
| 3991 | + if ( $OverrideColors != NULL ) { |
|
| 4471 | 3992 | $OverrideColors = $this->validatePalette($OverrideColors,$OverrideSurrounding); |
| 4472 | 3993 | $this->DataSet->saveExtendedData("Palette",$OverrideColors); |
| 4473 | 3994 | } |
@@ -4476,10 +3997,8 @@ discard block |
||
| 4476 | 3997 | |
| 4477 | 3998 | $SeriesCount = $this->countDrawableSeries(); |
| 4478 | 3999 | $CurrentSerie = 0; |
| 4479 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 4480 | - { |
|
| 4481 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 4482 | - { |
|
| 4000 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 4001 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 4483 | 4002 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; |
| 4484 | 4003 | if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = $R; $DisplayG = $G; $DisplayB = $B; } |
| 4485 | 4004 | if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; } |
@@ -4497,12 +4016,10 @@ discard block |
||
| 4497 | 4016 | $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); |
| 4498 | 4017 | |
| 4499 | 4018 | if ( $Floating0Value != NULL ) |
| 4500 | - { $YZero = $this->scaleComputeY($Floating0Value,array("AxisID"=>$Serie["Axis"])); } |
|
| 4501 | - else |
|
| 4019 | + { $YZero = $this->scaleComputeY($Floating0Value,array("AxisID"=>$Serie["Axis"])); } else |
|
| 4502 | 4020 | { $YZero = $this->scaleComputeY(0,array("AxisID"=>$Serie["Axis"])); } |
| 4503 | 4021 | |
| 4504 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 4505 | - { |
|
| 4022 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 4506 | 4023 | if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; } |
| 4507 | 4024 | if ( $YZero < $this->GraphAreaY1+1 ) { $YZero = $this->GraphAreaY1+1; } |
| 4508 | 4025 | |
@@ -4522,13 +4039,10 @@ discard block |
||
| 4522 | 4039 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4523 | 4040 | |
| 4524 | 4041 | $ID = 0; |
| 4525 | - foreach($PosArray as $Key => $Y2) |
|
| 4526 | - { |
|
| 4527 | - if ( $Floating0Serie != NULL ) |
|
| 4528 | - { |
|
| 4042 | + foreach($PosArray as $Key => $Y2) { |
|
| 4043 | + if ( $Floating0Serie != NULL ) { |
|
| 4529 | 4044 | if ( isset($Data["Series"][$Floating0Serie]["Data"][$Key]) ) |
| 4530 | - { $Value = $Data["Series"][$Floating0Serie]["Data"][$Key]; } |
|
| 4531 | - else |
|
| 4045 | + { $Value = $Data["Series"][$Floating0Serie]["Data"][$Key]; } else |
|
| 4532 | 4046 | { $Value = 0; } |
| 4533 | 4047 | |
| 4534 | 4048 | $YZero = $this->scaleComputeY($Value,array("AxisID"=>$Serie["Axis"])); |
@@ -4541,42 +4055,33 @@ discard block |
||
| 4541 | 4055 | if ( $OverrideColors != NULL ) |
| 4542 | 4056 | { if ( isset($OverrideColors[$ID]) ) { $Color = array("R"=>$OverrideColors[$ID]["R"],"G"=>$OverrideColors[$ID]["G"],"B"=>$OverrideColors[$ID]["B"],"Alpha"=>$OverrideColors[$ID]["Alpha"],"BorderR"=>$OverrideColors[$ID]["BorderR"],"BorderG"=>$OverrideColors[$ID]["BorderG"],"BorderB"=>$OverrideColors[$ID]["BorderB"]); } else { $Color = $this->getRandomColor(); } } |
| 4543 | 4057 | |
| 4544 | - if ( $Y2 != VOID ) |
|
| 4545 | - { |
|
| 4058 | + if ( $Y2 != VOID ) { |
|
| 4546 | 4059 | $BarHeight = $Y1 - $Y2; |
| 4547 | 4060 | |
| 4548 | - if ( $Serie["Data"][$Key] == 0 ) |
|
| 4549 | - { |
|
| 4061 | + if ( $Serie["Data"][$Key] == 0 ) { |
|
| 4550 | 4062 | $this->drawLine($X+$XOffset+$XSpace,$Y1,$X+$XOffset+$XSize-$XSpace,$Y1,$Color); |
| 4551 | 4063 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X+$XOffset+$XSpace).",".floor($Y1-1).",".floor($X+$XOffset+$XSize-$XSpace).",".floor($Y1+1),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4552 | - } |
|
| 4553 | - else |
|
| 4554 | - { |
|
| 4064 | + } else { |
|
| 4555 | 4065 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X+$XOffset+$XSpace).",".floor($Y1).",".floor($X+$XOffset+$XSize-$XSpace).",".floor($Y2),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4556 | 4066 | |
| 4557 | 4067 | if ( $Rounded ) |
| 4558 | 4068 | $this->drawRoundedFilledRectangle($X+$XOffset+$XSpace,$Y1,$X+$XOffset+$XSize-$XSpace,$Y2,$RoundRadius,$Color); |
| 4559 | - else |
|
| 4560 | - { |
|
| 4069 | + else { |
|
| 4561 | 4070 | $this->drawFilledRectangle($X+$XOffset+$XSpace,$Y1,$X+$XOffset+$XSize-$XSpace,$Y2,$Color); |
| 4562 | 4071 | |
| 4563 | 4072 | if ( $InnerColor != NULL ) { $this->drawRectangle($X+$XOffset+$XSpace+1,min($Y1,$Y2)+1,$X+$XOffset+$XSize-$XSpace-1,max($Y1,$Y2)-1,$InnerColor); } |
| 4564 | 4073 | |
| 4565 | - if ( $Gradient ) |
|
| 4566 | - { |
|
| 4074 | + if ( $Gradient ) { |
|
| 4567 | 4075 | $this->Shadow = FALSE; |
| 4568 | 4076 | |
| 4569 | - if ( $GradientMode == GRADIENT_SIMPLE ) |
|
| 4570 | - { |
|
| 4077 | + if ( $GradientMode == GRADIENT_SIMPLE ) { |
|
| 4571 | 4078 | if ( $Serie["Data"][$Key] >= 0 ) |
| 4572 | 4079 | $GradienColor = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha); |
| 4573 | 4080 | else |
| 4574 | 4081 | $GradienColor = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha); |
| 4575 | 4082 | |
| 4576 | 4083 | $this->drawGradientArea($X+$XOffset+$XSpace,$Y1,$X+$XOffset+$XSize-$XSpace,$Y2,DIRECTION_VERTICAL,$GradienColor); |
| 4577 | - } |
|
| 4578 | - elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) |
|
| 4579 | - { |
|
| 4084 | + } elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) { |
|
| 4580 | 4085 | $GradienColor1 = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha); |
| 4581 | 4086 | $GradienColor2 = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha); |
| 4582 | 4087 | $XSpan = floor($XSize / 3); |
@@ -4588,8 +4093,7 @@ discard block |
||
| 4588 | 4093 | } |
| 4589 | 4094 | } |
| 4590 | 4095 | |
| 4591 | - if ( $Draw0Line ) |
|
| 4592 | - { |
|
| 4096 | + if ( $Draw0Line ) { |
|
| 4593 | 4097 | $Line0Color = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20); |
| 4594 | 4098 | |
| 4595 | 4099 | if ( abs($Y1 - $Y2) > 3 ) { $Line0Width = 3; } else { $Line0Width = 1; } |
@@ -4600,23 +4104,19 @@ discard block |
||
| 4600 | 4104 | } |
| 4601 | 4105 | } |
| 4602 | 4106 | |
| 4603 | - if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) |
|
| 4604 | - { |
|
| 4107 | + if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) { |
|
| 4605 | 4108 | if ( $DisplayShadow ) { $this->Shadow = TRUE; } |
| 4606 | 4109 | |
| 4607 | 4110 | $Caption = $this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit); |
| 4608 | 4111 | $TxtPos = $this->getTextBox(0,0,$DisplayFont,$DisplaySize,90,$Caption); |
| 4609 | 4112 | $TxtHeight = $TxtPos[0]["Y"] - $TxtPos[1]["Y"] + $TxtMargin; |
| 4610 | 4113 | |
| 4611 | - if ( $DisplayPos == LABEL_POS_INSIDE && abs($TxtHeight) < abs($BarHeight) ) |
|
| 4612 | - { |
|
| 4114 | + if ( $DisplayPos == LABEL_POS_INSIDE && abs($TxtHeight) < abs($BarHeight) ) { |
|
| 4613 | 4115 | $CenterX = (($X+$XOffset+$XSize-$XSpace)-($X+$XOffset+$XSpace))/2 + $X+$XOffset+$XSpace; |
| 4614 | 4116 | $CenterY = ($Y2-$Y1)/2 + $Y1; |
| 4615 | 4117 | |
| 4616 | 4118 | $this->drawText($CenterX,$CenterY,$Caption,array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"Angle"=>90)); |
| 4617 | - } |
|
| 4618 | - else |
|
| 4619 | - { |
|
| 4119 | + } else { |
|
| 4620 | 4120 | if ( $Serie["Data"][$Key] >= 0 ) { $Align = TEXT_ALIGN_BOTTOMMIDDLE; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_TOPMIDDLE; $Offset = -$DisplayOffset; } |
| 4621 | 4121 | $this->drawText($X+$XOffset+$XSize/2,$Y2-$Offset,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align,"FontSize"=>$DisplaySize)); |
| 4622 | 4122 | } |
@@ -4628,9 +4128,7 @@ discard block |
||
| 4628 | 4128 | $X = $X + $XStep; |
| 4629 | 4129 | $ID++; |
| 4630 | 4130 | } |
| 4631 | - } |
|
| 4632 | - else |
|
| 4633 | - { |
|
| 4131 | + } else { |
|
| 4634 | 4132 | if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; } |
| 4635 | 4133 | if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; } |
| 4636 | 4134 | |
@@ -4651,10 +4149,8 @@ discard block |
||
| 4651 | 4149 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4652 | 4150 | |
| 4653 | 4151 | $ID = 0 ; |
| 4654 | - foreach($PosArray as $Key => $X2) |
|
| 4655 | - { |
|
| 4656 | - if ( $Floating0Serie != NULL ) |
|
| 4657 | - { |
|
| 4152 | + foreach($PosArray as $Key => $X2) { |
|
| 4153 | + if ( $Floating0Serie != NULL ) { |
|
| 4658 | 4154 | if ( isset($Data["Series"][$Floating0Serie]["Data"][$Key]) ) |
| 4659 | 4155 | $Value = $Data["Series"][$Floating0Serie]["Data"][$Key]; |
| 4660 | 4156 | else { $Value = 0; } |
@@ -4668,42 +4164,33 @@ discard block |
||
| 4668 | 4164 | if ( $OverrideColors != NULL ) |
| 4669 | 4165 | { if ( isset($OverrideColors[$ID]) ) { $Color = array("R"=>$OverrideColors[$ID]["R"],"G"=>$OverrideColors[$ID]["G"],"B"=>$OverrideColors[$ID]["B"],"Alpha"=>$OverrideColors[$ID]["Alpha"],"BorderR"=>$OverrideColors[$ID]["BorderR"],"BorderG"=>$OverrideColors[$ID]["BorderG"],"BorderB"=>$OverrideColors[$ID]["BorderB"]); } else { $Color = $this->getRandomColor(); } } |
| 4670 | 4166 | |
| 4671 | - if ( $X2 != VOID ) |
|
| 4672 | - { |
|
| 4167 | + if ( $X2 != VOID ) { |
|
| 4673 | 4168 | $BarWidth = $X2 - $X1; |
| 4674 | 4169 | |
| 4675 | - if ( $Serie["Data"][$Key] == 0 ) |
|
| 4676 | - { |
|
| 4170 | + if ( $Serie["Data"][$Key] == 0 ) { |
|
| 4677 | 4171 | $this->drawLine($X1,$Y+$YOffset+$YSpace,$X1,$Y+$YOffset+$YSize-$YSpace,$Color); |
| 4678 | 4172 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X1-1).",".floor($Y+$YOffset+$YSpace).",".floor($X1+1).",".floor($Y+$YOffset+$YSize-$YSpace),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4679 | - } |
|
| 4680 | - else |
|
| 4681 | - { |
|
| 4173 | + } else { |
|
| 4682 | 4174 | if ( $RecordImageMap ) { $this->addToImageMap("RECT",floor($X1).",".floor($Y+$YOffset+$YSpace).",".floor($X2).",".floor($Y+$YOffset+$YSize-$YSpace),$this->toHTMLColor($R,$G,$B),$SerieDescription,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit)); } |
| 4683 | 4175 | |
| 4684 | 4176 | if ( $Rounded ) |
| 4685 | 4177 | $this->drawRoundedFilledRectangle($X1+1,$Y+$YOffset+$YSpace,$X2,$Y+$YOffset+$YSize-$YSpace,$RoundRadius,$Color); |
| 4686 | - else |
|
| 4687 | - { |
|
| 4178 | + else { |
|
| 4688 | 4179 | $this->drawFilledRectangle($X1,$Y+$YOffset+$YSpace,$X2,$Y+$YOffset+$YSize-$YSpace,$Color); |
| 4689 | 4180 | |
| 4690 | 4181 | if ( $InnerColor != NULL ) { $this->drawRectangle(min($X1,$X2)+1,$Y+$YOffset+$YSpace+1,max($X1,$X2)-1,$Y+$YOffset+$YSize-$YSpace-1,$InnerColor); } |
| 4691 | 4182 | |
| 4692 | - if ( $Gradient ) |
|
| 4693 | - { |
|
| 4183 | + if ( $Gradient ) { |
|
| 4694 | 4184 | $this->Shadow = FALSE; |
| 4695 | 4185 | |
| 4696 | - if ( $GradientMode == GRADIENT_SIMPLE ) |
|
| 4697 | - { |
|
| 4186 | + if ( $GradientMode == GRADIENT_SIMPLE ) { |
|
| 4698 | 4187 | if ( $Serie["Data"][$Key] >= 0 ) |
| 4699 | 4188 | $GradienColor = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha); |
| 4700 | 4189 | else |
| 4701 | 4190 | $GradienColor = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha); |
| 4702 | 4191 | |
| 4703 | 4192 | $this->drawGradientArea($X1,$Y+$YOffset+$YSpace,$X2,$Y+$YOffset+$YSize-$YSpace,DIRECTION_HORIZONTAL,$GradienColor); |
| 4704 | - } |
|
| 4705 | - elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) |
|
| 4706 | - { |
|
| 4193 | + } elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) { |
|
| 4707 | 4194 | $GradienColor1 = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha); |
| 4708 | 4195 | $GradienColor2 = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha); |
| 4709 | 4196 | $YSpan = floor($YSize / 3); |
@@ -4715,8 +4202,7 @@ discard block |
||
| 4715 | 4202 | } |
| 4716 | 4203 | } |
| 4717 | 4204 | |
| 4718 | - if ( $Draw0Line ) |
|
| 4719 | - { |
|
| 4205 | + if ( $Draw0Line ) { |
|
| 4720 | 4206 | $Line0Color = array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>20); |
| 4721 | 4207 | |
| 4722 | 4208 | if ( abs($X1 - $X2) > 3 ) { $Line0Width = 3; } else { $Line0Width = 1; } |
@@ -4727,23 +4213,19 @@ discard block |
||
| 4727 | 4213 | } |
| 4728 | 4214 | } |
| 4729 | 4215 | |
| 4730 | - if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) |
|
| 4731 | - { |
|
| 4216 | + if ( $DisplayValues && $Serie["Data"][$Key] != VOID ) { |
|
| 4732 | 4217 | if ( $DisplayShadow ) { $this->Shadow = TRUE; } |
| 4733 | 4218 | |
| 4734 | 4219 | $Caption = $this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit); |
| 4735 | 4220 | $TxtPos = $this->getTextBox(0,0,$DisplayFont,$DisplaySize,0,$Caption); |
| 4736 | 4221 | $TxtWidth = $TxtPos[1]["X"] - $TxtPos[0]["X"] + $TxtMargin; |
| 4737 | 4222 | |
| 4738 | - if ( $DisplayPos == LABEL_POS_INSIDE && abs($TxtWidth) < abs($BarWidth) ) |
|
| 4739 | - { |
|
| 4223 | + if ( $DisplayPos == LABEL_POS_INSIDE && abs($TxtWidth) < abs($BarWidth) ) { |
|
| 4740 | 4224 | $CenterX = ($X2-$X1)/2 + $X1; |
| 4741 | 4225 | $CenterY = (($Y+$YOffset+$YSize-$YSpace)-($Y+$YOffset+$YSpace))/2 + ($Y+$YOffset+$YSpace); |
| 4742 | 4226 | |
| 4743 | 4227 | $this->drawText($CenterX,$CenterY,$Caption,array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize)); |
| 4744 | - } |
|
| 4745 | - else |
|
| 4746 | - { |
|
| 4228 | + } else { |
|
| 4747 | 4229 | if ( $Serie["Data"][$Key] >= 0 ) { $Align = TEXT_ALIGN_MIDDLELEFT; $Offset = $DisplayOffset; } else { $Align = TEXT_ALIGN_MIDDLERIGHT; $Offset = -$DisplayOffset; } |
| 4748 | 4230 | $this->drawText($X2+$Offset,$Y+$YOffset+$YSize/2,$Caption,array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>$Align,"FontSize"=>$DisplaySize)); |
| 4749 | 4231 | } |
@@ -4761,8 +4243,7 @@ discard block |
||
| 4761 | 4243 | } |
| 4762 | 4244 | |
| 4763 | 4245 | /* Draw a bar chart */ |
| 4764 | - function drawStackedBarChart($Format=NULL) |
|
| 4765 | - { |
|
| 4246 | + function drawStackedBarChart($Format=NULL) { |
|
| 4766 | 4247 | $DisplayValues = isset($Format["DisplayValues"]) ? $Format["DisplayValues"] : FALSE; |
| 4767 | 4248 | $DisplayOrientation = isset($Format["DisplayOrientation"]) ? $Format["DisplayOrientation"] : ORIENTATION_AUTO; |
| 4768 | 4249 | $DisplayRound = isset($Format["DisplayRound"]) ? $Format["DisplayRound"] : 0; |
@@ -4803,10 +4284,8 @@ discard block |
||
| 4803 | 4284 | $RestoreShadow = $this->Shadow; |
| 4804 | 4285 | |
| 4805 | 4286 | $LastX = ""; $LastY = ""; |
| 4806 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 4807 | - { |
|
| 4808 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 4809 | - { |
|
| 4287 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 4288 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 4810 | 4289 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; |
| 4811 | 4290 | if ( $DisplayColor == DISPLAY_AUTO ) { $DisplayR = 255; $DisplayG = 255; $DisplayB = 255; } |
| 4812 | 4291 | if ( $Surrounding != NULL ) { $BorderR = $R+$Surrounding; $BorderG = $G+$Surrounding; $BorderB = $B+$Surrounding; } |
@@ -4827,8 +4306,7 @@ discard block |
||
| 4827 | 4306 | |
| 4828 | 4307 | $Color = array("TransCorner"=>TRUE,"R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"BorderR"=>$BorderR,"BorderG"=>$BorderG,"BorderB"=>$BorderB); |
| 4829 | 4308 | |
| 4830 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 4831 | - { |
|
| 4309 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 4832 | 4310 | if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; } |
| 4833 | 4311 | if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; } |
| 4834 | 4312 | |
@@ -4839,10 +4317,8 @@ discard block |
||
| 4839 | 4317 | $XOffset = -($XSize/2); |
| 4840 | 4318 | |
| 4841 | 4319 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4842 | - foreach($PosArray as $Key => $Height) |
|
| 4843 | - { |
|
| 4844 | - if ( $Height != VOID && $Serie["Data"][$Key] != 0 ) |
|
| 4845 | - { |
|
| 4320 | + foreach($PosArray as $Key => $Height) { |
|
| 4321 | + if ( $Height != VOID && $Serie["Data"][$Key] != 0 ) { |
|
| 4846 | 4322 | if ( $Serie["Data"][$Key] > 0 ) { $Pos = "+"; } else { $Pos = "-"; } |
| 4847 | 4323 | |
| 4848 | 4324 | if ( !isset($LastY[$Key] ) ) { $LastY[$Key] = ""; } |
@@ -4858,23 +4334,18 @@ discard block |
||
| 4858 | 4334 | |
| 4859 | 4335 | if ( $Rounded ) |
| 4860 | 4336 | $this->drawRoundedFilledRectangle($X+$XOffset,$Y1-$YSpaceUp+$YSpaceDown,$X+$XOffset+$XSize,$Y2,$RoundRadius,$Color); |
| 4861 | - else |
|
| 4862 | - { |
|
| 4337 | + else { |
|
| 4863 | 4338 | $this->drawFilledRectangle($X+$XOffset,$Y1-$YSpaceUp+$YSpaceDown,$X+$XOffset+$XSize,$Y2,$Color); |
| 4864 | 4339 | |
| 4865 | 4340 | if ( $InnerColor != NULL ) { $RestoreShadow = $this->Shadow; $this->Shadow = FALSE; $this->drawRectangle(min($X+$XOffset+1,$X+$XOffset+$XSize),min($Y1-$YSpaceUp+$YSpaceDown,$Y2)+1,max($X+$XOffset+1,$X+$XOffset+$XSize)-1,max($Y1-$YSpaceUp+$YSpaceDown,$Y2)-1,$InnerColor); $this->Shadow = $RestoreShadow;} |
| 4866 | 4341 | |
| 4867 | - if ( $Gradient ) |
|
| 4868 | - { |
|
| 4342 | + if ( $Gradient ) { |
|
| 4869 | 4343 | $this->Shadow = FALSE; |
| 4870 | 4344 | |
| 4871 | - if ( $GradientMode == GRADIENT_SIMPLE ) |
|
| 4872 | - { |
|
| 4345 | + if ( $GradientMode == GRADIENT_SIMPLE ) { |
|
| 4873 | 4346 | $GradientColor = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha); |
| 4874 | 4347 | $this->drawGradientArea($X+$XOffset,$Y1-1-$YSpaceUp+$YSpaceDown,$X+$XOffset+$XSize,$Y2+1,DIRECTION_VERTICAL,$GradientColor); |
| 4875 | - } |
|
| 4876 | - elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) |
|
| 4877 | - { |
|
| 4348 | + } elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) { |
|
| 4878 | 4349 | $GradientColor1 = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha); |
| 4879 | 4350 | $GradientColor2 = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha); |
| 4880 | 4351 | $XSpan = floor($XSize / 3); |
@@ -4886,8 +4357,7 @@ discard block |
||
| 4886 | 4357 | } |
| 4887 | 4358 | } |
| 4888 | 4359 | |
| 4889 | - if ( $DisplayValues ) |
|
| 4890 | - { |
|
| 4360 | + if ( $DisplayValues ) { |
|
| 4891 | 4361 | $BarHeight = abs($Y2-$Y1)-2; |
| 4892 | 4362 | $BarWidth = $XSize+($XOffset/2)-$FontFactor; |
| 4893 | 4363 | |
@@ -4900,17 +4370,14 @@ discard block |
||
| 4900 | 4370 | $YCenter = ( ($Y2) - ($Y1-$YSpaceUp+$YSpaceDown) ) / 2 + $Y1-$YSpaceUp+$YSpaceDown; |
| 4901 | 4371 | |
| 4902 | 4372 | $Done = FALSE; |
| 4903 | - if ( $DisplayOrientation == ORIENTATION_HORIZONTAL || $DisplayOrientation == ORIENTATION_AUTO ) |
|
| 4904 | - { |
|
| 4905 | - if ( $TxtHeight < $BarHeight && $TxtWidth < $BarWidth ) |
|
| 4906 | - { |
|
| 4373 | + if ( $DisplayOrientation == ORIENTATION_HORIZONTAL || $DisplayOrientation == ORIENTATION_AUTO ) { |
|
| 4374 | + if ( $TxtHeight < $BarHeight && $TxtWidth < $BarWidth ) { |
|
| 4907 | 4375 | $this->drawText($XCenter,$YCenter,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"FontName"=>$DisplayFont)); |
| 4908 | 4376 | $Done = TRUE; |
| 4909 | 4377 | } |
| 4910 | 4378 | } |
| 4911 | 4379 | |
| 4912 | - if ( $DisplayOrientation == ORIENTATION_VERTICAL || ( $DisplayOrientation == ORIENTATION_AUTO && !$Done) ) |
|
| 4913 | - { |
|
| 4380 | + if ( $DisplayOrientation == ORIENTATION_VERTICAL || ( $DisplayOrientation == ORIENTATION_AUTO && !$Done) ) { |
|
| 4914 | 4381 | if ( $TxtHeight < $BarWidth && $TxtWidth < $BarHeight ) |
| 4915 | 4382 | $this->drawText($XCenter,$YCenter,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Angle"=>90,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"FontName"=>$DisplayFont)); |
| 4916 | 4383 | } |
@@ -4921,9 +4388,7 @@ discard block |
||
| 4921 | 4388 | |
| 4922 | 4389 | $X = $X + $XStep; |
| 4923 | 4390 | } |
| 4924 | - } |
|
| 4925 | - else |
|
| 4926 | - { |
|
| 4391 | + } else { |
|
| 4927 | 4392 | if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; } |
| 4928 | 4393 | if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; } |
| 4929 | 4394 | |
@@ -4934,10 +4399,8 @@ discard block |
||
| 4934 | 4399 | $YOffset = -($YSize/2); |
| 4935 | 4400 | |
| 4936 | 4401 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 4937 | - foreach($PosArray as $Key => $Width) |
|
| 4938 | - { |
|
| 4939 | - if ( $Width != VOID && $Serie["Data"][$Key] != 0 ) |
|
| 4940 | - { |
|
| 4402 | + foreach($PosArray as $Key => $Width) { |
|
| 4403 | + if ( $Width != VOID && $Serie["Data"][$Key] != 0 ) { |
|
| 4941 | 4404 | if ( $Serie["Data"][$Key] > 0 ) { $Pos = "+"; } else { $Pos = "-"; } |
| 4942 | 4405 | |
| 4943 | 4406 | if ( !isset($LastX[$Key] ) ) { $LastX[$Key] = ""; } |
@@ -4953,23 +4416,18 @@ discard block |
||
| 4953 | 4416 | |
| 4954 | 4417 | if ( $Rounded ) |
| 4955 | 4418 | $this->drawRoundedFilledRectangle($X1+$XSpaceLeft,$Y+$YOffset,$X2-$XSpaceRight,$Y+$YOffset+$YSize,$RoundRadius,$Color); |
| 4956 | - else |
|
| 4957 | - { |
|
| 4419 | + else { |
|
| 4958 | 4420 | $this->drawFilledRectangle($X1+$XSpaceLeft,$Y+$YOffset,$X2-$XSpaceRight,$Y+$YOffset+$YSize,$Color); |
| 4959 | 4421 | |
| 4960 | 4422 | if ( $InnerColor != NULL ) { $RestoreShadow = $this->Shadow; $this->Shadow = FALSE; $this->drawRectangle(min($X1+$XSpaceLeft,$X2-$XSpaceRight)+1,min($Y+$YOffset,$Y+$YOffset+$YSize)+1,max($X1+$XSpaceLeft,$X2-$XSpaceRight)-1,max($Y+$YOffset,$Y+$YOffset+$YSize)-1,$InnerColor); $this->Shadow = $RestoreShadow;} |
| 4961 | 4423 | |
| 4962 | - if ( $Gradient ) |
|
| 4963 | - { |
|
| 4424 | + if ( $Gradient ) { |
|
| 4964 | 4425 | $this->Shadow = FALSE; |
| 4965 | 4426 | |
| 4966 | - if ( $GradientMode == GRADIENT_SIMPLE ) |
|
| 4967 | - { |
|
| 4427 | + if ( $GradientMode == GRADIENT_SIMPLE ) { |
|
| 4968 | 4428 | $GradientColor = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha); |
| 4969 | 4429 | $this->drawGradientArea($X1+$XSpaceLeft,$Y+$YOffset,$X2-$XSpaceRight,$Y+$YOffset+$YSize,DIRECTION_HORIZONTAL,$GradientColor); |
| 4970 | - } |
|
| 4971 | - elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) |
|
| 4972 | - { |
|
| 4430 | + } elseif ( $GradientMode == GRADIENT_EFFECT_CAN ) { |
|
| 4973 | 4431 | $GradientColor1 = array("StartR"=>$GradientEndR,"StartG"=>$GradientEndG,"StartB"=>$GradientEndB,"EndR"=>$GradientStartR,"EndG"=>$GradientStartG,"EndB"=>$GradientStartB,"Alpha"=>$GradientAlpha); |
| 4974 | 4432 | $GradientColor2 = array("StartR"=>$GradientStartR,"StartG"=>$GradientStartG,"StartB"=>$GradientStartB,"EndR"=>$GradientEndR,"EndG"=>$GradientEndG,"EndB"=>$GradientEndB,"Alpha"=>$GradientAlpha); |
| 4975 | 4433 | $YSpan = floor($YSize / 3); |
@@ -4981,8 +4439,7 @@ discard block |
||
| 4981 | 4439 | } |
| 4982 | 4440 | } |
| 4983 | 4441 | |
| 4984 | - if ( $DisplayValues ) |
|
| 4985 | - { |
|
| 4442 | + if ( $DisplayValues ) { |
|
| 4986 | 4443 | $BarWidth = abs($X2-$X1)-$FontFactor; |
| 4987 | 4444 | $BarHeight = $YSize+($YOffset/2)-$FontFactor/2; |
| 4988 | 4445 | $Caption = $this->scaleFormat(round($Serie["Data"][$Key],$DisplayRound),$Mode,$Format,$Unit); |
@@ -4994,17 +4451,14 @@ discard block |
||
| 4994 | 4451 | $YCenter = ( ($Y+$YOffset+$YSize) - ($Y+$YOffset) ) / 2 + $Y+$YOffset; |
| 4995 | 4452 | |
| 4996 | 4453 | $Done = FALSE; |
| 4997 | - if ( $DisplayOrientation == ORIENTATION_HORIZONTAL || $DisplayOrientation == ORIENTATION_AUTO ) |
|
| 4998 | - { |
|
| 4999 | - if ( $TxtHeight < $BarHeight && $TxtWidth < $BarWidth ) |
|
| 5000 | - { |
|
| 4454 | + if ( $DisplayOrientation == ORIENTATION_HORIZONTAL || $DisplayOrientation == ORIENTATION_AUTO ) { |
|
| 4455 | + if ( $TxtHeight < $BarHeight && $TxtWidth < $BarWidth ) { |
|
| 5001 | 4456 | $this->drawText($XCenter,$YCenter,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"FontName"=>$DisplayFont)); |
| 5002 | 4457 | $Done = TRUE; |
| 5003 | 4458 | } |
| 5004 | 4459 | } |
| 5005 | 4460 | |
| 5006 | - if ( $DisplayOrientation == ORIENTATION_VERTICAL || ( $DisplayOrientation == ORIENTATION_AUTO && !$Done) ) |
|
| 5007 | - { |
|
| 4461 | + if ( $DisplayOrientation == ORIENTATION_VERTICAL || ( $DisplayOrientation == ORIENTATION_AUTO && !$Done) ) { |
|
| 5008 | 4462 | if ( $TxtHeight < $BarWidth && $TxtWidth < $BarHeight ) |
| 5009 | 4463 | $this->drawText($XCenter,$YCenter,$this->scaleFormat($Serie["Data"][$Key],$Mode,$Format,$Unit),array("R"=>$DisplayR,"G"=>$DisplayG,"B"=>$DisplayB,"Angle"=>90,"Align"=>TEXT_ALIGN_MIDDLEMIDDLE,"FontSize"=>$DisplaySize,"FontName"=>$DisplayFont)); |
| 5010 | 4464 | } |
@@ -5021,8 +4475,7 @@ discard block |
||
| 5021 | 4475 | } |
| 5022 | 4476 | |
| 5023 | 4477 | /* Draw a stacked area chart */ |
| 5024 | - function drawStackedAreaChart($Format=NULL) |
|
| 5025 | - { |
|
| 4478 | + function drawStackedAreaChart($Format=NULL) { |
|
| 5026 | 4479 | $DrawLine = isset($Format["DrawLine"]) ? $Format["DrawLine"] : FALSE; |
| 5027 | 4480 | $LineSurrounding = isset($Format["LineSurrounding"]) ? $Format["LineSurrounding"] : NULL; |
| 5028 | 4481 | $LineR = isset($Format["LineR"]) ? $Format["LineR"] : VOID; |
@@ -5051,21 +4504,17 @@ discard block |
||
| 5051 | 4504 | $OffsetData = ""; |
| 5052 | 4505 | $OverallOffset = ""; |
| 5053 | 4506 | $SerieOrder = ""; |
| 5054 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 5055 | - { |
|
| 5056 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 5057 | - { |
|
| 4507 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 4508 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 5058 | 4509 | $SerieOrder[] = $SerieName; |
| 5059 | 4510 | |
| 5060 | - foreach($Serie["Data"] as $Key => $Value) |
|
| 5061 | - { |
|
| 4511 | + foreach($Serie["Data"] as $Key => $Value) { |
|
| 5062 | 4512 | if ( $Value == VOID ) { $Value = 0; } |
| 5063 | 4513 | if ($Value >= 0) { $Sign = "+"; } else { $Sign = "-"; } |
| 5064 | 4514 | if ( !isset($OverallOffset[$Key]) || !isset($OverallOffset[$Key][$Sign]) ) { $OverallOffset[$Key][$Sign] = 0; } |
| 5065 | 4515 | |
| 5066 | 4516 | if ( $Sign == "+" ) |
| 5067 | - { $Data["Series"][$SerieName]["Data"][$Key] = $Value + $OverallOffset[$Key][$Sign]; } |
|
| 5068 | - else |
|
| 4517 | + { $Data["Series"][$SerieName]["Data"][$Key] = $Value + $OverallOffset[$Key][$Sign]; } else |
|
| 5069 | 4518 | { $Data["Series"][$SerieName]["Data"][$Key] = $Value - $OverallOffset[$Key][$Sign]; } |
| 5070 | 4519 | |
| 5071 | 4520 | $OverallOffset[$Key][$Sign] = $OverallOffset[$Key][$Sign] + abs($Value); |
@@ -5075,11 +4524,9 @@ discard block |
||
| 5075 | 4524 | $SerieOrder = array_reverse($SerieOrder); |
| 5076 | 4525 | |
| 5077 | 4526 | $LastX = ""; $LastY = ""; |
| 5078 | - foreach($SerieOrder as $Key => $SerieName) |
|
| 5079 | - { |
|
| 4527 | + foreach($SerieOrder as $Key => $SerieName) { |
|
| 5080 | 4528 | $Serie = $Data["Series"][$SerieName]; |
| 5081 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 5082 | - { |
|
| 4529 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 5083 | 4530 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; |
| 5084 | 4531 | if ( $ForceTransparency != NULL ) { $Alpha = $ForceTransparency; } |
| 5085 | 4532 | |
@@ -5107,8 +4554,7 @@ discard block |
||
| 5107 | 4554 | |
| 5108 | 4555 | $this->DataSet->Data["Series"][$SerieName]["XOffset"] = 0; |
| 5109 | 4556 | |
| 5110 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 5111 | - { |
|
| 4557 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 5112 | 4558 | if ( $YZero < $this->GraphAreaY1+1 ) { $YZero = $this->GraphAreaY1+1; } |
| 5113 | 4559 | if ( $YZero > $this->GraphAreaY2-1 ) { $YZero = $this->GraphAreaY2-1; } |
| 5114 | 4560 | |
@@ -5118,8 +4564,7 @@ discard block |
||
| 5118 | 4564 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 5119 | 4565 | |
| 5120 | 4566 | $Plots = ""; $Plots[] = $X; $Plots[] = $YZero; |
| 5121 | - foreach($PosArray as $Key => $Height) |
|
| 5122 | - { |
|
| 4567 | + foreach($PosArray as $Key => $Height) { |
|
| 5123 | 4568 | if ( $Height != VOID ) { $Plots[] = $X; $Plots[] = $YZero-$Height; } |
| 5124 | 4569 | $X = $X + $XStep; |
| 5125 | 4570 | } |
@@ -5129,10 +4574,8 @@ discard block |
||
| 5129 | 4574 | |
| 5130 | 4575 | $this->Shadow = $RestoreShadow; |
| 5131 | 4576 | if ( $DrawLine ) { for($i=2; $i<=count($Plots)-6; $i=$i+2) { $this->drawLine($Plots[$i],$Plots[$i+1],$Plots[$i+2],$Plots[$i+3],$LineColor); } } |
| 5132 | - if ( $DrawPlot ) |
|
| 5133 | - { |
|
| 5134 | - for($i=2; $i<=count($Plots)-4; $i=$i+2) |
|
| 5135 | - { |
|
| 4577 | + if ( $DrawPlot ) { |
|
| 4578 | + for($i=2; $i<=count($Plots)-4; $i=$i+2) { |
|
| 5136 | 4579 | if ( $PlotBorder != 0 ) |
| 5137 | 4580 | { $this->drawFilledCircle($Plots[$i],$Plots[$i+1],$PlotRadius+$PlotBorder,$PlotBorderColor); } |
| 5138 | 4581 | |
@@ -5140,9 +4583,7 @@ discard block |
||
| 5140 | 4583 | } |
| 5141 | 4584 | } |
| 5142 | 4585 | $this->Shadow = FALSE; |
| 5143 | - } |
|
| 5144 | - elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) |
|
| 5145 | - { |
|
| 4586 | + } elseif ( $Data["Orientation"] == SCALE_POS_TOPBOTTOM ) { |
|
| 5146 | 4587 | if ( $YZero < $this->GraphAreaX1+1 ) { $YZero = $this->GraphAreaX1+1; } |
| 5147 | 4588 | if ( $YZero > $this->GraphAreaX2-1 ) { $YZero = $this->GraphAreaX2-1; } |
| 5148 | 4589 | |
@@ -5152,8 +4593,7 @@ discard block |
||
| 5152 | 4593 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 5153 | 4594 | |
| 5154 | 4595 | $Plots = ""; $Plots[] = $YZero; $Plots[] = $Y; |
| 5155 | - foreach($PosArray as $Key => $Height) |
|
| 5156 | - { |
|
| 4596 | + foreach($PosArray as $Key => $Height) { |
|
| 5157 | 4597 | if ( $Height != VOID ) { $Plots[] = $YZero+$Height; $Plots[] = $Y; } |
| 5158 | 4598 | $Y = $Y + $YStep; |
| 5159 | 4599 | } |
@@ -5163,10 +4603,8 @@ discard block |
||
| 5163 | 4603 | |
| 5164 | 4604 | $this->Shadow = $RestoreShadow; |
| 5165 | 4605 | if ( $DrawLine ) { for($i=2; $i<=count($Plots)-6; $i=$i+2) { $this->drawLine($Plots[$i],$Plots[$i+1],$Plots[$i+2],$Plots[$i+3],$LineColor); } } |
| 5166 | - if ( $DrawPlot ) |
|
| 5167 | - { |
|
| 5168 | - for($i=2; $i<=count($Plots)-4; $i=$i+2) |
|
| 5169 | - { |
|
| 4606 | + if ( $DrawPlot ) { |
|
| 4607 | + for($i=2; $i<=count($Plots)-4; $i=$i+2) { |
|
| 5170 | 4608 | if ( $PlotBorder != 0 ) |
| 5171 | 4609 | { $this->drawFilledCircle($Plots[$i],$Plots[$i+1],$PlotRadius+$PlotBorder,$PlotBorderColor); } |
| 5172 | 4610 | |
@@ -5185,27 +4623,22 @@ discard block |
||
| 5185 | 4623 | { return(array("R"=>rand(0,255),"G"=>rand(0,255),"B"=>rand(0,255),"Alpha"=>$Alpha)); } |
| 5186 | 4624 | |
| 5187 | 4625 | /* Validate a palette */ |
| 5188 | - function validatePalette($Colors,$Surrounding=NULL) |
|
| 5189 | - { |
|
| 4626 | + function validatePalette($Colors,$Surrounding=NULL) { |
|
| 5190 | 4627 | $Result = ""; |
| 5191 | 4628 | |
| 5192 | 4629 | if ( !is_array($Colors) ) { return($this->getRandomColor()); } |
| 5193 | 4630 | |
| 5194 | - foreach($Colors as $Key => $Values) |
|
| 5195 | - { |
|
| 4631 | + foreach($Colors as $Key => $Values) { |
|
| 5196 | 4632 | if ( isset($Values["R"]) ) { $Result[$Key]["R"] = $Values["R"]; } else { $Result[$Key]["R"] = rand(0,255); } |
| 5197 | 4633 | if ( isset($Values["G"]) ) { $Result[$Key]["G"] = $Values["G"]; } else { $Result[$Key]["G"] = rand(0,255); } |
| 5198 | 4634 | if ( isset($Values["B"]) ) { $Result[$Key]["B"] = $Values["B"]; } else { $Result[$Key]["B"] = rand(0,255); } |
| 5199 | 4635 | if ( isset($Values["Alpha"]) ) { $Result[$Key]["Alpha"] = $Values["Alpha"]; } else { $Result[$Key]["Alpha"] = 100; } |
| 5200 | 4636 | |
| 5201 | - if ( $Surrounding != NULL ) |
|
| 5202 | - { |
|
| 4637 | + if ( $Surrounding != NULL ) { |
|
| 5203 | 4638 | $Result[$Key]["BorderR"] = $Result[$Key]["R"] + $Surrounding; |
| 5204 | 4639 | $Result[$Key]["BorderG"] = $Result[$Key]["G"] + $Surrounding; |
| 5205 | 4640 | $Result[$Key]["BorderB"] = $Result[$Key]["B"] + $Surrounding; |
| 5206 | - } |
|
| 5207 | - else |
|
| 5208 | - { |
|
| 4641 | + } else { |
|
| 5209 | 4642 | if ( isset($Values["BorderR"]) ) { $Result[$Key]["BorderR"] = $Values["BorderR"]; } else { $Result[$Key]["BorderR"] = $Result[$Key]["R"]; } |
| 5210 | 4643 | if ( isset($Values["BorderG"]) ) { $Result[$Key]["BorderG"] = $Values["BorderG"]; } else { $Result[$Key]["BorderG"] = $Result[$Key]["G"]; } |
| 5211 | 4644 | if ( isset($Values["BorderB"]) ) { $Result[$Key]["BorderB"] = $Values["BorderB"]; } else { $Result[$Key]["BorderB"] = $Result[$Key]["B"]; } |
@@ -5217,8 +4650,7 @@ discard block |
||
| 5217 | 4650 | } |
| 5218 | 4651 | |
| 5219 | 4652 | /* Draw the derivative chart associated to the data series */ |
| 5220 | - function drawDerivative($Format=NULL) |
|
| 5221 | - { |
|
| 4653 | + function drawDerivative($Format=NULL) { |
|
| 5222 | 4654 | $Offset = isset($Format["Offset"]) ? $Format["Offset"] : 10; |
| 5223 | 4655 | $SerieSpacing = isset($Format["SerieSpacing"]) ? $Format["SerieSpacing"] : 3; |
| 5224 | 4656 | $DerivativeHeight = isset($Format["DerivativeHeight"]) ? $Format["DerivativeHeight"] : 4; |
@@ -5268,29 +4700,23 @@ discard block |
||
| 5268 | 4700 | else |
| 5269 | 4701 | $XPos = $this->DataSet->Data["GraphArea"]["X2"] + $Offset; |
| 5270 | 4702 | |
| 5271 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 5272 | - { |
|
| 5273 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 5274 | - { |
|
| 4703 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 4704 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 5275 | 4705 | $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; $Alpha = $Serie["Color"]["Alpha"]; $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"]; |
| 5276 | 4706 | |
| 5277 | 4707 | $AxisID = $Serie["Axis"]; |
| 5278 | 4708 | $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); |
| 5279 | 4709 | |
| 5280 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 5281 | - { |
|
| 5282 | - if ( $Caption ) |
|
| 5283 | - { |
|
| 5284 | - if ( $CaptionLine ) |
|
| 5285 | - { |
|
| 4710 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 4711 | + if ( $Caption ) { |
|
| 4712 | + if ( $CaptionLine ) { |
|
| 5286 | 4713 | $StartX = floor($this->GraphAreaX1-$CaptionWidth+$XMargin-$CaptionMargin); |
| 5287 | 4714 | $EndX = floor($this->GraphAreaX1-$CaptionMargin+$XMargin); |
| 5288 | 4715 | |
| 5289 | 4716 | $CaptionSettings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight); |
| 5290 | 4717 | if ( $CaptionBox ) { $this->drawFilledRectangle($StartX,$YPos,$EndX,$YPos+$CaptionHeight,array("R"=>$CaptionFillR,"G"=>$CaptionFillG,"B"=>$CaptionFillB,"BorderR"=>$CaptionBorderR,"BorderG"=>$CaptionBorderG,"BorderB"=>$CaptionBorderB,"Alpha"=>$CaptionFillAlpha)); } |
| 5291 | 4718 | $this->drawLine($StartX+2,$YPos+($CaptionHeight/2),$EndX-2,$YPos+($CaptionHeight/2),$CaptionSettings); |
| 5292 | - } |
|
| 5293 | - else |
|
| 4719 | + } else |
|
| 5294 | 4720 | $this->drawFilledRectangle($this->GraphAreaX1-$CaptionWidth+$XMargin-$CaptionMargin,$YPos,$this->GraphAreaX1-$CaptionMargin+$XMargin,$YPos+$CaptionHeight,array("R"=>$R,"G"=>$G,"B"=>$B,"BorderR"=>$CaptionBorderR,"BorderG"=>$CaptionBorderG,"BorderB"=>$CaptionBorderB)); |
| 5295 | 4721 | } |
| 5296 | 4722 | |
@@ -5313,33 +4739,26 @@ discard block |
||
| 5313 | 4739 | |
| 5314 | 4740 | /* Determine the Max slope index */ |
| 5315 | 4741 | $LastX = NULL; $LastY = NULL; $MinSlope = 0; $MaxSlope = 1; |
| 5316 | - foreach($PosArray as $Key => $Y) |
|
| 5317 | - { |
|
| 4742 | + foreach($PosArray as $Key => $Y) { |
|
| 5318 | 4743 | if ( $Y != VOID && $LastX != NULL ) |
| 5319 | 4744 | { $Slope = ($LastY - $Y); if ( $Slope > $MaxSlope ) { $MaxSlope = $Slope; } if ( $Slope < $MinSlope ) { $MinSlope = $Slope; } } |
| 5320 | 4745 | |
| 5321 | 4746 | if ( $Y == VOID ) |
| 5322 | - { $LastX = NULL; $LastY = NULL; } |
|
| 5323 | - else |
|
| 4747 | + { $LastX = NULL; $LastY = NULL; } else |
|
| 5324 | 4748 | { $LastX = $X; $LastY = $Y; } |
| 5325 | 4749 | } |
| 5326 | 4750 | |
| 5327 | 4751 | $LastX = NULL; $LastY = NULL; $LastColor = NULL; |
| 5328 | - foreach($PosArray as $Key => $Y) |
|
| 5329 | - { |
|
| 5330 | - if ( $Y != VOID && $LastY != NULL ) |
|
| 5331 | - { |
|
| 4752 | + foreach($PosArray as $Key => $Y) { |
|
| 4753 | + if ( $Y != VOID && $LastY != NULL ) { |
|
| 5332 | 4754 | $Slope = ($LastY - $Y); |
| 5333 | 4755 | |
| 5334 | - if ( $Slope >= 0 ) |
|
| 5335 | - { |
|
| 4756 | + if ( $Slope >= 0 ) { |
|
| 5336 | 4757 | $SlopeIndex = (100 / $MaxSlope) * $Slope; |
| 5337 | 4758 | $R = (($PositiveSlopeEndR - $PositiveSlopeStartR)/100)*$SlopeIndex+$PositiveSlopeStartR; |
| 5338 | 4759 | $G = (($PositiveSlopeEndG - $PositiveSlopeStartG)/100)*$SlopeIndex+$PositiveSlopeStartG; |
| 5339 | 4760 | $B = (($PositiveSlopeEndB - $PositiveSlopeStartB)/100)*$SlopeIndex+$PositiveSlopeStartB; |
| 5340 | - } |
|
| 5341 | - elseif ( $Slope < 0 ) |
|
| 5342 | - { |
|
| 4761 | + } elseif ( $Slope < 0 ) { |
|
| 5343 | 4762 | $SlopeIndex = (100 / abs($MinSlope)) * abs($Slope); |
| 5344 | 4763 | $R = (($NegativeSlopeEndR - $NegativeSlopeStartR)/100)*$SlopeIndex+$NegativeSlopeStartR; |
| 5345 | 4764 | $G = (($NegativeSlopeEndG - $NegativeSlopeStartG)/100)*$SlopeIndex+$NegativeSlopeStartG; |
@@ -5352,36 +4771,29 @@ discard block |
||
| 5352 | 4771 | { |
| 5353 | 4772 | $GradientSettings = array("StartR"=>$LastColor["R"],"StartG"=>$LastColor["G"],"StartB"=>$LastColor["B"],"EndR"=>$R,"EndG"=>$G,"EndB"=>$B); |
| 5354 | 4773 | $this->drawGradientArea($LastX,$TopY,$X,$BottomY,DIRECTION_HORIZONTAL,$GradientSettings); |
| 5355 | - } |
|
| 5356 | - elseif ( !$ShadedSlopeBox || $LastColor == NULL ) // || $Slope == 0 |
|
| 4774 | + } elseif ( !$ShadedSlopeBox || $LastColor == NULL ) // || $Slope == 0 |
|
| 5357 | 4775 | $this->drawFilledRectangle(floor($LastX),$TopY,floor($X),$BottomY,$Color); |
| 5358 | 4776 | |
| 5359 | 4777 | $LastColor = $Color; |
| 5360 | 4778 | } |
| 5361 | 4779 | |
| 5362 | 4780 | if ( $Y == VOID ) |
| 5363 | - { $LastY = NULL; } |
|
| 5364 | - else |
|
| 4781 | + { $LastY = NULL; } else |
|
| 5365 | 4782 | { $LastX = $X; $LastY = $Y; } |
| 5366 | 4783 | |
| 5367 | 4784 | $X = $X + $XStep; |
| 5368 | 4785 | } |
| 5369 | 4786 | |
| 5370 | 4787 | $YPos = $YPos + $CaptionHeight + $SerieSpacing; |
| 5371 | - } |
|
| 5372 | - else |
|
| 5373 | - { |
|
| 5374 | - if ( $Caption ) |
|
| 5375 | - { |
|
| 4788 | + } else { |
|
| 4789 | + if ( $Caption ) { |
|
| 5376 | 4790 | $StartY = floor($this->GraphAreaY1-$CaptionWidth+$XMargin-$CaptionMargin); |
| 5377 | 4791 | $EndY = floor($this->GraphAreaY1-$CaptionMargin+$XMargin); |
| 5378 | - if ( $CaptionLine ) |
|
| 5379 | - { |
|
| 4792 | + if ( $CaptionLine ) { |
|
| 5380 | 4793 | $CaptionSettings = array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha,"Ticks"=>$Ticks,"Weight"=>$Weight); |
| 5381 | 4794 | if ( $CaptionBox ) { $this->drawFilledRectangle($XPos,$StartY,$XPos+$CaptionHeight,$EndY,array("R"=>$CaptionFillR,"G"=>$CaptionFillG,"B"=>$CaptionFillB,"BorderR"=>$CaptionBorderR,"BorderG"=>$CaptionBorderG,"BorderB"=>$CaptionBorderB,"Alpha"=>$CaptionFillAlpha)); } |
| 5382 | 4795 | $this->drawLine($XPos+($CaptionHeight/2),$StartY+2,$XPos+($CaptionHeight/2),$EndY-2,$CaptionSettings); |
| 5383 | - } |
|
| 5384 | - else |
|
| 4796 | + } else |
|
| 5385 | 4797 | $this->drawFilledRectangle($XPos,$StartY,$XPos+$CaptionHeight,$EndY,array("R"=>$R,"G"=>$G,"B"=>$B,"BorderR"=>$CaptionBorderR,"BorderG"=>$CaptionBorderG,"BorderB"=>$CaptionBorderB)); |
| 5386 | 4798 | } |
| 5387 | 4799 | |
@@ -5405,33 +4817,26 @@ discard block |
||
| 5405 | 4817 | |
| 5406 | 4818 | /* Determine the Max slope index */ |
| 5407 | 4819 | $LastX = NULL; $LastY = NULL; $MinSlope = 0; $MaxSlope = 1; |
| 5408 | - foreach($PosArray as $Key => $X) |
|
| 5409 | - { |
|
| 4820 | + foreach($PosArray as $Key => $X) { |
|
| 5410 | 4821 | if ( $X != VOID && $LastX != NULL ) |
| 5411 | 4822 | { $Slope = ($X - $LastX); if ( $Slope > $MaxSlope ) { $MaxSlope = $Slope; } if ( $Slope < $MinSlope ) { $MinSlope = $Slope; } } |
| 5412 | 4823 | |
| 5413 | 4824 | if ( $X == VOID ) |
| 5414 | - { $LastX = NULL; } |
|
| 5415 | - else |
|
| 4825 | + { $LastX = NULL; } else |
|
| 5416 | 4826 | { $LastX = $X; } |
| 5417 | 4827 | } |
| 5418 | 4828 | |
| 5419 | 4829 | $LastX = NULL; $LastY = NULL; $LastColor = NULL; |
| 5420 | - foreach($PosArray as $Key => $X) |
|
| 5421 | - { |
|
| 5422 | - if ( $X != VOID && $LastX != NULL ) |
|
| 5423 | - { |
|
| 4830 | + foreach($PosArray as $Key => $X) { |
|
| 4831 | + if ( $X != VOID && $LastX != NULL ) { |
|
| 5424 | 4832 | $Slope = ($X - $LastX); |
| 5425 | 4833 | |
| 5426 | - if ( $Slope >= 0 ) |
|
| 5427 | - { |
|
| 4834 | + if ( $Slope >= 0 ) { |
|
| 5428 | 4835 | $SlopeIndex = (100 / $MaxSlope) * $Slope; |
| 5429 | 4836 | $R = (($PositiveSlopeEndR - $PositiveSlopeStartR)/100)*$SlopeIndex+$PositiveSlopeStartR; |
| 5430 | 4837 | $G = (($PositiveSlopeEndG - $PositiveSlopeStartG)/100)*$SlopeIndex+$PositiveSlopeStartG; |
| 5431 | 4838 | $B = (($PositiveSlopeEndB - $PositiveSlopeStartB)/100)*$SlopeIndex+$PositiveSlopeStartB; |
| 5432 | - } |
|
| 5433 | - elseif ( $Slope < 0 ) |
|
| 5434 | - { |
|
| 4839 | + } elseif ( $Slope < 0 ) { |
|
| 5435 | 4840 | $SlopeIndex = (100 / abs($MinSlope)) * abs($Slope); |
| 5436 | 4841 | $R = (($NegativeSlopeEndR - $NegativeSlopeStartR)/100)*$SlopeIndex+$NegativeSlopeStartR; |
| 5437 | 4842 | $G = (($NegativeSlopeEndG - $NegativeSlopeStartG)/100)*$SlopeIndex+$NegativeSlopeStartG; |
@@ -5440,21 +4845,18 @@ discard block |
||
| 5440 | 4845 | |
| 5441 | 4846 | $Color = array("R"=>$R,"G"=>$G,"B"=>$B); |
| 5442 | 4847 | |
| 5443 | - if ( $ShadedSlopeBox && $LastColor != NULL ) |
|
| 5444 | - { |
|
| 4848 | + if ( $ShadedSlopeBox && $LastColor != NULL ) { |
|
| 5445 | 4849 | $GradientSettings = array("StartR"=>$LastColor["R"],"StartG"=>$LastColor["G"],"StartB"=>$LastColor["B"],"EndR"=>$R,"EndG"=>$G,"EndB"=>$B); |
| 5446 | 4850 | |
| 5447 | 4851 | $this->drawGradientArea($TopX,$LastY,$BottomX,$Y,DIRECTION_VERTICAL,$GradientSettings); |
| 5448 | - } |
|
| 5449 | - elseif ( !$ShadedSlopeBox || $LastColor == NULL ) |
|
| 4852 | + } elseif ( !$ShadedSlopeBox || $LastColor == NULL ) |
|
| 5450 | 4853 | $this->drawFilledRectangle($TopX,floor($LastY),$BottomX,floor($Y),$Color); |
| 5451 | 4854 | |
| 5452 | 4855 | $LastColor = $Color; |
| 5453 | 4856 | } |
| 5454 | 4857 | |
| 5455 | 4858 | if ( $X == VOID ) |
| 5456 | - { $LastX = NULL; } |
|
| 5457 | - else |
|
| 4859 | + { $LastX = NULL; } else |
|
| 5458 | 4860 | { $LastX = $X; $LastY = $Y; } |
| 5459 | 4861 | |
| 5460 | 4862 | $Y = $Y + $XStep; |
@@ -5469,8 +4871,7 @@ discard block |
||
| 5469 | 4871 | } |
| 5470 | 4872 | |
| 5471 | 4873 | /* Draw the line of best fit */ |
| 5472 | - function drawBestFit($Format="") |
|
| 5473 | - { |
|
| 4874 | + function drawBestFit($Format="") { |
|
| 5474 | 4875 | $OverrideTicks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL; |
| 5475 | 4876 | $OverrideR = isset($Format["R"]) ? $Format["R"] : VOID; |
| 5476 | 4877 | $OverrideG = isset($Format["G"]) ? $Format["G"] : VOID; |
@@ -5480,10 +4881,8 @@ discard block |
||
| 5480 | 4881 | $Data = $this->DataSet->getData(); |
| 5481 | 4882 | list($XMargin,$XDivs) = $this->scaleGetXSettings(); |
| 5482 | 4883 | |
| 5483 | - foreach($Data["Series"] as $SerieName => $Serie) |
|
| 5484 | - { |
|
| 5485 | - if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) |
|
| 5486 | - { |
|
| 4884 | + foreach($Data["Series"] as $SerieName => $Serie) { |
|
| 4885 | + if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] ) { |
|
| 5487 | 4886 | if ( $OverrideR != VOID && $OverrideG != VOID && $OverrideB != VOID ) { $R = $OverrideR; $G = $OverrideG; $B = $OverrideB; } else { $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"]; } |
| 5488 | 4887 | if ( $OverrideTicks == NULL ) { $Ticks = $Serie["Ticks"]; } else { $Ticks = $OverrideTicks; } |
| 5489 | 4888 | if ( $OverrideAlpha == VOID ) { $Alpha = $Serie["Color"]["Alpha"]; } else { $Alpha = $OverrideAlpha; } |
@@ -5493,17 +4892,14 @@ discard block |
||
| 5493 | 4892 | $AxisID = $Serie["Axis"]; |
| 5494 | 4893 | $PosArray = $this->scaleComputeY($Serie["Data"],array("AxisID"=>$Serie["Axis"])); |
| 5495 | 4894 | |
| 5496 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 5497 | - { |
|
| 4895 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 5498 | 4896 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; } |
| 5499 | 4897 | $X = $this->GraphAreaX1 + $XMargin; |
| 5500 | 4898 | |
| 5501 | 4899 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 5502 | 4900 | $Sxy = 0; $Sx = 0; $Sy = 0; $Sxx = 0; |
| 5503 | - foreach($PosArray as $Key => $Y) |
|
| 5504 | - { |
|
| 5505 | - if ( $Y != VOID ) |
|
| 5506 | - { |
|
| 4901 | + foreach($PosArray as $Key => $Y) { |
|
| 4902 | + if ( $Y != VOID ) { |
|
| 5507 | 4903 | $Sxy = $Sxy + $X*$Y; |
| 5508 | 4904 | $Sx = $Sx + $X; |
| 5509 | 4905 | $Sy = $Sy + $Y; |
@@ -5527,18 +4923,14 @@ discard block |
||
| 5527 | 4923 | if ( $Y2 > $this->GraphAreaY2 ) { $X2 = $X2 - ($Y2-$this->GraphAreaY2); $Y2 = $this->GraphAreaY2; } |
| 5528 | 4924 | |
| 5529 | 4925 | $this->drawLine($X1,$Y1,$X2,$Y2,$Color); |
| 5530 | - } |
|
| 5531 | - else |
|
| 5532 | - { |
|
| 4926 | + } else { |
|
| 5533 | 4927 | if ( $XDivs == 0 ) { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $YStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; } |
| 5534 | 4928 | $Y = $this->GraphAreaY1 + $XMargin; |
| 5535 | 4929 | |
| 5536 | 4930 | if ( !is_array($PosArray) ) { $Value = $PosArray; $PosArray = ""; $PosArray[0] = $Value; } |
| 5537 | 4931 | $Sxy = 0; $Sx = 0; $Sy = 0; $Sxx = 0; |
| 5538 | - foreach($PosArray as $Key => $X) |
|
| 5539 | - { |
|
| 5540 | - if ( $X != VOID ) |
|
| 5541 | - { |
|
| 4932 | + foreach($PosArray as $Key => $X) { |
|
| 4933 | + if ( $X != VOID ) { |
|
| 5542 | 4934 | $Sxy = $Sxy + $X*$Y; |
| 5543 | 4935 | $Sx = $Sx + $Y; |
| 5544 | 4936 | $Sy = $Sy + $X; |
@@ -5568,8 +4960,7 @@ discard block |
||
| 5568 | 4960 | } |
| 5569 | 4961 | |
| 5570 | 4962 | /* Write labels */ |
| 5571 | - function writeLabel($SeriesName,$Indexes,$Format="") |
|
| 5572 | - { |
|
| 4963 | + function writeLabel($SeriesName,$Indexes,$Format="") { |
|
| 5573 | 4964 | $OverrideTitle = isset($Format["OverrideTitle"]) ? $Format["OverrideTitle"] : NULL; |
| 5574 | 4965 | $ForceLabels = isset($Format["ForceLabels"]) ? $Format["ForceLabels"] : NULL; |
| 5575 | 4966 | $DrawPoint = isset($Format["DrawPoint"]) ? $Format["DrawPoint"] : LABEL_POINT_BOX; |
@@ -5587,34 +4978,28 @@ discard block |
||
| 5587 | 4978 | if ( !is_array($SeriesName) ) { $SerieName = $SeriesName; $SeriesName = ""; $SeriesName[] = $SerieName; } |
| 5588 | 4979 | if ( $ForceLabels != NULL && !is_array($ForceLabels) ) { $ForceLabel = $ForceLabels; $ForceLabels = ""; $ForceLabels[] = $ForceLabel; } |
| 5589 | 4980 | |
| 5590 | - foreach ($Indexes as $Key => $Index) |
|
| 5591 | - { |
|
| 4981 | + foreach ($Indexes as $Key => $Index) { |
|
| 5592 | 4982 | $Series = ""; |
| 5593 | 4983 | |
| 5594 | - if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) |
|
| 5595 | - { |
|
| 4984 | + if ( $Data["Orientation"] == SCALE_POS_LEFTRIGHT ) { |
|
| 5596 | 4985 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; } |
| 5597 | 4986 | $X = $this->GraphAreaX1 + $XMargin + $Index * $XStep; |
| 5598 | 4987 | |
| 5599 | 4988 | if ( $DrawVerticalLine ) { $this->drawLine($X,$this->GraphAreaY1+$Data["YMargin"],$X,$this->GraphAreaY2-$Data["YMargin"],array("R"=>$VerticalLineR,"G"=>$VerticalLineG,"B"=>$VerticalLineB,"Alpha"=>$VerticalLineAlpha,"Ticks"=>$VerticalLineTicks)); } |
| 5600 | 4989 | |
| 5601 | 4990 | $MinY = $this->GraphAreaY2; |
| 5602 | - foreach ($SeriesName as $iKey => $SerieName) |
|
| 5603 | - { |
|
| 5604 | - if ( isset($Data["Series"][$SerieName]["Data"][$Index]) ) |
|
| 5605 | - { |
|
| 4991 | + foreach ($SeriesName as $iKey => $SerieName) { |
|
| 4992 | + if ( isset($Data["Series"][$SerieName]["Data"][$Index]) ) { |
|
| 5606 | 4993 | $AxisID = $Data["Series"][$SerieName]["Axis"]; |
| 5607 | 4994 | |
| 5608 | 4995 | if ( $OverrideTitle != NULL) |
| 5609 | 4996 | $Description = $OverrideTitle; |
| 5610 | - elseif ( count($SeriesName) == 1 ) |
|
| 5611 | - { |
|
| 4997 | + elseif ( count($SeriesName) == 1 ) { |
|
| 5612 | 4998 | if ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) ) |
| 5613 | 4999 | $Description = $Data["Series"][$SerieName]["Description"]." - ".$Data["Series"][$Data["Abscissa"]]["Data"][$Index]; |
| 5614 | 5000 | else |
| 5615 | 5001 | $Description = $Data["Series"][$SerieName]["Description"]; |
| 5616 | - } |
|
| 5617 | - elseif ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) ) |
|
| 5002 | + } elseif ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) ) |
|
| 5618 | 5003 | $Description = $Data["Series"][$Data["Abscissa"]]["Data"][$Index]; |
| 5619 | 5004 | |
| 5620 | 5005 | $AxisMode = $Data["Axis"][$AxisID]["Display"]; |
@@ -5640,17 +5025,13 @@ discard block |
||
| 5640 | 5025 | else |
| 5641 | 5026 | $Caption = $this->scaleFormat($Value,$AxisMode,$AxisFormat,$AxisUnit); |
| 5642 | 5027 | |
| 5643 | - if ( $this->LastChartLayout == CHART_LAST_LAYOUT_STACKED ) |
|
| 5644 | - { |
|
| 5028 | + if ( $this->LastChartLayout == CHART_LAST_LAYOUT_STACKED ) { |
|
| 5645 | 5029 | if ( $Value >=0 ) { $LookFor = "+"; } else { $LookFor = "-"; } |
| 5646 | 5030 | |
| 5647 | 5031 | $Value = 0; $Done = FALSE; |
| 5648 | - foreach($Data["Series"] as $Name => $SerieLookup) |
|
| 5649 | - { |
|
| 5650 | - if ( $SerieLookup["isDrawable"] == TRUE && $Name != $Data["Abscissa"] && !$Done ) |
|
| 5651 | - { |
|
| 5652 | - if ( isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID ) |
|
| 5653 | - { |
|
| 5032 | + foreach($Data["Series"] as $Name => $SerieLookup) { |
|
| 5033 | + if ( $SerieLookup["isDrawable"] == TRUE && $Name != $Data["Abscissa"] && !$Done ) { |
|
| 5034 | + if ( isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID ) { |
|
| 5654 | 5035 | if ($Data["Series"][$Name]["Data"][$Index] >= 0 && $LookFor == "+" ) { $Value = $Value + $Data["Series"][$Name]["Data"][$Index]; } |
| 5655 | 5036 | if ($Data["Series"][$Name]["Data"][$Index] < 0 && $LookFor == "-" ) { $Value = $Value - $Data["Series"][$Name]["Data"][$Index]; } |
| 5656 | 5037 | if ($Name == $SerieName ) { $Done = TRUE; } |
@@ -5674,31 +5055,25 @@ discard block |
||
| 5674 | 5055 | } |
| 5675 | 5056 | $this->drawLabelBox($X,$MinY-3,$Description,$Series,$Format); |
| 5676 | 5057 | |
| 5677 | - } |
|
| 5678 | - else |
|
| 5679 | - { |
|
| 5058 | + } else { |
|
| 5680 | 5059 | if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaY2-$this->GraphAreaY1)/4; } else { $XStep = ($this->GraphAreaY2-$this->GraphAreaY1-$XMargin*2)/$XDivs; } |
| 5681 | 5060 | $Y = $this->GraphAreaY1 + $XMargin + $Index * $XStep; |
| 5682 | 5061 | |
| 5683 | 5062 | if ( $DrawVerticalLine ) { $this->drawLine($this->GraphAreaX1+$Data["YMargin"],$Y,$this->GraphAreaX2-$Data["YMargin"],$Y,array("R"=>$VerticalLineR,"G"=>$VerticalLineG,"B"=>$VerticalLineB,"Alpha"=>$VerticalLineAlpha,"Ticks"=>$VerticalLineTicks)); } |
| 5684 | 5063 | |
| 5685 | 5064 | $MinX = $this->GraphAreaX2; |
| 5686 | - foreach ($SeriesName as $Key => $SerieName) |
|
| 5687 | - { |
|
| 5688 | - if ( isset($Data["Series"][$SerieName]["Data"][$Index]) ) |
|
| 5689 | - { |
|
| 5065 | + foreach ($SeriesName as $Key => $SerieName) { |
|
| 5066 | + if ( isset($Data["Series"][$SerieName]["Data"][$Index]) ) { |
|
| 5690 | 5067 | $AxisID = $Data["Series"][$SerieName]["Axis"]; |
| 5691 | 5068 | |
| 5692 | 5069 | if ( $OverrideTitle != NULL) |
| 5693 | 5070 | $Description = $OverrideTitle; |
| 5694 | - elseif ( count($SeriesName) == 1 ) |
|
| 5695 | - { |
|
| 5071 | + elseif ( count($SeriesName) == 1 ) { |
|
| 5696 | 5072 | if ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) ) |
| 5697 | 5073 | $Description = $Data["Series"][$SerieName]["Description"]." - ".$Data["Series"][$Data["Abscissa"]]["Data"][$Index]; |
| 5698 | 5074 | else |
| 5699 | 5075 | $Description = $Data["Series"][$SerieName]["Description"]; |
| 5700 | - } |
|
| 5701 | - elseif ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) ) |
|
| 5076 | + } elseif ( isset($Data["Abscissa"]) && isset($Data["Series"][$Data["Abscissa"]]["Data"][$Index]) ) |
|
| 5702 | 5077 | $Description = $Data["Series"][$Data["Abscissa"]]["Data"][$Index]; |
| 5703 | 5078 | |
| 5704 | 5079 | $AxisMode = $Data["Axis"][$AxisID]["Display"]; |
@@ -5706,15 +5081,12 @@ discard block |
||
| 5706 | 5081 | $AxisUnit = $Data["Axis"][$AxisID]["Unit"]; |
| 5707 | 5082 | |
| 5708 | 5083 | $Serie = ""; |
| 5709 | - if ( isset($Data["Extended"]["Palette"][$Index] ) ) |
|
| 5710 | - { |
|
| 5084 | + if ( isset($Data["Extended"]["Palette"][$Index] ) ) { |
|
| 5711 | 5085 | $Serie["R"] = $Data["Extended"]["Palette"][$Index]["R"]; |
| 5712 | 5086 | $Serie["G"] = $Data["Extended"]["Palette"][$Index]["G"]; |
| 5713 | 5087 | $Serie["B"] = $Data["Extended"]["Palette"][$Index]["B"]; |
| 5714 | 5088 | $Serie["Alpha"] = $Data["Extended"]["Palette"][$Index]["Alpha"]; |
| 5715 | - } |
|
| 5716 | - else |
|
| 5717 | - { |
|
| 5089 | + } else { |
|
| 5718 | 5090 | $Serie["R"] = $Data["Series"][$SerieName]["Color"]["R"]; |
| 5719 | 5091 | $Serie["G"] = $Data["Series"][$SerieName]["Color"]["G"]; |
| 5720 | 5092 | $Serie["B"] = $Data["Series"][$SerieName]["Color"]["B"]; |
@@ -5733,17 +5105,13 @@ discard block |
||
| 5733 | 5105 | $Caption = $this->scaleFormat($Value,$AxisMode,$AxisFormat,$AxisUnit); |
| 5734 | 5106 | if ( $Value == VOID ) { $Value = "NaN"; } |
| 5735 | 5107 | |
| 5736 | - if ( $this->LastChartLayout == CHART_LAST_LAYOUT_STACKED ) |
|
| 5737 | - { |
|
| 5108 | + if ( $this->LastChartLayout == CHART_LAST_LAYOUT_STACKED ) { |
|
| 5738 | 5109 | if ( $Value >=0 ) { $LookFor = "+"; } else { $LookFor = "-"; } |
| 5739 | 5110 | |
| 5740 | 5111 | $Value = 0; $Done = FALSE; |
| 5741 | - foreach($Data["Series"] as $Name => $SerieLookup) |
|
| 5742 | - { |
|
| 5743 | - if ( $SerieLookup["isDrawable"] == TRUE && $Name != $Data["Abscissa"] && !$Done ) |
|
| 5744 | - { |
|
| 5745 | - if ( isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID ) |
|
| 5746 | - { |
|
| 5112 | + foreach($Data["Series"] as $Name => $SerieLookup) { |
|
| 5113 | + if ( $SerieLookup["isDrawable"] == TRUE && $Name != $Data["Abscissa"] && !$Done ) { |
|
| 5114 | + if ( isset($Data["Series"][$Name]["Data"][$Index]) && $Data["Series"][$Name]["Data"][$Index] != VOID ) { |
|
| 5747 | 5115 | if ($Data["Series"][$Name]["Data"][$Index] >= 0 && $LookFor == "+" ) { $Value = $Value + $Data["Series"][$Name]["Data"][$Index]; } |
| 5748 | 5116 | if ($Data["Series"][$Name]["Data"][$Index] < 0 && $LookFor == "-" ) { $Value = $Value - $Data["Series"][$Name]["Data"][$Index]; } |
| 5749 | 5117 | if ($Name == $SerieName ) { $Done = TRUE; } |
@@ -5772,8 +5140,7 @@ discard block |
||
| 5772 | 5140 | } |
| 5773 | 5141 | |
| 5774 | 5142 | /* Draw a label box */ |
| 5775 | - function drawLabelBox($X,$Y,$Title,$Captions,$Format="") |
|
| 5776 | - { |
|
| 5143 | + function drawLabelBox($X,$Y,$Title,$Captions,$Format="") { |
|
| 5777 | 5144 | $NoTitle = isset($Format["NoTitle"]) ? $Format["NoTitle"] : NULL; |
| 5778 | 5145 | $BoxWidth = isset($Format["BoxWidth"]) ? $Format["BoxWidth"] : 50; |
| 5779 | 5146 | $DrawSerieColor = isset($Format["DrawSerieColor"]) ? $Format["DrawSerieColor"] : TRUE; |
@@ -5814,8 +5181,7 @@ discard block |
||
| 5814 | 5181 | if ( $NoTitle ) { $TitleWidth = 0; $TitleHeight = 0; } |
| 5815 | 5182 | |
| 5816 | 5183 | $CaptionWidth = 0; $CaptionHeight = -$HorizontalMargin; |
| 5817 | - foreach($Captions as $Key =>$Caption) |
|
| 5818 | - { |
|
| 5184 | + foreach($Captions as $Key =>$Caption) { |
|
| 5819 | 5185 | $TxtPos = $this->getTextBox($X,$Y,$FontName,$FontSize,0,$Caption["Caption"]); |
| 5820 | 5186 | $CaptionWidth = max($CaptionWidth,($TxtPos[1]["X"] - $TxtPos[0]["X"])+$VerticalMargin*2); |
| 5821 | 5187 | $CaptionHeight = $CaptionHeight + max(($TxtPos[0]["Y"] - $TxtPos[2]["Y"]),($SerieBoxSize+2)) + $HorizontalMargin; |
@@ -5831,8 +5197,7 @@ discard block |
||
| 5831 | 5197 | $XMax = $X + 5 + floor(($BoxWidth-10) / 2); |
| 5832 | 5198 | |
| 5833 | 5199 | $RestoreShadow = $this->Shadow; |
| 5834 | - if ( $this->Shadow == TRUE ) |
|
| 5835 | - { |
|
| 5200 | + if ( $this->Shadow == TRUE ) { |
|
| 5836 | 5201 | $this->Shadow = FALSE; |
| 5837 | 5202 | |
| 5838 | 5203 | $Poly = ""; |
@@ -5840,13 +5205,10 @@ discard block |
||
| 5840 | 5205 | $Poly[] = $X+5+$this->ShadowX; $Poly[] = $Y-5+$this->ShadowX; |
| 5841 | 5206 | $Poly[] = $XMax+$this->ShadowX; $Poly[] = $Y-5+$this->ShadowX; |
| 5842 | 5207 | |
| 5843 | - if ( $NoTitle ) |
|
| 5844 | - { |
|
| 5208 | + if ( $NoTitle ) { |
|
| 5845 | 5209 | $Poly[] = $XMax+$this->ShadowX; $Poly[] = $Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2+$this->ShadowX; |
| 5846 | 5210 | $Poly[] = $XMin+$this->ShadowX; $Poly[] = $Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2+$this->ShadowX; |
| 5847 | - } |
|
| 5848 | - else |
|
| 5849 | - { |
|
| 5211 | + } else { |
|
| 5850 | 5212 | $Poly[] = $XMax+$this->ShadowX; $Poly[] = $Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3+$this->ShadowX; |
| 5851 | 5213 | $Poly[] = $XMin+$this->ShadowX; $Poly[] = $Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3+$this->ShadowX; |
| 5852 | 5214 | } |
@@ -5871,14 +5233,11 @@ discard block |
||
| 5871 | 5233 | imageline($this->Picture,$X,$Y,$X-5,$Y-5,$OuterBorderColor); |
| 5872 | 5234 | imageline($this->Picture,$X,$Y,$X+5,$Y-5,$OuterBorderColor); |
| 5873 | 5235 | imageline($this->Picture,$X+5,$Y-5,$XMax,$Y-5,$OuterBorderColor); |
| 5874 | - if ( $NoTitle ) |
|
| 5875 | - { |
|
| 5236 | + if ( $NoTitle ) { |
|
| 5876 | 5237 | imageline($this->Picture,$XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMin,$Y-5,$OuterBorderColor); |
| 5877 | 5238 | imageline($this->Picture,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMax,$Y-5,$OuterBorderColor); |
| 5878 | 5239 | imageline($this->Picture,$XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$OuterBorderColor); |
| 5879 | - } |
|
| 5880 | - else |
|
| 5881 | - { |
|
| 5240 | + } else { |
|
| 5882 | 5241 | imageline($this->Picture,$XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMin,$Y-5,$OuterBorderColor); |
| 5883 | 5242 | imageline($this->Picture,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax,$Y-5,$OuterBorderColor); |
| 5884 | 5243 | imageline($this->Picture,$XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$OuterBorderColor); |
@@ -5890,29 +5249,23 @@ discard block |
||
| 5890 | 5249 | imageline($this->Picture,$X,$Y-1,$X-5,$Y-6,$InnerBorderColor); |
| 5891 | 5250 | imageline($this->Picture,$X,$Y-1,$X+5,$Y-6,$InnerBorderColor); |
| 5892 | 5251 | imageline($this->Picture,$X+5,$Y-6,$XMax-1,$Y-6,$InnerBorderColor); |
| 5893 | - if ( $NoTitle ) |
|
| 5894 | - { |
|
| 5252 | + if ( $NoTitle ) { |
|
| 5895 | 5253 | imageline($this->Picture,$XMin+1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMin+1,$Y-6,$InnerBorderColor); |
| 5896 | 5254 | imageline($this->Picture,$XMax-1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMax-1,$Y-6,$InnerBorderColor); |
| 5897 | 5255 | imageline($this->Picture,$XMin+1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$XMax-1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*2,$InnerBorderColor); |
| 5898 | - } |
|
| 5899 | - else |
|
| 5900 | - { |
|
| 5256 | + } else { |
|
| 5901 | 5257 | imageline($this->Picture,$XMin+1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMin+1,$Y-6,$InnerBorderColor); |
| 5902 | 5258 | imageline($this->Picture,$XMax-1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax-1,$Y-6,$InnerBorderColor); |
| 5903 | 5259 | imageline($this->Picture,$XMin+1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax-1,$Y-4-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$InnerBorderColor); |
| 5904 | 5260 | } |
| 5905 | 5261 | |
| 5906 | 5262 | /* Draw the separator line */ |
| 5907 | - if ( $TitleMode == LABEL_TITLE_NOBACKGROUND && !$NoTitle ) |
|
| 5908 | - { |
|
| 5263 | + if ( $TitleMode == LABEL_TITLE_NOBACKGROUND && !$NoTitle ) { |
|
| 5909 | 5264 | $YPos = $Y-7-$CaptionHeight-$HorizontalMargin-$HorizontalMargin/2; |
| 5910 | 5265 | $XMargin = $VerticalMargin / 2; |
| 5911 | 5266 | $this->drawLine($XMin+$XMargin,$YPos+1,$XMax-$XMargin,$YPos+1,array("R"=>$GradientEndR,"G"=>$GradientEndG,"B"=>$GradientEndB)); |
| 5912 | 5267 | $this->drawLine($XMin+$XMargin,$YPos,$XMax-$XMargin,$YPos,array("R"=>$GradientStartR,"G"=>$GradientStartG,"B"=>$GradientStartB)); |
| 5913 | - } |
|
| 5914 | - elseif ( $TitleMode == LABEL_TITLE_BACKGROUND ) |
|
| 5915 | - { |
|
| 5268 | + } elseif ( $TitleMode == LABEL_TITLE_BACKGROUND ) { |
|
| 5916 | 5269 | $this->drawFilledRectangle($XMin,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin*3,$XMax,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin+$HorizontalMargin/2,array("R"=>$TitleBackgroundR,"G"=>$TitleBackgroundG,"B"=>$TitleBackgroundB)); |
| 5917 | 5270 | imageline($this->Picture,$XMin+1,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin+$HorizontalMargin/2+1,$XMax-1,$Y-5-$TitleHeight-$CaptionHeight-$HorizontalMargin+$HorizontalMargin/2+1,$InnerBorderColor); |
| 5918 | 5271 | } |
@@ -5923,15 +5276,13 @@ discard block |
||
| 5923 | 5276 | |
| 5924 | 5277 | /* Write the value */ |
| 5925 | 5278 | $YPos = $Y-5-$HorizontalMargin; $XPos = $XMin+$VerticalMargin+$SerieBoxSize+$SerieBoxSpacing; |
| 5926 | - foreach($Captions as $Key => $Caption) |
|
| 5927 | - { |
|
| 5279 | + foreach($Captions as $Key => $Caption) { |
|
| 5928 | 5280 | $CaptionTxt = $Caption["Caption"]; |
| 5929 | 5281 | $TxtPos = $this->getTextBox($XPos,$YPos,$FontName,$FontSize,0,$CaptionTxt); |
| 5930 | 5282 | $CaptionHeight = ($TxtPos[0]["Y"] - $TxtPos[2]["Y"]); |
| 5931 | 5283 | |
| 5932 | 5284 | /* Write the serie color if needed */ |
| 5933 | - if ( $DrawSerieColor ) |
|
| 5934 | - { |
|
| 5285 | + if ( $DrawSerieColor ) { |
|
| 5935 | 5286 | $BoxSettings = array("R"=>$Caption["Format"]["R"],"G"=>$Caption["Format"]["G"],"B"=>$Caption["Format"]["B"],"Alpha"=>$Caption["Format"]["Alpha"],"BorderR"=>0,"BorderG"=>0,"BorderB"=>0); |
| 5936 | 5287 | $this->drawFilledRectangle($XMin+$VerticalMargin,$YPos-$SerieBoxSize,$XMin+$VerticalMargin+$SerieBoxSize,$YPos,$BoxSettings); |
| 5937 | 5288 | } |
@@ -5945,48 +5296,34 @@ discard block |
||
| 5945 | 5296 | } |
| 5946 | 5297 | |
| 5947 | 5298 | /* Draw a basic shape */ |
| 5948 | - function drawShape($X,$Y,$Shape,$PlotSize,$PlotBorder,$BorderSize,$R,$G,$B,$Alpha,$BorderR,$BorderG,$BorderB,$BorderAlpha) |
|
| 5949 | - { |
|
| 5950 | - if ( $Shape == SERIE_SHAPE_FILLEDCIRCLE ) |
|
| 5951 | - { |
|
| 5299 | + function drawShape($X,$Y,$Shape,$PlotSize,$PlotBorder,$BorderSize,$R,$G,$B,$Alpha,$BorderR,$BorderG,$BorderB,$BorderAlpha) { |
|
| 5300 | + if ( $Shape == SERIE_SHAPE_FILLEDCIRCLE ) { |
|
| 5952 | 5301 | if ( $PlotBorder ) { $this->drawFilledCircle($X,$Y,$PlotSize+$BorderSize,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha)); } |
| 5953 | 5302 | $this->drawFilledCircle($X,$Y,$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 5954 | - } |
|
| 5955 | - elseif ( $Shape == SERIE_SHAPE_FILLEDSQUARE ) |
|
| 5956 | - { |
|
| 5303 | + } elseif ( $Shape == SERIE_SHAPE_FILLEDSQUARE ) { |
|
| 5957 | 5304 | if ( $PlotBorder ) { $this->drawFilledRectangle($X-$PlotSize-$BorderSize,$Y-$PlotSize-$BorderSize,$X+$PlotSize+$BorderSize,$Y+$PlotSize+$BorderSize,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha)); } |
| 5958 | 5305 | $this->drawFilledRectangle($X-$PlotSize,$Y-$PlotSize,$X+$PlotSize,$Y+$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 5959 | - } |
|
| 5960 | - elseif ( $Shape == SERIE_SHAPE_FILLEDTRIANGLE ) |
|
| 5961 | - { |
|
| 5962 | - if ( $PlotBorder ) |
|
| 5963 | - { |
|
| 5306 | + } elseif ( $Shape == SERIE_SHAPE_FILLEDTRIANGLE ) { |
|
| 5307 | + if ( $PlotBorder ) { |
|
| 5964 | 5308 | $Pos = ""; $Pos[]=$X; $Pos[]=$Y-$PlotSize-$BorderSize; $Pos[]=$X-$PlotSize-$BorderSize; $Pos[]=$Y+$PlotSize+$BorderSize; $Pos[]=$X+$PlotSize+$BorderSize; $Pos[]=$Y+$PlotSize+$BorderSize; |
| 5965 | 5309 | $this->drawPolygon($Pos,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha)); |
| 5966 | 5310 | } |
| 5967 | 5311 | |
| 5968 | 5312 | $Pos = ""; $Pos[]=$X; $Pos[]=$Y-$PlotSize; $Pos[]=$X-$PlotSize; $Pos[]=$Y+$PlotSize; $Pos[]=$X+$PlotSize; $Pos[]=$Y+$PlotSize; |
| 5969 | 5313 | $this->drawPolygon($Pos,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 5970 | - } |
|
| 5971 | - elseif ( $Shape == SERIE_SHAPE_TRIANGLE ) |
|
| 5972 | - { |
|
| 5314 | + } elseif ( $Shape == SERIE_SHAPE_TRIANGLE ) { |
|
| 5973 | 5315 | $this->drawLine($X,$Y-$PlotSize,$X-$PlotSize,$Y+$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 5974 | 5316 | $this->drawLine($X-$PlotSize,$Y+$PlotSize,$X+$PlotSize,$Y+$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 5975 | 5317 | $this->drawLine($X+$PlotSize,$Y+$PlotSize,$X,$Y-$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 5976 | - } |
|
| 5977 | - elseif ( $Shape == SERIE_SHAPE_SQUARE ) |
|
| 5318 | + } elseif ( $Shape == SERIE_SHAPE_SQUARE ) |
|
| 5978 | 5319 | $this->drawRectangle($X-$PlotSize,$Y-$PlotSize,$X+$PlotSize,$Y+$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 5979 | 5320 | elseif ( $Shape == SERIE_SHAPE_CIRCLE ) |
| 5980 | 5321 | $this->drawCircle($X,$Y,$PlotSize,$PlotSize,array("R"=>$R,"G"=>$G,"B"=>$B,"Alpha"=>$Alpha)); |
| 5981 | - elseif ( $Shape == SERIE_SHAPE_DIAMOND ) |
|
| 5982 | - { |
|
| 5322 | + elseif ( $Shape == SERIE_SHAPE_DIAMOND ) { |
|
| 5983 | 5323 | $Pos = ""; $Pos[]=$X-$PlotSize; $Pos[]=$Y; $Pos[]=$X; $Pos[]=$Y-$PlotSize; $Pos[]=$X+$PlotSize; $Pos[]=$Y; $Pos[]=$X; $Pos[]=$Y+$PlotSize; |
| 5984 | 5324 | $this->drawPolygon($Pos,array("NoFill"=>TRUE,"BorderR"=>$R,"BorderG"=>$G,"BorderB"=>$B,"BorderAlpha"=>$Alpha)); |
| 5985 | - } |
|
| 5986 | - elseif ( $Shape == SERIE_SHAPE_FILLEDDIAMOND ) |
|
| 5987 | - { |
|
| 5988 | - if ( $PlotBorder ) |
|
| 5989 | - { |
|
| 5325 | + } elseif ( $Shape == SERIE_SHAPE_FILLEDDIAMOND ) { |
|
| 5326 | + if ( $PlotBorder ) { |
|
| 5990 | 5327 | $Pos = ""; $Pos[]=$X-$PlotSize-$BorderSize; $Pos[]=$Y; $Pos[]=$X; $Pos[]=$Y-$PlotSize-$BorderSize; $Pos[]=$X+$PlotSize+$BorderSize; $Pos[]=$Y; $Pos[]=$X; $Pos[]=$Y+$PlotSize+$BorderSize; |
| 5991 | 5328 | $this->drawPolygon($Pos,array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha)); |
| 5992 | 5329 | } |
@@ -5996,8 +5333,7 @@ discard block |
||
| 5996 | 5333 | } |
| 5997 | 5334 | } |
| 5998 | 5335 | |
| 5999 | - function drawPolygonChart($Points,$Format="") |
|
| 6000 | - { |
|
| 5336 | + function drawPolygonChart($Points,$Format="") { |
|
| 6001 | 5337 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
| 6002 | 5338 | $G = isset($Format["G"]) ? $Format["G"] : 0; |
| 6003 | 5339 | $B = isset($Format["B"]) ? $Format["B"] : 0; |
@@ -6028,15 +5364,12 @@ discard block |
||
| 6028 | 5364 | |
| 6029 | 5365 | /* Simplify straight lines */ |
| 6030 | 5366 | $Result = ""; $inHorizon = FALSE; $LastX = VOID; |
| 6031 | - foreach($Segments as $Key => $Pos) |
|
| 6032 | - { |
|
| 6033 | - if ( $Pos["Y1"] != $Pos["Y2"] ) |
|
| 6034 | - { |
|
| 5367 | + foreach($Segments as $Key => $Pos) { |
|
| 5368 | + if ( $Pos["Y1"] != $Pos["Y2"] ) { |
|
| 6035 | 5369 | if ( $inHorizon ) { $inHorizon = FALSE; $Result[] = array("X1"=>$LastX,"Y1"=>$Pos["Y1"],"X2"=>$Pos["X1"],"Y2"=>$Pos["Y1"]); } |
| 6036 | 5370 | |
| 6037 | 5371 | $Result[] = array("X1"=>$Pos["X1"],"Y1"=>$Pos["Y1"],"X2"=>$Pos["X2"],"Y2"=>$Pos["Y2"]); |
| 6038 | - } |
|
| 6039 | - else { if ( !$inHorizon ) { $inHorizon = TRUE; $LastX = $Pos["X1"];} } |
|
| 5372 | + } else { if ( !$inHorizon ) { $inHorizon = TRUE; $LastX = $Pos["X1"];} } |
|
| 6040 | 5373 | } |
| 6041 | 5374 | $Segments = $Result; |
| 6042 | 5375 | |
@@ -6049,8 +5382,7 @@ discard block |
||
| 6049 | 5382 | |
| 6050 | 5383 | /* Find out the min & max Y boundaries */ |
| 6051 | 5384 | $MinY = OUT_OF_SIGHT; $MaxY = OUT_OF_SIGHT; |
| 6052 | - foreach($Segments as $Key => $Coords) |
|
| 6053 | - { |
|
| 5385 | + foreach($Segments as $Key => $Coords) { |
|
| 6054 | 5386 | if ( $MinY == OUT_OF_SIGHT || $MinY > min($Coords["Y1"],$Coords["Y2"]) ) { $MinY = min($Coords["Y1"],$Coords["Y2"]); } |
| 6055 | 5387 | if ( $MaxY == OUT_OF_SIGHT || $MaxY < max($Coords["Y1"],$Coords["Y2"]) ) { $MaxY = max($Coords["Y1"],$Coords["Y2"]); } |
| 6056 | 5388 | } |
@@ -6065,44 +5397,32 @@ discard block |
||
| 6065 | 5397 | |
| 6066 | 5398 | $MinY = floor($MinY); $MaxY = floor($MaxY); $YStep = 1; |
| 6067 | 5399 | |
| 6068 | - if ( !$NoFill ) |
|
| 6069 | - { |
|
| 5400 | + if ( !$NoFill ) { |
|
| 6070 | 5401 | //if ( $DebugLine ) { $MinY = $DebugLine; $MaxY = $DebugLine; } |
| 6071 | - for($Y=$MinY;$Y<=$MaxY;$Y=$Y+$YStep) |
|
| 6072 | - { |
|
| 5402 | + for($Y=$MinY;$Y<=$MaxY;$Y=$Y+$YStep) { |
|
| 6073 | 5403 | $Intersections = ""; $LastSlope = NULL; $RestoreLast = "-"; |
| 6074 | - foreach($Segments as $Key => $Coords) |
|
| 6075 | - { |
|
| 5404 | + foreach($Segments as $Key => $Coords) { |
|
| 6076 | 5405 | $X1 = $Coords["X1"]; $X2 = $Coords["X2"]; $Y1 = $Coords["Y1"]; $Y2 = $Coords["Y2"]; |
| 6077 | 5406 | |
| 6078 | - if ( min($Y1,$Y2) <= $Y && max($Y1,$Y2) >= $Y ) |
|
| 6079 | - { |
|
| 5407 | + if ( min($Y1,$Y2) <= $Y && max($Y1,$Y2) >= $Y ) { |
|
| 6080 | 5408 | if ( $Y1 == $Y2 ) |
| 6081 | - { $X = $X1; } |
|
| 6082 | - else |
|
| 5409 | + { $X = $X1; } else |
|
| 6083 | 5410 | { $X = $X1 + ( ($Y-$Y1)*$X2 - ($Y-$Y1)*$X1 ) / ($Y2-$Y1); } |
| 6084 | 5411 | |
| 6085 | 5412 | $X = floor($X); |
| 6086 | 5413 | |
| 6087 | 5414 | if ( $X2 == $X1 ) |
| 6088 | - { $Slope = "!"; } |
|
| 6089 | - else |
|
| 6090 | - { |
|
| 5415 | + { $Slope = "!"; } else { |
|
| 6091 | 5416 | $SlopeC = ($Y2 - $Y1) / ($X2 - $X1); |
| 6092 | 5417 | if( $SlopeC == 0 ) |
| 6093 | - { $Slope = "="; } |
|
| 6094 | - elseif( $SlopeC > 0 ) |
|
| 6095 | - { $Slope = "+"; } |
|
| 6096 | - elseif ( $SlopeC < 0 ) |
|
| 5418 | + { $Slope = "="; } elseif( $SlopeC > 0 ) |
|
| 5419 | + { $Slope = "+"; } elseif ( $SlopeC < 0 ) |
|
| 6097 | 5420 | { $Slope = "-"; } |
| 6098 | 5421 | } |
| 6099 | 5422 | |
| 6100 | 5423 | if ( !is_array($Intersections) ) |
| 6101 | - { $Intersections[] = $X; } |
|
| 6102 | - elseif( !in_array($X,$Intersections) ) |
|
| 6103 | - { $Intersections[] = $X; } |
|
| 6104 | - elseif( in_array($X,$Intersections) ) |
|
| 6105 | - { |
|
| 5424 | + { $Intersections[] = $X; } elseif( !in_array($X,$Intersections) ) |
|
| 5425 | + { $Intersections[] = $X; } elseif( in_array($X,$Intersections) ) { |
|
| 6106 | 5426 | if ($Y == $DebugLine) { echo $Slope."/".$LastSlope."(".$X.") "; } |
| 6107 | 5427 | |
| 6108 | 5428 | if ( $Slope == "=" && $LastSlope == "-" ) { $Intersections[] = $X; } |
@@ -6117,40 +5437,32 @@ discard block |
||
| 6117 | 5437 | } |
| 6118 | 5438 | if ( $RestoreLast != "-" ) { $Intersections[] = $RestoreLast; echo "@".$Y."\r\n"; } |
| 6119 | 5439 | |
| 6120 | - if ( is_array($Intersections) ) |
|
| 6121 | - { |
|
| 5440 | + if ( is_array($Intersections) ) { |
|
| 6122 | 5441 | sort($Intersections); |
| 6123 | 5442 | |
| 6124 | 5443 | if ($Y == $DebugLine) { print_r($Intersections); } |
| 6125 | 5444 | |
| 6126 | 5445 | /* Remove NULL plots */ |
| 6127 | 5446 | $Result = ""; |
| 6128 | - for($i=0;$i<=count($Intersections)-1;$i=$i+2) |
|
| 6129 | - { |
|
| 5447 | + for($i=0;$i<=count($Intersections)-1;$i=$i+2) { |
|
| 6130 | 5448 | if ( isset($Intersections[$i+1]) ) |
| 6131 | 5449 | { if ( $Intersections[$i] != $Intersections[$i+1] ) { $Result[] = $Intersections[$i]; $Result[] = $Intersections[$i+1]; } } |
| 6132 | 5450 | } |
| 6133 | 5451 | |
| 6134 | - if ( is_array($Result) ) |
|
| 6135 | - { |
|
| 5452 | + if ( is_array($Result) ) { |
|
| 6136 | 5453 | $Intersections = $Result; |
| 6137 | 5454 | |
| 6138 | 5455 | $LastX = OUT_OF_SIGHT; |
| 6139 | - foreach($Intersections as $Key => $X) |
|
| 6140 | - { |
|
| 5456 | + foreach($Intersections as $Key => $X) { |
|
| 6141 | 5457 | if ( $LastX == OUT_OF_SIGHT ) |
| 6142 | 5458 | $LastX = $X; |
| 6143 | - elseif ( $LastX != OUT_OF_SIGHT ) |
|
| 6144 | - { |
|
| 5459 | + elseif ( $LastX != OUT_OF_SIGHT ) { |
|
| 6145 | 5460 | if ( $this->getFirstDecimal($LastX) > 1 ) { $LastX++; } |
| 6146 | 5461 | |
| 6147 | 5462 | $Color = $DefaultColor; |
| 6148 | - if ( $Threshold != NULL ) |
|
| 6149 | - { |
|
| 6150 | - foreach($Threshold as $Key => $Parameters) |
|
| 6151 | - { |
|
| 6152 | - if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"]) |
|
| 6153 | - { |
|
| 5463 | + if ( $Threshold != NULL ) { |
|
| 5464 | + foreach($Threshold as $Key => $Parameters) { |
|
| 5465 | + if ( $Y <= $Parameters["MinX"] && $Y >= $Parameters["MaxX"]) { |
|
| 6154 | 5466 | if ( isset($Parameters["R"]) ) { $R = $Parameters["R"]; } else { $R = 0; } |
| 6155 | 5467 | if ( isset($Parameters["G"]) ) { $G = $Parameters["G"]; } else { $G = 0; } |
| 6156 | 5468 | if ( isset($Parameters["B"]) ) { $B = $Parameters["B"]; } else { $B = 0; } |
@@ -6173,18 +5485,17 @@ discard block |
||
| 6173 | 5485 | } |
| 6174 | 5486 | |
| 6175 | 5487 | /* Draw the polygon border, if required */ |
| 6176 | - if ( !$NoBorder) |
|
| 6177 | - { |
|
| 6178 | - foreach($Segments as $Key => $Coords) |
|
| 6179 | - $this->drawLine($Coords["X1"],$Coords["Y1"],$Coords["X2"],$Coords["Y2"],array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Threshold"=>$Threshold)); |
|
| 5488 | + if ( !$NoBorder) { |
|
| 5489 | + foreach($Segments as $Key => $Coords) { |
|
| 5490 | + $this->drawLine($Coords["X1"],$Coords["Y1"],$Coords["X2"],$Coords["Y2"],array("R"=>$BorderR,"G"=>$BorderG,"B"=>$BorderB,"Alpha"=>$BorderAlpha,"Threshold"=>$Threshold)); |
|
| 5491 | + } |
|
| 6180 | 5492 | } |
| 6181 | 5493 | |
| 6182 | 5494 | $this->Shadow = $RestoreShadow; |
| 6183 | 5495 | } |
| 6184 | 5496 | |
| 6185 | 5497 | /* Return the abscissa margin */ |
| 6186 | - function getAbscissaMargin($Data) |
|
| 6187 | - { |
|
| 5498 | + function getAbscissaMargin($Data) { |
|
| 6188 | 5499 | foreach($Data["Axis"] as $AxisID => $Values) { if ( $Values["Identity"] == AXIS_X ) { return($Values["Margin"]); } } |
| 6189 | 5500 | return(0); |
| 6190 | 5501 | } |
@@ -82,6 +82,12 @@ discard block |
||
| 82 | 82 | var $LastChartLayout = CHART_LAST_LAYOUT_REGULAR; // Last layout : regular or stacked |
| 83 | 83 | |
| 84 | 84 | /* Class constructor */ |
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * @param integer $XSize |
|
| 88 | + * @param integer $YSize |
|
| 89 | + * @param pData $DataSet |
|
| 90 | + */ |
|
| 85 | 91 | function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE) |
| 86 | 92 | { |
| 87 | 93 | $this->TransparentBackground = $TransparentBackground; |
@@ -126,6 +132,13 @@ discard block |
||
| 126 | 132 | } |
| 127 | 133 | |
| 128 | 134 | /* Set the graph area position */ |
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * @param integer $X1 |
|
| 138 | + * @param integer $Y1 |
|
| 139 | + * @param integer $X2 |
|
| 140 | + * @param integer $Y2 |
|
| 141 | + */ |
|
| 129 | 142 | function setGraphArea($X1,$Y1,$X2,$Y2) |
| 130 | 143 | { |
| 131 | 144 | if ( $X2 < $X1 || $X1 == $X2 || $Y2 < $Y1 || $Y1 == $Y2 ) { return(-1); } |
@@ -145,6 +158,10 @@ discard block |
||
| 145 | 158 | { return($this->YSize); } |
| 146 | 159 | |
| 147 | 160 | /* Render the picture to a file */ |
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @param string $FileName |
|
| 164 | + */ |
|
| 148 | 165 | function render($FileName) |
| 149 | 166 | { |
| 150 | 167 | if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); } |
@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | /* The GD extension is mandatory */ |
| 17 | - if (!extension_loaded('gd') && !extension_loaded('gd2')) |
|
| 18 | - { |
|
| 17 | + if (!extension_loaded('gd') && !extension_loaded('gd2')) { |
|
| 19 | 18 | echo "GD extension must be loaded. \r\n"; |
| 20 | 19 | exit(); |
| 21 | 20 | } |
@@ -31,8 +30,7 @@ discard block |
||
| 31 | 30 | /* ImageMap string delimiter */ |
| 32 | 31 | define("IMAGE_MAP_DELIMITER" , chr(1)); |
| 33 | 32 | |
| 34 | - class pImage extends pDraw |
|
| 35 | - { |
|
| 33 | + class pImage extends pDraw { |
|
| 36 | 34 | /* Image settings, size, quality, .. */ |
| 37 | 35 | var $XSize = NULL; // Width of the picture |
| 38 | 36 | var $YSize = NULL; // Height of the picture |
@@ -82,8 +80,7 @@ discard block |
||
| 82 | 80 | var $LastChartLayout = CHART_LAST_LAYOUT_REGULAR; // Last layout : regular or stacked |
| 83 | 81 | |
| 84 | 82 | /* Class constructor */ |
| 85 | - function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE) |
|
| 86 | - { |
|
| 83 | + function pImage($XSize,$YSize,$DataSet=NULL,$TransparentBackground=FALSE) { |
|
| 87 | 84 | $this->TransparentBackground = $TransparentBackground; |
| 88 | 85 | |
| 89 | 86 | if ( $DataSet != NULL ) { $this->DataSet = $DataSet; } |
@@ -92,23 +89,19 @@ discard block |
||
| 92 | 89 | $this->YSize = $YSize; |
| 93 | 90 | $this->Picture = imagecreatetruecolor($XSize,$YSize); |
| 94 | 91 | |
| 95 | - if ( $this->TransparentBackground ) |
|
| 96 | - { |
|
| 92 | + if ( $this->TransparentBackground ) { |
|
| 97 | 93 | imagealphablending($this->Picture,FALSE); |
| 98 | 94 | imagefilledrectangle($this->Picture, 0,0,$XSize, $YSize, imagecolorallocatealpha($this->Picture, 255, 255, 255, 127)); |
| 99 | 95 | imagealphablending($this->Picture,TRUE); |
| 100 | 96 | imagesavealpha($this->Picture,true); |
| 101 | - } |
|
| 102 | - else |
|
| 103 | - { |
|
| 97 | + } else { |
|
| 104 | 98 | $C_White = $this->AllocateColor($this->Picture,255,255,255); |
| 105 | 99 | imagefilledrectangle($this->Picture,0,0,$XSize,$YSize,$C_White); |
| 106 | 100 | } |
| 107 | 101 | } |
| 108 | 102 | |
| 109 | 103 | /* Enable / Disable and set shadow properties */ |
| 110 | - function setShadow($Enabled=TRUE,$Format="") |
|
| 111 | - { |
|
| 104 | + function setShadow($Enabled=TRUE,$Format="") { |
|
| 112 | 105 | $X = isset($Format["X"]) ? $Format["X"] : 2; |
| 113 | 106 | $Y = isset($Format["Y"]) ? $Format["Y"] : 2; |
| 114 | 107 | $R = isset($Format["R"]) ? $Format["R"] : 0; |
@@ -126,8 +119,7 @@ discard block |
||
| 126 | 119 | } |
| 127 | 120 | |
| 128 | 121 | /* Set the graph area position */ |
| 129 | - function setGraphArea($X1,$Y1,$X2,$Y2) |
|
| 130 | - { |
|
| 122 | + function setGraphArea($X1,$Y1,$X2,$Y2) { |
|
| 131 | 123 | if ( $X2 < $X1 || $X1 == $X2 || $Y2 < $Y1 || $Y1 == $Y2 ) { return(-1); } |
| 132 | 124 | |
| 133 | 125 | $this->GraphAreaX1 = $X1; $this->DataSet->Data["GraphArea"]["X1"] = $X1; |
@@ -145,19 +137,16 @@ discard block |
||
| 145 | 137 | { return($this->YSize); } |
| 146 | 138 | |
| 147 | 139 | /* Render the picture to a file */ |
| 148 | - function render($FileName) |
|
| 149 | - { |
|
| 140 | + function render($FileName) { |
|
| 150 | 141 | if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); } |
| 151 | 142 | imagepng($this->Picture,$FileName); |
| 152 | 143 | } |
| 153 | 144 | |
| 154 | 145 | /* Render the picture to a web browser stream */ |
| 155 | - function stroke($BrowserExpire=FALSE) |
|
| 156 | - { |
|
| 146 | + function stroke($BrowserExpire=FALSE) { |
|
| 157 | 147 | if ( $this->TransparentBackground ) { imagealphablending($this->Picture,false); imagesavealpha($this->Picture,true); } |
| 158 | 148 | |
| 159 | - if ( $BrowserExpire ) |
|
| 160 | - { |
|
| 149 | + if ( $BrowserExpire ) { |
|
| 161 | 150 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
| 162 | 151 | header("Cache-Control: no-cache"); |
| 163 | 152 | header("Pragma: no-cache"); |
@@ -168,8 +157,7 @@ discard block |
||
| 168 | 157 | } |
| 169 | 158 | |
| 170 | 159 | /* Automatic output method based on the calling interface */ |
| 171 | - function autoOutput($FileName="output.png") |
|
| 172 | - { |
|
| 160 | + function autoOutput($FileName="output.png") { |
|
| 173 | 161 | if (php_sapi_name() == "cli") |
| 174 | 162 | $this->Render($FileName); |
| 175 | 163 | else |
@@ -181,15 +169,13 @@ discard block |
||
| 181 | 169 | { return(sqrt(pow(max($X1,$X2)-min($X1,$X2),2)+pow(max($Y1,$Y2)-min($Y1,$Y2),2))); } |
| 182 | 170 | |
| 183 | 171 | /* Return the orientation of a line */ |
| 184 | - function getAngle($X1,$Y1,$X2,$Y2) |
|
| 185 | - { |
|
| 172 | + function getAngle($X1,$Y1,$X2,$Y2) { |
|
| 186 | 173 | $Opposite = $Y2 - $Y1; $Adjacent = $X2 - $X1;$Angle = rad2deg(atan2($Opposite,$Adjacent)); |
| 187 | 174 | if ($Angle > 0) { return($Angle); } else { return(360-abs($Angle)); } |
| 188 | 175 | } |
| 189 | 176 | |
| 190 | 177 | /* Return the surrounding box of text area */ |
| 191 | - function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text) |
|
| 192 | - { |
|
| 178 | + function getTextBox_deprecated($X,$Y,$FontName,$FontSize,$Angle,$Text) { |
|
| 193 | 179 | $Size = imagettfbbox($FontSize,$Angle,$FontName,$Text); |
| 194 | 180 | $Width = $this->getLength($Size[0],$Size[1],$Size[2],$Size[3])+1; |
| 195 | 181 | $Height = $this->getLength($Size[2],$Size[3],$Size[4],$Size[5])+1; |
@@ -206,13 +192,11 @@ discard block |
||
| 206 | 192 | } |
| 207 | 193 | |
| 208 | 194 | /* Return the surrounding box of text area */ |
| 209 | - function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text) |
|
| 210 | - { |
|
| 195 | + function getTextBox($X,$Y,$FontName,$FontSize,$Angle,$Text) { |
|
| 211 | 196 | $coords = imagettfbbox($FontSize, 0, $FontName, $Text); |
| 212 | 197 | |
| 213 | 198 | $a = deg2rad($Angle); $ca = cos($a); $sa = sin($a); $RealPos = array(); |
| 214 | - for($i = 0; $i < 7; $i += 2) |
|
| 215 | - { |
|
| 199 | + for($i = 0; $i < 7; $i += 2) { |
|
| 216 | 200 | $RealPos[$i/2]["X"] = $X + round($coords[$i] * $ca + $coords[$i+1] * $sa); |
| 217 | 201 | $RealPos[$i/2]["Y"] = $Y + round($coords[$i+1] * $ca - $coords[$i] * $sa); |
| 218 | 202 | } |
@@ -231,8 +215,7 @@ discard block |
||
| 231 | 215 | } |
| 232 | 216 | |
| 233 | 217 | /* Set current font properties */ |
| 234 | - function setFontProperties($Format="") |
|
| 235 | - { |
|
| 218 | + function setFontProperties($Format="") { |
|
| 236 | 219 | $R = isset($Format["R"]) ? $Format["R"] : -1; |
| 237 | 220 | $G = isset($Format["G"]) ? $Format["G"] : -1; |
| 238 | 221 | $B = isset($Format["B"]) ? $Format["B"] : -1; |
@@ -253,8 +236,7 @@ discard block |
||
| 253 | 236 | } |
| 254 | 237 | |
| 255 | 238 | /* Returns the 1st decimal values (used to correct AA bugs) */ |
| 256 | - function getFirstDecimal($Value) |
|
| 257 | - { |
|
| 239 | + function getFirstDecimal($Value) { |
|
| 258 | 240 | $Values = preg_split("/\./",$Value); |
| 259 | 241 | if ( isset($Values[1]) ) { return(substr($Values[1],0,1)); } else { return(0); } |
| 260 | 242 | } |
@@ -268,18 +250,14 @@ discard block |
||
| 268 | 250 | { print_r($this->DataSet); } |
| 269 | 251 | |
| 270 | 252 | /* Initialise the image map methods */ |
| 271 | - function initialiseImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp") |
|
| 272 | - { |
|
| 253 | + function initialiseImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp") { |
|
| 273 | 254 | $this->ImageMapIndex = $Name; |
| 274 | 255 | $this->ImageMapStorageMode = $StorageMode; |
| 275 | 256 | |
| 276 | - if ($StorageMode == IMAGE_MAP_STORAGE_SESSION) |
|
| 277 | - { |
|
| 257 | + if ($StorageMode == IMAGE_MAP_STORAGE_SESSION) { |
|
| 278 | 258 | if(!isset($_SESSION)) { session_start(); } |
| 279 | 259 | $_SESSION[$this->ImageMapIndex] = NULL; |
| 280 | - } |
|
| 281 | - elseif($StorageMode == IMAGE_MAP_STORAGE_FILE) |
|
| 282 | - { |
|
| 260 | + } elseif($StorageMode == IMAGE_MAP_STORAGE_FILE) { |
|
| 283 | 261 | $this->ImageMapFileName = $UniqueID; |
| 284 | 262 | $this->ImageMapStorageFolder = $StorageFolder; |
| 285 | 263 | |
@@ -288,27 +266,22 @@ discard block |
||
| 288 | 266 | } |
| 289 | 267 | |
| 290 | 268 | /* Add a zone to the image map */ |
| 291 | - function addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL,$HTMLEncode=FALSE) |
|
| 292 | - { |
|
| 269 | + function addToImageMap($Type,$Plots,$Color=NULL,$Title=NULL,$Message=NULL,$HTMLEncode=FALSE) { |
|
| 293 | 270 | if ( $this->ImageMapStorageMode == NULL ) { $this->initialiseImageMap(); } |
| 294 | 271 | |
| 295 | 272 | /* Encode the characters in the imagemap in HTML standards */ |
| 296 | 273 | $Title = str_replace("€","\u20AC",$Title); |
| 297 | 274 | $Title = htmlentities($Title,ENT_QUOTES,"ISO-8859-15"); |
| 298 | - if ( $HTMLEncode ) |
|
| 299 | - { |
|
| 275 | + if ( $HTMLEncode ) { |
|
| 300 | 276 | $Message = htmlentities($Message,ENT_QUOTES,"ISO-8859-15"); |
| 301 | 277 | $Message = str_replace("<","<",$Message); |
| 302 | 278 | $Message = str_replace(">",">",$Message); |
| 303 | 279 | } |
| 304 | 280 | |
| 305 | - if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) |
|
| 306 | - { |
|
| 281 | + if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) { |
|
| 307 | 282 | if(!isset($_SESSION)) { $this->initialiseImageMap(); } |
| 308 | 283 | $_SESSION[$this->ImageMapIndex][] = array($Type,$Plots,$Color,$Title,$Message); |
| 309 | - } |
|
| 310 | - elseif($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE) |
|
| 311 | - { |
|
| 284 | + } elseif($this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE) { |
|
| 312 | 285 | $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'a'); |
| 313 | 286 | fwrite($Handle, $Type.IMAGE_MAP_DELIMITER.$Plots.IMAGE_MAP_DELIMITER.$Color.IMAGE_MAP_DELIMITER.$Title.IMAGE_MAP_DELIMITER.$Message."\r\n"); |
| 314 | 287 | fclose($Handle); |
@@ -316,8 +289,7 @@ discard block |
||
| 316 | 289 | } |
| 317 | 290 | |
| 318 | 291 | /* Remove VOID values from an imagemap custom values array */ |
| 319 | - function removeVOIDFromArray($SerieName, $Values) |
|
| 320 | - { |
|
| 292 | + function removeVOIDFromArray($SerieName, $Values) { |
|
| 321 | 293 | if ( !isset($this->DataSet->Data["Series"][$SerieName]) ) { return(-1); } |
| 322 | 294 | |
| 323 | 295 | $Result = ""; |
@@ -327,36 +299,28 @@ discard block |
||
| 327 | 299 | } |
| 328 | 300 | |
| 329 | 301 | /* Replace the title of one image map serie */ |
| 330 | - function replaceImageMapTitle($OldTitle, $NewTitle) |
|
| 331 | - { |
|
| 302 | + function replaceImageMapTitle($OldTitle, $NewTitle) { |
|
| 332 | 303 | if ( $this->ImageMapStorageMode == NULL ) { return(-1); } |
| 333 | 304 | |
| 334 | 305 | if ( is_array($NewTitle) ) { $NewTitle = $this->removeVOIDFromArray($OldTitle, $NewTitle); } |
| 335 | 306 | |
| 336 | - if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) |
|
| 337 | - { |
|
| 307 | + if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) { |
|
| 338 | 308 | if(!isset($_SESSION)) { return(-1); } |
| 339 | 309 | if ( is_array($NewTitle) ) |
| 340 | - { $ID = 0; foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID])) { $_SESSION[$this->ImageMapIndex][$Key][3] = $NewTitle[$ID]; $ID++; } } } |
|
| 341 | - else |
|
| 310 | + { $ID = 0; foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID])) { $_SESSION[$this->ImageMapIndex][$Key][3] = $NewTitle[$ID]; $ID++; } } } else |
|
| 342 | 311 | { foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $OldTitle ) { $_SESSION[$this->ImageMapIndex][$Key][3] = $NewTitle; } } } |
| 343 | - } |
|
| 344 | - elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) |
|
| 345 | - { |
|
| 312 | + } elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) { |
|
| 346 | 313 | $TempArray = ""; |
| 347 | 314 | $Handle = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r"); |
| 348 | - if ($Handle) |
|
| 349 | - { |
|
| 350 | - while (($Buffer = fgets($Handle, 4096)) !== false) |
|
| 351 | - { |
|
| 315 | + if ($Handle) { |
|
| 316 | + while (($Buffer = fgets($Handle, 4096)) !== false) { |
|
| 352 | 317 | $Fields = split(IMAGE_MAP_DELIMITER,str_replace(array(chr(10),chr(13)),"",$Buffer)); |
| 353 | 318 | $TempArray[] = array($Fields[0],$Fields[1],$Fields[2],$Fields[3],$Fields[4]); |
| 354 | 319 | } |
| 355 | 320 | fclose($Handle); |
| 356 | 321 | |
| 357 | 322 | if ( is_array($NewTitle) ) |
| 358 | - { $ID = 0; foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID]) ) { $TempArray[$Key][3] = $NewTitle[$ID]; $ID++; } } } |
|
| 359 | - else |
|
| 323 | + { $ID = 0; foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle && isset($NewTitle[$ID]) ) { $TempArray[$Key][3] = $NewTitle[$ID]; $ID++; } } } else |
|
| 360 | 324 | { foreach($TempArray as $Key => $Settings) { if ( $Settings[3] == $OldTitle ) { $TempArray[$Key][3] = $NewTitle; } } } |
| 361 | 325 | |
| 362 | 326 | $Handle = fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", 'w'); |
@@ -368,25 +332,19 @@ discard block |
||
| 368 | 332 | } |
| 369 | 333 | |
| 370 | 334 | /* Replace the values of the image map contents */ |
| 371 | - function replaceImageMapValues($Title, $Values) |
|
| 372 | - { |
|
| 335 | + function replaceImageMapValues($Title, $Values) { |
|
| 373 | 336 | if ( $this->ImageMapStorageMode == NULL ) { return(-1); } |
| 374 | 337 | |
| 375 | 338 | $Values = $this->removeVOIDFromArray($Title, $Values); |
| 376 | 339 | $ID = 0; |
| 377 | - if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) |
|
| 378 | - { |
|
| 340 | + if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) { |
|
| 379 | 341 | if(!isset($_SESSION)) { return(-1); } |
| 380 | 342 | foreach($_SESSION[$this->ImageMapIndex] as $Key => $Settings) { if ( $Settings[3] == $Title ) { if ( isset($Values[$ID]) ) { $_SESSION[$this->ImageMapIndex][$Key][4] = $Values[$ID]; } $ID++; } } |
| 381 | - } |
|
| 382 | - elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) |
|
| 383 | - { |
|
| 343 | + } elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) { |
|
| 384 | 344 | $TempArray = ""; |
| 385 | 345 | $Handle = @fopen($this->ImageMapStorageFolder."/".$this->ImageMapFileName.".map", "r"); |
| 386 | - if ($Handle) |
|
| 387 | - { |
|
| 388 | - while (($Buffer = fgets($Handle, 4096)) !== false) |
|
| 389 | - { |
|
| 346 | + if ($Handle) { |
|
| 347 | + while (($Buffer = fgets($Handle, 4096)) !== false) { |
|
| 390 | 348 | $Fields = split(IMAGE_MAP_DELIMITER,str_replace(array(chr(10),chr(13)),"",$Buffer)); |
| 391 | 349 | $TempArray[] = array($Fields[0],$Fields[1],$Fields[2],$Fields[3],$Fields[4]); |
| 392 | 350 | } |
@@ -403,24 +361,18 @@ discard block |
||
| 403 | 361 | } |
| 404 | 362 | |
| 405 | 363 | /* Dump the image map */ |
| 406 | - function dumpImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp") |
|
| 407 | - { |
|
| 364 | + function dumpImageMap($Name="pChart",$StorageMode=IMAGE_MAP_STORAGE_SESSION,$UniqueID="imageMap",$StorageFolder="tmp") { |
|
| 408 | 365 | $this->ImageMapIndex = $Name; |
| 409 | 366 | $this->ImageMapStorageMode = $StorageMode; |
| 410 | 367 | |
| 411 | - if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) |
|
| 412 | - { |
|
| 368 | + if ( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_SESSION ) { |
|
| 413 | 369 | if(!isset($_SESSION)) { session_start(); } |
| 414 | - if ( $_SESSION[$Name] != NULL ) |
|
| 415 | - { |
|
| 370 | + if ( $_SESSION[$Name] != NULL ) { |
|
| 416 | 371 | foreach($_SESSION[$Name] as $Key => $Params) |
| 417 | 372 | { echo $Params[0].IMAGE_MAP_DELIMITER.$Params[1].IMAGE_MAP_DELIMITER.$Params[2].IMAGE_MAP_DELIMITER.$Params[3].IMAGE_MAP_DELIMITER.$Params[4]."\r\n"; } |
| 418 | 373 | } |
| 419 | - } |
|
| 420 | - elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) |
|
| 421 | - { |
|
| 422 | - if (file_exists($StorageFolder."/".$UniqueID.".map")) |
|
| 423 | - { |
|
| 374 | + } elseif( $this->ImageMapStorageMode == IMAGE_MAP_STORAGE_FILE ) { |
|
| 375 | + if (file_exists($StorageFolder."/".$UniqueID.".map")) { |
|
| 424 | 376 | $Handle = @fopen($StorageFolder."/".$UniqueID.".map", "r"); |
| 425 | 377 | if ($Handle) { while (($Buffer = fgets($Handle, 4096)) !== false) { echo $Buffer; } } |
| 426 | 378 | fclose($Handle); |
@@ -434,8 +386,7 @@ discard block |
||
| 434 | 386 | } |
| 435 | 387 | |
| 436 | 388 | /* Return the HTML converted color from the RGB composite values */ |
| 437 | - function toHTMLColor($R,$G,$B) |
|
| 438 | - { |
|
| 389 | + function toHTMLColor($R,$G,$B) { |
|
| 439 | 390 | $R=intval($R); $G=intval($G); $B=intval($B); |
| 440 | 391 | $R=dechex($R<0?0:($R>255?255:$R)); $G=dechex($G<0?0:($G>255?255:$G));$B=dechex($B<0?0:($B>255?255:$B)); |
| 441 | 392 | $Color="#".(strlen($R) < 2?'0':'').$R; $Color.=(strlen($G) < 2?'0':'').$G; $Color.= (strlen($B) < 2?'0':'').$B; |
@@ -443,16 +394,14 @@ discard block |
||
| 443 | 394 | } |
| 444 | 395 | |
| 445 | 396 | /* Reverse an array of points */ |
| 446 | - function reversePlots($Plots) |
|
| 447 | - { |
|
| 397 | + function reversePlots($Plots) { |
|
| 448 | 398 | $Result = ""; |
| 449 | 399 | for($i=count($Plots)-2;$i>=0;$i=$i-2) { $Result[] = $Plots[$i]; $Result[] = $Plots[$i+1]; } |
| 450 | 400 | return($Result); |
| 451 | 401 | } |
| 452 | 402 | |
| 453 | 403 | /* Mirror Effect */ |
| 454 | - function drawAreaMirror($X,$Y,$Width,$Height,$Format="") |
|
| 455 | - { |
|
| 404 | + function drawAreaMirror($X,$Y,$Width,$Height,$Format="") { |
|
| 456 | 405 | $StartAlpha = isset($Format["StartAlpha"]) ? $Format["StartAlpha"] : 80; |
| 457 | 406 | $EndAlpha = isset($Format["EndAlpha"]) ? $Format["EndAlpha"] : 0; |
| 458 | 407 | |
@@ -461,8 +410,7 @@ discard block |
||
| 461 | 410 | $Picture = imagecreatetruecolor($this->XSize,$this->YSize); |
| 462 | 411 | imagecopy($Picture,$this->Picture,0,0,0,0,$this->XSize,$this->YSize); |
| 463 | 412 | |
| 464 | - for($i=1;$i<=$Height;$i++) |
|
| 465 | - { |
|
| 413 | + for($i=1;$i<=$Height;$i++) { |
|
| 466 | 414 | if ( $Y+($i-1) < $this->YSize && $Y-$i > 0 ) { imagecopymerge($Picture,$this->Picture,$X,$Y+($i-1),$X,$Y-$i,$Width,1,$StartAlpha-$AlphaStep*$i); } |
| 467 | 415 | } |
| 468 | 416 | |