Skip to content

Bar Graph: Hide/Show Labels automatically if enough space when zooming #11166

@zevero

Description

@zevero

What problem does this feature solve?

I have a bar graph (screenshots below) with few big entries an many small entries. It is not possible to display a label for every entry. There would be too many labels overlapping.
My current solution is to use label: formatter: p => p.value[1] > minLabelValue ? p.value[1] : '' in order to hide labels for values smaller than my defined minLabelValue.
However, when zooming in, those entries will of course not get displayed.

Users should only see relevant labels (without beeing distracted from man overlapping tiny ones). But when zooming in, these labels (as there is enough room) should appear.

What does the proposed API look like?

an option like:
barMinHeightLabel: 10
could only show the label if there is enough room (at least 10 pixel) for it.
or even better
label: {
hideIfNotEnoughSpace: true
}

LabelZoom1
When not zoomed, it looks like intended.
LabelZoom2
But on zoom, label values should appear as they fit into the graph.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions