Fill Patterns
fill, linefill.new, and ctx.atk.fill_between — choosing the right fill API based on whether lines are static declarations or ATK bridge lines.
Fill and Zone Patterns#
| Need | Recommended API | Why |
|---|---|---|
| Fill between two static lines | fill(...) or linefill.new(...) | Use when the paired lines already exist as static declarations. |
| Fill between ATK bridge lines | ctx.atk.fill_between(...) | Use when the lines were created through ctx.atk.plot_line. |
| Zone batch or rectangle family | ctx.atk.rectangles(...) or related bridge helper | Use when the visual is more like a grouped region than a line pair. |
Identity mismatch: ctx.atk.fill_between fills between bridge line keys, not static plot keys. Trying
to mix the two identities will not work as expected. Match your fill API to the API that created the lines.
Correct fill_between pattern#
# Wrong: trying to fill between static keys with the bridge helper.
# ctx.atk.fill_between(line1="bb_upper", line2="bb_lower", ...)
# Right: bridge fills between bridge line keys.
ctx.atk.plot_line(key="fast_line", source="fast", color="#00c853")
ctx.atk.plot_line(key="slow_line", source="slow", color="#f23645")
ctx.atk.fill_between(key="trend_fill", line1="fast_line", line2="slow_line", fill_alpha=24)Correct static fill pattern#
# Declare two plot lines at the script level.
plot("bb_upper", key="bb_upper", title="Upper Band", color="#2962ff")
plot("bb_lower", key="bb_lower", title="Lower Band", color="#2962ff")
# Fill between them using the static fill API.
fill("bb_upper", "bb_lower", color="#2962ff20", title="BB Fill")