79508337

Date: 2025-03-14 07:04:16
Score: 2
Natty:
Report link

I didn't think to try ChatGPT before.

It gave me the following solution but it does nothing (not even set the greens/reds..

{"field":"Adult CAP", 'tooltipValueGetter': {"function": "params.data.DRLcount + ' scans included'"},
        'cellStyle': {
            # This function checks for empty values (None or empty string)
            'function': '''
                function(params) {
                    // Check if the value is null, undefined, or empty
                    if (params.value === null || params.value === undefined || params.value === '') {
                        return null; // No style applied for empty cells
                    }
                    // Apply some style conditions if the cell is not empty
                    if (params.value > 7) {
                        return { backgroundColor: 'redn' };
                    } else {
                        return { backgroundColor: 'green' };
                    }
                }
            '''
        }

I also tried forcing nan's to zeroes and then the following:

{"field":"Adult CAP", 'tooltipValueGetter': {"function": "params.data.DRLcount + ' scans included'"},
        'cellStyle': {"styleConditions": [{"condition": "0 > params.value <= 11","style": {"backgroundColor": "#16F529"}},
        {"condition": "params.value > 11","style": {"backgroundColor": "#FD1C03"}}, {"condition": "params.value == 0","style": {"backgroundColor": "#FD1C03"}}]}},

It still colours my 0's green?

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: JRP