Commit dd85f27a8225ce31af30ef9f0e50d7092e4879bb

Authored by lucvic
1 parent 905ac68d

Dataset explorer: accept width and height as parameters

datalets/datasetexplorer-datalet/datasetexplorer-datalet.html
... ... @@ -109,17 +109,6 @@ Example:
109 109 :host ::content .children:hover rect.child {
110 110 fill: #bbb;
111 111 }
112   -
113   - :host ::content .spinner {
114   - position: absolute;
115   - left: 50%;
116   - top: 50%;
117   - width: 160px;
118   - height: 160px;
119   - margin-left: -80px;
120   - margin-top: -80px;
121   -
122   - }
123 112 </style>
124 113 <div id="treemap_placeholder"></div>
125 114 <base-ajax-json-jsonpath-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}"></base-ajax-json-jsonpath-datalet>
... ... @@ -199,7 +188,7 @@ Example:
199 188 var xyz = function(url) {
200 189 me.selectResource(url);
201 190 }
202   - build(this.map, "treemap_placeholder", xyz);
  191 + build(this.map, "treemap_placeholder", xyz, this._component.width, this._component.height);
203 192 },
204 193  
205 194 selectResource: function(url) {
... ... @@ -233,6 +222,16 @@ Example:
233 222 behavior : {
234 223 type : Object,
235 224 value : {}
  225 + },
  226 +
  227 + width : {
  228 + type : Number,
  229 + value: -1
  230 + },
  231 +
  232 + height : {
  233 + type : Number,
  234 + value: -1
236 235 }
237 236 },
238 237  
... ...
datalets/datasetexplorer-datalet/js/buildtreemap.js
... ... @@ -2,10 +2,10 @@
2 2 * Created by Utente on 17/07/2015.
3 3 */
4 4  
5   -function build(root, place_holder, select_listener) {
  5 +function build(root, place_holder, select_listener, width, height) {
6 6  
7   - var plwidth = $("#" + place_holder).width(),
8   - plheight = $("#" + place_holder).height();
  7 + var plwidth = width >= 0 ? width : $("#" + place_holder).width(),
  8 + plheight = height >= 0 ? height : $("#" + place_holder).height();
9 9  
10 10 var margin = {top: 20, right: 0, bottom: 0, left: 0},
11 11 width = plwidth,
... ...