Skip to main content

Custom Streamlit component to preserve zoom level of plotly charts when getting event data from them.

Project description

# streamlit-advanced-plotly-chart
This is a streamlit custom component to preserve the zoom level of a plotly chart when getting event data from it. It also returns the range of the x-axis, which is useful for zooming in on a specific part of the chart and using a rangeslider.

It is based on the [streamlit-plotly-events](https://github.com/null-jones/streamlit-plotly-events/tree/master) component.


## Usage
```python
import streamlit as st
import plotly.express as px
import numpy as np

st.set_page_config(layout="wide")

st.subheader("Plotly Line Chart")

time = np.arange(0, 100, 0.1)
amplitude = np.sin(time)

fig = px.line(x=time, y=amplitude)

fig.update_xaxes(rangeslider_visible=True, range=[0, 10])

clickedPoint = preserveZoomPlotlyChart(fig, event='click')
```

When adding multiple lines to the chart and using a key, the plotly chart is stuck. Therefore, the key argument is not supported.

## Installation
```bash
pip install streamlit-advanced-plotly-chart
```



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit-advanced-plotly-chart-0.0.2.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file streamlit-advanced-plotly-chart-0.0.2.tar.gz.

File metadata

  • Download URL: streamlit-advanced-plotly-chart-0.0.2.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.9

File hashes

Hashes for streamlit-advanced-plotly-chart-0.0.2.tar.gz
Algorithm Hash digest
SHA256 dfc2d0af7ac3e700d24ad03d882641fa20cc61f16c9ed4e04147e394ad324e0e
MD5 e7bb4f1fbdafedb0371dc8a2c93ee22f
BLAKE2b-256 5f1b37c6296f3c64e37bd7f54184f41967074ca53e5453e40a0a171a79b1aa44

See more details on using hashes here.

File details

Details for the file streamlit_advanced_plotly_chart-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: streamlit_advanced_plotly_chart-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.9

File hashes

Hashes for streamlit_advanced_plotly_chart-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f67f97a18c0d8ff20351d3fae9d43aefb9ded6be8301959f390b2c989b9ee14e
MD5 06a9d910783be1b0cd16fabfb91839e4
BLAKE2b-256 48861ee99b4c542a24f551dc733810a187b00cc61cb4916826d9e07f94c18622

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page