Skip to content

Commit

Permalink
* improve update_lines performance
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhrisca committed Nov 27, 2019
1 parent 6833c2c commit bb2d67c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions asammdf/gui/widgets/channel_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ def update(self):
self.set_value(self._value)

def set_value(self, value):
if self._value == value:
return

self._value = value
if self.ranges and value not in ("", "n.a."):
for (start, stop), color in self.ranges.items():
Expand Down
20 changes: 19 additions & 1 deletion asammdf/gui/widgets/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,25 @@ def update_lines(self, with_dots=None, force=False):
self.view_boxes[i].addItem(curve)
else:
curve = self.curves[i]
curve.setData(x=t, y=sig.plot_samples)

if len(t):

# curve.setData(x=t, y=sig.plot_samples)
curve.invalidateBounds()
curve._boundsCache = [
[(1, None), (t[0], t[-1])],
[(1, None), (sig.min, sig.max)]
]

curve.xData = t
curve.yData = sig.plot_samples
curve.path = None
curve.fillPath = None
curve._mouseShape = None
curve.prepareGeometryChange()
curve.informViewBoundsChanged()
curve.update()
curve.sigPlotChanged.emit(curve)

if sig.enable:
curve.show()
Expand Down
2 changes: 1 addition & 1 deletion asammdf/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
""" asammdf version module """

__version__ = "5.13.17.dev0"
__version__ = "5.13.17"

0 comments on commit bb2d67c

Please sign in to comment.