How to do conditional color for pie-chart

256
0
01-16-2023 07:30 AM
laioz
by
New Contributor

Hi all, 

I have created a pie chart map, where I define 4 different attributes.

Is it possible to define a conditional color code based on yet another field instead of defining them for each field in the attributes?

Ex.: If Field5 less1 then color should be gray

if Field5 more or equal than 1 and Field4 less and equal than 3 then color should be green

etc

I tried defining visualVariables type color and the stops for each different value, but it does not seem to work.

The renderer is defined as following:

const renderer_pie = {
            type: "pie-chart",
            attributes: [
            {
              field: "Field1",
              label: 'label1',
              color: 'blue'
            },
          {
              field: "Field2",
              label: 'label2',
              color: '#green'
            },
          {
              field: "Field3",
              label: 'label3',
              color: 'orange'
            },
          {
              field: "Field4",
              label: 'label4',
              color: 'gray'
            },
      ] 
 };

 

Tags (2)
0 Kudos
0 Replies