Conditionally render label line in Recharts

48 Views Asked by At

Im trying to render a label line conditionally in a Piechart in Recharts library. Currently, the label line is being render absolutely for all sections of the Piechart. My goal is to set a condition to render it if, for example, the % of the section is higher the X.

The docs are no really clear about it and do not provide clear examples

If false set, label lines will not be drawn. 
If true set, label lines will be drawn which have the props calculated internally. 
If object set, label lines will be drawn which have the props mergered by the internal calculated props and the option.
If ReactElement set, the option can be the custom label line element. 
If set a function, the function will be called to render customized label line.

I was thinking about something in the sort of:

      <Pie
        data={data}
        cx={200}
        cy={200}
        labelLine={data=> data.value > 0.5}
        dataKey="value"
      >
      </Pie>
0

There are 0 best solutions below