Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2166828
  • 博文数量: 82
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 880
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-14 00:01
文章分类

全部博文(82)

文章存档

2014年(1)

2011年(1)

2009年(8)

2008年(11)

2007年(13)

2006年(26)

2005年(22)

我的朋友

分类:

2007-07-10 01:09:32

用graphpite总是要提示下载文件,结果又下载不了,观察header,发现有attachment字样,
于是搜索Graph.php,找到下面这行,注释掉
header("Content-Disposition: attachment; filename = \"". (isset($_GET['thumb']) ? $_GET['thumb'] : (isset($_GET['image']) ?
$_GET['image'] : ""))."\"");
学例子:
Line
Image_Graph_Dataset_Random的最后一个参数为true,则X从0开始,否则从1
true type字体需指明路径或放在Image/Fonts目录下,注意文字要utf-8编码.setAngle是设置方向
$vFont = new Image_Graph_Font_TTF("font.TTF");;
$vFont->setAngle(270);
$vFont->setSize(10);
X和Y上的字体用下面这类方法来实现
$AxisX =& $PlotArea->getAxis(IMAGE_GRAPH_AXIS_X);     
    $AxisX->setDataPreprocessor(
        new Image_Graph_DataPreprocessor_Array(
            array(
                1 => "30 Jul",
                2 => "31 Jul",
                3 => "八月1",
                4 => "2 Aug",
                5 => "3 Aug",
                6 => "4 Aug",
                7 => "5 Aug",
                8 => "6 Aug"
            )
        )
    );
$AxisX->setFont($vFont);
$AxisY =& $PlotArea->getAxis(IMAGE_GRAPH_AXIS_Y);
$AxisY->setFont($vFont);
$AxisY->setDataPreprocessor(new Image_Graph_DataPreprocessor_Formatted("+ %0.1f%%"));
饼状图用了hideAxis,所以
// create a Y data value marker
$Marker =& $Plot->add(new Image_Graph_Marker_Value(IMAGE_GRAPH_VALUE_X));
// fill it with white
$Marker->setFillColor(IMAGE_GRAPH_WHITE);
// and use black border
$Marker->setBorderColor(IMAGE_GRAPH_BLACK);
$Marker->setFont($vFont);
在实际使用时,才发觉一些问题,
include("app/part/Graph.php");
出错:
Warning: require_once(Image/Graph/Marker/Circle.php) [function.require-once]: failed to open stream: No such file or
directory in D:\www\test\edu\app\part\Graph\Marker\Bubble.php on line 39
因此只有include("Image/Graph.php");
但最重大的问题是在类中调用会出错.
Fatal error: Call to a member function _setParent() on a non-object in D:\www\gd\gite\Image\Graph.php on line 260
经查,
Graph/Constants.php
中的类似于
$Image_Graph_font = & new Image_Graph_Font();
要改成
$GLOBALS['_Image_Graph_font'] = & new Image_Graph_Font();
三个变量都要改,因为在类中包含的变量不是全局变量,所以Graph.php中类初始化时就会找不到全局变量
 
 
阅读(1023) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~