Box
方框图的句柄。
静态方法
new
创建一个新的盒子对象。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
left | series int | 左坐标(bar 索引或 UNIX 时间)。 | |
top | series float | 顶部坐标(价格)。 | |
right | series int | 右坐标(bar 索引或 UNIX 时间)。 | |
bottom | series float | 底部坐标(价格)。 | |
border_color | series color | color.BLUE | 框的边框颜色。 |
border_width | series int | 1 | 边框宽度(以像素为单位)。 |
border_style | series LineStyle | LineStyle.Solid | 边框线样式。 |
extend | series Extend | Extend.None | 扩展模式:extend.none、extend.left、extend.right或extend.both。 |
xloc | series Xloc | Xloc.BarIndex | x 位置类型:xloc.bar_index 或 xloc.bar_time。 |
bgcolor | series color | color.BLUE | 框的背景颜色。 |
text | series string | "" | 框的文本内容。 |
text_size | series int | 0 | 文本大小(以像素为单位)。 |
text_color | series color | color.BLACK | 文字颜色。 |
text_halign | series TextHAlign | TextHAlign.Right | 水平文本对齐方式。 |
text_valign | series TextVAlign | TextVAlign.Center | 垂直文本对齐方式。 |
text_wrap | series TextWrap | TextWrap.None | 文本换行模式。 |
text_font_family | series FontFamily | FontFamily.Default | 文本的字体系列。 |
force_overlay | const bool | false | 如果为 true,则该框将呈现在顶部。 |
text_formatting | const TextFormat | text.NONE | 文本格式选项。 |
返回: series Box
静态属性
all
返回一个数组,其中填充了脚本绘制的所有当前框。
方法
copy
navi
Box.copy(id: series Box): series Box创建指定框的拷贝并返回其 id。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要复制的框。 |
返回: series Box
delete
navi
Box.delete(id: series Box)从图表中删除指定的框。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要删除的框。 |
get_bottom
navi
Box.get_bottom(id: series Box): series float返回盒子底部边框的价格值。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 从中获取底部坐标的框。 |
返回: series float
get_left
navi
Box.get_left(id: series Box): series int返回框左边框的 bar 索引或 UNIX 时间(取决于用于“xloc”的最后一个值)。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 从中获取左坐标的框。 |
返回: series int
get_right
navi
Box.get_right(id: series Box): series int返回框右边框的 bar 索引或 UNIX 时间(取决于用于“xloc”的最后一个值)。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 从中获取正确坐标的框。 |
返回: series int
get_top
navi
Box.get_top(id: series Box): series float返回盒子上边框的价格值。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 从中获取顶部坐标的框。 |
返回: series float
set_bg_color
navi
Box.set_bg_color(id: series Box, color: series color)设置框的背景颜色。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
color | series color | 新的背景颜色。 |
set_border_color
navi
Box.set_border_color(id: series Box, color: series color)设置框的边框颜色。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
color | series color | 新的边框颜色。 |
set_border_style
navi
Box.set_border_style(id: series Box, style: series LineStyle)设置框的边框样式。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
style | series LineStyle | 新的边框线样式。 |
set_border_width
navi
Box.set_border_width(id: series Box, width: series int)设置框的边框宽度。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
width | series int | 新的边框宽度(以像素为单位)。 |
set_bottom
navi
Box.set_bottom(id: series Box, bottom: series float)设置框的底部坐标。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
bottom | series float | 新的底部坐标(价格)。 |
set_bottom_right_point
navi
Box.set_bottom_right_point(id: series Box, point: series chart.Point)使用 chart.point 对象设置框的右下角。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
point | series chart.Point | 指定新右下角的 chart.point 对象。 |
set_extend
navi
Box.set_extend(id: series Box, extend: series Extend)设置此框对象边框的扩展类型。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
extend | series Extend | 扩展模式:extend.none、extend.left、extend.right或extend.both。 |
set_left
navi
Box.set_left(id: series Box, left: series int)设置框的左坐标。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
left | series int | 新的左坐标(bar 索引或 UNIX 时间)。 |
set_lefttop
navi
Box.set_lefttop(id: series Box, left: series int, top: series float)设置框的左侧和顶部坐标。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
left | series int | 新的左坐标(bar 索引或 UNIX 时间)。 | |
top | series float | 新的顶部坐标(价格)。 |
set_right
navi
Box.set_right(id: series Box, right: series int)设置框的右坐标。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
right | series int | 新的右坐标(bar 索引或 UNIX 时间)。 |
set_rightbottom
navi
Box.set_rightbottom(id: series Box, right: series int, bottom: series float)设置框的右侧和底部坐标。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
right | series int | 新的右坐标(bar 索引或 UNIX 时间)。 | |
bottom | series float | 新的底部坐标(价格)。 |
set_text
navi
Box.set_text(id: series Box, text: series string)设置框的文本大小。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
text | series string | 新的文本内容。 |
set_text_color
navi
Box.set_text_color(id: series Box, text_color: series color)设置框的文本颜色。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
text_color | series color | 新的文本颜色。 |
set_text_font_family
navi
Box.set_text_font_family(id: series Box, font_family: series string)设置框文本的字体系列。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
font_family | series string | 字体系列:FontFamily.Default 或 FontFamily.Monospace。 |
set_text_formatting
navi
Box.set_text_formatting(id: series Box, text_formatting: const TextFormat)设置框的文本格式。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
text_formatting | const TextFormat | 文本格式选项。 |
set_text_halign
navi
Box.set_text_halign(id: series Box, text_halign: series TextHAlign)设置框文本的水平对齐方式。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
text_halign | series TextHAlign | 水平文本对齐方式:TextHAlign.Left、TextHAlign.Center 或 TextHAlign.Right。 |
set_text_size
set_text_valign
navi
Box.set_text_valign(id: series Box, text_valign: series TextVAlign)设置框文本的垂直对齐方式。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
text_valign | series TextVAlign | 垂直文本对齐方式:text.align_top、TextHAlign.Center 或 text.align_bottom。 |
set_text_wrap
navi
Box.set_text_wrap(id: series Box, text_wrap: series TextWrap)设置框的文本环绕模式。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
text_wrap | series TextWrap | 文本换行模式:text.wrap_none 或 text.wrap_auto。 |
set_top
navi
Box.set_top(id: series Box, top: series float)设置框的顶部坐标。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
top | series float | 新的顶部坐标(价格)。 |
set_top_left_point
navi
Box.set_top_left_point(id: series Box, point: series chart.Point)使用 chart.point 对象设置框的左上角。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
point | series chart.Point | 指定新左上角的 chart.point 对象。 |
set_xloc
navi
Box.set_xloc(
id: series Box,
left: series int,
right: series int,
xloc: series Xloc
)设置框的左边框和右边框并更新其 xloc 属性。
参数
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
id | series Box | 要修改的框。 | |
left | series int | 新的左坐标(bar 索引或 UNIX 时间)。 | |
right | series int | 新的右坐标(bar 索引或 UNIX 时间)。 | |
xloc | series Xloc | x 位置类型:xloc.bar_index 或 xloc.bar_time。 |