Drop unneeded .hide(); add more comments

basic_orders
Tyler Goodlet 2021-01-26 22:16:18 -05:00
parent cfc36e7928
commit 03541bd368
1 changed files with 17 additions and 4 deletions

View File

@ -462,6 +462,8 @@ def level_line(
**linelabelkwargs **linelabelkwargs
) )
label.update_from_data(0, level) label.update_from_data(0, level)
# by default, the label must be shown by client code
label.hide() label.hide()
# TODO: can we somehow figure out a max value from the parent axis? # TODO: can we somehow figure out a max value from the parent axis?
@ -470,19 +472,32 @@ def level_line(
line = LevelLine( line = LevelLine(
chart, chart,
label, label,
color=color, color=color,
# lookup "highlight" equivalent # lookup "highlight" equivalent
highlight_color=color + '_light', highlight_color=color + '_light',
movable=True, movable=True,
angle=0, angle=0,
hl_on_hover=hl_on_hover,
dotted=dotted, dotted=dotted,
# UX related options
hl_on_hover=hl_on_hover,
# makes order line labels offset from their parent axis
# such that they don't collide with the L1/L2 lines/prices
# that are displayed on the axis
adjust_to_l1=adjust_to_l1, adjust_to_l1=adjust_to_l1,
# when set to True the label is always shown instead of just on
# highlight (which is a privacy thing for orders)
always_show_label=always_show_label, always_show_label=always_show_label,
) )
# activate/draw label # activate/draw label
line.setValue(level) line.setValue(level) # it's just .setPos() right?
line.set_level() line.set_level()
chart.plotItem.addItem(line) chart.plotItem.addItem(line)
@ -510,6 +525,4 @@ def order_line(
line.label.size = size line.label.size = size
line.label.size_digits = size_digits line.label.size_digits = size_digits
line.label.hide()
return line return line