Skip to content

Bar Chart Fails with 'Invalid min/max y-axis configuration' When Column Values Are Uniform #13584

@NoobPeen

Description

@NoobPeen

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

Bar Chart Throws 'Invalid min/max y-axis configuration' for Uniform Column Values Without y-axis Bounds, Unlike st.plotly_chart

Reproducible Code Example

import pandas as pd
import streamlit as st
import plotly.graph_objects as go

data_df = pd.DataFrame({
    "values": [
        [4, 4, 4, 4],
    ]
})

col1, col2 = st.columns(2)

with col1:
    st.data_editor(
        data_df,
        column_config={
            "values": st.column_config.BarChartColumn(
                "Values",
                width="medium"
            ),
        },
        hide_index=True,
    )

with col2:
    for idx, row in data_df.iterrows():
        fig = go.Figure(data=[
            go.Bar(x=list(range(len(row['values']))), y=row['values'])
        ])
        fig.update_layout(
            title=f"Row {idx}",
            xaxis_title="Index",
            yaxis_title="Values",
            yaxis=dict(range=[0, 10]),
            height=300
        )
        st.plotly_chart(fig, use_container_width=True)

Steps To Reproduce

No response

Expected Behavior

When all values in the column are identical and greater than or equal to 0, the bar chart should render the bars at a consistent fixed level on the y-axis, without requiring explicit y_min or y_max configuration.

Current Behavior

Image

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version:1.52.2
  • Python version:3.12.3
  • Operating System:AlmaLinux release 8.10 (Cerulean Leopard)
  • Browser:Google Chrome

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:st.column_configRelated to column configuration functionalitypriority:P3Medium prioritystatus:confirmedBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions