Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
11d3a50f
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 搜索 >>
提交
11d3a50f
编写于
7月 15, 2020
作者:
S
susiwen8
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tooltip unified function
上级
76c645bc
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
28 addition
and
27 deletion
+28
-27
src/chart/map/MapSeries.ts
src/chart/map/MapSeries.ts
+2
-2
src/chart/radar/RadarSeries.ts
src/chart/radar/RadarSeries.ts
+3
-3
src/chart/sankey/SankeySeries.ts
src/chart/sankey/SankeySeries.ts
+5
-8
src/chart/themeRiver/ThemeRiverSeries.ts
src/chart/themeRiver/ThemeRiverSeries.ts
+6
-2
src/chart/tree/TreeSeries.ts
src/chart/tree/TreeSeries.ts
+3
-4
src/chart/treemap/TreemapSeries.ts
src/chart/treemap/TreemapSeries.ts
+2
-2
src/component/marker/MarkerModel.ts
src/component/marker/MarkerModel.ts
+2
-5
src/model/Series.ts
src/model/Series.ts
+1
-1
src/util/format.ts
src/util/format.ts
+4
-0
未找到文件。
src/chart/map/MapSeries.ts
浏览文件 @
11d3a50f
...
...
@@ -21,7 +21,7 @@
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
createListSimply
from
'
../helper/createListSimply
'
;
import
SeriesModel
from
'
../../model/Series
'
;
import
{
encodeHTML
,
addCommas
}
from
'
../../util/format
'
;
import
{
encodeHTML
,
addCommas
,
concatTooltipHtml
}
from
'
../../util/format
'
;
import
{
DataSelectableMixin
,
DataSelectableOptionMixin
,
SelectableTarget
}
from
'
../../component/helper/selectableMixin
'
;
import
{
retrieveRawAttr
}
from
'
../../data/helper/dataProvider
'
;
import
geoSourceManager
from
'
../../coord/geo/geoSourceManager
'
;
...
...
@@ -223,7 +223,7 @@ class MapSeries extends SeriesModel<MapSeriesOption> {
}
return
seriesNames
.
join
(
'
,
'
)
+
'
<br />
'
+
encodeHTML
(
name
+
'
:
'
+
formattedValue
);
+
concatTooltipHtml
(
encodeHTML
(
name
),
formattedValue
);
}
getTooltipPosition
=
function
(
this
:
MapSeries
,
dataIndex
:
number
):
number
[]
{
...
...
src/chart/radar/RadarSeries.ts
浏览文件 @
11d3a50f
...
...
@@ -20,7 +20,7 @@
import
SeriesModel
from
'
../../model/Series
'
;
import
createListSimply
from
'
../helper/createListSimply
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
{
encodeHTML
,
concatTooltipHtml
}
from
'
../../util/format
'
;
import
LegendVisualProvider
from
'
../../visual/LegendVisualProvider
'
;
import
{
SeriesOption
,
...
...
@@ -113,8 +113,8 @@ class RadarSeriesModel extends SeriesModel<RadarSeriesOption> {
return
encodeHTML
(
name
===
''
?
this
.
name
:
name
)
+
'
<br/>
'
+
zrUtil
.
map
(
indicatorAxes
,
function
(
axis
,
idx
)
{
const
val
=
data
.
get
(
data
.
mapDimension
(
axis
.
dim
),
dataIndex
);
return
'
<p style="margin: 8px 0 0;">
'
+
encodeHTML
(
axis
.
name
)
+
`<strong style="float:right;margin-left:20px;color:#000;">
${
val
}
</strong>`
return
'
<p style="margin: 8px 0 0;">
'
+
concatTooltipHtml
(
encodeHTML
(
axis
.
name
),
val
)
+
'
</p>
'
;
}).
join
(
''
);
}
...
...
src/chart/sankey/SankeySeries.ts
浏览文件 @
11d3a50f
...
...
@@ -19,7 +19,7 @@
import
SeriesModel
from
'
../../model/Series
'
;
import
createGraphFromNodeEdge
from
'
../helper/createGraphFromNodeEdge
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
{
encodeHTML
,
concatTooltipHtml
}
from
'
../../util/format
'
;
import
Model
from
'
../../model/Model
'
;
import
{
__DEV__
}
from
'
../../config
'
;
import
{
...
...
@@ -238,18 +238,15 @@ class SankeySeriesModel extends SeriesModel<SankeySeriesOption> {
if
(
dataType
===
'
edge
'
)
{
const
params
=
this
.
getDataParams
(
dataIndex
,
dataType
);
const
rawDataOpt
=
params
.
data
;
let
html
=
rawDataOpt
.
source
+
'
--
'
+
rawDataOpt
.
target
;
if
(
params
.
value
)
{
html
+=
'
:
'
+
params
.
value
;
}
return
encodeHTML
(
html
);
const
html
=
encodeHTML
(
rawDataOpt
.
source
+
'
--
'
+
rawDataOpt
.
target
);
return
concatTooltipHtml
(
html
,
params
.
value
||
''
);
}
else
if
(
dataType
===
'
node
'
)
{
const
node
=
this
.
getGraph
().
getNodeByIndex
(
dataIndex
);
const
value
=
node
.
getLayout
().
value
;
const
name
=
this
.
getDataParams
(
dataIndex
,
dataType
).
data
.
name
;
const
html
=
value
?
name
+
'
:
'
+
value
:
''
;
return
encodeHTML
(
html
);
const
html
=
encodeHTML
(
value
?
name
:
''
)
;
return
concatTooltipHtml
(
html
,
value
||
''
);
}
return
super
.
formatTooltip
(
dataIndex
,
multipleSeries
);
}
...
...
src/chart/themeRiver/ThemeRiverSeries.ts
浏览文件 @
11d3a50f
...
...
@@ -23,7 +23,7 @@ import {getDimensionTypeByAxis} from '../../data/helper/dimensionHelper';
import
List
from
'
../../data/List
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
{
groupData
}
from
'
../../util/model
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
{
encodeHTML
,
concatTooltipHtml
}
from
'
../../util/format
'
;
import
LegendVisualProvider
from
'
../../visual/LegendVisualProvider
'
;
import
{
SeriesOption
,
...
...
@@ -308,7 +308,11 @@ class ThemeRiverSeriesModel extends SeriesModel<ThemeRiverSeriesOption> {
if
(
isNaN
(
htmlValue
as
number
)
||
htmlValue
==
null
)
{
htmlValue
=
'
-
'
;
}
return
encodeHTML
(
htmlName
+
'
:
'
+
htmlValue
);
return
`
<p style="margin: 8px 0 0;">
${
concatTooltipHtml
(
encodeHTML
(
htmlName
),
htmlValue
)}
</p>
`
;
}
static
defaultOption
:
ThemeRiverSeriesOption
=
{
...
...
src/chart/tree/TreeSeries.ts
浏览文件 @
11d3a50f
...
...
@@ -19,7 +19,7 @@
import
SeriesModel
from
'
../../model/Series
'
;
import
Tree
from
'
../../data/Tree
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
{
encodeHTML
,
concatTooltipHtml
}
from
'
../../util/format
'
;
import
{
SeriesOption
,
SymbolOptionMixin
,
...
...
@@ -230,9 +230,8 @@ class TreeSeriesModel extends SeriesModel<TreeSeriesOption> {
name
=
node
.
parentNode
.
name
+
'
.
'
+
name
;
node
=
node
.
parentNode
;
}
return
encodeHTML
(
name
+
(
(
isNaN
(
value
as
number
)
||
value
==
null
)
?
''
:
'
:
'
+
value
));
return
concatTooltipHtml
(
encodeHTML
(
name
),
(
isNaN
(
value
as
number
)
||
value
==
null
)
?
''
:
value
);
}
static
defaultOption
:
TreeSeriesOption
=
{
...
...
src/chart/treemap/TreemapSeries.ts
浏览文件 @
11d3a50f
...
...
@@ -21,7 +21,7 @@ import * as zrUtil from 'zrender/src/core/util';
import
SeriesModel
from
'
../../model/Series
'
;
import
Tree
,
{
TreeNode
}
from
'
../../data/Tree
'
;
import
Model
from
'
../../model/Model
'
;
import
{
encodeHTML
,
addCommas
}
from
'
../../util/format
'
;
import
{
encodeHTML
,
addCommas
,
concatTooltipHtml
}
from
'
../../util/format
'
;
import
{
wrapTreePathInfo
}
from
'
../helper/treeHelper
'
;
import
{
SeriesOption
,
...
...
@@ -387,7 +387,7 @@ class TreemapSeriesModel extends SeriesModel<TreemapSeriesOption> {
?
addCommas
(
value
[
0
]
as
number
)
:
addCommas
(
value
as
number
);
const
name
=
data
.
getName
(
dataIndex
);
return
encodeHTML
(
name
+
'
:
'
+
formattedValue
);
return
concatTooltipHtml
(
encodeHTML
(
name
),
formattedValue
);
}
/**
...
...
src/component/marker/MarkerModel.ts
浏览文件 @
11d3a50f
...
...
@@ -20,7 +20,7 @@
import
{
__DEV__
}
from
'
../../config
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
env
from
'
zrender/src/core/env
'
;
import
*
as
formatUtil
from
'
../../util/format
'
;
import
{
addCommas
,
encodeHTML
,
concatTooltipHtml
}
from
'
../../util/format
'
;
import
DataFormatMixin
from
'
../../model/mixin/dataFormat
'
;
import
ComponentModel
from
'
../../model/Component
'
;
import
SeriesModel
from
'
../../model/Series
'
;
...
...
@@ -37,9 +37,6 @@ import GlobalModel from '../../model/Global';
import
List
from
'
../../data/List
'
;
import
{
makeInner
,
defaultEmphasis
}
from
'
../../util/model
'
;
const
addCommas
=
formatUtil
.
addCommas
;
const
encodeHTML
=
formatUtil
.
encodeHTML
;
function
fillLabel
(
opt
:
DisplayStateHostOption
)
{
defaultEmphasis
(
opt
,
'
label
'
,
[
'
show
'
]);
}
...
...
@@ -218,7 +215,7 @@ abstract class MarkerModel<Opts extends MarkerOption = MarkerOption> extends Com
}
}
if
(
value
!=
null
)
{
html
+=
encodeHTML
(
formattedValue
);
html
=
concatTooltipHtml
(
html
,
encodeHTML
(
formattedValue
)
);
}
return
html
;
}
...
...
src/model/Series.ts
浏览文件 @
11d3a50f
...
...
@@ -525,7 +525,7 @@ class SeriesModel<Opt extends SeriesOption = SeriesOption> extends ComponentMode
colorStr
=
typeof
colorEl
===
'
string
'
?
colorEl
:
colorEl
.
content
;
const
html
=
!
multipleSeries
?
seriesName
+
'
<br/>
'
+
'
<p style="margin: 8px 0 0;">
'
+
colorStr
?
seriesName
+
(
seriesName
?
'
<br/>
'
:
''
)
+
'
<p style="margin: 8px 0 0;">
'
+
colorStr
+
(
name
?
`
${
encodeHTML
(
name
)}${
content
}
`
:
content
...
...
src/util/format.ts
浏览文件 @
11d3a50f
...
...
@@ -66,6 +66,10 @@ export function encodeHTML(source: string): string {
});
}
export
function
concatTooltipHtml
(
html
:
string
,
value
:
unknown
):
string
{
return
`
${
html
}
<strong style="float:right;margin-left:20px;color:#000;">
${
value
||
''
}
</strong>`
;
}
const
TPL_VAR_ALIAS
=
[
'
a
'
,
'
b
'
,
'
c
'
,
'
d
'
,
'
e
'
,
'
f
'
,
'
g
'
];
const
wrapVar
=
function
(
varName
:
string
,
seriesIdx
?:
number
):
string
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录