Skip to content

Commit

Permalink
attachToPlotItem method
Browse files Browse the repository at this point in the history
  • Loading branch information
Lev Maximov committed Apr 7, 2020
1 parent 0e6e7f1 commit 4daf793
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyqtgraph/graphicsItems/DateAxisItem.py
Expand Up @@ -220,3 +220,18 @@ def setZoomLevelForDensity(self, density):
key = next((k for k in keys if density < k), keys[-1])
self.zoomLevel = self.zoomLevels[key]
self.zoomLevel.utcOffset = self.utcOffset

def attachToPlotItem(self, plotItem):
"""Add this axis to the given PlotItem
:param plotItem: (PlotItem)
"""
self.setParentItem(plotItem)
viewBox = plotItem.getViewBox()
self.linkToView(viewBox)
self._oldAxis = plotItem.axes[self.orientation]['item']
self._oldAxis.hide()
plotItem.axes[self.orientation]['item'] = self
pos = plotItem.axes[self.orientation]['pos']
plotItem.layout.addItem(self, *pos)
self.setZValue(-1000)

0 comments on commit 4daf793

Please sign in to comment.