Commit 71125626 authored by Leo Gordon's avatar Leo Gordon
Browse files

allow configuring boxes' colourscheme/offset from hive_config.json

parent 3821ae80
......@@ -24,8 +24,12 @@
"edge" : "Helvetica",
},
"DisplayDetails" : 1,
"DisplaySemaphoreBoxes" : 1,
"DisplayStretched" : 0,
"SemaphoreBoxes" : {
"Display" : 1,
"ColourScheme" : "blues9", # Examples: "blues9" or "bugn7" or "orrd8" or "purples7" or "ylorbr9"
"ColourOffset" : 1,
},
}
}
......@@ -28,7 +28,7 @@ $Author: lg4 $
=head1 VERSION
$Revision: 1.12 $
$Revision: 1.13 $
=cut
......@@ -194,8 +194,10 @@ sub build {
}
}
if($self->config->get('Graph', 'DisplaySemaphoreBoxes') ) {
if($self->config->get('Graph', 'SemaphoreBoxes', 'Display') ) {
$self->graph->subgraphs( \%subgraph_allocation );
$self->graph->colour_scheme( $self->config->get('Graph', 'SemaphoreBoxes', 'ColourScheme') );
$self->graph->colour_offset( $self->config->get('Graph', 'SemaphoreBoxes', 'ColourOffset') );
}
return $self->graph();
......
......@@ -7,12 +7,6 @@ use strict;
use warnings;
use base ('GraphViz');
#my ($colorscheme, $coloroffset) = ('ylorbr9', 1);
#my ($colorscheme, $coloroffset) = ('purples7', 1);
#my ($colorscheme, $coloroffset) = ('orrd8', 1);
#my ($colorscheme, $coloroffset) = ('bugn7', 0);
my ($colorscheme, $coloroffset) = ('blues9', 1);
sub subgraphs {
my $self = shift @_;
......@@ -23,6 +17,24 @@ sub subgraphs {
}
sub colour_scheme {
my $self = shift @_;
if(@_) {
$self->{_colour_scheme} = shift @_;
}
return $self->{_colour_scheme};
}
sub colour_offset {
my $self = shift @_;
if(@_) {
$self->{_colour_offset} = shift @_;
}
return $self->{_colour_offset};
}
sub get_top_clusters {
my $self = shift @_;
......@@ -55,7 +67,9 @@ sub get_nodes_that_point_at {
sub generate_subgraph {
my ($self, $cluster_name, $depth) = @_;
my $subgraphs = $self->subgraphs();
my $subgraphs = $self->subgraphs();
my $colour_scheme = $self->colour_scheme();
my $colour_offset = $self->colour_offset();
my $prefix = "\t" x $depth;
......@@ -63,9 +77,9 @@ sub generate_subgraph {
$text .= $prefix . "subgraph cluster_${cluster_name} {\n";
# $text .= $prefix . "\tlabel=\"$cluster_name\";\n";
$text .= $prefix . "\tcolorscheme=$colorscheme;\n";
$text .= $prefix . "\tcolorscheme=$colour_scheme;\n";
$text .= $prefix . "\tstyle=filled;\n";
$text .= $prefix . "\tcolor=".($depth+$coloroffset).";\n";
$text .= $prefix . "\tcolor=".($depth+$colour_offset).";\n";
foreach my $node_name ( @{ $self->get_nodes_that_point_at( $cluster_name ) } ) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment