A Dash Component library for ChartJs.
Project description
Dash Chartjs Component
Chart.js is one the most popular javascript charting library. Dash Chartjs Component is a Dash component library that renders ChartJs React component inside Dash App.
Installation
pip install dash-chartjs
Prop List
id (str): The ID used to identify this component in Dash callbacks.
type (str): Chart.js chart type.
data (dict): The data object that is passed into the Chart.js chart.
options (dict): The options object that is passed into the Chart.js chart.
redraw (boolean): Teardown and redraw chart on every update.
toolbox (boolean): Toolbox with reset and download buttons for chart.
customJSFunctions (dict): Write custom JS functions in dict format.
customPlugins (dict): Write Plugins in dict format.
clickData (dict): clickData returns the datasetIndex and index of data point clicked.
style (dict): Defines CSS styles which will override styles previously set.
Basic Usage
from dash import dash,html
import pandas as pd
from dash_chartjs import ChartJs
app = dash.Dash(__name__,meta_tags=[{"name": "viewport", "content": "width=device-width, initial-scale=1"}])
df = pd.read_csv('https://raw.githubusercontent.com/JetBlack101/visitors-to-georgia-ts-analysis/main/Data/VisitorsToGeorgia_2011-2019.csv')
df['Date'] = pd.to_datetime(df['Date'])
x = df['Date']
y = df['Visitors']
data = {
'labels': x,
'datasets': [{
'label': 'Visitors to Georgia',
'data': y,
'fill':'false',
'borderColor': 'rgb(75, 192, 192)',
'tension': 0.1
}]
}
options = {
'scales': {
'x': {
'type':'time'
}
},
'plugins':{
'zoom':{
'zoom':{
'wheel':{
'enabled': True
},
'mode':'xy'
}
}
}
}
app.layout = html.Div(
[
ChartJs(type='line',data=data,options=options)
]
)
if __name__ == '__main__':
app.run_server(debug=False)
Demo
Additional Plugins Integrated
chartjs-plugin-zoom
chartjs-plugin-datalabels
Example
chartjs-plugin-annotation
Example
chartjs-chart-geo
Example
chartjs-chart-boxplot
Example
chartjs-chart-matrix
Example
chartjs-chart-treemap
Example
chartjs-chart-sankey
Example
chartjs-chart-graph
Example
chartjs-chart-pcp
Example
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
File details
Details for the file dash_chartjs-1.2.1.tar.gz
.
File metadata
- Download URL: dash_chartjs-1.2.1.tar.gz
- Upload date:
- Size: 248.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9a84911556504a51c5ae6a55a7390fe58424246dbc427e9e77e8ef76c0b51a46
|
|
MD5 |
05f26788b1453cbd31a9091534c5b9ea
|
|
BLAKE2b-256 |
03d305d0712b483cc595bc5ef9c1f69c436d2068bf33bd365ddeb3c030341a24
|