Skip to content

Commit

Permalink
GUI labels tab: fix some legend related issues
Browse files Browse the repository at this point in the history
These were missed in recent commits that
focused on the spatial tab.
  • Loading branch information
shawnlaffan committed Jan 3, 2024
1 parent 3342a50 commit cb1d492
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
17 changes: 10 additions & 7 deletions lib/Biodiverse/GUI/Dendrogram.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1248,13 +1248,16 @@ sub recolour_cluster_lines {
my $analysis_max = $self->{analysis_max};
my $colour_mode = $self->get_cluster_colour_mode();

my $legend = $map->get_legend;
$legend->set_colour_mode_from_list_and_index (
list => $list_name,
index => $list_index,
);
my @minmax_args = ($analysis_min, $analysis_max);
my $colour_method = $legend->get_colour_method;
my ($legend, @minmax_args, $colour_method);
if ($colour_mode ne 'palette' and not $self->in_multiselect_mode) {
$legend = $map->get_legend;
$legend->set_colour_mode_from_list_and_index(
list => $list_name,
index => $list_index,
);
@minmax_args = ($analysis_min, $analysis_max);
$colour_method = $legend->get_colour_method;
}

foreach my $node_ref (@$cluster_nodes) {

Expand Down
3 changes: 2 additions & 1 deletion lib/Biodiverse/GUI/Tabs/Labels.pm
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,7 @@ sub on_selected_labels_changed {
else {
$grid->set_legend_log_mode_off;
}
my $legend = $grid->get_legend;

my $colour_func = sub {
my $elt = shift;
Expand All @@ -1003,7 +1004,7 @@ sub on_selected_labels_changed {
#if ($use_log) {
# $val = log ($val + 1);
#}
return $grid->get_colour($val, 0, $display_max_value);
return $legend->get_colour($val, 0, $display_max_value);
};

$grid->colour($colour_func);
Expand Down

0 comments on commit cb1d492

Please sign in to comment.