No project description provided
Project description
fh-plotly
Use Plotly charts with FastHTML.
Installation
pip install fh-plotly
Make sure to add the right headers to your FastHTML app:
from fasthtml.common import fast_app
from fh_plotly import plotly_headers
app, rt = fast_app(
hdrs = plotly_headers
)
This ensures that the required javascript and css files are always loaded.
Examples
Run examples/test_app.py to see the examples in action.
python examples/test_app.py
The gist of conversion to Plotly is with the plotly2fasthtml
function.
from fh_plotly import plotly2fasthtml
def generate_line_chart():
df = pd.DataFrame({'y': [1, 2, 3, 2], 'x': [3, 1, 2, 4]})
fig = px.line(df, x='x', y='y')
return plotly2fasthtml(fig)
Contributing
Feel free to open an issue or a pull request to add FastHTML Plotly functionality.
Please install with poetry install
for contributing.
poetry install
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fh_plotly-0.1.0.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for fh_plotly-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 445973e4502e447805e3a35a4874a882651b2e927deee3c9559a9ee30c166607 |
|
MD5 | c08363eefd14964186544ec727213878 |
|
BLAKE2b-256 | 44d0ffed61014b9e3e7435d4b17093e2b581654dde4d3d3cc74d0b5cd3db0688 |