Lul, actually scaled main chart from linked set

This was a subtle logic error when building the `plots: dict` we weren't
adding the "main (ohlc or other source) chart" from the `LinkedSplits`
set when interacting with some sub-chart from `.subplots`..

Further this tries out bypassing `numpy.median()` altogether by just
using `median = (ymx - ymn) / 2` which should be nearly the same?
log_linearized_curve_overlays
Tyler Goodlet 2023-01-24 17:16:23 -05:00
parent 517c68f3ad
commit 5a8fd42c0c
1 changed files with 19 additions and 15 deletions

View File

@ -959,29 +959,31 @@ class ChartView(ViewBox):
): ):
profiler = Profiler( profiler = Profiler(
msg=f'ChartView.interact_graphics_cycle() for {self.name}', msg=f'ChartView.interact_graphics_cycle() for {self.name}',
# disabled=not pg_profile_enabled(), disabled=not pg_profile_enabled(),
# ms_threshold=ms_slower_then, ms_threshold=ms_slower_then,
disabled=False,
ms_threshold=4,
# XXX: important to avoid not seeing underlying # XXX: important to avoid not seeing underlying
# ``Viz.update_graphics()`` nested profiling likely # ``Viz.update_graphics()`` nested profiling likely
# due to the way delaying works and garbage collection of # due to the way delaying works and garbage collection of
# the profiler in the delegated method calls. # the profiler in the delegated method calls.
delayed=True, delayed=True,
# for hardcore latency checking, comment these flags above.
# disabled=False,
# ms_threshold=4,
) )
# TODO: a faster single-loop-iterator way of doing this XD # TODO: a faster single-loop-iterator way of doing this XD
chart = self._chart chart = self._chart
plots = {chart.name: chart}
linked = self.linked linked = self.linked
if ( if (
do_linked_charts do_linked_charts
and linked and linked
): ):
plots = {linked.chart.name: linked.chart}
plots |= linked.subplots plots |= linked.subplots
else:
plots = {chart.name: chart}
for chart_name, chart in plots.items(): for chart_name, chart in plots.items():
@ -1083,17 +1085,19 @@ class ChartView(ViewBox):
in_view = arr[read_slc] in_view = arr[read_slc]
row_start = arr[read_slc.start - 1] row_start = arr[read_slc.start - 1]
y_med = (ymx - ymn) / 2
if viz.is_ohlc: if viz.is_ohlc:
y_med = viz.median_from_range( # y_med = (ymx - ymin) / 2
read_slc.start, # y_med = viz.median_from_range(
read_slc.stop, # read_slc.start,
) # read_slc.stop,
# )
y_start = row_start['open'] y_start = row_start['open']
else: else:
y_med = viz.median_from_range( # y_med = viz.median_from_range(
read_slc.start, # read_slc.start,
read_slc.stop, # read_slc.stop,
) # )
y_start = row_start[viz.name] y_start = row_start[viz.name]
profiler(f'{viz.name}@{chart_name} MINOR curve median') profiler(f'{viz.name}@{chart_name} MINOR curve median')