So here is the problem statement:
I am trying to build dashboard similar to epic stock ticker example video, but am using the data frame imported from my desktop file now whats the challenge is am not able to understand how to connect it with a search box and even if I connect how to know which column to select.
import pandas as pd
import numpy as np
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
df = pd.DataFrame(pd.read_csv(âDesktop/sale.csvâ))
df[âactualâ] = df[âsales_madeâ]/df[âdaysâ]
df[âgoalâ] = df[âtargetâ]/df[âdaysâ]
dff = df[[âmanagerâ, âempâ, âsale_typeâ,âweekâ,âactualâ,âgoalâ]]
dff= dff.set_index(ârpt_weekâ)
dff = dff[dff[âsale_typeâ]==âdoor_to_doorâ]
app = dash.Dash()
app.layout = html.Div(children= [
html.H1(âPerformance Dashboardâ),
dcc.Input(id='input', value='', type='text'),
html.Div(id='output-graph'),
])
@app.callback(
Output(component_id=âoutput-graphâ, component_property=âchildrenâ),
[Input(component_id=âinputâ, component_property=âvalueâ)]
)
def update_value(input_data):
return dcc.Graph(
id = 'example-graph',
figure = {
'data' :[
{ 'x':dff.index , 'y':dff.actual , 'type':'bar' , 'name':input_data},
#{ 'x':dff.index , 'y':dff.goal , 'type':'bar' , 'name':'goal'},
],
'layout': {
'title': input_data
}
}
)
if name == âmainâ:
app.run_server(debug=True)
above is my code, the part of the "def update value " not getting what to put. Please let me know if itâs not clear.
Thank You.