我要用open-flash-chart-2 做报表,做的是折线图,要求能点击节点触发事件的那种需要用php文件来传输数据,但是为什么我的php文件。老是读取不了,而且就是直接复制官网上面的php文件他也不能读取,下面是我的php文件,希望高手帮忙看看:
白鞋!<?phpinclude 'php-ofc-library/open-flash-chart.php';$data_1 = array();
$data_2 = array();for( $i=0; $i<6.2; $i+=0.2 )
{
$data_1[] = (sin($i) * 1.9) + 7;
$data_2[] = (sin($i) * 1.9) + 10;
}$title = new title( date("D M d Y") );$s = new star();
$s->size(5)->halo_size(2)->on_click("line_1");$line_1 = new line();
$line_1->set_values( $data_1 );
$line_1->set_default_dot_style($s);
$line_1->set_colour( '#EB7600' );
$line_1->set_width( 2 );
$line_1->set_key( "Orange Crush Baby", 10 );$d = new solid_dot();
$d->size(5)->on_click("line_2");$line_2 = new line();
$line_2->set_values( $data_2 );
$line_2->set_default_dot_style($d);
$line_2->set_colour( '#7BED09' );
$line_2->set_width( 1 );
$line_2->set_key( "Green Machine", 10 );$y = new y_axis();
$y->set_range( 0, 15, 5 );
$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $line_1 );
$chart->add_element( $line_2 );
$chart->set_y_axis( $y );echo $chart->toPrettyString();
?>报的错误是:
Open Flash ChartJSON Parse Error [Syntax Error]
Error at character 0, line 1:0: <?php高手指点,
白鞋!
白鞋!<?phpinclude 'php-ofc-library/open-flash-chart.php';$data_1 = array();
$data_2 = array();for( $i=0; $i<6.2; $i+=0.2 )
{
$data_1[] = (sin($i) * 1.9) + 7;
$data_2[] = (sin($i) * 1.9) + 10;
}$title = new title( date("D M d Y") );$s = new star();
$s->size(5)->halo_size(2)->on_click("line_1");$line_1 = new line();
$line_1->set_values( $data_1 );
$line_1->set_default_dot_style($s);
$line_1->set_colour( '#EB7600' );
$line_1->set_width( 2 );
$line_1->set_key( "Orange Crush Baby", 10 );$d = new solid_dot();
$d->size(5)->on_click("line_2");$line_2 = new line();
$line_2->set_values( $data_2 );
$line_2->set_default_dot_style($d);
$line_2->set_colour( '#7BED09' );
$line_2->set_width( 1 );
$line_2->set_key( "Green Machine", 10 );$y = new y_axis();
$y->set_range( 0, 15, 5 );
$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $line_1 );
$chart->add_element( $line_2 );
$chart->set_y_axis( $y );echo $chart->toPrettyString();
?>报的错误是:
Open Flash ChartJSON Parse Error [Syntax Error]
Error at character 0, line 1:0: <?php高手指点,
白鞋!
解决方案 »
- 关于点击链接打开一个文档的问题。
- 如何用AJAX做一个树形二级菜单?
- 我是新手,我想问下关于MYSQL字符的问题
- 救命啊!!!使用header下载文件在winxp中无效
- 使用foreach循环遍历数组时的一个奇怪的问题,请高手指教!?
- 关于php+mysql+iis 的问题求教.
- 我今天安裝了apache,mysql,php後,想安裝PHPMYADMIN在wwwroot文件夾中,運行沒有反映????
- 在线等!php利用GD画图,图中显示中文问题!急!
- 请大家帮忙解决几个问题!与客户机环境有关!
- 关于PHP在WIN2000 IIS5+SP2上的问题
- 高手指教一下,谢谢!!第十行变量错误。
- 在php生成静态html后,怎么就能把html文件也删除呢?
改成
include ('php-ofc-library/open-flash-chart.php');
试试
我的html 如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title><script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF(
"open-flash-chart.swf", "my_chart", "550", "200",
"9.0.0", "expressInstall.swf",
{"data-file":"click.php", "id":"my_chart_id"} );
</script><script type="text/javascript">function line_1( chart_id, index )
{
hello( chart_id, 1, index );
}function line_2( chart_id, index )
{
hello( chart_id, 2, index );
}function hello( chart_id, line, index )
{
alert( 'Chart '+chart_id +', hello from line '+ line +' -> '+ index );
}</script></head>
<body>
<div id="my_chart"></div>
</body>
</html>请指教.....
这个文件换成已经静态的文件如xml文件能够正常显示么?
Open Flash ChartJSON Parse Error [Syntax Error]
Error at character 0, line 1:0: <?php
------------------------------------------------
确认你php环境搭配好了么,怎么http返回还能带<?php标签的。
我对php不了解,这是公司项目要求所需,才做的这个,你说的php环境都是什么?我就是按照他们官网上面的一个例子弄下来,
然后就抱着个错,按照正常来说,这个php文件应该被读取生成一个数据文件,但是我试了,他没有生成,现在只能确定的确是php这里出错了,但是到底怎么错的,我还真是一头雾水望指点谢了