Skip to content

Commit 6a3d559

Browse files
author
mschor
committed
Size of bar graph would sometimes get too narrow even when there was ample real estate
1 parent c4d128d commit 6a3d559

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

js/stacked-bar-graph.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -459,19 +459,11 @@ function draw_chart(svg_id, stacked_data, x_axis, y_axis) {
459459

460460
let grandparent_width = $('#' + svg_id).parent().parent().width();
461461

462-
if (stacked_data.length > 12) {
463-
svg_width = stacked_data.length * 40;
464-
svg.attr("width", svg_width);
465-
}
466-
else {
462+
svg_width = stacked_data.length * 40;
463+
if (svg_width < grandparent_width) {
467464
svg_width = grandparent_width;
468-
svg.attr("width", grandparent_width);
469465
}
470-
471-
472-
473-
474-
466+
svg.attr("width", svg_width);
475467

476468
if (svg_width < 200) svg_width = 200;
477469
if (svg_height < 200) svg_height = 300;

0 commit comments

Comments
 (0)