From c99e3c6d2e843904ef98755b916bf22ddee0e535 Mon Sep 17 00:00:00 2001 From: Zarino Zappia Date: Thu, 13 Sep 2018 11:41:57 +0100 Subject: .js-make-bar-chart now accepts custom chart/bar dimensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We needed this for Collideoscope, where we’re displaying small bar charts on the Statistics page, and the default bar height of 30px was much too small when the chart was reduced in size. --- web/js/dashboard.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web/js/dashboard.js') diff --git a/web/js/dashboard.js b/web/js/dashboard.js index 848fb0c2e..48a273ed6 100644 --- a/web/js/dashboard.js +++ b/web/js/dashboard.js @@ -201,9 +201,11 @@ $(function(){ var $table = $(this); var $trs = $table.find('tr'); var $wrapper = $('
').addClass('responsive-bar-chart').insertBefore($table); + var canvasWidth = $table.attr('data-canvas-width') || 600; + var rowHeight = $table.attr('data-row-height') || 30; var $canvas = $('').attr({ - 'width': 600, - 'height': 30 * $trs.length + 'width': canvasWidth, + 'height': rowHeight * $trs.length }).appendTo($wrapper); var rowLabels = []; var rowValues = []; -- cgit v1.2.3