G2Plot icon indicating copy to clipboard operation
G2Plot copied to clipboard

🥰 [FEATURE] Allow data label style to be a function (same as for data points)

Open juergenr opened this issue 2 years ago • 0 comments

🥰 Features description [Please make everyone to understand it]

Allow data label style to be a function (same as for data points).

🏞 What problem does this feature solve

So it would be possible to use different colors for different categories.

🧐 What does the proposed API look like

label.style: (item) => {
          if (item.category === 'Gas fuel') {
            return {fill: 'red'};
          }
          return {fill: 'green'};
},

🚑 Any additional [like screenshots]

image

juergenr avatar Jul 23 '22 16:07 juergenr