Jan
12
2016

Change Background Image with Parameter

2This article explains how to change the background images by using the parameter selection in Tableau.

Theory/Information:

Sometimes we need to change the background image in our dashboard/Worksheet so that we can better represent our analytical goal. As we know that, Tableau allows you to load dynamic image by using Custom maps option. Background Images are images that you display underneath your data in order to add more complex to the marks in the view.

Steps to Reproduce:

Let’s use the sample file, Sample – Superstore Sales (Excel). Open a new worksheet and select Sample – Superstore Sales (Excel) as the data source.

Once the data is loaded, perform the following steps to add a background images in the worksheet:

Step 1: (Optional)

The first requirement for using a non-map background image is to establish your own representation of X and Y coordinates i.e. we need to generate our own coordinate system. So, first open your background image (any selected image) in a tool like Microsoft Office Picture Manager or Microsoft Office to get the dimensions. Then

Microsoft Office Picture Manager View

1

Microsoft Office View

2

Step 2:

Add your required Dimensions/measures in the view. In my view, I am taking [Profit] in Column Shelf and [Sales] in Rows Shelf. After that I added [State] in my Color Marks and [Category] in Details Marks card which generated the below view.

3

Step 3:

For adding a background image, go to the Map → Background Images → [Data Source] and then Add Image, which resulted in a dialog box, which I filled out as shown in below image.

4

Step 4:

Select the field to map to the X-axis and Y- axis of the image and specify the left and right values as per highlighted Section of the Image mentioned in the step 2 and Click OK. In the Options tab, I made sure to select both Lock Aspect Ratio and Always Show Entire Image, because I didn’t want to either distort the image or chop off any of the sides.

5

Now the Worksheet will look like the below image.

6

Step 5:

Right-click in the Data window and then select Create Parameter. In the Create Parameter dialog box, do the following, and then click OK:

  • Name the parameter. In the example workbook, the parameter is named BG Image Selection.
  • For Data Type, select String and Allowable values as List and name the list of values.
  • Right-click the parameter and then select Show Parameter Control.

7

Step 6:

Create a calculated Field by using the Parameter name .This “materializes” or “instantiates” the parameter as a field value in the data source.

8

Step 7:

 Now put the newly created Calculated Field Background Selection on the Level of Detail Shelf. This makes the value of Parameter BG Image Selection available in the view.

9

 Step 8:

 Add another image by following the step 4, again map to the X-axis and Y- axis of the image and specify the left and right values correctly.

10

Step 9:

Go to the Options Tab, Click on “Add” Button and Select the desired Calculated Field “Background Selection” which you added in the details marks card from the List of values.

11

12

Step 10:

Now change the parameter value and you are able to see you background image is changing as per your parameter selection.

13

14

 

 

 

 

 

 

 

 

Related Posts

About the Author: Rajeev Pandey

I am a multidisciplinary designer working in data visualization, interaction design and innovation. Expertise in developing Tableau, Web focus based visualization and reporting applications. I have a passion for analyzing, dissecting, and manipulating data sets as well as, building beautiful dashboard. Naturally talented in communicating between technology and business needs. Diverse and experienced in plenty of different domains .I am quick learner who can absorb new ideas and can communicate clearly and effectively.I love creativity and enjoy experimenting with various technologies.

4 Comments+ Add Comment

  • really good article.
    Just tried this method. Works perfectly.

  • Very nice Explanation Rajeev..  Can u also please post something on how to plot YTD,MTD, QTD previous and current year comparison charts.

Leave a comment

You must be logged into post a comment.