绘图 - 表直到列移动 / rerender之前,表不正确显示

发布于 2025-02-12 02:21:59 字数 1398 浏览 1 评论 0原文

我正在使用Plotly在简单的表中显示数据。我在下面的一些虚拟数据中填充了。

import plotly.graph_objects as go
data = [go.Table(
    columnorder = [1,2],    
    header = dict(
        values = ['<b>'+'TENOR'+'</b>'] + list(['a','b','c','d','e']),
        line_color = 'darkslategray',
        fill_color = 'royalblue',
        align = 'center',
        font = dict(color = 'white', size = 12),
        height = 20
        ),
    cells = dict(
        values = [['row1','row2','row3'],[1,1,1],[2,2,2],[3,3,3],[4,4,4],[5,5,5]],
        line_color = 'darkslategray',
        fill = dict(color=['paleturquoise', 'white']),
        align = ['right', 'center'],
        font_size = 12,
        height = 20)
    )]

fig = go.Figure(data = data)
fig.show()

当我运行此操作时(Jupyter,但同样的结果也会在其他几个IDE中发生),最初显示为:

< img src =“ https://i.sstatic.net/jrtwf.png” alt =“在此处输入图像说明”>

然后,一旦我以任何方式移动列/操作,然后重新播放它,然后重新播放(正确,除了我移动的列)AS:

“在此处输入图像描述”

任何想法首先没有正确渲染它?我基本上是从的一个示例 ... ... ... ...

I am using Plotly to display data in a simple table. I've populated in some dummy data below.

import plotly.graph_objects as go
data = [go.Table(
    columnorder = [1,2],    
    header = dict(
        values = ['<b>'+'TENOR'+'</b>'] + list(['a','b','c','d','e']),
        line_color = 'darkslategray',
        fill_color = 'royalblue',
        align = 'center',
        font = dict(color = 'white', size = 12),
        height = 20
        ),
    cells = dict(
        values = [['row1','row2','row3'],[1,1,1],[2,2,2],[3,3,3],[4,4,4],[5,5,5]],
        line_color = 'darkslategray',
        fill = dict(color=['paleturquoise', 'white']),
        align = ['right', 'center'],
        font_size = 12,
        height = 20)
    )]

fig = go.Figure(data = data)
fig.show()

When I run this (Jupyter, but same result happens in a couple other IDEs too) it initially displays as:

enter image description here

Then, as soon as I move a column / manipulate it in any way, it then redisplays (properly, except the column that I've moved) as:

enter image description here

Any idea why it's not rendering correctly in the first place? I basically took this right from one of their table examples...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

极致的悲 2025-02-19 02:22:00

评论您的行columnorder = [1,2,3,4,5],

import plotly.graph_objects as go
data = [go.Table(
    #columnorder = [1,2],    
    header = dict(
        values = ['<b>'+'TENOR'+'</b>'] + list(['a','b','c','d','e']),
        line_color = 'darkslategray',
        fill_color = 'royalblue',
        align = 'center',
        font = dict(color = 'white', size = 12),
        height = 20
        ),
    cells = dict(
        values = [['row1','row2','row3'],[1,1,1],[2,2,2],[3,3,3],[4,4,4],[5,5,5]],
        line_color = 'darkslategray',
        fill = dict(color=['paleturquoise', 'white']),
        align = ['right', 'center'],
        font_size = 12,
        height = 20)
    )]

fig = go.Figure(data = data)
fig.show()

指定您只想显示这些列出的列。

或者,,将该行更改为columnorder = [0,1,2,3,4,5],

Comment out your line columnorder = [1,2,3,4,5],.

import plotly.graph_objects as go
data = [go.Table(
    #columnorder = [1,2],    
    header = dict(
        values = ['<b>'+'TENOR'+'</b>'] + list(['a','b','c','d','e']),
        line_color = 'darkslategray',
        fill_color = 'royalblue',
        align = 'center',
        font = dict(color = 'white', size = 12),
        height = 20
        ),
    cells = dict(
        values = [['row1','row2','row3'],[1,1,1],[2,2,2],[3,3,3],[4,4,4],[5,5,5]],
        line_color = 'darkslategray',
        fill = dict(color=['paleturquoise', 'white']),
        align = ['right', 'center'],
        font_size = 12,
        height = 20)
    )]

fig = go.Figure(data = data)
fig.show()

Specifying that is saying you only want to show those listed columns.

Alternatively, change that line to columnorder = [0,1,2,3,4,5],.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文