1 2 Previous Next 18 Replies Latest reply on Jan 6, 2013 12:28 AM by Noel Avison

# Mapping Dynamic Polygons

I am making polygons that represent storage containers. These polygons change their size based on the how much of the selected category take up the total space availiable. For one category this isnt too bad, but to make subcategories it seems to take a really huge number of lines.  If you look at sheet one on my packaged workbook, you will notice the different category filters on the right for the age of the different storage areas. So what is visible is how much of the storage area is filled as well as roughly what percentage of that filled area is filled with different age categories. On sheet two, it shows the total percentage of the storage area filled as well as a selector for different types of inventories and how much of each one of those makes up the total filled area. Each different category on each sheet is a new layer of polygons, and those polygons will change size depending on the data.

What I want to be able to do is show how much of one category makes up another category. For example I want to be able to see how much of a storage area is filled with ARAW almonds in the >60 Days age category. I also would like the
polygon to change size based on how much of that new subcategory makes up the total filled area. The problem that I am running into is that for now it looks good when only looking at one category at a time, but if I want to make subcategories
for each possible combination it will take a very large number of polygons that I have to map out in order to show the new amount of space that the new subcategory. As of now when only having data for each category alone, the excel
file I am using takes up 29,000+ lines and if I were to make each possible combination for all the of categories and subcategories I would like to be able to see, I can easily see the file reaching several hundred thousand lines long. Is there away to make a formula in Tableau that can calculate the polygons for me based on the categories and subcategories that I select?

• ###### 1. Re: Mapping Dynamic Polygons

To clarify, the raw data sheet I used to get the numbers here is itself about 20k lines long. Each section on the map is an area that holds up to 40 smaller containers, so the visual represents roughly how many of the 40 possible units are filled in the total space which is represented in black. For example the green polygons are the total space filled in each row, and on sheet one the different colors represent the amount of the section that is filled for each age filter. I want to be able to add more than one filter type for the polygons without increasing the length of the file by huge amounts to draw polygons that represent each combination of filters.

• ###### 2. Re: Mapping Dynamic Polygons

Noel, there's no need to post multiple times in different forums categories. I'm looking at your workbook, and I agree with you that what you're attempting to do will be an incredible amount of work doing it the way you are using polygons, especially considering you're really just trying to do stacked bar charts. Granted they're many multiples tightly packed together and against an image background, but I wonder if there's a better way. The image isn't really providing much information, could that be eliminated? If so you might be able to do this several stacked bar charts on a dashboard. It certainly would be easier, faster to load/refresh and less complex. Probably much easier to maintain.

Interesting viz, though.

Anybody else have any thoughts?

--Shawn

• ###### 3. Re: Mapping Dynamic Polygons

Ya I already deleted the 2nd post, sorry. Well the background image file is pretty necessary because it gives a reference point for exactly where these storage units are located with respect to the plant. Is there a way to put stacked bar charts in the correct location with a background image for each area? Also the calculations that to change the size of the bars are all done in Excel. Maybe there is a way to do the calculations in Tableau? For example if the data says that there are 10/40 units in a storage row that meet X Y Z parameters. So for the visual it subtracts 75% the difference from the top Y values for the polygon and the bottom Y values to generate the polygon, as opposed to having the polygons pre-mapped for every possible filter combination. I have no clue how to do this is it is possible. I am very new at with this program.

• ###### 4. Re: Mapping Dynamic Polygons

I'm having troubles with your tif file of the plant. Do you have a png or jpg file of this? Or maybe just post another copy of the tif. I'm getting a 'bad data' when I try to open it in Painter.

--Shawn

• ###### 5. Re: Mapping Dynamic Polygons

Here is the original file I got it from.

• ###### 6. Re: Mapping Dynamic Polygons

Well first off, can I make it so that the black background cells never dissapear no matter what filters I am running through? I don't want the option to turn them off to be available.

• ###### 7. Re: Mapping Dynamic Polygons

Here's what I'm seeing:

- The view is drawing 6+ times as many marks as it needs to. First of all, there are bars drawn for most every value of Age of Inventory, I'd suggest figuring out how to reduce the number of rows to just enough. Secondly, when I highlight any mark and Exclude it, what I see underneath is a second mark of the same color. I'm not sure what is going on there, I don't know the data well enough. In any case, you should only be drawing (600-odd rectangles * 4 points per rectangle * N average colors/dimensions per rectangle) marks.

- In terms of the data that goes into Tableau, you will need N rows, where N = (number of storage bins * 4 points per rectangle * Types of Inventory * Age of Inventory). Handling a bunch of rows like that is not a problem for Tableau, the key will be doing the appropriate filtering/calculating so you're not trying to draw so many marks.

- You're using a direct connection, an extract will almost certainly be faster (2-10x faster than Excel, in my experience)

All that said, I think you could do this with Gantt Bars, as in the attached. With Gantt Bars you have exact control over the start and length of each bar, so you could shrink your data down to (number of storage bins * types of inventory * age of inventory + one extra row per bin) and make use of calculated fields that use table calculations to determine the Y position and size (length) of each mark. Besides having the pre-calculated row for Empty space in each bin (that would reflect actual empty space), I also added a row to each bin's data for "Otherwise In Use" space. This allows for a mark to be displayed even when some data has been filtered out, so the user can still see what portion of the bin is in use.

Now I'm not sure about the background image, because Tableau seems to want X and Y to be dimensions or regular aggregates, not table calculations (which the Plotted Y uses). Maybe Shawn might have a better idea here. One thought is that you could use annotations to draw some boxes & lines, another is that you could just draw the background map using polygons on a dual axis, the map seems simple enough.

Jonathan

• ###### 8. Re: Mapping Dynamic Polygons

Ok, I'm not sure what's going on with the background image, I did some more testing and was able to make a background image appear when using table calcs for X and Y in the superstore sales data, so you should be able to do the Gantt Bars and use a background image. Shawn Wallwork, could you take a look at this?

• ###### 9. Re: Mapping Dynamic Polygons

Noel what Jonathan said. I think the Gantt chart approach is your best bet. I was thinking you could slice up the storage unit image into four sides and arrange them around the Gantt charts on a dashboard. But I'm really not sure they add much value, unless you were thinking you were going to let them zoom out (but you hadn't set it up that way).

I think having the map on the splash screen and then letting them click a building that switches them to the Gantt charts Jonathan is talking about, is your best option.

--Shawn

1 of 1 people found this helpful
• ###### 10. Re: Mapping Dynamic Polygons

Happy to. Jonathan, please post the workbook you created that gets Gantt bars on top of an image. I'm interested to see.

--Shawn

1 of 1 people found this helpful
• ###### 11. Re: Mapping Dynamic Polygons

Here you go. The red bar is just part of the background, the blue bars are the Gantt Bars.

1 of 1 people found this helpful
• ###### 12. Re: Mapping Dynamic Polygons

One problem with the gantt bar approach is that you can't auto-size the width of the bars - so I think you'll end up having to fiddle with the size slider if you resize the window/open it on a different sized screen.

I can see why you suggested going that way, Jonathan, but I do wonder if it would still be possible to keep finer control of the layout by using polygons, but calculate all the vertices with table calculations. You're doing almost all the work for that anyway with your Y and Size calculations. I might have a wee play...

(As an aside - since when have polygons automatically joined up like that? I've been religiously drawing an extra mark back at the starting point to close the loop - and telling people on the forum that they needed to do that - since the year dot. I wonder if it's always been like that or that's something which snuck in quietly in version 4 or sometime.)

1 of 1 people found this helpful
• ###### 13. Re: Mapping Dynamic Polygons

I also think it is totally possible to do it with table calcs, I was avoiding diving into that.

The polygon question is an interesting one. When I started with Tableau 6.1, some document somewhere said that N+1 marks were necessary, but when I was doing the build your own area chart post last month I found that I didn't need the extra marks. Strange...

• ###### 14. Re: Mapping Dynamic Polygons

Thanks for all the replies!

Although the Gantt bars do seem like a neat fix, the main issue with them is what Richard said about fiddling with the size slider. I ran into that problem when working with mapping out the silos and using circles. The best senario is where the size of the polygon displayed represents the amount of bins within the area that meet all criteria. In order to do that the way I am currently doing it, I would have to have a set of polygons drawn to meet all the possible combinations. I want there to be at least 3 sets of possible filters eventually (Age(4-5),Type(6),TypesofHolds(3)), and to draw that many sets of polygons would take somewhere around 200k lines.

Richard an Jonathan, you mentioned guys mentioned calculating the Y and vertices with table calculation. This sounds like something I had in mind, however I am very new at using tableau, or any GIS software, so I am kind of learning as I go. Here is the excel file as well I used for that data.

1 2 Previous Next