From c9fa6da7c07c8e7cc25c84f098ca65f2aa0d734d Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Fri, 29 Sep 2017 20:37:59 +0800 Subject: [PATCH] DASH: sparkline svg viewBox not fixed width+height This way the SVG image auto-adopts to 100% of the width. --- python_suite/dashboard/static/js/sparkline.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python_suite/dashboard/static/js/sparkline.js b/python_suite/dashboard/static/js/sparkline.js index f809dd4..97b73f6 100644 --- a/python_suite/dashboard/static/js/sparkline.js +++ b/python_suite/dashboard/static/js/sparkline.js @@ -144,8 +144,8 @@ function sparkline() { // Adds the svg canvas to the selector - 'body' by default var svg = d3.select(chart.selector()) .append('svg') - .attr('width', width + margin.left + margin.right) - .attr('height', height + margin.top + margin.bottom) + .attr("viewBox", "0 0 " + (width + margin.left + margin.right) + " " + (height + margin.top + margin.bottom)) + .attr("preserveAspectRatio", "xMidYMid meet") .append('g') .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')'); -- 2.43.0