Ignore:
Timestamp:
12/14/12 14:30:35 (11 years ago)
Author:
douglasz
Message:

Ticket #3236 - Melhorias de performance no codigo do Expresso.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/phplot/phplot.php

    r6057 r7655  
    549549            $this->ndx_data_colors[$i] = $this->SetIndexColor($col); 
    550550            $this->ndx_data_dark_colors[$i] = $this->SetIndexDarkColor($col); 
    551             $i++; 
     551            ++$i; 
    552552        } 
    553553 
     
    574574        foreach($this->data_border_colors as $col) { 
    575575            $this->ndx_data_border_colors[$i] = $this->SetIndexColor($col); 
    576             $i++; 
     576            ++$i; 
    577577        } 
    578578    } // function SetDataBorderColors() 
     
    595595        foreach($this->error_bar_colors as $col) { 
    596596            $this->ndx_error_bar_colors[$i] = $this->SetIndexColor($col); 
    597             $i++; 
     597            ++$i; 
    598598        } 
    599599        return TRUE; 
     
    628628                $this->default_dashed_style .= str_repeat('IMG_COLOR_TRANSPARENT,', $s); 
    629629            } 
    630             $t++; 
     630            ++$t; 
    631631        } 
    632632        // Remove trailing comma and add closing parenthesis 
     
    959959 
    960960                $ypos = $which_ypos; 
    961                 for($i = 0; $i < $nlines; $i++) { 
     961                for($i = 0; $i < $nlines; ++$i) { 
    962962                    // Center the text vertically around $which_ypos (each line) 
    963963                    if ($which_valign == 'center') 
     
    983983 
    984984                $xpos = $which_xpos; 
    985                 for($i = 0; $i < $nlines; $i++) { 
     985                for($i = 0; $i < $nlines; ++$i) { 
    986986                    // center the text around $which_xpos 
    987987                    if ($which_halign == 'center') 
     
    17101710 
    17111711        // Fix odd point sizes for point shapes which need it 
    1712         for ($i = 0; $i < $pt; $i++) { 
     1712        for ($i = 0; $i < $pt; ++$i) { 
    17131713            if ($this->point_shapes[$i] == 'diamond' or $this->point_shapes[$i] == 'triangle') { 
    17141714                if ($this->point_sizes[$i] % 2 != 0) { 
     
    17621762        $this->total_records = 0;               // Perform some useful calculations. 
    17631763        $this->records_per_group = 1; 
    1764         for ($i = 0, $recs = 0; $i < $this->num_data_rows; $i++) { 
     1764        for ($i = 0, $recs = 0; $i < $this->num_data_rows; ++$i) { 
    17651765            // Copy 
    17661766            $this->data[$i] = array_values($which_dv[$i]);   // convert to numerical indices. 
     
    18421842 
    18431843        // Process each row of data 
    1844         for ($i=0; $i < $this->num_data_rows; $i++) { 
     1844        for ($i=0; $i < $this->num_data_rows; ++$i) { 
    18451845            $j=0; 
    18461846            // Extract maximum text label length 
     
    18581858                    $miny = $maxy; 
    18591859                } 
    1860                 for (; $j < $this->num_recs[$i]; $j++) { 
     1860                for (; $j < $this->num_recs[$i]; ++$j) { 
    18611861                    $val = (double)$this->data[$i][$j]; 
    18621862                    if ($this->plot_type == 'stackedbars') { 
     
    18761876                $miny = $maxy = (double)$this->data[$i][$j++]; 
    18771877                // $numrecs = @ count($this->data[$i]); 
    1878                 for (; $j < $this->num_recs[$i]; $j++) { 
     1878                for (; $j < $this->num_recs[$i]; ++$j) { 
    18791879                    $val = (double)$this->data[$i][$j]; 
    18801880                    $maxy = ($val > $maxy) ? $val : $maxy; 
     
    31803180            $y_pos += $char_h + $this->line_spacing; 
    31813181 
    3182             $color_index++; 
     3182            ++$color_index; 
    31833183            if ($color_index > $max_color_index) 
    31843184                $color_index = 0; 
     
    32223222        // Get sum of each column? One pie slice per column 
    32233223        if ($this->data_type === 'text-data') { 
    3224             for ($i = 0; $i < $this->num_data_rows; $i++) { 
    3225                 for ($j = 1; $j < $this->num_recs[$i]; $j++) {      // Label ($row[0]) unused in these pie charts 
     3224            for ($i = 0; $i < $this->num_data_rows; ++$i) { 
     3225                for ($j = 1; $j < $this->num_recs[$i]; ++$j) {      // Label ($row[0]) unused in these pie charts 
    32263226                    @ $sumarr[$j] += abs($this->data[$i][$j]);      // NOTE!  sum > 0 to make pie charts 
    32273227                } 
     
    32303230        // Or only one column per row, one pie slice per row? 
    32313231        else if ($this->data_type == 'text-data-single') { 
    3232             for ($i = 0; $i < $this->num_data_rows; $i++) { 
     3232            for ($i = 0; $i < $this->num_data_rows; ++$i) { 
    32333233                $legend[$i] = $this->data[$i][0];                   // Set the legend to column labels 
    32343234                $sumarr[$i] = $this->data[$i][1]; 
     
    32363236        } 
    32373237        else if ($this->data_type == 'data-data') { 
    3238             for ($i = 0; $i < $this->num_data_rows; $i++) { 
    3239                 for ($j = 2; $j < $this->num_recs[$i]; $j++) { 
     3238            for ($i = 0; $i < $this->num_data_rows; ++$i) { 
     3239                for ($j = 2; $j < $this->num_recs[$i]; ++$j) { 
    32403240                    @ $sumarr[$j] += abs($this->data[$i][$j]); 
    32413241                } 
     
    33043304                                    $label_txt, 'center', 'center'); 
    33053305                } 
    3306                 $color_index++; 
     3306                ++$color_index; 
    33073307                $color_index = $color_index % $max_data_colors; 
    33083308            }   // end for 
     
    33253325        $do_labels = ($this->plot_type != 'linepoints'); 
    33263326 
    3327         for($row = 0, $cnt = 0; $row < $this->num_data_rows; $row++) { 
     3327        for($row = 0, $cnt = 0; $row < $this->num_data_rows; ++$row) { 
    33283328            $record = 1;                                // Skip record #0 (title) 
    33293329 
     
    33373337 
    33383338            // Now go for Y, E+, E- 
    3339             for ($idx = 0; $record < $this->num_recs[$row]; $idx++) { 
     3339            for ($idx = 0; $record < $this->num_recs[$row]; ++$idx) { 
    33403340                    // Y: 
    33413341                    $y_now = $this->data[$row][$record++]; 
     
    33673367        $do_labels = ($this->plot_type != 'linepoints'); 
    33683368 
    3369         for ($row = 0, $cnt = 0; $row < $this->num_data_rows; $row++) { 
     3369        for ($row = 0, $cnt = 0; $row < $this->num_data_rows; ++$row) { 
    33703370            $rec = 1;                    // Skip record #0 (data label) 
    33713371 
     
    33833383 
    33843384            // Proceed with Y values 
    3385             for($idx = 0;$rec < $this->num_recs[$row]; $rec++, $idx++) { 
     3385            for($idx = 0;$rec < $this->num_recs[$row]; ++$rec, ++$idx) { 
    33863386                if (is_numeric($this->data[$row][$rec])) {              // Allow for missing Y data 
    33873387                    $this->DrawDot($x_now, $this->data[$row][$rec], 
     
    34003400        $this->CheckOption($this->data_type, 'text-data, data-data', __FUNCTION__); 
    34013401 
    3402         for ($row = 0, $cnt = 0; $row < $this->num_data_rows; $row++) { 
     3402        for ($row = 0, $cnt = 0; $row < $this->num_data_rows; ++$row) { 
    34033403            $rec = 1;                    // Skip record #0 (data label) 
    34043404 
     
    34163416 
    34173417            // Proceed with Y values 
    3418             for($idx = 0;$rec < $this->num_recs[$row]; $rec++, $idx++) { 
     3418            for($idx = 0;$rec < $this->num_recs[$row]; ++$rec, ++$idx) { 
    34193419                if (is_numeric($this->data[$row][$rec])) {              // Allow for missing Y data 
    34203420                    ImageSetThickness($this->img, $this->line_widths[$idx]); 
     
    35453545        $incomplete_data_defaults_to_x_axis = FALSE;        // TODO: make this configurable 
    35463546 
    3547         for ($row = 0, $cnt = 0; $row < $this->num_data_rows; $row++) { 
     3547        for ($row = 0, $cnt = 0; $row < $this->num_data_rows; ++$row) { 
    35483548            $rec = 1;                                       // Skip record #0 (data label) 
    35493549 
     
    35613561            // Proceed with Y values 
    35623562            // Create array of points for imagefilledpolygon() 
    3563             for($idx = 0; $rec < $this->num_recs[$row]; $rec++, $idx++) { 
     3563            for($idx = 0; $rec < $this->num_recs[$row]; ++$rec, ++$idx) { 
    35643564                if (is_numeric($this->data[$row][$rec])) {              // Allow for missing Y data 
    35653565                    $y_now_pixels = $this->ytr($this->data[$row][$rec]); 
     
    35823582 
    35833583        $end = count($posarr); 
    3584         for ($i = 0; $i < $end; $i++) { 
     3584        for ($i = 0; $i < $end; ++$i) { 
    35853585            // Prepend initial points. X = first point's X, Y = x_axis_y_pixels 
    35863586            $x = $posarr[$i][0]; 
     
    36183618        } 
    36193619 
    3620         for ($row = 0, $cnt = 0; $row < $this->num_data_rows; $row++) { 
     3620        for ($row = 0, $cnt = 0; $row < $this->num_data_rows; ++$row) { 
    36213621            $record = 1;                                    // Skip record #0 (data label) 
    36223622 
     
    36313631                $this->DrawXDataLabel($this->data[$row][0], $x_now_pixels, $row); 
    36323632 
    3633             for ($idx = 0; $record < $this->num_recs[$row]; $record++, $idx++) { 
     3633            for ($idx = 0; $record < $this->num_recs[$row]; ++$record, ++$idx) { 
    36343634                if (($line_style = $this->line_styles[$idx]) == 'none') 
    36353635                    continue; //Allow suppressing entire line, useful with linepoints 
     
    36793679        $start_lines = array_fill(0, $this->records_per_group, FALSE); 
    36803680 
    3681         for ($row = 0, $cnt = 0; $row < $this->num_data_rows; $row++) { 
     3681        for ($row = 0, $cnt = 0; $row < $this->num_data_rows; ++$row) { 
    36823682            $record = 1;                                    // Skip record #0 (data label) 
    36833683 
     
    36913691 
    36923692            // Now go for Y, E+, E- 
    3693             for ($idx = 0; $record < $this->num_recs[$row]; $idx++) { 
     3693            for ($idx = 0; $record < $this->num_recs[$row]; ++$idx) { 
    36943694                if (($line_style = $this->line_styles[$idx]) == 'none') 
    36953695                    continue; //Allow suppressing entire line, useful with linepoints 
     
    37493749        } 
    37503750 
    3751         for ($row = 0, $cnt = 0; $row < $this->num_data_rows; $row++) { 
     3751        for ($row = 0, $cnt = 0; $row < $this->num_data_rows; ++$row) { 
    37523752            $record = 1;                                    // Skip record #0 (data label) 
    37533753 
     
    37633763 
    37643764            // Draw Lines 
    3765             for ($idx = 0; $record < $this->num_recs[$row]; $record++, $idx++) { 
     3765            for ($idx = 0; $record < $this->num_recs[$row]; ++$record, ++$idx) { 
    37663766                if (is_numeric($this->data[$row][$record])) {               // Allow for missing Y data 
    37673767                    $y_now_pixels = $this->ytr($this->data[$row][$record]); 
     
    38133813        $x_first_bar = (($this->records_per_group - 1) * $this->record_bar_width) / 2 - $this->bar_adjust_gap; 
    38143814 
    3815         for ($row = 0; $row < $this->num_data_rows; $row++) { 
     3815        for ($row = 0; $row < $this->num_data_rows; ++$row) { 
    38163816            $record = 1;                                    // Skip record #0 (data label) 
    38173817 
     
    38253825 
    38263826            // Draw the bars in the group: 
    3827             for ($idx = 0; $record < $this->num_recs[$row]; $record++, $idx++) { 
     3827            for ($idx = 0; $record < $this->num_recs[$row]; ++$record, ++$idx) { 
    38283828                if (is_numeric($this->data[$row][$record])) {       // Allow for missing Y data 
    38293829                    $x2 = $x1 + $this->actual_bar_width; 
     
    38923892        $x_first_bar = $this->record_bar_width / 2 - $this->bar_adjust_gap; 
    38933893 
    3894         for ($row = 0; $row < $this->num_data_rows; $row++) { 
     3894        for ($row = 0; $row < $this->num_data_rows; ++$row) { 
    38953895            $record = 1;                                    // Skip record #0 (data label) 
    38963896 
     
    39063906            // Draw the bars 
    39073907            $oldv = 0; 
    3908             for ($idx = 0; $record < $this->num_recs[$row]; $record++, $idx++) { 
     3908            for ($idx = 0; $record < $this->num_recs[$row]; $record++, ++$idx) { 
    39093909                if (is_numeric($this->data[$row][$record])) {       // Allow for missing Y data 
    39103910 
Note: See TracChangeset for help on using the changeset viewer.