Support maxmin over multiple arrays; Keep dark vlm in view
parent
06934be047
commit
6a0fba1eb3
|
@ -592,14 +592,22 @@ async def open_vlm_displays(
|
||||||
)
|
)
|
||||||
|
|
||||||
# force 0 to always be in view
|
# force 0 to always be in view
|
||||||
def maxmin(name) -> tuple[float, float]:
|
def maxmin(
|
||||||
|
names: list[str],
|
||||||
|
|
||||||
|
) -> tuple[float, float]:
|
||||||
|
mx = 0
|
||||||
|
for name in names:
|
||||||
mxmn = chart.maxmin(name=name)
|
mxmn = chart.maxmin(name=name)
|
||||||
if mxmn:
|
if mxmn:
|
||||||
return 0, mxmn[1]
|
mx = max(mxmn[1], mx)
|
||||||
|
|
||||||
return 0, 0
|
# if mx:
|
||||||
|
# return 0, mxmn[1]
|
||||||
|
|
||||||
chart.view._maxmin = partial(maxmin, name='volume')
|
return 0, mx
|
||||||
|
|
||||||
|
chart.view._maxmin = partial(maxmin, names=['volume'])
|
||||||
|
|
||||||
# TODO: fix the x-axis label issue where if you put
|
# TODO: fix the x-axis label issue where if you put
|
||||||
# the axis on the left it's totally not lined up...
|
# the axis on the left it's totally not lined up...
|
||||||
|
@ -675,7 +683,11 @@ async def open_vlm_displays(
|
||||||
)
|
)
|
||||||
|
|
||||||
# add custom auto range handler
|
# add custom auto range handler
|
||||||
pi.vb._maxmin = partial(maxmin, name='dolla_vlm')
|
pi.vb._maxmin = partial(
|
||||||
|
maxmin,
|
||||||
|
# keep both regular and dark vlm in view
|
||||||
|
names=['dolla_vlm', 'dark_vlm'],
|
||||||
|
)
|
||||||
|
|
||||||
curve, _ = chart.draw_curve(
|
curve, _ = chart.draw_curve(
|
||||||
name='dolla_vlm',
|
name='dolla_vlm',
|
||||||
|
|
Loading…
Reference in New Issue