How do you implement a dataframe of Vertical Lines in Dcc.Graph?

Hi All,

Have gone through the forums and implemented code to add vertical line shapes within an app I’m working on from a dataframe of events and dates. During implementation, I couldn’t find documentation on how to create a set of lines for all of the rows in the dataframe. Rather, I had to call each datetimeindex row individually and hard-code them in.

shapes=[{‘type’:‘line’, ‘xref’:‘x’, ‘x0’:df.index[0], ‘x1’:df.index[0], ‘y0’:0, ‘y1’:1, ‘line’:{‘width’:2, ‘color’:’#000000’}},
{‘type’:‘line’, ‘x0’:df.index[1], ‘x1’:df.index[1], ‘y0’:0, ‘y1’:1, ‘line’:{‘width’:2, ‘color’:’#000000’}},
{‘type’:‘line’, ‘x0’:df.index[2], ‘x1’ df.index[2], ‘y0’:0, ‘y1’:1, ‘line’:{‘width’:2, ‘color’:’#000000’}}

I’d like to do something like this:

shapes = [for i in df.iterrows(): {‘type’:‘line’, ‘xref’:‘x’, ‘x0’:df.index[i], ‘x1’:df.index[i], ‘y0’:0, ‘y1’:1, ‘line’:{‘width’:2, ‘color’:’#000000’}}

Is there a way to do this?