Skip to content

Table show incorrect #452

@zenz

Description

@zenz

If drawing multiple tables in a for loop. the arrangement for first two tables will be conflict.

import mercury as mr  # for widgets
import pandas as pd

app = mr.App(title="Test", description="Table test")

category = ["model1", "model2", "model3", "model4"]

employee = ["employeeA", "employeeB", "employeeC"]
for emp in employee:
    temp_df = pd.DataFrame(
        columns=["类别", "对比年总销售额", "对比年同期销售额", "今年同期销售额", "同期增长额", "同期增长比例%"]
    )
    for x in category:
        temp_df.loc[len(temp_df)] = [
            x,
            1,
            1,
            1,
            1,
            1,
        ]
    mr.Table(data=temp_df, width="800px", text_align="center")

Please see pictures below
截屏2024-05-29 16 16 56

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