Skip to content

px.bar: when base is used, hoverlabel label should be "base+y: %y" #2786

@eddy-geek

Description

@eddy-geek

Minimal example:

tasks = pd.DataFrame([
    dict(Task="A", Start=0, Elapsed=10),
    dict(Task="B", Start=0, Elapsed=5),
    dict(Task="C", Start=5, Elapsed=10)
])
px.bar(tasks, base='Start', y='Elapsed', text='Task',)

image

Imagine an horizontal gantt-chart where x=Elapsed is Task duration in days. The issue is that Task C has "Elapsed=15" instead of "Elapsed=10".

This also an issue in the graph_objects API in the default hover, but at least adding x as text shows the proper one.

go.Figure(data=[go.Bar(base=tasks['Start'], y=tasks['Elapsed'], text=tasks['Elapsed'])])

image

Note: In px.timeline it's fine since user must give Finish=but in px.bar it's looks pretty misleading to "change" x into finish :-)

If my Task lasts 10 days, the fact that it ends at day 15 is an internal positioning detail.

@nicolaskruchten is it just an oversight from #2585 or do you intend it this way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions