Compare commits
13 Commits
662c71dcec
...
d2b539edbd
| Author | SHA1 | Date |
|---|---|---|
|
|
d2b539edbd | |
|
|
5a6b63b2ee | |
|
|
16f4f966b7 | |
|
|
91a2fa2641 | |
|
|
fb0c8fa7ad | |
|
|
3b81e8f69d | |
|
|
3f84f183e6 | |
|
|
2594c39816 | |
|
|
2d893f9ad5 | |
|
|
5123d919f4 | |
|
|
286a411f35 | |
|
|
ba752e4de8 | |
|
|
768b6f316e |
|
|
@ -20,8 +20,9 @@ Chart axes graphics and behavior.
|
||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from typing import Callable
|
|
||||||
from math import floor
|
from math import floor
|
||||||
|
import platform
|
||||||
|
from typing import Callable
|
||||||
|
|
||||||
import polars as pl
|
import polars as pl
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
|
|
@ -42,6 +43,7 @@ from ._style import DpiAwareFont, hcolor, _font
|
||||||
from ._interaction import ChartView
|
from ._interaction import ChartView
|
||||||
from ._dataviz import Viz
|
from ._dataviz import Viz
|
||||||
|
|
||||||
|
_friggin_macos: bool = platform.system() == 'Darwin'
|
||||||
_axis_pen = pg.mkPen(hcolor('bracket'))
|
_axis_pen = pg.mkPen(hcolor('bracket'))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -172,6 +174,7 @@ class Axis(pg.AxisItem):
|
||||||
text_offset = None
|
text_offset = None
|
||||||
if self.orientation in ('bottom',):
|
if self.orientation in ('bottom',):
|
||||||
text_offset = floor(0.25 * font_size)
|
text_offset = floor(0.25 * font_size)
|
||||||
|
|
||||||
elif self.orientation in ('left', 'right'):
|
elif self.orientation in ('left', 'right'):
|
||||||
text_offset = floor(font_size / 2)
|
text_offset = floor(font_size / 2)
|
||||||
|
|
||||||
|
|
@ -293,6 +296,7 @@ class PriceAxis(Axis):
|
||||||
) -> None:
|
) -> None:
|
||||||
self._min_tick = size
|
self._min_tick = size
|
||||||
|
|
||||||
|
if _friggin_macos:
|
||||||
def size_to_values(self) -> None:
|
def size_to_values(self) -> None:
|
||||||
# Call PyQtGraph's internal width update mechanism
|
# Call PyQtGraph's internal width update mechanism
|
||||||
# This respects autoExpandTextSpace and updates min/max constraints
|
# This respects autoExpandTextSpace and updates min/max constraints
|
||||||
|
|
@ -303,6 +307,12 @@ class PriceAxis(Axis):
|
||||||
if self.pi and hasattr(self.pi, 'updateGeometry'):
|
if self.pi and hasattr(self.pi, 'updateGeometry'):
|
||||||
self.pi.updateGeometry()
|
self.pi.updateGeometry()
|
||||||
|
|
||||||
|
else:
|
||||||
|
def size_to_values(self) -> None:
|
||||||
|
# XXX, old code!
|
||||||
|
self.setWidth(self.typical_br.width())
|
||||||
|
|
||||||
|
|
||||||
# XXX: drop for now since it just eats up h space
|
# XXX: drop for now since it just eats up h space
|
||||||
|
|
||||||
def tickStrings(
|
def tickStrings(
|
||||||
|
|
@ -344,6 +354,7 @@ class DynamicDateAxis(Axis):
|
||||||
1: '%H:%M:%S',
|
1: '%H:%M:%S',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _friggin_macos:
|
||||||
def size_to_values(self) -> None:
|
def size_to_values(self) -> None:
|
||||||
# Call PyQtGraph's internal height update mechanism
|
# Call PyQtGraph's internal height update mechanism
|
||||||
# This respects autoExpandTextSpace and updates min/max constraints
|
# This respects autoExpandTextSpace and updates min/max constraints
|
||||||
|
|
@ -354,6 +365,11 @@ class DynamicDateAxis(Axis):
|
||||||
if self.pi and hasattr(self.pi, 'updateGeometry'):
|
if self.pi and hasattr(self.pi, 'updateGeometry'):
|
||||||
self.pi.updateGeometry()
|
self.pi.updateGeometry()
|
||||||
|
|
||||||
|
else:
|
||||||
|
def size_to_values(self) -> None:
|
||||||
|
# XXX, old code!
|
||||||
|
self.setHeight(self.typical_br.height() + 1)
|
||||||
|
|
||||||
def _indexes_to_timestrs(
|
def _indexes_to_timestrs(
|
||||||
self,
|
self,
|
||||||
indexes: list[int],
|
indexes: list[int],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue