Question

Chart Colors Based on Non-Numeric Column?

  • 15 May 2018
  • 1 reply
  • 133 views

In scripting language data viz (e.g. ggplot2 in R), imagine I have a dataframe where each row represents a school, with three columns:


school.type, which has 3 possible values: ‘elementary’ or ‘middle’ or ‘high’

school.name, each school’s name

student.body.size, and integer count of enrolled students


If I want to make a bar chart where the x axis lists the school names, the y axis is each school’s student body size, and I want each bar’s color to be selected from a palette of 3, based on its school.type, I can just set x, y, and colour parameters to school.name, student.body.size, and school.type variables respectively.


In Looker this isn’t possible currently. In order for bars to be differently colored, they need to correspond to different columns, which I’m able to accomplish with some goofy pivoting, but it would be really nice to be able to set color to be based on a non-numeric column, like school.type here.


1 reply

Userlevel 7
Badge +1

Hey Paul,


That’s a super cool idea, as a longtime R user I know exactly what you mean-- That’d be really useful.


I’d be happy to pass the idea along to the product team to let them know! Thanks for helping to make Looker even better 🙂.


Best,

Izzy

Reply