Black Lives Matter. Please consider donating to Black Girls Code today.

Callback with only output

I am not getting the graph on my webpage with this code.
The update_graph1 function is intended to plot the graph on dcc.Graph(id=‘graph1’), it needs no input just output. Please help.

[quote="sharmaji, post:1, topic:13665, full:true"]

I am not getting the graph on my webpage with this code

app = dash.Dash()

app.layout = html.Div([
	html.Div([
		html.Label(children='Enter keyword to track')]),
		dcc.Input(id ='keyword-in',placeholder='Enter Keyword'),
		dcc.Input(id ='number-of-tweets',placeholder='Number of tweets'),
		html.Button(id='submit-button',children='Analyze', n_clicks=0),
		dcc.Graph(id='graph1'),
		html.Div(id='temp')
		])

@app.callback(Output('temp','children'),
	[Input('submit-button','n_clicks')],
	[State('keyword-in','value'),
	State('number-of-tweets','value')])
def update_value(n_clicks,query,number_of_tweets):
	if n_clicks>0:
		get_data(query,int(number_of_tweets))
		update_graph1()
@app.callback(Output('graph1','figure'))
def update_graph1():
	temp = df.groupby('created_at').count()
	print()
	data = [go.Scatter(
		x=temp.index.values,
		y= temp.tweet_id,
		mode='lines+markers')]
	return {'data':data,
			'layout':go.Layout(title='Tweets per day',
								xaxis={'title':'Dates'},
								yaxis={'title':'Number of Tweets'},
								hovermode='closest')
			}

[/quote]

Are you getting an error message?

You need an Input with the callback, I suggest putting a dummy div in the layout and using it as input Input('dummy', 'id'), will be callled at least once.

So I cannot have a function which only changes the output of graph?

The print statement prints the temp dataframe, that means my function is activated but its not changing the graph.

I am not getting any type of error.