Port to `Cursor`
parent
08aa5984ec
commit
88d48bd188
|
@ -32,7 +32,7 @@ from ._axes import (
|
||||||
PriceAxis,
|
PriceAxis,
|
||||||
)
|
)
|
||||||
from ._graphics._cursor import (
|
from ._graphics._cursor import (
|
||||||
CrossHair,
|
Cursor,
|
||||||
ContentsLabel,
|
ContentsLabel,
|
||||||
)
|
)
|
||||||
from ._graphics._lines import (
|
from ._graphics._lines import (
|
||||||
|
@ -186,7 +186,7 @@ class LinkedSplitCharts(QtGui.QWidget):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.signals_visible: bool = False
|
self.signals_visible: bool = False
|
||||||
self._ch: CrossHair = None # crosshair graphics
|
self._cursor: Cursor = None # crosshair graphics
|
||||||
self.chart: ChartPlotWidget = None # main (ohlc) chart
|
self.chart: ChartPlotWidget = None # main (ohlc) chart
|
||||||
self.subplots: Dict[Tuple[str, ...], ChartPlotWidget] = {}
|
self.subplots: Dict[Tuple[str, ...], ChartPlotWidget] = {}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class LinkedSplitCharts(QtGui.QWidget):
|
||||||
self.digits = symbol.digits()
|
self.digits = symbol.digits()
|
||||||
|
|
||||||
# add crosshairs
|
# add crosshairs
|
||||||
self._ch = CrossHair(
|
self._cursor = Cursor(
|
||||||
linkedsplitcharts=self,
|
linkedsplitcharts=self,
|
||||||
digits=self.digits
|
digits=self.digits
|
||||||
)
|
)
|
||||||
|
@ -246,7 +246,7 @@ class LinkedSplitCharts(QtGui.QWidget):
|
||||||
_is_main=True,
|
_is_main=True,
|
||||||
)
|
)
|
||||||
# add crosshair graphic
|
# add crosshair graphic
|
||||||
self.chart.addItem(self._ch)
|
self.chart.addItem(self._cursor)
|
||||||
|
|
||||||
# axis placement
|
# axis placement
|
||||||
if _xaxis_at == 'bottom':
|
if _xaxis_at == 'bottom':
|
||||||
|
@ -298,7 +298,7 @@ class LinkedSplitCharts(QtGui.QWidget):
|
||||||
'right': PriceAxis(linked_charts=self)
|
'right': PriceAxis(linked_charts=self)
|
||||||
},
|
},
|
||||||
viewBox=cv,
|
viewBox=cv,
|
||||||
cursor=self._ch,
|
cursor=self._cursor,
|
||||||
**cpw_kwargs,
|
**cpw_kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ class LinkedSplitCharts(QtGui.QWidget):
|
||||||
cpw.setXLink(self.chart)
|
cpw.setXLink(self.chart)
|
||||||
|
|
||||||
# add to cross-hair's known plots
|
# add to cross-hair's known plots
|
||||||
self._ch.add_plot(cpw)
|
self._cursor.add_plot(cpw)
|
||||||
|
|
||||||
# draw curve graphics
|
# draw curve graphics
|
||||||
if style == 'bar':
|
if style == 'bar':
|
||||||
|
@ -368,7 +368,7 @@ class ChartPlotWidget(pg.PlotWidget):
|
||||||
name: str,
|
name: str,
|
||||||
array: np.ndarray,
|
array: np.ndarray,
|
||||||
static_yrange: Optional[Tuple[float, float]] = None,
|
static_yrange: Optional[Tuple[float, float]] = None,
|
||||||
cursor: Optional[CrossHair] = None,
|
cursor: Optional[Cursor] = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""Configure chart display settings.
|
"""Configure chart display settings.
|
||||||
|
|
Loading…
Reference in New Issue