Inspired by the great work of Ian Wilson at (Qlik Sense: How to set custom colors by measure in a bar chart ) which showed me how to colour by dimension in bar and line charts, I quickly became frustrated with how long it took to make the expressions required to create the charts.
So I made a quick (and very ugly) macro that takes the fields, and creates the synthetic dimension, synthetic measure, and colour expressions automatically for you so you can just copy paste them into the appropriate fields following Ian's guide. It makes a two way gradient (colormix2()) based on rgb values that you enter.
I have attached it here.
Copy the fields, i.e. the measures for which you want individual bars/lines in your chart in the column titled "Fields".
On the right hand side there is a box titled synthetic dimension, measure, and colour expression.
Copy those into the appropriate fields in qlik
A couple notes:
I whipped this up rather quickly and have only tested it briefly, there may well be some errors. Let me know and I will do my best to fix them. Also I am well aware of how long and ugly and inefficient this macro is. Hush.
In the box with Color1, Color2, and Color 3, you can set your colours by RGB values where Color2 is the middle colour in the equivalent of a colormix2() function. However to permanently change those values to colours of your choosing/organisation, you have to change them in lines 33-49 in the macrobutton module, as the reset function replaces them with the values already in the file.
Let me know if you have any questions, suggestions, or if there are any bugs.