Skip to content

Commit

Permalink
feat(svg): limit number of props to display
Browse files Browse the repository at this point in the history
add a note "+ <N> properties" to the GraphViz node labels when
no. of props is greater than $PROP_VIZ_LIMIT (default 25)
  • Loading branch information
majensen committed Feb 21, 2023
1 parent 4ad5887 commit ad87b50
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/Perl/make-model/lib/Bento/MakeModel.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ use Hash::Merge;
use strict;
use warnings;

our $VERSION="0.2";
our $VERSION="0.21";
our $MERGER = Hash::Merge->new();
my $PROP_VIZ_LIMIT = 25;

if (defined $OVERLAY_MERGE_BEH) {
$MERGER->add_behavior_spec($OVERLAY_MERGE_BEH, 'R_OVERLAY');
}
Expand Down Expand Up @@ -212,6 +214,11 @@ sub viz {
);
for ($self->nodes) {
my @lbl = sort map { $_->name } $self->model->node($_)->props;
if (@lbl > $PROP_VIZ_LIMIT) {
my $addl = @lbl - $PROP_VIZ_LIMIT;
@lbl = @lbl[0..$PROP_VIZ_LIMIT-1];
$lbl[$PROP_VIZ_LIMIT] = "+ $addl properties";
}
unshift @lbl, $_;
if (@lbl>1) {
$lbl[1] = "|{$lbl[1]";
Expand Down

0 comments on commit ad87b50

Please sign in to comment.