Why Nostr? What is Njump?
2023-01-09 15:23:56
in reply to

dave on Nostr: import dash import dash_core_components as dcc import dash_html_components as html ...

import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as go

# Create the Dash app
app = dash.Dash(__name__)

# Read the Data
df = pd.read_csv('data.csv')

# Create a Dash Layout
app.layout = html.Div([
# Add a header and a paragraph
html.H1("Dashboard Showing DatePickerSingle"),
html.P("This dashboard filters data based on DatePickerSingle"),
# Add a DataTable
dcc.DatePickerSingle(
id='date_picker_single',
min_date_allowed=df['date'].min(),
max_date_allowed=df['date'].max(),
initial_visible_month=df['date'].min(),
date=df['date'].max()
),
# Add a Plotly Graph
dcc.Graph(id='table-date-picker-single'),
])

# Update the Index
@app.callback(
dash.dependencies.Output('table-date-picker-single', 'figure'),
[dash.dependencies.Input('date_picker_single', 'date')])
def update_graph(selected_date):
# Filter the data based on the selected date
filtered_df = df[df['date'] == selected_date]

# Create the graph
traces = []
for column in filtered_df.columns[1:]:
traces.append(go.Scatter(
x=filtered_df['date'],
y=filtered_df[column],
mode='markers',
opacity=0.7,
name=column
))

return {
'data': traces,
'layout': go.Layout(
xaxis={'title': 'Date'},
yaxis={'title': 'Values'},
hovermode='closest'
)
}

# Run the Dash app
if __name__ == '__main__':
app.run_
Author Public Key
npub1tsgw6pncspg4d5u778hk63s3pls70evs4czfsmx0fzap9xwt203qtkhtk4