Hi, im having issues with visualisations and defining colour ranges. Although I can override the colour via the legend in the visualisation adding this into a Canvas ignores the colours I set. It reverts to the default green to red.
Can I define the colours within the object? E.g. add a colour value to each range defined and remove the colorSchema.
"metric": {
  "percentageMode": false,
  "useRanges": false,
  "colorSchema": "Green to Red",
  "metricColorMode": "Labels",
  "colorsRange": [
    {
      "from": 0,
      "to": 9
    },
    {
      "from": 9,
      "to": 16
    },
    {
      "from": 16,
      "to": 18
    },
    {
      "from": 18,
      "to": 21
    },
    {
      "from": 21,
      "to": 24 
             
            
               
               
               
            
            
           
          
            
              
                rashmi  
                (kulkarni)
               
              
                  
                    March 5, 2021,  4:17am
                   
                   
              2 
               
             
            
              I see that you are looking for conditional coloring in Canvas. There are few threads which discuss this in detail.See if it helps:
  
  
    @Catherine_Liu  I have basically the same problem not with the font color but with the background color 
I have just one condition instead of two my approach is quite like the fist you gave to ksunil. 
I do a select count(*) and if it is greater than 0 the backround should be green otherwise it should be red. 
The expression editor looks like below 
filters | essql query="SELECT * FROM uacuser WHERE logintime > NOW() - INTERVAL 1 MONTH AND disabled = 0" | math "size(userid)" | metric "Users logge…
   
 
and there is a GH issue as well
  
  
    
  
  
    
    
      
        opened 06:46PM - 23 Apr 19 UTC 
      
        
          closed 03:44PM - 06 Apr 23 UTC 
        
      
     
    
        
          enhancement
         
        
          Team:Presentation
         
        
          design
         
        
          loe:medium
         
        
          impact:low
         
        
          Feature:Canvas
         
    
   
 
  
    **Describe the feature:**
As a Canvas users, I want to change the appearance of…  an element based upon an underlying value. For example, set the metric font to red if a value under a specified threshold. 
**Describe a specific use case for the feature:**
Whether I'm building a report or dashboard in Canvas, I may way want to emphasize a negative state by putting more visual emphasis on an element. This could be useful when there are a high level of negative occurrences (errors, security findings, etc.); likewise for positive occurrences. This could also be used for positioning, size, etc.
You can currently do this through the expression editor like so:
```
demodata
| math "unique(country)"
| metric "Countries" 
metricFont={font size=48 family="'Open Sans', Helvetica, Arial, sans-serif" color={if {gt 10} then=red else=black} align="center" lHeight=48}
```
It is a question that comes up regularly which is why adding it to the UI (side panel settings) would be a nice way make this feature more discoverable. At first, it may simply be enough UI to handle two states that equate to an `if then else` statement. In the initial version, this could be visually assembled with some simple text inputs.
I can provide mockups, if necessary, when this is ready to be worked on. 
   
   
  
    
    
  
  
 
Hope it helps 
Thanks 
Rashmi
cc @Catherine_Liu 
             
            
               
               
               
            
            
           
          
            
              
                system  
                (system)
                  Closed 
               
              
                  
                    April 2, 2021,  4:17am
                   
                   
              3 
               
             
            
              This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.