How to install phpChart lite library?

2019-09-14 22:36发布

I'm running Ubuntu with LAMPP and I do not really understand how set up the library. When I run an example, I get this error:

Warning: require_once(/opt/lampp/htdocs//phpChart_Lite//conf.php): failed to open stream: No existe el archivo o el directorio in /opt/lampp/htdocs/simulacion_tecnodi/phpChart_Lite/server/cls_conf.php(1) : eval()'d code on line 1

Fatal error: require_once(): Failed opening required '/opt/lampp/htdocs//phpChart_Lite//conf.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/simulacion_tecnodi/phpChart_Lite/server/cls_conf.php(1) : eval()'d code on line 1

The example code:

<?php
require_once("../conf.php");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>phpChart - Bar Test</title>
</head>
    <body>
    <div><span> </span><span id="info1b"></span></div>

<?php
$s1 = array(2, 6, 7, 10);
$ticks = array('a', 'b', 'c', 'd');

$pc = new C_PhpChartX(array($s1),'chart1');
$pc->add_plugins(array('highlighter','pointLabels'));
$pc->set_animate(true);
$pc->set_series_default(array(
    'renderer'=>'plugin::BarRenderer',
    'pointLabels'=> array('show'=>true)));
$pc->set_axes(array(
     'xaxis'=>array(
        'renderer'=>'plugin::CategoryAxisRenderer',
        'ticks'=>$ticks)
));
$pc->set_highlighter(array('show'=>false));
$pc->bind_js('jqplotDataClick',array(
    'series'=>'seriesIndex',
    'point'=>'pointIndex',
    'data'=>'data'));
$pc->draw(400,300);
?>
</body>
</html>

Here is the conf.php file code:

<?php
define('SCRIPTPATH','/phpChart_Lite/');
define('DEBUG', true);
/******** DO NOT MODIFY ***********/
require_once('phpChart.php');     
/**********************************/
?>

标签: php charts
1条回答
【Aperson】
2楼-- · 2019-09-14 22:49

The way the file is zipped causes multiple "phpChart_Lite" folders to be created. In line 2 of your php.conf file, make sure the path is like this:

define('SCRIPTPATH','[YOUR PATH HERE]/phpChart_Lite/phpChart_Lite');
查看更多
登录 后发表回答