From 903b7f050d8d5df25d4738bd8172a382ebe03e2f Mon Sep 17 00:00:00 2001 From: peller Date: Thu, 18 Aug 2016 13:46:34 -0400 Subject: [PATCH] WIP resize based on parent cell, works for dashboard, not for notebook #59 (c) Copyright IBM Corp. 2016 --- urth-viz-explorer.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/urth-viz-explorer.html b/urth-viz-explorer.html index 0a260f6..ff58439 100644 --- a/urth-viz-explorer.html +++ b/urth-viz-explorer.html @@ -357,6 +357,15 @@ }, _resize: function() { + // Measure the parent Jupyter Notebook cell, if any + // NOTE: JQuery dependency as well as Jupyter + var cellSize = $(this).parents('.cell').first().css(['height', 'width']); + if (cellSize) { + this.style.width = cellSize.width; + this.style.height = cellSize.height; + } + + // Resize the child urth-viz-vega widget var vega = this.$$('urth-viz-vega'); if (vega) vega._resize(); },