Skip to content

Datalabel nodes with empty text is still rendered #2796

@praneetloke

Description

@praneetloke

Description

When datalabels are enabled it seems that even returning an empty string value or undefined from the formatter function renders empty <text> nodes which affects performance. It seems that we have to completely disable datalabels when there are quite a few data points. I only noticed this because I saw a console warning being printed about there being too many datalabels. Also it seems that I could get rid of the warning by simply setting the maxItems to equal the length of the data points in the series but I don't want to do that. I would not like the <text> nodes to render at all if the formatter returns undefined or empty string value (but ok to render if 0 is returned since it is a valid label value.) I would also be ok if it didn't render only if undefined is returned which is not the case as I tried that too.

Steps to Reproduce

  1. Create a column chart (bar) with at least 200 data points
  2. Enable data labels via dataLabels.enabled property
  3. Warning is printed in the console

Expected Behavior

Empty text nodes are not rendered.

Actual Behavior

Empty text nodes are rendered.

Screenshots

N/A

Reproduction Link

https://codepen.io/praneetloke/pen/vYJqYdo

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions