Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
z1593
incubator-echarts
提交
fdda0254
I
incubator-echarts
项目概览
z1593
/
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,发现更多精彩内容 >>
未验证
提交
fdda0254
编写于
3月 23, 2023
作者:
T
Tommy
提交者:
GitHub
3月 23, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(sankey): provide missing label value in formatter #18212
上级
b84493a7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
102 addition
and
3 deletion
+102
-3
src/chart/sankey/SankeyView.ts
src/chart/sankey/SankeyView.ts
+1
-0
src/label/labelStyle.ts
src/label/labelStyle.ts
+3
-3
test/sankey-labelValue.html
test/sankey-labelValue.html
+98
-0
未找到文件。
src/chart/sankey/SankeyView.ts
浏览文件 @
fdda0254
...
...
@@ -275,6 +275,7 @@ class SankeyView extends ChartView {
{
labelFetcher
:
seriesModel
,
labelDataIndex
:
node
.
dataIndex
,
labelValue
:
layout
.
value
,
defaultText
:
node
.
id
}
);
...
...
src/label/labelStyle.ts
浏览文件 @
fdda0254
...
...
@@ -94,6 +94,7 @@ interface SetLabelStyleOpt<TLabelDataIndex> extends TextCommonParams {
};
labelDataIndex
?:
TLabelDataIndex
;
labelDimIndex
?:
number
;
labelValue
?:
number
;
/**
* Inject a setter of text for the text animation case.
...
...
@@ -135,6 +136,7 @@ function getLabelText<TLabelDataIndex>(
const
labelFetcher
=
opt
.
labelFetcher
;
const
labelDataIndex
=
opt
.
labelDataIndex
;
const
labelDimIndex
=
opt
.
labelDimIndex
;
const
labelValue
=
opt
.
labelValue
;
const
normalModel
=
stateModels
.
normal
;
let
baseText
;
if
(
labelFetcher
)
{
...
...
@@ -143,9 +145,7 @@ function getLabelText<TLabelDataIndex>(
null
,
labelDimIndex
,
normalModel
&&
normalModel
.
get
(
'
formatter
'
),
interpolatedValue
!=
null
?
{
interpolatedValue
:
interpolatedValue
}
:
null
{
interpolatedValue
:
retrieve2
(
interpolatedValue
,
labelValue
)}
);
}
if
(
baseText
==
null
)
{
...
...
test/sankey-labelValue.html
0 → 100644
浏览文件 @
fdda0254
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<script
src=
"lib/simpleRequire.js"
></script>
<script
src=
"lib/config.js"
></script>
</head>
<body>
<style>
html
,
body
,
#main
{
margin
:
0
;
width
:
100%
;
height
:
100vh
;
}
</style>
<div
id=
"main"
></div>
<script>
require
([
'
echarts
'
],
function
(
echarts
)
{
var
chart
=
echarts
.
init
(
document
.
querySelector
(
"
#main
"
),
'
dark
'
);
window
.
onresize
=
chart
.
resize
;
const
sankeyData
=
[
{
source
:
'
EasyGrid Energy
'
,
target
:
'
Chip Industry
'
,
value
:
860
},
{
source
:
'
EasyGrid Energy
'
,
target
:
'
Industrial Internet
'
,
value
:
1600
},
{
source
:
'
EG Green Energy
'
,
target
:
'
Chip Industry
'
,
value
:
2600
},
{
source
:
'
EG Green Energy
'
,
target
:
'
IOT
'
,
value
:
500
},
{
source
:
'
Industrial Internet
'
,
target
:
'
IOT
'
,
value
:
800
},
{
source
:
'
Industrial Internet
'
,
target
:
'
Intelligent Manufacturing
'
,
value
:
600
},
{
source
:
'
Chip Industry
'
,
target
:
'
Chip Manufacturing
'
,
value
:
1600
},
{
source
:
'
Chip Industry
'
,
target
:
'
Chip Package
'
,
value
:
1200
},
{
source
:
'
Chip Industry
'
,
target
:
'
Chip Design
'
,
value
:
600
},
{
source
:
'
Chip Manufacturing
'
,
target
:
'
5mm
'
,
value
:
600
},
{
source
:
'
Chip Manufacturing
'
,
target
:
'
10mm
'
,
value
:
500
},
{
source
:
'
Chip Manufacturing
'
,
target
:
'
15mm
'
,
value
:
500
}
];
var
option
=
{
title
:
{
text
:
'
The values of Label and Tooltip are the same
'
,
padding
:
20
},
series
:
[{
type
:
'
sankey
'
,
layout
:
'
none
'
,
lineStyle
:
{
color
:
'
gradient
'
,
curveness
:
0.5
},
emphasis
:
{
focus
:
'
adjacency
'
},
data
:
getNames
(),
links
:
sankeyData
}],
tooltip
:
{
trigger
:
'
item
'
,
triggerOn
:
'
mousemove
'
},
label
:
{
formatter
:
(
params
)
=>
{
return
params
.
name
+
'
'
+
params
.
value
+
'
kW·h
'
;
}
}
};
chart
.
setOption
(
option
);
function
getNames
()
{
return
sankeyData
.
reduce
((
names
,
item
)
=>
{
if
(
-
1
==
names
.
indexOf
(
item
.
source
))
{
names
.
push
(
item
.
source
);
}
if
(
-
1
==
names
.
indexOf
(
item
.
target
))
{
names
.
push
(
item
.
target
);
}
return
names
;
},
[]).
map
(
item
=>
{
return
{
name
:
item
}});
}
});
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录