Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
ca0ed029
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
incubator-echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ca0ed029
编写于
8月 15, 2019
作者:
S
sushuang
提交者:
Yi Shen
8月 19, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enhance the approach of interpretation of textPosition 'inside' for some custom shape like 'pin'.
上级
952b196c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
9 deletion
+66
-9
src/util/symbol.js
src/util/symbol.js
+8
-9
test/hoverStyle.html
test/hoverStyle.html
+58
-0
未找到文件。
src/util/symbol.js
浏览文件 @
ca0ed029
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
*
as
graphic
from
'
./graphic
'
;
import
*
as
graphic
from
'
./graphic
'
;
import
BoundingRect
from
'
zrender/src/core/BoundingRect
'
;
import
BoundingRect
from
'
zrender/src/core/BoundingRect
'
;
import
{
interpretTextPosition
}
from
'
zrender/src/contain/text
'
;
/**
/**
* Triangle shape
* Triangle shape
...
@@ -269,21 +270,19 @@ var SymbolClz = graphic.extendShape({
...
@@ -269,21 +270,19 @@ var SymbolClz = graphic.extendShape({
height
:
0
height
:
0
},
},
beforeBrush
:
function
(
)
{
interpretTextPosition
(
out
,
style
,
rect
)
{
var
style
=
this
.
style
;
var
res
=
interpretTextPosition
(
out
,
style
,
rect
)
;
var
shape
=
this
.
shape
;
var
shape
=
this
.
shape
;
// FIXME
if
(
shape
&&
shape
.
symbolType
===
'
pin
'
&&
style
.
textPosition
===
'
inside
'
)
{
if
(
shape
.
symbolType
===
'
pin
'
&&
style
.
textPosition
===
'
inside
'
)
{
res
.
y
=
rect
.
y
+
rect
.
height
*
0.4
;
style
.
textPosition
=
[
'
50%
'
,
'
40%
'
];
style
.
textAlign
=
'
center
'
;
style
.
textVerticalAlign
=
'
middle
'
;
}
}
return
res
;
},
},
buildPath
:
function
(
ctx
,
shape
,
inBundle
)
{
buildPath
:
function
(
ctx
,
shape
,
inBundle
)
{
var
symbolType
=
shape
.
symbolType
;
var
symbolType
=
shape
.
symbolType
;
var
proxySymbol
=
symbolBuildProxies
[
symbolType
];
if
(
symbolType
!==
'
none
'
)
{
if
(
shape
.
symbolType
!==
'
none
'
)
{
var
proxySymbol
=
symbolBuildProxies
[
symbolType
];
if
(
!
proxySymbol
)
{
if
(
!
proxySymbol
)
{
// Default rect
// Default rect
symbolType
=
'
rect
'
;
symbolType
=
'
rect
'
;
...
...
test/hoverStyle.html
浏览文件 @
ca0ed029
...
@@ -54,6 +54,7 @@ under the License.
...
@@ -54,6 +54,7 @@ under the License.
<div
id=
"info"
></div>
<div
id=
"info"
></div>
<div
id=
"maina1"
></div>
<div
id=
"mainb1"
></div>
<div
id=
"mainb1"
></div>
<div
id=
"mainb2"
></div>
<div
id=
"mainb2"
></div>
<div
id=
"mainb3"
></div>
<div
id=
"mainb3"
></div>
...
@@ -151,6 +152,57 @@ under the License.
...
@@ -151,6 +152,57 @@ under the License.
<script>
var
option
;
require
([
'
echarts
'
],
function
(
echarts
)
{
var
option
=
{
hoverLayerThreshold
:
hoverLayerThreshold
,
xAxis
:
{
axisLine
:
{
show
:
false
},
axisTick
:
{
show
:
false
},
splitLine
:
{
show
:
false
},
axisLabel
:
{
show
:
false
}
},
yAxis
:
{
axisLine
:
{
show
:
false
},
axisTick
:
{
show
:
false
},
splitLine
:
{
show
:
false
},
axisLabel
:
{
show
:
false
}
},
series
:
{
type
:
'
line
'
,
markPoint
:
{
data
:
[{
type
:
'
max
'
,
name
:
'
a
'
}]
},
data
:
[[
12
,
34
]]
}
};
var
chart
=
testHelper
.
create
(
echarts
,
'
maina1
'
,
{
option
:
option
,
height
:
150
,
title
:
[
'
Only a pin displayed
'
,
'
The text of the "pin" should be **inside**
'
,
'
Hover "pin", should be normal
'
]
});
});
</script>
<script>
<script>
require
([
'
echarts
'
],
function
(
echarts
)
{
require
([
'
echarts
'
],
function
(
echarts
)
{
...
@@ -968,5 +1020,11 @@ under the License.
...
@@ -968,5 +1020,11 @@ under the License.
</body>
</body>
</html>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录