Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
c3cc56d0
I
incubator-echarts
项目概览
x649585723
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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 搜索 >>
提交
c3cc56d0
编写于
7月 13, 2020
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact(sunburst): forward sunburstHighlight action to general highlight action
上级
93148887
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
34 deletion
+43
-34
src/chart/sunburst/SunburstView.ts
src/chart/sunburst/SunburstView.ts
+0
-14
src/chart/sunburst/sunburstAction.ts
src/chart/sunburst/sunburstAction.ts
+22
-16
test/sunburst-highlight.html
test/sunburst-highlight.html
+21
-4
未找到文件。
src/chart/sunburst/SunburstView.ts
浏览文件 @
c3cc56d0
...
...
@@ -78,20 +78,6 @@ class SunburstView extends ChartView {
renderRollUp
(
virtualRoot
,
newRoot
);
if
(
payload
&&
payload
.
highlight
&&
payload
.
highlight
.
piece
)
{
const
highlightPolicy
=
seriesModel
.
getShallow
(
'
highlightPolicy
'
);
payload
.
highlight
.
piece
.
onEmphasis
(
highlightPolicy
);
}
else
if
(
payload
&&
payload
.
unhighlight
)
{
let
piece
=
this
.
virtualPiece
;
if
(
!
piece
&&
virtualRoot
.
children
.
length
)
{
piece
=
virtualRoot
.
children
[
0
].
piece
;
}
if
(
piece
)
{
piece
.
onNormal
();
}
}
this
.
_initEvents
();
this
.
_oldChildren
=
newChildren
;
...
...
src/chart/sunburst/sunburstAction.ts
浏览文件 @
c3cc56d0
...
...
@@ -26,6 +26,9 @@ import * as helper from '../helper/treeHelper';
import
SunburstSeriesModel
from
'
./SunburstSeries
'
;
import
{
Payload
}
from
'
../../util/types
'
;
import
GlobalModel
from
'
../../model/Global
'
;
import
ExtensionAPI
from
'
../../ExtensionAPI
'
;
import
{
extend
}
from
'
zrender/src/core/util
'
;
import
{
deprecateLog
}
from
'
../../preprocessor/helper/compatStyle
'
;
export
const
ROOT_TO_NODE_ACTION
=
'
sunburstRootToNode
'
;
...
...
@@ -61,22 +64,29 @@ const HIGHLIGHT_ACTION = 'sunburstHighlight';
interface
SunburstHighlightPayload
extends
Payload
{}
echarts
.
registerAction
(
{
type
:
HIGHLIGHT_ACTION
,
update
:
'
updateView
'
},
function
(
payload
:
SunburstHighlightPayload
,
ecModel
:
GlobalModel
)
{
{
type
:
HIGHLIGHT_ACTION
,
update
:
'
none
'
},
function
(
payload
:
SunburstHighlightPayload
,
ecModel
:
GlobalModel
,
api
:
ExtensionAPI
)
{
// Clone
payload
=
extend
({},
payload
);
ecModel
.
eachComponent
(
{
mainType
:
'
series
'
,
subType
:
'
sunburst
'
,
query
:
payload
},
handleHighlight
);
function
handleHighlight
(
model
:
SunburstSeriesModel
,
index
:
number
)
{
function
handleHighlight
(
model
:
SunburstSeriesModel
)
{
const
targetInfo
=
helper
.
retrieveTargetInfo
(
payload
,
[
HIGHLIGHT_ACTION
],
model
);
if
(
targetInfo
)
{
payload
.
highlight
=
targetInfo
.
node
;
payload
.
dataIndex
=
targetInfo
.
node
.
dataIndex
;
}
}
deprecateLog
(
'
Use `highlight` action instead of `sunburstHighlight`
'
);
// Fast forward action
api
.
dispatchAction
(
extend
(
payload
,
{
type
:
'
highlight
'
}));
}
);
...
...
@@ -87,15 +97,11 @@ interface SunburstUnhighlightPayload extends Payload {}
echarts
.
registerAction
(
{
type
:
UNHIGHLIGHT_ACTION
,
update
:
'
updateView
'
},
function
(
payload
:
SunburstUnhighlightPayload
,
ecModel
:
GlobalModel
)
{
ecModel
.
eachComponent
(
{
mainType
:
'
series
'
,
subType
:
'
sunburst
'
,
query
:
payload
},
handleUnhighlight
);
function
handleUnhighlight
(
model
:
SunburstSeriesModel
,
index
:
number
)
{
payload
.
unhighlight
=
true
;
}
function
(
payload
:
SunburstUnhighlightPayload
,
ecModel
:
GlobalModel
,
api
:
ExtensionAPI
)
{
payload
=
extend
({},
payload
);
deprecateLog
(
'
Use `downplay` action instead of `sunburstUnhighlight`
'
);
api
.
dispatchAction
(
extend
(
payload
,
{
type
:
'
downplay
'
}));
}
);
test/sunburst-highlight.html
浏览文件 @
c3cc56d0
...
...
@@ -32,8 +32,17 @@ under the License.
/* background-image: url(old_mathematics.png); */
/* background-repeat: repeat; */
}
#toolbar
{
position
:
absolute
;
left
:
10px
;
top
:
10px
;
}
</style>
<div
id=
"main"
></div>
<div
id=
"toolbar"
>
<button
id=
"highlight"
>
Highlight
</button>
<button
id=
"downplay"
>
Downplay
</button>
</div>
<script>
var
chart
;
require
([
...
...
@@ -105,10 +114,18 @@ under the License.
chart
.
setOption
(
option
);
chart
.
dispatchAction
({
type
:
'
sunburstHighlight
'
,
targetNodeId
:
'
target
'
});
document
.
querySelector
(
'
#highlight
'
).
onclick
=
function
()
{
chart
.
dispatchAction
({
type
:
'
sunburstHighlight
'
,
targetNodeId
:
'
target
'
});
}
document
.
querySelector
(
'
#downplay
'
).
onclick
=
function
()
{
chart
.
dispatchAction
({
type
:
'
sunburstUnhighlight
'
,
targetNodeId
:
'
target
'
});
}
});
</script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录