Draw line between two points based on data source

I want to draw a line based on columns in my data source between (‘TimeStart’, ‘EventGroup’) and (‘TimeEnd’, ‘EventGroup’). I tried

        event_view = CDSView(source=self._data_source, filters=[event_filter])
        r_event = self._figure.line(x=['TimeStart', 'TimeEnd'],
                                    y=['EventGroup', 'EventGroup'],
                                    line_width=2,
                                    line_color='EventColor',
                                    source=self._data_source, view=event_view)

But that gives me

Expected x and y to reference fields in the supplied data source.

What is the correct syntax to use?

‘TimeStart’, ‘TimeEnd’ and ‘EventGroup’ are definitely columns in the data source.

I think you want Segment — Bokeh 3.2.2 Documentation .

EDIT: was referencing outdated docs

1 Like

If you are looking for something a slope graph, here is a recent example:

slope_graph — Bokeh 3.3.3 Documentation

Regarding:

‘TimeStart’, ‘TimeEnd’ and ‘EventGroup’ are definitely columns in the data source.

Each property can be associated to a column name.

Just FYI @gmerritt123 you have linked quite old (2.4.2) docs.

That’s what I need. Thanks.

1 Like

thx, updated, dang google

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.