Hi guys,
I’m trying to add a simple double-scatter graph with two-sets of y-data for the same x-data.
The desired result is something like:
I’m following the documentation for plotly.graph_objects and using the ‘fig.add_trace()’ method as described in the docs. (plotly.graph_objects.Figure — 5.8.1 documentation)
You can see below my codebase, which follows this exactly (There is also the commented code above which is my actual data, but I wanted to simplify to show the error)
The issue I’m having is an error TypeError: 'WrappedObject' object is not callable
on line 102 (The first line with ‘fig.add_trace(go.Scatter())’)
Seems like theres some mismatch between plotly.graph_objects on anvil and the actual library. Can anyone shed any light?
Much appreciated:)
Code Sample:
data_journeys = anvil.server.call('get_journeys_data')
# my_fig = go.Figure()
# line1 = go.Scatter(x = [d['Minutes'] for d in data_journeys],
# y = [d['FocusLevel'] for d in data_journeys],
# name = "Focus",
# mode = "lines")
# line2 = go.Scatter(x = [d['Minutes'] for d in data_journeys],
# y = [d['ExcitementLevel'] for d in data_journeys],
# name = "Excitement",
# mode="lines")
# my_fig.add_trace(line1)
# my_fig.add_trace(line2)
# my_fig.update_layout(xaxis_title="Minutes", yaxis_title="Intensity")
fig = go.Figure()
fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2]))
fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2]))
self.plot_journeys_2.figure = fig
return