Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Custom colors for Pie chart

meghasaraf
5 - Atom

Hi All,

 

Can anyone help me figure out how to add custom colors to Pie chart?

 

I have a predefined set of colors which needs to be used however, I am unable to set the colors in the Pie chart format area.

 

Can anyone help me with this.

 

Thanks,

Megha

7 REPLIES 7
apathetichell
18 - Pollux

On a semi-related issue - I was looking into this and came up with the attached bug ... When an action tool is set up to a chart tool and you open the chart tool - configure chart crashes. take away the action tool and everything is copacetic.2021-07-04 (4).png

apathetichell
18 - Pollux

also my suggestion was either concatenating color codes and then using a batch macro to go in and edit each color value via an action tool/get word combo - with one action tool per color or the dreaded "use R/Python." Perhaps someone else has a better idea or knows the secret of pie chart colors.

danilang
19 - Altair
19 - Altair

Hi @meghasaraf 

 

I was able to add custom colours by following the excellent tutorial by @kelly_gilbert 

 

  1. Navigate to C:\Program Files\Alteryx\bin\RuntimeData\HtmlAssets\Charting
  2. Right-click on ayx-chart-editor-tool.bundle.js --> Properties --> un-check Read Only
  3. Make a backup copy of bundle.js, in case you need to go back to the original.
  4. Go to the start menu and search for Notepad++ (or your text editor of choice)
  5. Right-click on Notepad++ --> Run as Administrator
  6. In Notepad++, navigate to C:\Program Files\Alteryx\bin\RuntimeData\HtmlAssets\ayx-chart-editor-tool.bundle.js
  7. Ctrl+F to search for ;t.BREWER=d;.
    At that point in the file, you will see the names of the categorical palettes. In my case, I am going to add a new categorical palette called Custom.
     
     

    danilang_3-1625485921160.png
  8. Add your new palette name at the end of the array, making sure to follow the syntax i("palletname") and delimit with commas.

  9. Your array should look like this

 

var f=[i("D3"),i("G10"),i("T10"),i("Alphabet"),i("Dark24"),i("Light24"),i("Custom")]

 

  • Next, you will see a (0,r.default)(l, statement for each palette. You will need to add one for the new palette. The array originally contained 6 palettes (F[] keys 0-5), and we added a seventh, so my new palette will be F[6].  I added the highlighted part below for my new palette:
    danilang_4-1625486589159.png

     


    Edit the array of hex codes as necessary to add your custom palette, making sure to follow the syntax with double quotes, comma delimited.

  • Save and close the file. You may also want to save a copy of the file in a different location, in case it is overwritten when you upgrade or reinstall.
  • Now your new palette will be available in the layer tab of the Interactive Chart tool:
     

    Dan

     

apathetichell
18 - Pollux

@danilangI was figuring if anyone knew a hack it would be you - I'm not 100% sure that's easier than the multi-action tool/get word approach but much less likely to crash configure chart.

kelly_gilbert
13 - Pulsar

@apathetichell - the main reason you'd want to edit the file is that you only have to do it once, and then it's ready to go from that point on (without the added complexity of adding a macro to the affected workflows). The modified .js file can be shared easily with others across the company (i.e. one person edits the file once, and then everyone can use it). So, if you only have only one charting workflow, it might not be easier, but with more than one workflow (or more than one user), a defined palette is definitely the way to go.

Having a defined palette is especially useful when using Transforms to split the data into separate channels, because you can assign the palette, and then when a new category shows up in your data, it just uses the next color in the palette automatically (without you needing to update/change the workflow). [Although, there is a known defect with the Transform functionality right now] 

apathetichell
18 - Pollux

@kelly_gilbert  - all true and great points. Thanks!

Charles
6 - Meteoroid

Hi,

 

I hope you are doing well.

I would love to share with you how to make beautiful charts in Google Sheets and Excel. I used ChartExpo™ to make 50+ types of charts in just few clicks.
There is no requirement of coding skills.

 

Sharing a video to watch how easy to create charts in Google Sheets and Excel.

How to create Sankey Chart?


Installation Source:

ChartExpo for Excel
ChartExpo for Google Sheets

 

Regards!

Labels