staticspaint.php

来自「通达OA2007SE源代码 非常好的」· PHP 代码 · 共 77 行

PHP
77
字号
<?
  include_once 'inc/utility_all.php';
  include 'inc/jpgraph/jpgraph.php';
  include 'inc/jpgraph/jpgraph_pie.php';
  include 'inc/jpgraph/jpgraph_pie3d.php';
  include 'inc/jpgraph/jpgraph_gb2312.php';
  $CUR_DATE = date ('Y-m-d', time ());
  $ARRAY_FIELD = explode (',', $ARRAY_FIELD1);
  $graphValues = explode (',', $graphValues1);
  $ARRAY_COUNT = sizeof ($graphValues);
  $MAX_Values = $graphValues[0];
  for ($I = 1; ($I < $ARRAY_COUNT); ++$I)
  {
    if (($MAX_Values < $graphValues[$I]))
    {
      $MAX_Values = $graphValues[$I];
      continue;
    }
  }
  $TOTAL = (ceil (($MAX_Values / 20)) * 20);
  if (($TOTAL == 0))
  {
    $TOTAL = 20;
  }
  $PERT = ($TOTAL / 20);
  $field1[0] = $TOTAL;
  $temp = 1;
  while ((0 < $TOTAL))
  {
    $TOTAL = ($TOTAL - $PERT);
    $field1[$temp] = $TOTAL;
    $temp = ($temp + 1);
  }
  $g2312 = new GB2312toUTF8 ();
  $TOTAL = 20;
  $aveWidth = 45;
  $aveHeight = 20;
  $imgWidth = (((sizeof ($ARRAY_FIELD) * $aveWidth) + 20) + 40);
  $imgHeight = ((($aveHeight * 20) + 35) + 100);
  $fieldcount = sizeof ($ARRAY_FIELD);
  $test = new TTF ();
  $font = $test->File (FF_SIMSUN, FS_BOLD);
  header ('Content-type: image/png');
  $image = imagecreate ($imgWidth, $imgHeight);
  $colorWhite = imagecolorallocate ($image, 255, 255, 255);
  $colorGrey = imagecolorallocate ($image, 192, 192, 192);
  $colorDarkBlue = imagecolorallocate ($image, 104, 157, 228);
  $colorLightBlue = imagecolorallocate ($image, 184, 212, 250);
  imageline ($image, 30, 20, 30, (($aveHeight * $TOTAL) + 20), $colorGrey);
  imageline ($image, 30, 20, ((($fieldcount * $aveWidth) + 20) + 10), 20, $colorGrey);
  imageline ($image, ((($fieldcount * $aveWidth) + 20) + 10), 20, ((($fieldcount * $aveWidth) + 20) + 10), (($aveHeight * $TOTAL) + 20), $colorGrey);
  imageline ($image, 30, (($aveHeight * $TOTAL) + 20), ((($fieldcount * $aveWidth) + 20) + 10), (($aveHeight * $TOTAL) + 20), $colorGrey);
  for ($i = 1; ($i < sizeof ($ARRAY_FIELD)); ++$i)
  {
    imageline ($image, ((($i * $aveWidth) + 20) + 10), 20, ((($i * $aveWidth) + 20) + 10), (($aveHeight * $TOTAL) + 20), $colorGrey);
  }
  imagettftext ($image, 10, 0, 0, 15, $colorDarkBlue, $font, ('('.$temptitle = ($g2312->gb2utf8 ($unit).')')));
  for ($i = 1; ($i < 20); ++$i)
  {
    imageline ($image, 30, (($i * $aveHeight) + 20), ((($fieldcount * $aveWidth) + 20) + 10), (($i * $aveHeight) + 20), $colorGrey);
    imagestring ($image, 2, 0, ((($i - 1) * $aveHeight) + 20), $field1[($i - 1)], $colorDarkBlue);
  }
  imagestring ($image, 2, 0, ((($i - 1) * $aveHeight) + 20), $field1[19], $colorDarkBlue);
  for ($i = 0; ($i < sizeof ($ARRAY_FIELD)); ++$i)
  {
    imagefilledrectangle ($image, ((($i * $aveWidth) + 20) + 10), ((($aveHeight * $TOTAL) - (($graphValues[$i] / $PERT) * $aveHeight)) + 20), (((($i + 1) * $aveWidth) + 20) + 10), (($aveHeight * $TOTAL) + 20), $colorDarkBlue);
    imagefilledrectangle ($image, (((($i * $aveWidth) + 1) + 20) + 10), (((($aveHeight * $TOTAL) - (($graphValues[$i] / $PERT) * $aveHeight)) + 2) + 20), ((((($i + 1) * $aveWidth) - 7) + 20) + 10), ((($aveHeight * $TOTAL) - 2) + 20), $colorLightBlue);
    imagestring ($image, 3, ((($i * $aveWidth) + 23) + 10), (((($aveHeight * $TOTAL) - (($graphValues[$i] / $PERT) * $aveHeight)) - 15) + 20), $graphValues[$i], $colorDarkBlue);
    $temptitle = $g2312->gb2utf8 ($ARRAY_FIELD[$i]);
    imagettftext ($image, 10, 270, ((($i * $aveWidth) + 32) + 10), (($imgHeight - 125) + 20), $colorDarkBlue, $font, $temptitle);
  }
  imagepng ($image);
  imagedestroy ($image);
  echo '
';
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?