SimpleCall::ChartDirector
- 需要安装 ChartDirector 库
- 需要把字体文件放到chart_director的fonts目录下,例如msyh.ttf/msyhbd.ttf
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/ ], # is_horizontal => 1, #条形图 );
参数同 chart_bar
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([[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_data_symbol => 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_line
参数同 chart_line with_aggregate_data_label => 1, #显示多个legend的数值总和
参数同 chart_line # is_horizontal => 1, #条形图 # with_bar_shape => 1, #不同legend对应不同形状的柱子 # layer_3d_depth => 4, #图层内 3d 形状深度
参数基本同 chart_line,区别是data多一层嵌套 $data = [ [ [ 10, 15, 6, 12, 14, 8, 13, 13, 16, 12, 10.5 ], [ 130, 150, 80, 110, 110, 105, 130, 115, 170, 125, 125 ], ], [ [ 6, 12, 4, 3.5, 7, 8, 9, 10, 12, 11, 8 ], [ 65, 80, 40, 45, 70, 80, 80, 90, 100, 105, 60 ], ], ];
参数同 chart_stacked_bar
参数同 chart_stacked_area
To install SimpleCall::ChartDirector, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SimpleCall::ChartDirector
CPAN shell
perl -MCPAN -e shell install SimpleCall::ChartDirector
For more information on module installation, please visit the detailed CPAN module installation guide.