Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabulator style background_gradient subset #6558

Closed
cdeil opened this issue Mar 24, 2024 · 0 comments · Fixed by #6560
Closed

Tabulator style background_gradient subset #6558

cdeil opened this issue Mar 24, 2024 · 0 comments · Fixed by #6560
Labels
type: bug Something isn't correct or isn't working
Milestone

Comments

@cdeil
Copy link
Contributor

cdeil commented Mar 24, 2024

ALL software version info

pandas                    2.2.1           py312h88edd18_0    conda-forge
panel                     1.4.0rc4                 pypi_0    pypi
bokeh                     3.4.0                    pypi_0    pypi
jupyter_bokeh             4.0.1                      py_0    bokeh

Description of expected behavior and the observed behavior

Similar to #5822 reported by @pwaibel with the latest Panel we still don't manage to use Tabulator style background_gradient for coloring.

As the example below shows the subset selection isn't working, all columns are colored. The bug is the same no matter if background_gradient is called on the pandas DataFrame to get a styler (this works fine), or on the Tabulator widget after creation.

In our code we would also like to use the Tabulator hidden_columns and frozen_columns, but that results in extra bugs (not shown here). But maybe the subset selection fix is on one place and then it should also work with those options?

Complete, minimal, self-contained example code that reproduces the issue

import panel as pn
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.rand(3, 5), columns=list("ABCDE"))
tab = pn.widgets.Tabulator(df)
tab.style.background_gradient(cmap="RdYlGn_r", vmin=0, vmax=0.5, subset=["A", "C", "D"])
tab.servable()

df_styled = df.style.background_gradient(cmap="RdYlGn_r", vmin=0, vmax=0.5, subset=["A", "C", "D"])
tab2 = pn.widgets.Tabulator(df_styled)
tab2.servable()

Stack traceback and/or browser JavaScript console output

silent error

Screenshots or screencasts of the bug in action

Screenshot 2024-03-24 at 17 44 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants