[BUG]: Table string cells render as NaN when cells.format is set before initial render, but Plotly.restyle renders correctly
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 55/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Pouca atividade
- Stack de tecnologia
- javascript, python
- Domínio
- data-visualization, frontend
Direção de pesquisa
Execute primeiro o reprodutor fornecido em Python e Playwright, comparando a renderização inicial com o caminho posterior de Plotly.restyle. Rastreie como table cells.format é tratado durante a renderização inicial em comparação com restyle e considere a issue concluída quando os valores de célula em formato de string forem renderizados de forma idêntica em ambos os casos.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
When initializing a Plotly go.Table with string cell values such as
"rgb(239, 243, 255)" and setting cells.format=[1] before the first render, the
string values are displayed as NaN.
However, if the same base table is rendered first and the same cells.format value
is then applied dynamically through Plotly.restyle, the table displays the original
string values correctly.
The setting is accepted by plotly.py and stored on the trace object, so this looks
like an initial-render formatting/coercion discrepancy in table traces rather than an
invalid Python-side property assignment.
Screenshots/Video
Steps to reproduce
import io
import plotly
import plotly.graph_objects as go
import plotly.io as pio
from PIL import Image, ImageChops
from playwright.sync_api import sync_playwright
print(f"Plotly version: {plotly.__version__}")
fig = go.Figure(
go.Table(
header={"values": ["Color"]},
cells={"values": [["rgb(239, 243, 255)", "rgb(8, 81, 156)"]]},
)
)
# Screenshot 1 / plot1.png: set cells.format in Python before the initial render.
fig.data[0].cells.format = [1]
assert fig.data[0].cells.format == (1,)
print("Python-side cells.format:", fig.data[0].cells.format)
html1 = pio.to_html(fig, full_html=True, include_plotlyjs="cdn")
# Screenshot 2 / plot2.png: render first, then apply the same value with JS.
fig.data[0].cells.format = None
html2 = pio.to_html(fig, full_html=True, include_plotlyjs="cdn")
html2 = html2.replace(
"</body>",
"""
<script>
window.addEventListener("DOMContentLoaded", () => {
const plotEl = document.getElementsByClassName("plotly-graph-div")[0];
setTimeout(() => {
Plotly.restyle(plotEl, {"cells.format": [1]}, [0]);
}, 1000);
});
</script>
</body>""",
)
with sync_playwright() as playwright:
browser = playwright.chromium.launch(
headless=True,
args=["--no-sandbox", "--disable-dev-shm-usage", "--disable-gpu"],
)
page = browser.new_page(viewport={"width": 1200, "height": 800})
page.set_content(html1)
page.wait_for_timeout(1500)
img1 = page.screenshot(path="plot1.png")
page.set_content(html2)
page.wait_for_timeout(2000)
img2 = page.screenshot(path="plot2.png")
browser.close()
diff = ImageChops.difference(
Image.open(io.BytesIO(img1)).convert("RGB"),
Image.open(io.BytesIO(img2)).convert("RGB"),
)
print("Saved plot1.png and plot2.png")
assert diff.getbbox() is not None, "Reproducer did not reproduce: images are identical."
Notes
Add info here that doesn't fit in the other sections.
- Linguagem predominante
- Python
- Estrelas
- 18.8k
- Forks
- 2.9k
- Merge médio
- 14h 12min
- PRs com merge (30d)
- 19
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de plotly/plotly.py
-
[BUG]: Unnecessary `UserWarning` when using `fig.write_image()` with `kaleido.start_sync_server()`Talvez já em andamento @jayzhou2309 assumiu há 2 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
P3 size: 1 task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
plotly/plotly.py#5769 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Remove `@types/plotly.js` dependencyTalvez já em andamento @Belagum assumiu há 18 dias. AbertaP3 size: 1 task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
bug P1
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
feature P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
Todas as issues de plotly/plotly.py
Issues semelhantes
-
Claiming namespace apexdevAbertanamespace operations
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
EclipseFdn/open-vsx.org#13737 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
zhuima/awesome-cloudflare#237 ·
-
Zero-token evaluations are treated as missing cost in selectionTalvez já em andamento @sylvesterkaczmarek assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
google-research/rrsi#6 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
aws-samples/sample-aws-genai-db-modernizer#294 ·
Mantenedores costumam responder em até 1 dia
-
feedback simulation workshop
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
githubnext/gh-aw-workshop#4174 ·
Mantenedores costumam responder em até 1 dia