Skip to main content

A custom Dash component for interactive line plots with draggable range selectors, ideal for data filtering.

Project description

RangeLinePlot

RangeLinePlot is a Dash component library.

RangeLinePlot integrates with Plotly.js to create interactive line plots with a draggable range selector. The component allows users to highlight a selected range on the x- or y-axis and dynamically adjust it through drag-and-drop functionality.

Demonstration


Features

  • Interactive Range Selection: Highlight a range on the x- or y-axis and adjust it interactively.
  • Customizable Styles: Modify line, boundary, and gray zone styles to match your design.
  • Dash Integration: Fully compatible with Python Dash applications.

Installation

Install the component from PyPI using pip:

pip install dash-rangelineplot

Usage

from dash import Dash, html
from rangelineplot import Rangelineplot

app = Dash(__name__)

app.layout = html.Div([
    Rangelineplot(
        id="example-plot",
        data={
            "x": list(range(10)),
            "y": [x ** 2 for x in range(10)],
        },
        range=[2, 6],  # Initial range
        axisType="x",  # Range applies to x-axis
    )
])

if __name__ == "__main__":
    app.run_server(debug=True)

Props

Prop Type Default Value Description
id string None Unique identifier for the component.
data dict {"x": [], "y": []} Input data as two arrays: x and y. Must have equal lengths.
range list[number] None Initial range [start, end] for the selected axis.
axisType string 'x' Specifies the axis for the range ('x' or 'y').
lineStyle dict {color: '#1f77b4', width: 2} Plotly line style for the main data trace.
grayZoneStyle dict {fillcolor: 'rgba(200,200,200,0.5)'} Fill style for gray zones outside the selected range.
boundaryStyle dict {color: 'transparent', width: 20} Line style for the draggable boundary lines.

Development

Install Dependencies

If you’re contributing to the development of this component, install the necessary dependencies:

npm install
pip install -r requirements.txt

Build the Component

After making changes to the React component, rebuild the bundle:

npm run build
python usage.py

The resulting files will be placed in the rangelineplot/ directory for use in the Python wrapper.

License

This project is licensed under the MIT License.

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

dash_rangelineplot-0.0.4.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

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

dash_rangelineplot-0.0.4-py3-none-any.whl (6.0 MB view details)

Uploaded Python 3

File details

Details for the file dash_rangelineplot-0.0.4.tar.gz.

File metadata

  • Download URL: dash_rangelineplot-0.0.4.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dash_rangelineplot-0.0.4.tar.gz
Algorithm Hash digest
SHA256 49e06153bada078561f22ff74e50517fe197ee25506ce6816f259989dc088513
MD5 9c779cd8bcc6863fde6818818a251811
BLAKE2b-256 2659954f4db23f6dce318273ac628ef2dc18bbe57ec8be593c797d0075836268

See more details on using hashes here.

File details

Details for the file dash_rangelineplot-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for dash_rangelineplot-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ee316cffbcc05cd6e78bfd333759cf35df23a12d1065004dc781176fb5cdf9be
MD5 dbdfda573dde6264eaa6cd7f362f8e7f
BLAKE2b-256 73416dfd0f970e5e576da428980f174f5e8d2d0bc250250094ede788402a868e

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