代码如下:
<?php
require_once 'src/jpgraph.php'; //导入Jpgraph类库
require_once 'src/jpgraph_bar.php'; //导入Jpgraph类库的柱状图功能
$data = array(80, 73, 89, 85, 92, 75 ,85 ,65, 84, 79, 85, 98); //设置统计数据
$graph = new Graph(600, 300); //设置画布大小
$graph->SetScale('textlin'); //设置坐标刻度类型
$graph->SetShadow(); //设置画布阴影
$graph->img->SetMargin(40, 30, 20, 40); //设置统计图边距
$barplot = new BarPlot($data); //实例化BarPlat对象
$barplot->SetFillColor('blue'); //设置柱形图前景色
$barplot->value->Show();
$graph->Add($barplot);$graph->title->Set('吉林省***科技有限公司年度收支'); //设置统计图标题
$graph->xaxis->title->Set('月份'); //设置X轴名称
$graph->yaxis->title->Set('总金额(万元)'); //设置y轴名称
$graph->title->SetFont(FF_SIMSUN, FS_BOLD); //设置标题字体
$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD); //设置X轴字体
$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD); //设置Y轴字体
$graph->Stroke(); //输出图像
?>
运行完就出现一个没有内容的小方块,求帮忙解决。
<?php
require_once 'src/jpgraph.php'; //导入Jpgraph类库
require_once 'src/jpgraph_bar.php'; //导入Jpgraph类库的柱状图功能
$data = array(80, 73, 89, 85, 92, 75 ,85 ,65, 84, 79, 85, 98); //设置统计数据
$graph = new Graph(600, 300); //设置画布大小
$graph->SetScale('textlin'); //设置坐标刻度类型
$graph->SetShadow(); //设置画布阴影
$graph->img->SetMargin(40, 30, 20, 40); //设置统计图边距
$barplot = new BarPlot($data); //实例化BarPlat对象
$barplot->SetFillColor('blue'); //设置柱形图前景色
$barplot->value->Show();
$graph->Add($barplot);$graph->title->Set('吉林省***科技有限公司年度收支'); //设置统计图标题
$graph->xaxis->title->Set('月份'); //设置X轴名称
$graph->yaxis->title->Set('总金额(万元)'); //设置y轴名称
$graph->title->SetFont(FF_SIMSUN, FS_BOLD); //设置标题字体
$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD); //设置X轴字体
$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD); //设置Y轴字体
$graph->Stroke(); //输出图像
?>
运行完就出现一个没有内容的小方块,求帮忙解决。
这是你的代码在 gbk 环境中生成的图片,utf-8 要注意去掉程序文件的 BOM 头