Can you make outlabels not display for 0 values?

I have an outlabeledDoughnut and I want to not display labels for values of zero. Can you pass a lambda to the display value? This is what I’m trying but it still displays the labels for everything:

            outlabels: {
              text: "%l: £%v",
              color: "black",
              stretch: 25,
              font: {
                resizable: true,
                minSize: 12,
                maxSize: 18
              },
              display: ->(v) { v.to_f.zero? ? false : true }
            }
          }
type or paste code here

Hi @jsja85,

Yes, you can do it like so:

      outlabels: {
        display: (context) => {
          const index = context.dataIndex;
          const value = context.dataset.data[index];
          return value > 0;
        },
        text: '%l %p',
        color: 'white',
        stretch: 35,
        font: {
          resizable: true,
          minSize: 12,
          maxSize: 18,
        },
      },

Example in chart editor

It looks like you’re using Ruby, so be sure to send the full chart configuration as a string. The Javascript is evaluated on our side.