Author: spadkins
Date: Thu Jun 28 08:00:36 2007
New Revision: 9691
Modified:
p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm
Log:
Added custom data_set_colors to line graph
Modified: p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm
==============================================================================
--- p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm (original)
+++ p5ee/trunk/App-Widget-ChartDirector/lib/App/Widget/ChartDirector.pm Thu Jun 28 08:00:36 2007
@@ -644,6 +644,14 @@
my ($self, $spec) = @_;
my $c = $self->new_xy_chart($spec);
+ my $data_set_colors;
+ if ($spec->{data_set_colors}) {
+ foreach my $color ( split(/,(?:\s+)?/, $spec->{data_set_colors}) ) {
+ $color =~ s/^#//;
+ push (@$data_set_colors, hex($color));
+ }
+ }
+
#Display 1 out of 3 labels on the x-axis.
# $c->xAxis()->setLabelStep(3);
@@ -694,7 +702,11 @@
################
#we choose colors from @color_set
if($i <= 19) {
- $dataset = $layer->addDataSet($y, hex($color_set[$i]), $y_labels->[$i]);
+ if ($#$data_set_colors != -1) {
+ $dataset = $layer->addDataSet($y, $data_set_colors->[$i], $y_labels->[$i]);
+ } else {
+ $dataset = $layer->addDataSet($y, hex($color_set[$i]), $y_labels->[$i]);
+ }
}
else {
#if number of y_labels is greater than 20, colors will be repeated
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.