Hello,
Here is my need. I plot all my points based on decimal indices but I’m trying to override their labels with dates, only on integer values:
from bokeh.models import ColumnDataSource
from bokeh.plotting import figure, show
import pandas as pd
import datetime
data = pd.DataFrame({"Index":list(range(10)),
"Value":[x * 10 for x in list(range(10))],
"Time":[datetime.datetime(2021, 3, i) for i in range(1, 11)]})
p = figure()
p.xaxis.major_label_orientation = 3.1415 / 4
p.xaxis.major_label_overrides = {
i: date.strftime("%x %X") for i, date in enumerate(data["Time"])
}
source = ColumnDataSource(data)
source.data["Left"] = source.data["Index"] - 0.5
p.line("Left", "Value", source=source)
show(p)
The problem is when I zoom, decimal indices appear:
How can I only associate labels with integer values?
Regards,
Mark


