Skip to content

Incomplete legend for multiple colored bars in one trace #1560

Closed
@hy9be

Description

@hy9be

I noticed that Plotly.js construct legend item per trace rather than per color: https://github.com/plotly/plotly.js/blob/master/src/components/legend/get_legend_data.js#L43-L71. Thus if markers in a trace are colored differently, the legend could only show the color of the first item.

Here is an example:
image

I tried to make some changes to draw the legend items correctly. But the filtering functionality breaks. And I failed to find a way to fix the filter as the current implementation is based on the concept of "trace".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions