You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to export an ipydatagrid to html? I saw the code below...but the index.html it produced had blank values. I removed the renderers in code below and expected to see integer values but there were none
I am using ipydatagrid 1.6.0 and ipywidgets 8.1.2
I did find this as an old issue....#279 but I wanted to know if there are other ways to do it also...
import pandas as pd
import numpy as np
import json
from ipydatagrid import DataGrid, TextRenderer, Expr
n = 50_000
df = pd.DataFrame(
{
"Value 1": np.random.randn(n),
"Value 2": np.random.randn(n),
"Value 3": np.random.choice([True, False], n),
"Value 4": np.random.choice([True, False], n),
}
)
# This returns the unicode value for specific font-awesome icons,
# check-out this link for more icons:
# https://fontawesome.com/v4.7.0/cheatsheet/
def bool_render_text1(cell):
if cell.value > 0:
return "\uf00c" # Check
else:
return "\uf00d" # Cross
def bool_render_text2(cell):
if cell.value > 0:
return "\uf111" # Circle
else:
return " "
def bool_render_text3(cell):
if cell.value:
return "\uf164" # Thumb up
else:
return "\uf165" # Thumb down
def bool_render_text4(cell):
if cell.value:
return "\uf118" # Smile
else:
return "\uf119" # Frown
def bool_render_color(cell):
if cell.value > 0:
return "#2fbd34"
else:
return "#b82538"
common_args = {
"font": "bold 14px fontawesome",
"text_color": Expr(bool_render_color),
"horizontal_alignment": "center",
}
renderers = {
"Value 1": TextRenderer(text_value=Expr(bool_render_text1), **common_args),
"Value 2": TextRenderer(text_value=Expr(bool_render_text2), **common_args),
"Value 3": TextRenderer(text_value=Expr(bool_render_text3), **common_args),
"Value 4": TextRenderer(text_value=Expr(bool_render_text4), **common_args),
}
#display(df)
w = DataGrid(df, base_row_size=30, base_column_size=150)
display(w)
from ipywidgets.embed import embed_minimal_html
embed_minimal_html("index.html", w)
The text was updated successfully, but these errors were encountered:
Is there a way to export an ipydatagrid to html? I saw the code below...but the index.html it produced had blank values. I removed the renderers in code below and expected to see integer values but there were none
I am using ipydatagrid 1.6.0 and ipywidgets 8.1.2
I did find this as an old issue....#279 but I wanted to know if there are other ways to do it also...
The text was updated successfully, but these errors were encountered: