diff options
author | Zarino Zappia <mail@zarino.co.uk> | 2018-09-13 11:41:57 +0100 |
---|---|---|
committer | Zarino Zappia <mail@zarino.co.uk> | 2018-09-13 11:41:57 +0100 |
commit | c99e3c6d2e843904ef98755b916bf22ddee0e535 (patch) | |
tree | 85d7e5ee90c2ebac7e31f6fe486f9185d8293b0c | |
parent | 42bbac994c625e24a6eb645de9c47a7dd2b226ef (diff) |
.js-make-bar-chart now accepts custom chart/bar dimensions
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.
-rw-r--r-- | web/js/dashboard.js | 6 |
1 files changed, 4 insertions, 2 deletions
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 = $('<div>').addClass('responsive-bar-chart').insertBefore($table); + var canvasWidth = $table.attr('data-canvas-width') || 600; + var rowHeight = $table.attr('data-row-height') || 30; var $canvas = $('<canvas>').attr({ - 'width': 600, - 'height': 30 * $trs.length + 'width': canvasWidth, + 'height': rowHeight * $trs.length }).appendTo($wrapper); var rowLabels = []; var rowValues = []; |