echarts 设置了grid. containLabel = true之后如何获取柱状图一个类目的宽度

epfja78i  于 4个月前  发布在  Echarts
关注(0)|答案(2)|浏览(36)

What problem does this feature solve?

想要实现的功能:点击柱状图的柱子,获取该柱子中点的横向像素坐标。现想结合一个类目宽度以及barGap,barCategoryGap,柱子的索引等信息获取柱子中点的横向像素坐标。如果有多个类目的情况下,可以通过两个类目中点横向像素坐标相减得到一个类目的宽度,但是如果只有一个类目的情况下,无法取得。现有如下问题:

  1. 设置了grid. containLabel = true之后如何获取柱状图一个类目的宽度
  2. 示例 中tooltip一个阴影的宽度 如何获取

What does the proposed API look like?

设置了grid. containLabel = true之后如何获取柱状图一个类目的宽度

sr4lhrrt

sr4lhrrt1#

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

The grid. containLabel = true How to get the width of a class of histograms

BODY

What problem does this feature solve?

The desired function: Click on a column of the histogram to obtain the horizontal pixel coordinates of the midpoint of the column. Now I want to combine a category width, barGap, barCategoryGap, column index and other information to obtain the horizontal pixel coordinates of the column midpoint. If there are multiple categories, the width of a category can be obtained by subtracting the horizontal pixel coordinates of the midpoints of the two categories, but if there is only one category, it cannot be obtained. The following problems exist:

  1. After setting grid.containLabel = true, how to get the width of a category in the histogram
  2. [Example]( https://echarts.apache.org/examples/zh/editor.html?code=PYBwLglsB2AEC8sDeAoWsDmAnCATAXMmurAMYxgCGE0AMpQEYCmanoWFgK5MA0x6LJgDMwhAEwAGYgF8-6MMGAtIIQqhKwOEDBiZZCAckoAPCAG cDckifMAFYDTB61_EmACeIJobMALSrjAAO4GrtIyVoK60ATIssTGAIKmZi4auJRUhADaAEQAsjC5PLC5ACrcxaUA6ky4VeW-nA0AYjgNAMqZnZzQuQC6EcTuyeZq8ehmehBMqbDZ6iTQlAC23qVdg sWuHl6EuQyUWNvpmZQ5AKwlkiUAzABsJQCMEs-vsDewACyD6BNEGmWa32AGFKFsrPJPOsDkcTiQMll5l9riUvu90Xd3mIxM9frBpINwigVu4Qf4sGAAHQwAAUBlILAgpAA1pZYAYpjhZuzaUwAG 5MaBgACUCAAfACyDAzEomFSWMAMHzBcKRcRyNAzGBkFyZmYAHKrXiwPWzACSMSYxhKQPWSRSADVwdwSvyXesRk6PQSELABUKwBqZTqQBBjKw_aTyUdqZrBZSysBbOHWLSkKbpharcYCSVsg7zM6WK7YF 6ix7-ur0JrtbAhBAsNraMIdYhoxS4zAE2AkymIyx04WzJbcNbCBJZBzCtADNXpVqdVNNbgWyIo2TO1T43pe8nU4OkMPR-PYJOSgYKkw58Rg1q5QqlbSwwOSg2m2A12ASsuYKvWz-TAr l-AC077Nq26rSCKQA&_source=echarts-doc-preview) How to get the width of a tooltip shadow

What does the proposed API look like?

How to get the width of a category of the histogram after setting grid.containLabel = true

n3h0vuf2

n3h0vuf22#

目前好像做不到这点,而且我也想不出一个简单的方式功能提供这一信息

相关问题