diff --git a/vnpy/chart/item.py b/vnpy/chart/item.py index 467b9c3e..979686df 100644 --- a/vnpy/chart/item.py +++ b/vnpy/chart/item.py @@ -115,7 +115,7 @@ class ChartItem(pg.GraphicsObject): max_ix = int(rect.right()) max_ix = min(max_ix, len(self._bar_picutures)) - rect_area = (rect.left(), rect.right()) + rect_area = (min_ix, max_ix) if rect_area != self._rect_area or not self._item_picuture: self._rect_area = rect_area self._draw_item_picture(min_ix, max_ix) diff --git a/vnpy/chart/widget.py b/vnpy/chart/widget.py index 53b5da1a..45c0b26c 100644 --- a/vnpy/chart/widget.py +++ b/vnpy/chart/widget.py @@ -470,10 +470,11 @@ class ChartCursor(QtCore.QObject): for item, plot in self._item_plot_map.items(): item_info_text = item.get_info_text(self._x) - if item_info_text: - if plot not in buf: - buf[plot] = item_info_text - else: + + if plot not in buf: + buf[plot] = item_info_text + else: + if item_info_text: buf[plot] += ("\n\n" + item_info_text) for plot_name, plot in self._plots.items():