如何在Codeigniter中使用PHPGraphLib?

时间:2015-11-29 14:09:53

标签: codeigniter phpgraphlib

请有人给我一个非常详细的教程,了解如何将PHPGraphLib与Codeigniter一起使用。

我试过用但是没用。

1 个答案:

答案 0 :(得分:1)

以下是在Codeigniter控制器中初始化PHPGraphLib的示例。

<?php 
function barras() {
    $this->load->library('phpgraphlib');
    $graph = new PHPGraphLib(350,200);
    for ($j=1;$j<=$total;$j++) {
                $graph->addData($data[$j]);
    }        
        $graph->setBars(false);
        $graph->setLine(true);
        $graph->setDataPoints(true);
        $graph->setTitle('Menciones por Canal dentro de : '.utf8_decode($camp).'');
        $graph->setLineColor("#FF0000", "#1D669D","#E7DE1D","#AB9999","#002102","#BBDDFF","#D91012","#ABB291","#CC0022","#DD9922","#AB2211");
        $graph->setDataPoints(false);
        $graph->setDataPointColor('maroon');
        $graph->setDataValueColor('maroon');
        $graph->setGoalLine(.0025);
        $graph->setGoalLineColor('red');
        $graph->createGraph();
}
?>

请务必在您的application / libraries文件夹中上传phpgraphlib 链接到Github library