Chart Config - Assign Colour to Lines based on Value Name

Using the Chart Config editor, can you dynamically assign a colour depending on the value name?

For example,

 

 

{Name: "Shorts", Colour: "blue"},
{Name: "Hat", Colour: "brown"}

 

 

I've done a lot of research into the chart config editor and the capabilities of it and seem to constantly hit a disappointing dead-end / end up questioning why this is a simple thing to do in Looker Studio but a painful process within Looker where you have to manually assign the colour in the values section for every chart.

The closest I have got prior to this is:

 

 

series: [{
name: 'Shorts',
color: '#b7b7b7'
},
{
name: 'Hat',
color: '#ca7fb1'
}

}]

 

 

However, this assigns the name and colour dependant on the order, meaning if I sort it the other way round it'll simply rename Hat to Shorts and visa versa.

 

The other attempt I made was altering the following code using the documentation provided:

 

 

{
  series: [{
    formatters: [{
      select: 'value >= 380',
      style: {
        color: 'orange'
      }
    }]
  }]
}
The select attribute
You can use the following values in a select expression:

value: This variable returns the value of the series. For example, you could use select: value > 0 to target all positive values, or value = 100 to only match series with a value of 100.
max: Use select: max to target the series value that has the maximum value.
min: Use select: min to target the series value that has the minimum value.
percent_rank: This variable targets the series value with a specified percentile. For example, you could use select: percent_rank >= 0.9 to target series values in the ninetieth percentile.
name: This variable returns the dimension value of the series. For example, if you had a chart showing Sold, Canceled, and Returned orders, you could use select: name = Sold to target the series where the dimension value is Sold.

 

 

 

However, the suggestion about using name doesn't seem to work / I am unable to get it to work. 

 

I'd really appreciate any help on this subject or simply some closure so I can move on and know it's simply a missing functionality and not my own error.

 

Thanks in advance!

 

0 5 1,166
5 REPLIES 5
Top Labels in this Space