zoukankan      html  css  js  c++  java
  • JGraph

    php中JPGraph入门配置与应用

    什么是PHP JPGraph?
    专门提供图表的类库。它使得作图变成了一件非常简单的事情。生成非美工人士生成的图表。二维码算法。

    到官方网站下载。
    docportal 帮助手册
    src 包含主要代码。里面有contour_dev开发用的方法。
    案例不能直接使用,需要将example调整后使用。

    include_once('src/jpgraph.php');
    include_once('src/jpgraph_line.php');

    注意事项:
    Examples文件夹包含了400多个文件,使用的时候却不能直接使用。必须把它的路径指向正确。把src剪切到example文件夹里面。同时把我们的src修改成jpgraph.

    =============================================================================
    php中JPGraph中文字体和背景设置

    1.JPGraph中文字体设置:只需要修改默认的配置即可。需要安装一个中文字体库,而字体必须是中文能够识别的字体,比如说是黑体。就可以了。
    $graph->title->Set("www.php100.com");
    $graph->title->SetFont(FF_FONT1,FS_BOLD);//英文字体
    $graph->title->SetFont(FF_SIMSUN,FS_BOLD,24);//设置字体类型,大小,黑体
    $graph->title->SetColor('red');

    $graph->title->SetFont(FF_SIMSUN,FS_BOLD);
    //设置标题中文字体
    $graph->legend->SetFont(FF_SIMSUN,FS_BOLD);
    //设置线条中文字体
    $graph->yaxis->SetFont(FF_SIMSUN,FS_BOLD);
    //设置Y轴线条中文字体
    $graph->xaxis->SetFont(FF_SIMSUN,FS_BOLD);
    //设置X轴线条中文字体
    *****************************************************************************
    2.JPGraph背景和背景图片设置
    $graph->setColor('red');
    $graph->setBackgroungImage("图片地址",1);//还包括层的位置
    $graph->img->SetMargin(0,0,0,0);//空余的四角边距,全0代表不空为位置。
    *****************************************************************************
    3.JPGraph3D 效果图设置。
    $graph->Set3DPerspective(SKEW3D_LEFT,700,600,true);
    //还可以设置是从上往下斜,还是从左往右斜,最后一个参数代表是否有边框,中间的两个参数代表与地平线的夹角
    //SKEW3D_LEFT
    //SKEW3D_RIGHT
    //SKEW3D_UP
    //SKEW3D_DOWN

    实例演示Example28.
    很多人使用JpGraph会出现乱码问题,但是网上有好多并无效果的解决方式,经过反 复试验及在网上看了其它人的经验,总结出在2.3版下最终较完美解决方案
    1、把simsun.ttc字体拷到服务器/usr/X11R6/lib/X11/fonts /truetype下,当然这个目录可以自定义
    2、不需要更改$aFF === FF_SIMSUN 或$aFF === FF_CHINESE ,直接用以下代 码即可
    $title = "JpGraph中文测试";
    $title = iconv("UTF-8", "gb2312", $title);
    $graph->title->Set($title);
    就可以完美的解决中文问题了
    3、还有一个问题,就是右上方的中文显示问题,就是SetLegend函数,解决方式如下
    打开jpgraph.php文件,找到
    private $font_family=FF_FONT1,$font_style=FS_NORMAL,$font_size=12;

    private $font_family=FF_SIMSUN,$font_style=FS_NORMAL,$font_size=8;

  • 相关阅读:
    Changing Icon File Of Push Button At Runtime In Oracle Forms 6i
    Set Font Properties On Mouse Hover Of Push Button And Text Items At Run time In Oracle Forms
    Change An Item Property Using Set_Item_Property In Oracle Forms
    Calling / Running a report in Oracle forms 10g / 11g
    Change Or Set Report Object Property At Run Time In Oracle Forms Using Set_Report_Object_Property Command
    Refresh / Updating a form screen in Oracle D2k Forms 6i
    Know How And When To Use System.Message_Level To Control Messages In Oracle Forms
    Perform Cut Copy Paste Operations Using Cut_Region Copy_Region Paste_Region Commands In Oracle Forms
    CHECKBOX_CHECKED built-in in Oracle D2k Forms
    Limiting To Select Only 5 Check Boxes Out Of Ten In Oracle Forms
  • 原文地址:https://www.cnblogs.com/smartyman/p/3798333.html
Copyright © 2011-2022 走看看