-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTableau Adjustable Sizer.html
More file actions
55 lines (44 loc) · 1.91 KB
/
Tableau Adjustable Sizer.html
File metadata and controls
55 lines (44 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<html>
<head>
<title>Resizing</title>
<script type="text/javascript"
src="https://public.tableau.com/javascripts/api/tableau-2.js"></script>
<script type="text/javascript">
var viz;
function initViz() {
var containerDiv = document.getElementById("vizContainer"),
url = "http://public.tableau.com/views/RegionalSampleWorkbook/Stocks",
options = {
hideTabs: true
};
viz = new tableau.Viz(containerDiv, url, options);
}
function vizResize() {
var width = document.getElementById("resizeWidth").value;
var height = document.getElementById("resizeHeight").value;
viz.setFrameSize(parseInt(width, 10), parseInt(height, 10));
}
</script>
</head>
<body onload="initViz();">
<div id="vizContainer" style="width:800px; height:700px; overflow:auto;"></div>
<div id="controls" style="padding:20px;">
<form id="resizeForm">
<input type="text" id="resizeWidth" placeholder="Width">
<input type="text" id="resizeHeight" placeholder="Height">
<button type="button" onClick="vizResize();">Resize</button>
</form>
</div>
</body>
</html>
/*****************************************************
To change the size of a visualization that contains a dashboard or story, use the following function instead.
function vizResize() {
var width = document.getElementById("resizeWidth").value;
var height = document.getElementById("resizeHeight").value;
var sheet = viz.getWorkbook().getActiveSheet();
sheet.changeSizeAsync(
{"behavior": "EXACTLY", "maxSize": { "height": height, "width": width }})
.then(viz.setFrameSize(parseInt(width, 10), parseInt(height, 10)));
}
****************************************/