From 019da35a554ed46ba47c7a057fc259fec1fb27a2 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 4 Sep 2019 22:41:33 +0800 Subject: [PATCH] [Fix] close #2055 --- vnpy/chart/widget.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vnpy/chart/widget.py b/vnpy/chart/widget.py index 45c0b26c..8d6ff343 100644 --- a/vnpy/chart/widget.py +++ b/vnpy/chart/widget.py @@ -106,6 +106,10 @@ class ChartWidget(pg.PlotWidget): # Store plot object in dict self._plots[plot_name] = plot + # Add plot onto the layout + self._layout.nextRow() + self._layout.addItem(plot) + def add_item( self, item_class: Type[ChartItem], @@ -120,10 +124,8 @@ class ChartWidget(pg.PlotWidget): plot = self._plots.get(plot_name) plot.addItem(item) - self._item_plot_map[item] = plot - self._layout.nextRow() - self._layout.addItem(plot) + self._item_plot_map[item] = plot def get_plot(self, plot_name: str) -> pg.PlotItem: """