echarts [Bug] 使用extendShape自定义组件时获取不到坐标

yv5phkfx  于 4个月前  发布在  Echarts
关注(0)|答案(3)|浏览(110)

Version

5.3.3

No response

Steps to Reproduce

创建extendShape 自定义样式
构建echart图表
使用series custom 自定义
再renderItem中传入shape:{
x: api.value(0),
y: api.value(1),
width: api.value(3),
height: api.value(4)
},
按照文档上的内容,该传参为坐标的x和y轴及宽高,但是获取到的0和1为data中的值,2和3为NaN

Current Behavior

根据网上搜索的结果,api中原应有一个方法 为 coord 可以根据值计算x和y的坐标,目前最新版无此方法,希望能重新引入

Expected Behavior

根据网上搜索的结果,api中原应有一个方法 为 coord 可以根据值计算x和y的坐标,目前最新版无此方法,希望能重新引入

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

jxct1oxe

jxct1oxe1#

@1836661896 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

[Bug] Can't get coordinates when using extendShape custom component

BODY

Version

5.3.3

No response

Steps to Reproduce

Create an extendShape custom style
Build an echart chart
Customize with series custom
RenderItem in the incoming shape:{
x: api.value(0),
y: api.value(1),
width: api.value(3),
height: api.value(4)
},
According to the content on the document, the parameter is the x and y axes of the coordinates and the width and height, but the obtained 0 and 1 are the values in the data, and 2 and 3 are NaN

Current Behavior

According to the results of the online search, api originally should have a method for coord to calculate the coordinates of x and y based on the value, the latest version does not have this method, hoping to be reintroduced

Expected Behavior

According to the results of the online search, api originally should have a method for coord to calculate the coordinates of x and y based on the value, the latest version does not have this method, hoping to be reintroduced

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

uurity8g

uurity8g2#

@1836661896 Please provide a demo for the issue either with Official Editor , CodePen , CodeSandbox or JSFiddle .

wh6knrhe

wh6knrhe3#

I also has the same question!
when I set the data as interface Hex[] ,it does work useing api.value(0) . As I console it ,it shows NaN . By the way,hex is a class I defined.

相关问题