Skip to content

Commit d1775df

Browse files
committed
REF: Bokeh 3.0 renaming FuncTickFormatter -> CustomJSTickFormatter
Refs: bokeh/bokeh#11696
1 parent 267d99f commit d1775df

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backtesting/_plotting.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525
HoverTool,
2626
Range1d,
2727
DatetimeTickFormatter,
28-
FuncTickFormatter,
2928
WheelZoomTool,
3029
LinearColorMapper,
3130
)
31+
try:
32+
from bokeh.models import CustomJSTickFormatter
33+
except ImportError: # Bokeh < 3.0
34+
from bokeh.models import FuncTickFormatter as CustomJSTickFormatter
3235
from bokeh.io import output_notebook, output_file, show
3336
from bokeh.io.state import curstate
3437
from bokeh.layouts import gridplot
@@ -242,7 +245,7 @@ def plot(*, results: pd.Series,
242245
trades_cmap = factor_cmap('returns_positive', colors_darker, ['0', '1'])
243246

244247
if is_datetime_index:
245-
fig_ohlc.xaxis.formatter = FuncTickFormatter(
248+
fig_ohlc.xaxis.formatter = CustomJSTickFormatter(
246249
args=dict(axis=fig_ohlc.xaxis[0],
247250
formatter=DatetimeTickFormatter(days=['%d %b', '%a %d'],
248251
months=['%m/%Y', "%b'%y"]),

0 commit comments

Comments
 (0)