1. Список говнокодов пользователя jdmien

    Всего: 1

  2. PHP / Говнокод #5293

    +159

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    /* Draw the legend of the active series */
       function drawLegend($X,$Y,$Format="")
        {
         $Family	= isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
    ...
         $Mode	= isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
         if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
         $YStep = max($this->FontSize,$BoxHeight) + 5;
         $XStep = $BoxWidth + 5;
         $XStep = $XSpacing;
         $Data = $this->DataSet->getData();
         $Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
         foreach($Data["Series"] as $SerieName => $Serie)
          {
           if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
            {
             if ( $Mode == LEGEND_VERTICAL )
              {
               $BoxArray = $this->getTextBox($vX+$BoxWidth+4,$vY+$BoxHeight/2,$FontName,$FontSize,0,$Serie["Description"]);
               if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxHeight/2; }
               if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
               if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxHeight/2; }
               $Lines = preg_split("/\n/",$Serie["Description"]);
               $vY = $vY + max($this->FontSize*count($Lines),$BoxHeight) + 5;
              }
             elseif ( $Mode == LEGEND_HORIZONTAL )
              {
               $Lines = preg_split("/\n/",$Serie["Description"]);
               $Width = "";
               foreach($Lines as $Key => $Value)
                {
                 $BoxArray = $this->getTextBox($vX+$BoxWidth+6,$Y+$BoxHeight/2+(($YStep-3)*$Key),$FontName,$FontSize,0,$Value);
                 if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxHeight/2; }
                 if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
                 if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxHeight/2; }
                 $Width[] = $BoxArray[1]["X"];
                }
               $vX=max($Width)+$XStep;
              }
            }
          }
         $vY=$vY-$YStep; $vX=$vX-$XStep;
         $TopOffset  = $Y - $Boundaries["T"];
         if ( $Boundaries["B"]-($vY+$BoxHeight) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxHeight+$TopOffset; }
         if ( $Style == LEGEND_ROUND )      $this->drawRoundedFilledRectangle(...);
         elseif ( $Style == LEGEND_BOX )  $this->drawFilledRectangle(...);
         $RestoreShadow = $this->Shadow; $this->Shadow = FALSE;
         foreach($Data["Series"] as $SerieName => $Serie)
          {
           if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
            {
             $R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"];
             $Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
             if ( $Family == LEGEND_FAMILY_BOX )
    
          }
         $this->Shadow = $RestoreShadow;
        }

    Наша либа, которая рисует графики: функция рисующая легенду.

    jdmien, 16 Января 2011

    Комментарии (3)