-
15. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Ken Flerlage Jul 12, 2018 7:49 AM (in response to Karthikeyan Masialamani)Here's the polygon approach. The data set is quite simplistic. It's an Excel file with one two tabs as shown below. I've also attached the file.
Sections Tab
Model Tab
We'll use Model in Tableau to create the data densification required to draw the curves. Once in Tableau, we're using bins (on the Range field) and some calculated fields, plus a bit of trigonometry (for a refresher on trig, please read my blog post: Beyond "Show Me" Part 2: Trigonometry - Ken Flerlage: Analytics Architecture, Strategy, & Visualization), to draw the polygons. I'm attaching the workbook. All the calculations are fairly well commented in the calcs themselves, so I won't detail them here. If you have any questions, let me know.
-
Half Pie.twbx 14.7 KB
-
Half Pie Data.xlsx 8.6 KB
-
-
16. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Karthikeyan Masialamani Jul 12, 2018 8:36 AM (in response to Ken Flerlage)Thanks a lot Ken for your detailed answer. I will download the file and go through your code/logic and come up with questions tomorrow morning.
-
17. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Karthikeyan Masialamani Jul 12, 2018 8:39 AM (in response to Karthikeyan Masialamani)Ken...I am able to download both the files.
-
18. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Ken Flerlage Jul 12, 2018 9:27 AM (in response to Karthikeyan Masialamani)Great. Let me know if you have any questions.
-
19. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Karthikeyan Masialamani Jul 12, 2018 10:28 PM (in response to Ken Flerlage)what is the use of Range(Bin) here? I can see the 'Size of Bins' value as 1, if I change it to 0.5 I get the below one. If I change I to 2, it is totally different. can you explain what is going on behind the scene?
2) Angle Spacing :
WINDOW_MAX(MAX(60/99))
// Angle spacing between each point. Each slice is 60 degrees and we have 100 points.
// But we want the first and last points of adjacent slices to appear on the same point...
// ...so we adjust it as if there were only 99 points.
Getting 0.6061 - is this value same for all the rows? it seems like that.
How do you test the value of all the calculated field values step by step to ensure the numbers are correct?
I'm also not clear on 99 instead of 100. I can understand the bolded statement, but the second part is not clear i.e .100 point..
60*3 ( slices) = 180 ??? points stands for something here?
3) How to view/get X & Y Values outside tableau? If I click on 'ViewData', I am just getting below the columns only, but usually all the calculated field value should be displayed. Right? or If I go back and see the 'DataSource' part I can see at least the value of calculated field values. But here I can see 'Undefined'.
4) COS(RADIANS([Angle]))
How to test the output of these function for row by row? I mean
Step1: some number in Angel
Step 2: Radian(Angel)'s output
Step 3:COS(RADIANS(Angle) 's output
How do you basically draw circle like this ? I mean do you test your numbers outside tableau ? or Verifying the output in tableau and then based on it modifying the calculated field numbers accordingly.
-
20. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Ken Flerlage Jul 13, 2018 5:30 AM (in response to Karthikeyan Masialamani)There's a lot here. I will try to answer these properly some time this evening, if I am able to find time.
-
21. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Karthikeyan Masialamani Jul 13, 2018 7:52 AM (in response to Ken Flerlage)Sure Ken! I am eagerly awaiting for your reply.
-
22. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Ken Flerlage Jul 13, 2018 9:55 AM (in response to Karthikeyan Masialamani)Let me try to answer a couple of these questions.
1) Why Bins? I'm using bins to artificially create missing values. Essentially, I want 101 individual points. Point 101 will be at the center (0,0), and the rest of the points will be used to draw the curve. When you create bins on the Range field, which has 2 values--1 and 101, then use an "Index" table calculation, telling it to compute using the bins, it will essentially create those 101 points. This is kind of an advanced topic, but you can take a look at the following blog I wrote for more details. It doesn't specifically detail bins, but you'll see how I use them there and that may help with understanding: Beyond "Show Me" Part 3: Parametric Equations - Ken Flerlage: Analytics Architecture, Strategy, & Visualization . You can also check out this blog: https://www.thedataschool.co.uk/david-sanchez/densification-bins-index-tableau-normal-distribution/
Since I want 101 points, I'm using a bin size of 1. If you used a bin size of 0.5 then you'd get 202 points, but the angle calculations are designed for 101 points, so that causes your polygons to get out of whack.
Instead of using bins, you could just create a data set that has 101 records with values 1, 2, 3, 4...101. Then that would allow you to do something similar.
2) Angle Spacing. The value will always be the same. I'm trying to find the spacing of the angle between each point. We want them equidistant so we get a smooth curve, so the angle spacing is always the same. The chart we're creating is half of a circle. A circle is 360 degrees, so half is 180 degrees. Since each slice is one third of the 180 degrees, they are each 60 degrees. We'll use 100 points to approximate each curve, but we want the first point to be at the beginning and the last to be and the end. Take for example the following line with 3 points plotted on it:
Let's assume that the line is length of 1. If we wanted to plot 3 equidistant points, then we'd assume that you just divide the length by the number of dots. In our case, 1/3. But that would give you spacing of 1/3 for each dot, which would look like this when plotted:
What we really want is the spacing to be 1/2. So instead of dividing 1 by the number of dots (let's call that "n"), we want to divide 1 by the n-1. In this case that would be 1/(3-1) or 1/2. Same with our example of 100 dots. We'll divide the total degrees of each slice (60) by n-1 or 99.
3) I don't think there is a way to export the data with the x and y coordinates. This is because the table calculations used in this can be set up to operate different ways. For instance, Index is set up to be computed using Range (bins). I could change this and the results would be different (much like when you changed the bin size). This does not actually impact the underlying data. It only changes the view itself.
4) When I first started doing this kind of thing in Tableau, I couldn't quite grasp the concept of using bins for data densification, so I did all of the math in Excel. Over time, I began to understand how to do it in Tableau and I now try to do as much of it in Tableau as possible, so people can download my work and understand what's being done. If I need to verify the values, I tend to just drop those fields on tooltip and hover over each one to make sure I'm getting what I expect. I also take small steps to get to the end result. For example, when I'm doing curves, I tend to just get everything laid out like the following first. Then I do the tooltip thing and make sure things are right before actually plotting the x and y coordinates.
As I said, this is all pretty complex stuff, so it takes some time to figure out. I'd recommend checking out my series of blogs called "Beyond Show Me" which go into these in small steps. It starts by introducing the concept of creating custom visualizations by plotting x & y coordinates, then talks about how to leverage trigonometry to draw curves, then discusses some complex curves which are defined by parametric equations. You can find them here:
Also, as noted earlier, you can do this without bins. So I'm attaching an Excel document and Tableau workbook which do it that way.
I hope this helps. If this has answered your questions, please mark this as helpful or the "correct answer". This will help others with similar questions in the future. Thanks!!
-
Half Pie No Bins.twbx 16.6 KB
-
Half Pie No Bins.xlsx 9.5 KB
-
-
23. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Karthikeyan Masialamani Jul 15, 2018 12:00 AM (in response to Ken Flerlage)Ken,
Thanks a lot for your detailed explanation and for your time.
1) I can understand about BIN now, but i still need to play with it in tableau to get more knowledge. Out of curiosity, I am just asking the BIN will use Histogram kind of algorithm behind the scene ?
To generate the range of values we have to use BIN along with INDEX(), what about RANK() in BIN ? Does BIN support only INDEX()?
Can I get few use cases where we think BIN while new requirement comes ? shall we use BIN to identify and fill the missing years , say for example a security's performance data was received in a file, there was no record for 2015 and from 2010 to 2018 data was filled in that file, but 2015 is missing, in this scenario, we can use BIN to identify the missing YEAR? Correct?
2) We'll use 100 points to approximate each curve....
I Can understand the line and 3 points example, but when i come to our case..it is bit unclear for me...can we also use 50, 75 or any number here ?...how you defined 100 here ? i mean based on some equation? please let me know.
-
24. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Ken Flerlage Jul 15, 2018 1:04 PM (in response to Karthikeyan Masialamani)1 of 1 people found this helpful1) If you create a histogram in Tableau, it will actually create Bins, just like we've done here. It's pretty much the same thing--we're just using it for a slightly different use case here. You can use lots of different functions in conjunction with Bins. INDEX() is a simple one as it allows us to create numbers 1, 2, 3, 4, etc. You can use lots of other functions though, depending on your use case. For the missing year example, it may not be necessary to use Bins as use of a continuous year/date field may sort of take care of that. All depends on your data though.
2) When we draw curves in Tableau, we're really just approximating a curve. We're just plotting points then connecting them with straight lines. We could draw this curve with only 3 points if we like, but it would not look like a smooth curve. By using 100 points, it looks like a smooth curve and our eyes can't really tell the difference. You could use 50 or 75 or 1000 or whatever you like. In fact, 50 would probably give you a quite a smooth curve as well. I just chose 100 because I knew I'd get that smoothness from it, but you can play around with different numbers.
-
25. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Karthikeyan Masialamani Jul 16, 2018 7:56 AM (in response to Ken Flerlage)Thanks Ken! I am on vacation leave today so I will be back to work tomorrow.
I don’t see correct answer or useful kind of option from my phone so as soon as I back I will mark it accordingly
-
26. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Ken Flerlage Jul 16, 2018 8:24 AM (in response to Karthikeyan Masialamani)Yeah, the mobile interface can be a bit problematic. I typically change it to the desktop view, which gives the full interface.
-
27. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Karthikeyan Masialamani Jul 16, 2018 9:13 PM (in response to Ken Flerlage)Ken
If you have some free time can you please check my another question topic “which chart will consume more memory” and provide your thoughts
-
28. Re: Full Round - Gauge/Speedometer Kind of Circular Chart
Ken Flerlage Jul 17, 2018 5:04 AM (in response to Karthikeyan Masialamani)Which question is that?