コード例 #1
0
ファイル: Graphic1.php プロジェクト: Ethennoob/Web
        $y2 = $y1 + 20.1 * $this->num_barras;
        imagerectangle($this->imag, $x1, $y1, $x2, $y2, $this->dark_cores[2]);
        //caixa envolvente
        imagefilledrectangle($this->imag, $x1 + 1, $y1 + 1, $x2 - 1, $y2 - 1, $cor_legenda);
        $x1 += 10;
        for ($a = 0, $k = 5; $a < $this->num_barras; $a++, $k += 20) {
            imagefilledrectangle($this->imag, $x1, $y1 + $k, $x1 + $inc, $y1 + $k + $inc, $this->cores[$a]);
            imagerectangle($this->imag, $x1 - 1, $y1 + $k - 1, $x1 + $inc + 1, $y1 + $k + $inc + 1, $this->preto);
            imagestring($this->imag, 3, 38, $y1 + $k - 1, $this->arr_nomes[$a], $this->cor_letras);
        }
    }
}
// ------------- criar o grafico -------------
$maior = 100;
// maior valor
$titulo = "Perguntas por tipo";
$gbarras = new GraficoBarras(3, 420, 400, $estilo_s);
$gbarras->adicionarTituloGrafico($titulo);
$gbarras->setmaxvalor($maior);
$gbarras->desenhaExterior();
$gbarras->desenhaEscVertical($maior);
$gbarras->desenhaEscHorizontal();
$gbarras->addDados(100);
$gbarras->addNomes("Benfica");
$gbarras->addDados(75);
$gbarras->addNomes("Porto MFC");
$gbarras->addDados(50);
$gbarras->addNomes("Juveo Gay");
$gbarras->criaGrafico();
$gbarras->criaLegenda();
$gbarras->desenhaGrafico();