# 在 K 线上做标记

图表库支持显示[K线标记](https://zlq4863947.gitbook.io/tradingview/fu-lu/pages/-Lxtj-uBuYVb2UoP7lQK#K线标记) 和[时间刻度标记](/tradingview/fu-lu/marks-on-bars.md#marks-on-the-timescale)。 如果[支持它们](/tradingview/3-shu-ju-bang-ding/js-api.md#supports_marks)，则会从您的后端请求标记。 标记旨在让您能够显示附加到K线/时间刻度的事件。 这里有一些例子：

* 新闻
* 一些比较特殊的K线配置
* 拆分/股息
* 等等

您可以使用 [subscribe(event, callback)](/tradingview/4-tu-biao-ding-zhi/widget-methods.md#subscribeevent-callback) Widget 方法订阅标记事件。 此外，还有[刷新标记](/tradingview/4-tu-biao-ding-zhi/chart-methods.md#refreshmarks)和[清除标记](/tradingview/4-tu-biao-ding-zhi/chart-methods.md#clearmarks)的图表方法。

## K线标记

K线标记是带有自定义大小和颜色的彩色圆圈，里面有一个字母。 一个K线可以有几个标记。当用户单击标记时，会出现工具提示。 工具提示可以包含 HTML 代码或纯文本。

例如:

![images/tv\_bar\_mark.png](/files/-Lxtj6NrzEx7v6q87mia)

图表库使用 [getMarks() JS API 方法](/tradingview/3-shu-ju-bang-ding/js-api.md#getmarkssymbolinfo-from-to-ondatacallback-resolution) 和 [/marks UDF 请求](/tradingview/3-shu-ju-bang-ding/udf.md#marks) 为可见数据范围请求K线上的标记。

## 时间刻度标记

时间刻度上的标记基本上是时间刻度上方的棒棒糖。 每个标记内部都有自定义字母和带有一两个信息字符串的弹出工具提示。

如果\[支持]，则从您的后端请求标记(JS-Api.md#supports\_timescale\_marks)。

例如:

![images/tv\_timescale\_mark.png](/files/-MdBu2e6gWDNAB0vGxoC)

时间刻度上的标记由图表库使用 [getTimescaleMarks() JS API 方法](/tradingview/3-shu-ju-bang-ding/js-api.md#gettimescalemarkssymbolinfo-from-to-ondatacallback-resolution) 和 \[/timescale\_marks UDF 请求]\(UDF.md#timescale-marks）。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zlq4863947.gitbook.io/tradingview/fu-lu/marks-on-bars.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
