getredash / redash

Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data.
http://redash.io/
BSD 2-Clause "Simplified" License
26.45k stars 4.38k forks source link

Default colors for Labels #2873

Open thoechsmann opened 6 years ago

thoechsmann commented 6 years ago

We have lots of graphs where we have the same groups. We always have to assign colors manually so the same label gets the same color.

For example we have many plots grouped by the platform like Android, iOS, Facebook. It would be great if we could maybe globally assign default colors to a label name.

kravets-levko commented 6 years ago

Hi! You can manually set colors for charts on the "Colors" settings tab:

image

thoechsmann commented 6 years ago

Yes, I know. And we do that. But we have LOTS of charts with the same labels and we have to set the color for all of them in every single query and even in every single visualisation.

A nice solution would be a list of name-color pairs in the global settings. (maybe even allow wildcards) A label will use the first color where the name matches.

arikfr commented 6 years ago

I would love to find some solution that doesn't require creating configuration for colors, as this introduces its own challenges. If anyone got ideas, don't be shy 🤓

jezdez commented 6 years ago

Maybe we could have an "autocolor" mode that is enabled with a single boolean setting, that would automatically populate the color values in a predictable way, e.g. alternating complementary colors that vary by a few grades of R, G or B per iteration? Maybe start at a not-quite-white and end at a not-quite-black?

arikfr commented 6 years ago

@jezdez how is it different than today's auto color picker?

jezdez commented 6 years ago

Oh right, I missed the important part 😬: "..automatically populate the color values in a predictable way based on the label".

WesleyBatista commented 5 years ago

just brainstorming here

could be a column_name: color mapping on the dashboard level that is applied to every widget on the dashboard when you access it. If you use the "Colors" settings tab from the query visualization, it should take priority.

WesleyBatista commented 5 years ago

I did not stopped to see how the code is nowadays, but ideally I imagine the settings being like:

"redash global settings" > "dashboard settings" > "query settings" > "query visualization settings"

deecay commented 5 years ago

Maybe 'autocolor' will take series name such as 'male' or 'female', and takes md5hash of it, then take lowest byte of the hash to calculate red, second to lowest for blue, etc. Calculation could be bit-AND, or mod 256 or whatever. This should always assign a fixed color to any series by default.

arikfr commented 5 years ago

@deecay and in case of collision, it will pick the next available color?

deecay commented 5 years ago

@arikfr no I was thinking of one way only. Md5 or other hasing function might give us just enogh randomness.

kravets-levko commented 5 years ago

@arikfr @deecay d3 has ordinal color scales intended exactly for this usage pattern (and no md5 needed)

arikfr commented 5 years ago

If I'm not mistaken, d3 scales function will return the same color for the same input value, but only for the current invocation /instance. But you might get different color between page refreshes.

I might be wrong, so worth checking.

On Mon, Jun 24, 2019, 19:12 Levko Kravets notifications@github.com wrote:

@arikfr https://github.com/arikfr @deecay https://github.com/deecay d3 has ordinal color scales https://d3-wiki.readthedocs.io/zh_CN/master/Ordinal-Scales/ intended exactly for this usage pattern (and no md5 needed)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getredash/redash/issues/2873?email_source=notifications&email_token=AAAROLATRPR7VI4HCFPJ3BDP4DXALA5CNFSM4FXZKTFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYNN5ZI#issuecomment-505077477, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAROLAIJLUUVWATQNZMZEDP4DXALANCNFSM4FXZKTFA .

arikfr commented 5 years ago

Might be relevant/useful: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f https://observablehq.com/@mbostock/turbo