*Actually they don't hate me.
By Allan Walker, Jeffrey Shaffer
var viz, one, workbooka, activeSheet, Worksheet, worksheet;
$(function() {
var onePh = document.getElementById("tableauViz1");
var oneUrl = "https://public.tableau.com/views/RoslinginTableau_3/RoslingGapminder?:showVizHome=no&:display_spinner=no&:jsdebug=n&:embed=y&:display_overlay=no&:display_static_image=no&:animate_transition=yes";
var oneOptions = {
width: "100%",
height: "100vh",
hideTabs: false,
onFirstInteractive: function() {
workbooka = viz1.getWorkbook();
window.setTimeout("animate()", "1000");
}
};
viz1 = new tableauSoftware.Viz(onePh, oneUrl, oneOptions);
i = 1;
});
function animate() {
if (i <= 62) {
window.setTimeout("animate()", "2000");
animate1(i);
i++;
}
}
function animate1(a) {
workbooka.changeParameterValueAsync("ANIMATE", [a]);
}
(defn get-data-and-show-modal!
[f]
(-> (:vizobj @viz)
(.getWorkbook)
(.getActiveSheet)
(f (clj->js @viz))
(.then (fn [data]
(swap! viz assoc :columns (.getColumns data) :data (.getData data))
(reagent-modals/modal! [modal] {:size :lg}) ))))
(defn underlying-button []
[:div.btn.btn-primary
{:disabled (not (:ready @viz))
:on-click (fn [] (get-data-and-show-modal! #(.getUnderlyingDataAsync %1 %2)))}
"Show underlying data"])
(defn summary-button []
[:div.btn.btn-primary
{:disabled (not (:ready @viz))
:on-click (fn [] (get-data-and-show-modal! #(.getSummaryDataAsync %1 %2)))}
"Show summary data"])
Text
var TableauLib = (function () {
function TableauLib() {
}
TableauLib.prototype.getTableau = function () {
if (!parent || !parent.parent) {
return null;
}
var grandParent = parent.parent;
return grandParent.tableau;
};
TableauLib.prototype.getCurrentViz = function () {
var tableau = this.getTableau();
if (!tableau) {
return null;
}
return tableau.VizManager.getVizs()[0];
};
//[...]
return TableauLib;
}());
* Not real, actually
Parameter | Description |
---|---|
autoRefresh_seconds | The number of seconds to count down from |
autoRefresh_radius | The radius of the arc in pixels |
autoRefresh_fontSize, autoRefresh_fontWeight, autoRefresh_fontColor, | The font style |
autoRefresh_fillStyle | The fill color |
autoRefresh_strokeStyle | The color of the stroke |
By Chris DeMartini
http://www.datablick.com/blog/2017/3/2/building-towards-d3js-plugins-for-tableau