without any with some minor hacks.
Do you need D3.js in your workbook that interacts with the other sheets in the workbook? No issues. Want to re-define some part of the portal like what should happen when users want to export or see underlying data? It’s easy. Add excel export directly to the exporting options? It’s an hour of work. But how?
This workbook contains a regular view and a ChartJS scatterplot view. When you click on any bars the scatterplot updates to show its underlying data using JS getData().
The magic is that we use an HTML object in our workbook that links to an HTML page published as web data connector. Web Data Connectors hosted on the Tableau Server, thus, they have the same domain as the portal and can access contents in their parent windows. If you refer parent.parent.tableau.VizManager.getVizs() then you get instantly an already initialised Tableau JS viz object. Sounds easy and actually it is.
How to try it out?
To test it locally you need administrator privileges on a Tableau Server. This is obviously required due to the security: this HTML page can read literally everything on your sessions if embedded. (Please also check if I include some nastiness, you know, audit, audit, audit). And now the steps:
- Download this HTML file and upload to your server
- Call tabadmin import_webdataconnector <html_file> on your server. Note the URL of the file on the server.
PS C:\users\Administrator> & 'C:\Program Files\Tableau\Tableau Server\10.0\bin\tabadmin.exe' import_webdataconnector .\j sapi_without_embed.html ===== Importing web data connector to server... -- The web data connector with the following URL was imported to the server: http://WIN-A5E9L0I0870:80/webdataconnectors/jsapi_without_embed.html
- Download this workbook
- Change the URL of Published HTML file parameter to the URL returned in step 2.
- Publish the workbook
- Open it, enjoy.
Behind the scenes
# Install all dependencies npm install # Install the gulp command line tool sudo npm install gulp --global
Running the development server
The development model is fairly simple:
Start your local development server:
gulp watch serve
Embed into tableau
Ask, if you have any.