echarts echart.convertToPixel({ seriesIndex: 0 }, point)传入坐标值和返回坐标值相同

xytpbqjk  于 2022-10-26  发布在  Echarts
关注(0)|答案(9)|浏览(633)

Version

5.0.2

Steps to reproduce

打印 instance.convertToPixel({ seriesIndex: 0 }, [100,100]) 返回值是[100,100]
我通过

const series = instance.getModel().getSeriesByIndex(0);
    const itemLayouts = series.getData()._itemLayouts;

获取到 graph force中node点的坐标,然后进行保存,下次进来渲染的时候直接用保存的坐标值渲染
然而获取到的xy值放入graph中发现比例不对
进而发现 convertToPixel 这个api穿进去任何值,返回出来的值还是原来的值,怀疑是个bug

What is expected?

希望获取到正确的坐标或者得到获取正确坐标的方式

What is actually happening?

instance.convertToPixel({ seriesIndex: 0 }, [100,100]) 返回值是[100,100]

m1m5dgzv

m1m5dgzv1#

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that it containsa minimum reproducible demoand necessaryimagesto illustrate. Otherwise, our committers will ask you to do so.

  • A minimum reproducible demo* should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.

You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org . Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list .

Have a nice day! 🍵

l2osamch

l2osamch2#

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

TRANSLATED

TITLE

'echart.convertToPixel' ('seriesIndex: 0', point)' incoming coordinate values are the same as returned coordinate values

BODY

Version

5.0.2

Steps to reproduce

Print 'instance.convertToPixel' ('seriesIndex: 0', '100,100') 'The return value is '100,100'
I passed

const series = instance.getModel().getSeriesByIndex(0);
    const itemLayouts = series.getData()._itemLayouts;

Gets the coordinates of the nodes in graph force, then saves them, rendering directly with the saved coordinate values the next time you come in and render
However, the obtained xy value is found to be in the wrong proportion in the graph
Then found that 'convertToPixel' this api wears any value, the returned value is still the original value, suspected to be a bug

What is expected?

You want to get the correct coordinates or how you get them

What is actually happening?

'instance.convertToPixel' ('seriesIndex:0', '100,100') 'Return value is '100,100'

mzmfm0qo

mzmfm0qo3#

Please provide a demo to reproduce

s8vozzvw

s8vozzvw5#

demo 在这里
@yufeng04

flseospp

flseospp6#

我想要实现的效果是点击后保持emphasis adjacency的效果,发现echart目前并不支持这种操作,所以想点击后获取所有点的坐标,将force图例转换成layout:none图例,自定义逻辑,将不相关点颜色变浅,并且使用force图例的坐标,
发现获取的坐标转换后和转换前相同,导致的效果是点击后图表会整体放大两次

h43kikqp

h43kikqp7#

这个问题什么时候解决啊?

g0czyy6m

g0czyy6m8#

我看了一下,graph 用的坐标系是 view, 这个坐标系里点的坐标就是像素信息,所以使用convertToPixel的时候返回的是同样的值

4uqofj5v

4uqofj5v9#

@pumpkindev 在鼠标缩放后值就不一样了。你说的转成 layout: none 会放大应该是因为 echarts 在设置 layout: none 后会自适应到视图大小,这个后面会优化假如是否自适应的配置项

相关问题