我现在已经实现x轴按日期画出图表,问题是BOSS希望周末的backgroundcolour 能够和平时的不一样。
my $graph = GD::Graph::chart->new(400, 300); $graph->set( x_label => 'X Label', y_label => 'Y label', title => 'Some simple graph', bgclr => 'blue', y_max_value => 8, y_tick_number => 8, y_label_skip => 2 ) or die $graph->error; my $gd = $graph->plot(\@data) or die $graph->error;
如何根据@data里的数据改变背景色呢。各位求教了
这个问题是我脑子歪了。需要添加另外一种图表类型,GD::Graph::area
GD本身提供了一种类 GD::Graph::mixed 来在一个图表中添加不同的样式。像area,bars,lines.
在插入的时候注意顺序,就可以避免被覆盖。