PHP 生成直方图的类(仿Light Chart)

这个博客介绍了一个名为plchart的PHP类,用于生成直方图。类中包含各种属性,如图表的宽度、高度、颜色、字体样式等,并提供了构建图像、头部和图表的方法。示例代码展示了如何使用该类来创建直方图,包括设置数据、调用类方法生成和输出图像。
摘要由CSDN通过智能技术生成
<?php

class plchart {

    var $chart;
    var $data = array(
        'title' => "title\ntest",
        'group_count' => 4, //how many groups
        'group_size' => 4, //size of each group
        'group_desc' => array('1月份', '2月份', '3月份','333'), //describe text of each group, the size equal to group_count, other wise will be ingored or empty('')
        'column_desc' => array('成交额', '销售额','不知道','我也不知道'), //describe text of each column in group, size same as group_size, other wise will be ingored or empty('')
        'raw_data' => array(//size of raw_data is the same as group_size
            array(34, 29, 55,33), //size of eache data is the same as group_count
            array(45, 45, 61,44),
            array(33,44,44,44),
            array(33,44,44,44)
        ),
        'legend_y' => '万元',
        'legend_x' => '日期',
    );
    //image parameter
    var $width = 1200;
    var $height = 600;
    var $quality = 100;
    var $bgcolor;
    var $savefile = '';
    //image parameter end
    //image header parameter (title & legend)
    var $header_height = 70;
    var $header_bgcolor;
    var $title_top_margin = 10;
    var $title_left_margin = 10;
    //字体
    var $title_font_color;
    var $title_font_size;
    var $title_font_style;
    //legend paramenter
    var $legend_height = 50;
    var $legend_width = 100;
    var $legend_bgcolor;
    var $legend_color_array = array(); //legend colors ,size same as group_size
    var $each_legend_h = 10;
    var $each_legend_w = 20;
    var $each_legend_gap = 5;
    //字体
    var $legend_font_color;
    var $legend_font_size;
    var $legend_font_style;
    //chart paramenter
    var $y_legend_font_color;
    var $y_legend_font_size;
    var $y_legend_font_style;
    var $x_legend_font_color;
    var $x_legend_font_size;
    var $x_legend_font_style;
    var $ruler_line_color;
    var $chart_y_left = 10; //y轴头部留下
    var $chart_x_left = 10; //x轴头部留下
    var $chart_left_margin = 70; //用来写纵坐标的刻度
    var $chart_right_margin = 10;
    var $chart_bottom_margin = 50; //用来写横坐标的说明
    var $chart_left_font_color;
    var $chart_left_font_size;
    var $chart_left_font_style;
    var $chart_bottom_font_color;
    var $chart_bottom_font_size;
    var $chart_bottom_font_style;
    var $chart_top_font_color;
    var $chart_top_font_size;
    var $chart_top_font_style;

    function __construct($w=1200, $h=600) {
        $this->width = $w;
        $this->height = $h;
        $this->ch
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值