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.