ecomfe / zrender

A lightweight graphic library providing 2d draw for Apache ECharts

Home Page:https://ecomfe.github.io/zrender-doc/public/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

无法在rect中显示文字

marvinzq opened this issue · comments

我写了一个非常简单的例子,用来生成一个rect并显示文字。但是文字并不显示。代码如下,直接写在了index.html里。

image

显示效果是这样的
image

我后续尝试了直接创建text,能够创建,但是不论我怎么设置textPosition,textRect,textOffset
文字显示的位置均在左上角,不会显示在指定位置

这是我使用的版本,"zrender": "^5.5.0"
npm install后将dist中的js拷贝使用,开发版和发布版的js均是一样的问题。
这个问题是如此的基础,我反反复复的核对了2个小时代码,尝试各种环境,均无果才来提问

天呀,当我将版本回退, "zrender": "^4.3.2",一切都正常了。我真不敢相信最新版本中像显示文字这样基本的功能都是不好使的!!!

从 5.0.0 开始用法有变化,需要改用 textContent 和 textConfig。参见这个例子