From 4c23e0d9a66be86e3d13a9d43ce1c43c7f490491 Mon Sep 17 00:00:00 2001 From: fasiondog Date: Wed, 15 Mar 2023 21:32:11 +0800 Subject: [PATCH] fixed for bokeh3 #78 #84 --- hikyuu/draw/drawplot/__init__.py | 12 +++++++++--- hikyuu/draw/drawplot/bokeh_draw.py | 10 +++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/hikyuu/draw/drawplot/__init__.py b/hikyuu/draw/drawplot/__init__.py index c19b9e1d..76b3999f 100644 --- a/hikyuu/draw/drawplot/__init__.py +++ b/hikyuu/draw/drawplot/__init__.py @@ -57,7 +57,6 @@ from .bokeh_draw import ax_draw_macd as bk_ax_draw_macd from .bokeh_draw import ax_draw_macd2 as bk_ax_draw_macd2 from .bokeh_draw import sgplot as bk_sgplot - g_draw_engine = 'matplotlib' @@ -249,6 +248,13 @@ def ax_set_locator_formatter(axes, dates, typ): use_draw_engine('matplotlib') __all__ = [ - 'use_draw_engine', 'get_current_draw_engine', 'create_figure', 'gcf', 'show_gcf', 'gca', - 'ax_draw_macd', 'ax_draw_macd2' + 'use_draw_engine', + 'get_current_draw_engine', + 'create_figure', + 'gcf', + 'show_gcf', + 'gca', + 'ax_draw_macd', + 'ax_draw_macd2', + 'use_bokeh_in_notebook', ] diff --git a/hikyuu/draw/drawplot/bokeh_draw.py b/hikyuu/draw/drawplot/bokeh_draw.py index 9f0d8752..d775a3df 100644 --- a/hikyuu/draw/drawplot/bokeh_draw.py +++ b/hikyuu/draw/drawplot/bokeh_draw.py @@ -7,7 +7,7 @@ from hikyuu import * from .common import get_draw_title -from bokeh.plotting import Figure, figure, ColumnDataSource +from bokeh.plotting import figure, ColumnDataSource from bokeh.models import DatetimeTickFormatter, HoverTool, Title, Label from bokeh.layouts import column from bokeh.io import output_notebook, output_file, show @@ -31,10 +31,6 @@ def ax_fill_between(self, *args, **kwargs): pass -Figure.set_xlim = ax_set_xlim -Figure.set_ylim = ax_set_ylim -Figure.fill_between = ax_fill_between - g_use_in_notbook = False g_figure = None g_axes = None @@ -212,8 +208,8 @@ def kplot(kdata, new=True, axes=None, colorup='r', colordown='g'): ) label = Label( - x=axes.plot_width * 0.01, - y=axes.plot_height * 0.82, + x=axes.width * 0.01, + y=axes.height * 0.82, x_units='screen', y_units='screen', text=text,