6 Replies Latest reply on Nov 10, 2018 3:13 AM by Simon Runc

    pie chart color based on another field

    Ranjith Palanisamy

      Hi everyone,

       

      I read articles on online and documentation, but i could not find any reliable answer. Could you please help me find a solution?

       

      I have the below data structure where product is graded and colored in a pie chart. As you can see, tableau color the grade with default colors or I can even change those colors for set of specific grades from color mark. But, it has a complexity that the same grade may have different color for another customer as shown below(CUST1 have Grade PASS with color GREEN where as CUST2 have YELLOW).

       

      Would it be possible to color the grade from a another field(which have the hex value of the color)? so that color will be loaded from the hex value which is assigned to that grade.

       

      I would really appreciate any guidance on this request. thank you!

       

      Version: 10.3

      sample.jpg

        • 1. Re: pie chart color based on another field
          Simon Runc

          hi Ranjith,

           

          So I'm not aware of a way that Tableau can pick the colour from the field (by picking up the hex number of the colour).

           

          Assuming you don't have too many, what I'd suggest is setting the default colour for each of your colour fields

           

           

          To the hex value

           

          Then use this field on the colour tile (rather than pass/fail...although you can keep this on the label)

           

          Hope that helps

          • 2. Re: pie chart color based on another field
            Shinichiro Murakami

            Hope this helps.

             

             

             

             

             

            Thanks,

            Shin

            • 3. Re: pie chart color based on another field
              Ranjith Palanisamy

              Hi Shin, Thank you for the response. I did try that, but i see the following behaviors. 1. Assuming that i set the hex value from DB for each customer - grade combination and i created a calculated field appending the grade and customer, it started showing in the legends(like PASS-CUST2). But, i need legends with just the grade name. 2. Additionally, I captured this sample data to explain the problem statement. In reality, I have at least 200 grades spread across at least 50 customers and color code is a configurable value for each grade. But i can assure you that, all 200 grades(may get increased over time) falls with then 20 colors to meet the max 20 members rule in tableau color mark.

              • 4. Re: pie chart color based on another field
                Shinichiro Murakami

                Getting confused a bit.

                Could you clarify you request?

                 

                1. To differentiate the color, need to have different name,  up to three color or something like that, you can use "PASS", "PASS.", "PASS " or something like that.

                  20 or mote ?   Good luck.

                 

                2. What do you need on this?  200 colors cannot be recognizable from the begging by anyone....

                 

                 

                 

                 

                Thanks,

                Shin

                • 5. Re: pie chart color based on another field
                  Ranjith Palanisamy

                  Hi Simon, Thank you for suggesting this approach. I quickly tried this and progressed little step forward. But, I still could not get all the necessary items which are captured below.

                   

                  1. I set the color based on the default properties and i can see the color applied based on the setting. but the legends started showing the color name instead of the grade. Is there any workaround you suggest to show the legend with its respective color? If not, i can remove the legend for now. But the real problem would be the next one.
                  2. I applied the default properties of distinct field value based on the data set i have at this moment. One additional requirement is that, this report pulls data set through live connection using Parameter. For example, when customer 1 view this report, this report gets the data set respective to customer 1 and render the report. When the customer 2 view this report, it gets the data set respective to customer 2 and render the report.
                    1. I do not know how to set the default properties for each color that can be present across all customers. But, I see only 15 distinct colors possible across all customers.

                   

                  Do you suggest any way? So that i set default color for each possible color hex value across customers.

                   

                  I have attached the video which capture the new chart. thank you!

                  • 6. Re: pie chart color based on another field
                    Simon Runc

                    So on part one, we can do this by setting up a worksheet to act as the Legend ...I've coloured on colour, but labelled on grade and put this on the dashboard in place of the actual legend.

                     

                    On part 2 ...tricky! So if when you are authoring the workbook, you remove the parameter filter so all Colours come into the datasource, you should then be able to set the colour up for every colour. You can now re-apply the parameter filter (albeit via SQL) and as people select a customer the workbook should hold the colour when it comes in (it should remember what the default colour is, when it see's that one again).

                     

                    If you want to go even "hackier" you could edit the workbook (which is just XML). Here is the bit where the default colours are assigned

                     

                     

                    So you could open the workbook in a text editor and then add all the colours here (even future colours if you know them). NOTE before editing the XML you should take a copy as if anything goes wrong (easy to miss a closing />) it's unsupported by Tableau

                     

                    Hopefully one of those options are do-able.