apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.2k stars 19.61k forks source link

为K线图添加类似股票交易软件中左上角固定位置显示均线MA的功能 #19477

Open nitxs opened 8 months ago

nitxs commented 8 months ago

What problem does this feature solve?

在echarts 5.1.2版本中,我需要开发K线图表,图表中除了显示蜡烛图外,还需要显示均线,同时根据功能要求,要如同股票交易软件中蜡烛图页面显示的一样,在左上角固定位置显示MA5、MA10、M20,并根据用户鼠标滑动,更新显示当前MA均线N日的值,请问能否增加这样的功能?或者在5.1.2版本中,能否有类似的实现? image

What does the proposed API look like?

graphic.style.text 值可设为回调函数,由tooltip触发时联动触发,获取tooltip.formatter滑动时获取的当前节点的所有数据

echarts-bot[bot] commented 8 months ago

@nitxs It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED
**TITLE** Add a function to the K-line chart similar to the function of displaying the moving average MA at a fixed position in the upper left corner of stock trading software. **BODY** ### What problem does this feature solve? In echarts version 5.1.2, I need to develop a K-line chart, in addition to displaying candlesticks, I also need to display moving averages, and at the same time, according to the functional requirements, as shown on the candlestick chart page in the stock trading software, MA5, MA10, M20 should be displayed in a fixed position in the upper left corner, and according to the user's mouse slide, update the value of the current MA moving average for N days, can you add such a function? Or in version 5.1.2, can there be a similar implementation? ![image](https://github.com/apache/echarts/assets/19258898/a00f69bd-2995-44de-970b-cac7cb23fe2e) ### What does the proposed API look like? The graphic.style.text value can be set as a callback function, which is triggered by the tooltip trigger linkage to get all the data of the current node obtained when the tooltip.formatter is sliding
helgasoft commented 8 months ago

see official example Tooltip position could be set as absolute (constant), like position :{left: 10, top: 30}. Then inside, MA values could be positioned one after another in a line.

nitxs commented 8 months ago

see official example Tooltip position could be set as absolute (constant), like position :{left: 10, top: 30}. Then inside, MA values could be positioned one after another in a line.

Tooltip 我已经设置了开盘价、收盘价、最低价、最高价,需求是这几个单独一个框显示,而MA值是要放在左上角固定显示,也就是我可能需要设置两个tooltip,该如何实现呢? image

我现在选择在graphic中设置显示MA均线值,如果可能想请问下,如何在鼠标滑动时也动态更新graphic设置的MA值? image

另外,我用的echarts版本是5.1.2

我现在的页面 image

helgasoft commented 8 months ago

see Demo Code

📌 please close issue if problem solved.

nitxs commented 8 months ago

see Demo Code

📌 please close issue if problem solved.

thanks,但你给出的demo并没有完全解决我的问题,我的问题是既要显示一个tooltip来显示【开盘价、收盘价、最低价、最高价】,还要一个额外的tooltip来固定在左上角显示MA均线值,也就是说,需要两个tooltip来同时显示,我用的echarts版本是5.1.2。

Xiaobaishushu25 commented 4 months ago

see official example Tooltip position could be set as absolute (constant), like position :{left: 10, top: 30}. Then inside, MA values could be positioned one after another in a line.

echarts目前好像不支持同时设置两个tooltip,顺便问问你有开发画线功能吗,我也在搞蜡烛图