I am trying to create a scatter plot with a secondary axis:
At the client side a call a plot function:
plot_data = anvil.server.call(‘update_funding_chart’)
self.funding_plot.data = plot_data #get data from server
self.funding_plot.layout = {‘title’: charttitle_funding,‘xaxis’: {‘title’: ‘date’}} # specify layout
At the server side I create the graph. I found the item secondary_y at the plotly documentation, but it does not work. Only the first graph is shown:
@anvil.server.callable
def update_funding_chart():
db_table = read_table()
data = []
trace = go.Scatter(
x = [x[‘time’] for x in db_table],
y = [x[‘funding’] for x in db_table],
mode = ‘lines’,
name = ‘Funding’,
secondary_y=False)
data.append(trace)
trace = go.Scatter(
x = [x[‘time’] for x in db_table],
y = [x[‘price’] for x in db_table],
mode = ‘lines’,
name = ‘Price’,
secondary_y=True)
data.append(trace)
return data
Are there any suggestions?