Timeseries chart not displaying timestamp on hover in bokeh

I have a dataframe containing timestamps of when a resource was accessed.

df_stud20.head()

    timestamp           resource
0   2016-03-01 11:11:31 Assessment
1   2016-03-01 11:11:33 Assessment Overview and Consideration
2   2016-03-01 11:12:27 Resources
3   2016-03-01 11:12:34 Weekly Program
4   2016-03-01 11:12:42 Resources

``

And I created a ColumnDataSource out of it

source1 = ColumnDataSource(data=dict(timestamp=[x.strftime(’%Y-%m-%d’) for x in df_stud20[‘timestamp’]],

resource=[str(x) for x in df_stud20[‘resource’]]))

``

Using the dataframe and columndatasource, I created a Timeseries chart,

from bokeh.charts import TimeSeries, output_notebook, show
p20 = TimeSeries(df_stud20, x='timestamp',y='resource',tools=TOOLS,
           plot_width=1000, builder_type='point',legend=True,xlabel='Date',
           ylabel='Activities',source=source1)
hover1 = p20.select(dict(type=HoverTool))
hover1.point_policy = "follow_mouse"
hover1.tooltips = OrderedDict([
    ("Time", "@timestamp"),
    ("Activity", "$y"),
])
output_file("timeseries.html", title="timeseries example")
show(p20)

``

But when I hover over the Timeseries chart, it only displays the activity but not the Timestamp, as is apparent in the image below:

How can I resolve this issue? The ColumnDataSource seems to contain the required values as I checked that by converting the source back to a dataframe and it gives the proper required result, so the problem is not with that. But I can’t figure out what else I’m doing wrong

dfasdsf = ColumnDataSource.to_df(source1)
dfasdsf.head()

``

Furthermore, the Activity(in hover) only displays when I use “$y”, if I try to use “@resource” instead, it starts showing “???”. I am facing a similar issue with hovers in the bar chart and heatmap I’ve created where I’m trying to call columns other than the x and y co-ordinates of the chart, but I keep getting question marks. I 've been working on resolving this issue for 3 days now and have gone through most questions I could find related to this on this Google group as well as StackOverflow.

This was an issue that was resolved in a recent PR:

  https://github.com/bokeh/bokeh/pull/5037

But this has not made it into any release yet. For now you will have to install a dev build, or wait for the upcoming 0.12.3 release.

Thanks,

Bryan

···

On Oct 1, 2016, at 10:43 PM, Sift Singh <[email protected]> wrote:

I have a dataframe containing timestamps of when a resource was accessed.
df_stud20.head()

    timestamp resource
0 2016-03-01 11:11:31 Assessment
1 2016-03-01 11:11:33 Assessment Overview and Consideration
2 2016-03-01 11:12:27 Resources
3 2016-03-01 11:12:34 Weekly Program
4 2016-03-01 11:12:42 Resources

And I created a ColumnDataSource out of it

source1 = ColumnDataSource(data=dict(timestamp=[x.strftime('%Y-%m-%d') for x in df_stud20['timestamp']],
                                     resource=[str(x) for x in df_stud20['resource']]))

Using the dataframe and columndatasource, I created a Timeseries chart,

from bokeh.charts import TimeSeries, output_notebook,
show
p20
= TimeSeries(df_stud20, x='timestamp',y='resource',tools=TOOLS,

           plot_width
=1000, builder_type='point',legend=True,xlabel='Date',

           ylabel
='Activities',source=source1)

hover1
= p20.select(dict(type=HoverTool))

hover1
.point_policy = "follow_mouse"

hover1
.tooltips = OrderedDict([

("Time", "@timestamp"),

("Activity", "$y"),
])

output_file
("timeseries.html", title="timeseries example")
  
show
(p20)

But when I hover over the Timeseries chart, it only displays the activity but not the Timestamp, as is apparent in the image below:

How can I resolve this issue? The ColumnDataSource seems to contain the required values as I checked that by converting the source back to a dataframe and it gives the proper required result, so the problem is not with that. But I can't figure out what else I'm doing wrong
dfasdsf = ColumnDataSource.to_df(source1)

dfasdsf
.head()

Furthermore, the Activity(in hover) only displays when I use "$y", if I try to use "@resource" instead, it starts showing "???". I am facing a similar issue with hovers in the bar chart and heatmap I've created where I'm trying to call columns other than the x and y co-ordinates of the chart, but I keep getting question marks. I 've been working on resolving this issue for 3 days now and have gone through most questions I could find related to this on this Google group as well as StackOverflow.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/28549687-f41b-4538-9558-26cc912a0b29%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Bryan,

I may be wrong but from the PR, it seems that it mentions those components which are not already a part of the chart itself whereas in this case, the Timestamp is already a part of the timeseries chart, so shouldnt it be visible?

Also, considering that it’s being done in other similar examples in the Bokeh Gallery, like

http://bokeh.pydata.org/en/latest/docs/gallery/periodic.html

http://bokeh.pydata.org/en/latest/docs/gallery/texas.html

https://demo.bokehplots.com/apps/movies

what steps am i missing in my code which is making me unable to replicate the same effect that is being performed in the given links?

···

On Sunday, 2 October 2016 15:07:35 UTC+11, Bryan Van de ven wrote:

This was an issue that was resolved in a recent PR:

    [https://github.com/bokeh/bokeh/pull/5037](https://github.com/bokeh/bokeh/pull/5037)

But this has not made it into any release yet. For now you will have to install a dev build, or wait for the upcoming 0.12.3 release.

Thanks,

Bryan

On Oct 1, 2016, at 10:43 PM, Sift Singh [email protected] wrote:

I have a dataframe containing timestamps of when a resource was accessed.

df_stud20.head()

timestamp           resource

0 2016-03-01 11:11:31 Assessment

1 2016-03-01 11:11:33 Assessment Overview and Consideration

2 2016-03-01 11:12:27 Resources

3 2016-03-01 11:12:34 Weekly Program

4 2016-03-01 11:12:42 Resources

And I created a ColumnDataSource out of it

source1 = ColumnDataSource(data=dict(timestamp=[x.strftime(’%Y-%m-%d’) for x in df_stud20[‘timestamp’]],

                                 resource=[str(x) for x in df_stud20['resource']]))

Using the dataframe and columndatasource, I created a Timeseries chart,

from bokeh.charts import TimeSeries, output_notebook,

show

p20
= TimeSeries(df_stud20, x=‘timestamp’,y=‘resource’,tools=TOOLS,

       plot_width

=1000, builder_type=‘point’,legend=True,xlabel=‘Date’,

       ylabel

=‘Activities’,source=source1)

hover1
= p20.select(dict(type=HoverTool))

hover1

.point_policy = “follow_mouse”

hover1

.tooltips = OrderedDict([

(“Time”, “@timestamp”),

(“Activity”, “$y”),

])

output_file

(“timeseries.html”, title=“timeseries example”)

show

(p20)

But when I hover over the Timeseries chart, it only displays the activity but not the Timestamp, as is apparent in the image below:

How can I resolve this issue? The ColumnDataSource seems to contain the required values as I checked that by converting the source back to a dataframe and it gives the proper required result, so the problem is not with that. But I can’t figure out what else I’m doing wrong

dfasdsf = ColumnDataSource.to_df(source1)

dfasdsf

.head()

Furthermore, the Activity(in hover) only displays when I use “$y”, if I try to use “@resource” instead, it starts showing “???”. I am facing a similar issue with hovers in the bar chart and heatmap I’ve created where I’m trying to call columns other than the x and y co-ordinates of the chart, but I keep getting question marks. I 've been working on resolving this issue for 3 days now and have gone through most questions I could find related to this on this Google group as well as StackOverflow.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/28549687-f41b-4538-9558-26cc912a0b29%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.