Skip to content

Commit

Permalink
Set graph width factor based on number of categories
Browse files Browse the repository at this point in the history
The ratio is calculated to be 1 when there are < 25 categories, and
increases linearly until a minimum factor of 0.25 is reached with 100
categories.

Fixes #25524
  • Loading branch information
dregad committed Mar 2, 2019
1 parent ca5f7e4 commit 3b1cd68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/MantisGraph/pages/category_graph.php
Expand Up @@ -34,6 +34,9 @@
print_summary_submenu();

$t_metrics = create_category_summary( $t_filter );

# Dynamically set width ratio between 1 and 0.25 based on number of categories
$t_wfactor = 1 - min( max( count( $t_metrics ), 25 ) - 25, 75 ) / 100;
?>

<div class="col-md-12 col-xs-12">
Expand All @@ -48,7 +51,7 @@
</div>

<div class="col-md-6 col-xs-12">
<?php graph_bar( $t_metrics, 1, true ); ?>
<?php graph_bar( $t_metrics, $t_wfactor, true ); ?>
</div>

<div class="col-md-6 col-xs-12">
Expand Down

0 comments on commit 3b1cd68

Please sign in to comment.