潘蓝兰

名称

SimpleCall::ChartDirector

说明

- 需要安装ChartDirector库

- 需要把字体文件放到chart_director的fonts目录下,例如msyh.ttf/msyhbd.ttf

函数

实例参考xt子文件夹

chart_bar 柱状图

    chart_bar([1, 2, 3], 
        file=> '01.chart_bar.png', 
        title => '测试一二', 
        label => [ '测试', '一二', '事情'] , 
        width => 800, 
        height => 330, 
        plot_area => [ 75, 70, 600, 200 ], 
        title_font_size => 12, 
        color => [ qw/Yellow Green Red1/ ], 
    );

chart_horizon_bar 条形图

    参数同 chart_bar

chart_pyramid 金字塔图

    参数同 chart_bar

chart_pie 饼图

    chart_pie([1, 2, 3], 
        file=> '04.chart_pie.png', 
        title => '测试一二', 
        label => [ '测试', '一二', '事情'] , 
        width => 700, 
        height => 500, 
        pie_size =>  [ 350, 290, 180 ],
        title_font_size => 12, 
        color => [ qw/Yellow Green Red1/ ], 

        #图例
        with_legend => 1, 
        legend_pos_x => 265, 
        legend_pos_y => 55, 
        legend_is_vertical => 0, 

        #旋转角度
        start_angle => 30,  

        #饼图各部分的标签
        label_format => "{label}\n{value}, {percent}%", 
        label_pos => 20, 

        #拉出一条线指向一块饼
        label_side_layout => 1, 
    );

chart_line 折线图

    chart_line([[5, 6, 7, 8], [1, 2, 6, 9], [3, 9, 2, 4], ], 
        file=> '06.chart_line.png', 
        title => '测试一二', 
        label => [ 'day1', 'day3', 'day5', 'day7'] , 
        legend => [ 'aa','bb','cc'] , 
        width => 1000, 
        height => 320, 
        plot_area => [ 75, 70, 800, 200 ],
        title_font_size => 12, 
        color => [ qw/Yellow Green Red1/ ], 

        #图例
        with_legend => 1, 
        legend_pos_x => 320, 
        legend_pos_y => 35, 
        legend_is_vertical => 0, 

        #描点加上不同形状
        with_symbol_shape => 1, 

        #描点加上标签
        with_data_label => 1, 

        #Y轴格式,例如'{value}%',
        #y_label_format => '{value}', 

        #Y轴坐标刻度
        #y_tick_density => 1, 

        #Y轴取值范围
        #y_axis_lower_limit => 0, 
        #y_axis_upper_limit => 10, 
    );

chart_spline 平滑曲线图

    参数同 chart_line

chart_stacked_bar 累积柱状图

    参数同 chart_line

chart_stacked_area 面积图

    参数同 chart_line

chart_multi_bar 多柱图

    参数同 chart_line



Hosting generously
sponsored by Bytemark