コード例 #1
0
function return_gChartPhp($code, $args)
{
    require_once "gChartPhpDSLParser.php";
    $parser = new gChartPhpDSLParser();
    $parser->parse($code);
    return "<img src=\"" . $parser->getUrl() . "\"/>";
}
コード例 #2
0
    function test_LineChart_GridLines()
    {
        $lineChart = new gLineChart(300, 300);
        $lineChart->addDataSet(array(112, 315, 66, 40));
        $lineChart->addDataSet(array(212, 115, 366, 140));
        $lineChart->addDataSet(array(112, 95, 116, 140));
        $lineChart->setLegend(array("first", "second", "third", "fourth"));
        $lineChart->setColors(array("ff3344", "11ff11", "22aacc", "3333aa"));
        $lineChart->setVisibleAxes(array('x', 'y'));
        $lineChart->setDataRange(0, 400);
        $lineChart->addAxisRange(0, 1, 4, 1);
        $lineChart->addAxisRange(1, 0, 400);
        $lineChart->setGridLines(33, 10);
        $text = <<<END
newLineChart: 300,300
addDataSet: 112,315,66,40
addDataSet: 212,115,366,140
addDataSet: 112,95,116,140
setLegend: first, second, third, fourth
setColors: ff3344, 11ff11, 22aacc, 3333aa
setVisibleAxes: x, y
setDataRange: 0, 400
addAxisRange: 0, 1, 4, 1
addAxisRange: 1, 0, 400
setGridLines: 33,10

END;
        $parser = new gChartPhpDSLParser();
        $parser->parse($text);
        $this->assertEqual($lineChart->getUrl(), $parser->getUrl());
    }