st.column_config.LineChartColumn

Hello!

It seems that this new st.column_config.LineChartColumn module doesn’t work for lists with 2 values.
For the example below it must be at least 3 months to visualize the graph. If there are only 2 months, nothing is shown. Does anyone know why?

import pandas as pd
import streamlit as st

data_df = pd.DataFrame(
    {
        "sales": [
            [0, 4, 26, 80, 100, 40],
            [80, 20, 80, 35, 40, 100],
            [10, 20, 80, 80, 70, 0],
            [10, 100, 20, 100, 30, 100],
        ],
    }
)

st.data_editor(
    data_df,
    column_config={
        "sales": st.column_config.LineChartColumn(
            "Sales (last 6 months)",
            width="medium",
            help="The sales volume in the last 6 months",
            y_min=0,
            y_max=100,
         ),
    },
    hide_index=True,
)

It is indeed currently coded that way, if the length of the data is less or equal than 2, an empty cell is shown. Check the dev’s note:

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.