As you may or may not know, Tableau unfortunately makes it almost impossible to resize your dashboard without all of the objects moving. This is particularly an issue when dashboards are built with floating objects. Good dashboard design issues aside, sometimes floating objects are much easier to work with.
In my scenario I was creating a long dashboard and needed to add some extra whitespace at the bottom and then remove the excess when finished.
Take for example this simple 100x100 dashboard with the white text on a black background (of the text box):
If I resize to 100x200 to add in another item below using tableau this resizes the text item to 100x200 as well
What I'd like tableau to do most times is just give me some more 'blank space' below the text box as follows:
The only way that I know of to do this is to edit the XML of the TWB file which manually would take a long time, especially if there are many items on a dashboard. So to help I've created a couple of vbScripts that do the hard work for you. The main limitation is that this will only work with TWB files not TWBX but this is not really an issue. To get a TWB file from a TWBX either:
- save as TWB in tableau. Once changed in size you will be able to save again as TWBX once done.
- rename the TWBX file to .ZIP and extract the TWB file from the zip archive. Once done overwrite the old TWB in the archive with the new file
Now to run the scripts of which there are two quite simply run the vbScript by double clicking (you may get a security prompt which you will have to accept) - This works on windows 7, I am unsure of other versions as I do not have them to test. This will run through a few steps:
- You will be prompted for the twb file location
- If there are multiple dashboard you will be warned, otherwise the script will detect the current width / height
- You will be asked to change the width / height
- A final prompt will appear and after clicking OK a new twb file will be written in the same folder as the current dashboard named OldFilename RESIZED.twb
I've attached two scripts to do this - one for width and one for height. The vbScript was written quickly so only has minimal comments
There are a few caveats as follows:
- This has not been extensively tested so please do not rely on to work
- Any updates to tableau may break the scripts if the XML schema is changed
- If there are multiple dashboards in your TWB file all will be resized based on the assumption that they all started the same size
- If you make the new size too smaller some objects may be off the dashboard range but will still be on there
- This script sets both the min and max sizes to the same so dashboards will not resize based on screen resolution
Alternative Method using only Excel - This method works but in my testing has show a few small text artefacts in titles and text that can easily be removed. This has been provided as it also works.
I've attached an excel spread sheet that works simply as follows:
- Open your TWB file in notepad and copy and paste the text into column A of the sheet 'Imported Data'
- Set the new height / width on the Settings and How To tab
- Ensure that the formulae in columns B to L on the 'Imported Data' sheet matches the number of rows in column A that you've just pasted in step 1
- Copy the entire Column L (except header) back into the TWB file in notepad and save
That's it all done. The example included is attached as an original 200x200 and a resized 300x300 so you can see how this works.
Hopefully this helps someone.
FYI tableau stores x and y coordinates and size based on a 100,000 by 100,000 grid. The scripts use the old and new size to calculate the new tableau guide co-ordinates and updates the XML accordingly.
Update 28/08/2018 - Amended to work where a dashboard contains maps with a custom background. Previously this was causing an error (thanks to Timothy Vermeiren for highlighting and providing a solution)