Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
3966af83
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,发现更多精彩内容 >>
提交
3966af83
编写于
4月 07, 2021
作者:
O
Ovilia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(legend): render legend in legendView when icon is defined
上级
da6d0409
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
30 deletion
+17
-30
src/chart/line/LineSeries.ts
src/chart/line/LineSeries.ts
+14
-20
src/component/legend/LegendModel.ts
src/component/legend/LegendModel.ts
+0
-5
src/component/legend/LegendView.ts
src/component/legend/LegendView.ts
+3
-5
未找到文件。
src/chart/line/LineSeries.ts
浏览文件 @
3966af83
...
...
@@ -39,10 +39,8 @@ import {
import
List
from
'
../../data/List
'
;
import
type
Cartesian2D
from
'
../../coord/cartesian/Cartesian2D
'
;
import
type
Polar
from
'
../../coord/polar/Polar
'
;
import
{
PathStyleProps
}
from
'
zrender/src/graphic/Path
'
;
import
{
createSymbol
,
ECSymbol
}
from
'
../../util/symbol
'
;
import
{
Group
}
from
'
../../util/graphic
'
;
import
{
LineStyleProps
}
from
'
../../model/mixin/lineStyle
'
;
import
{
LegendSymbolParams
}
from
'
../../component/legend/LegendModel
'
;
type
LineDataValue
=
OptionDataValue
|
OptionDataValue
[];
...
...
@@ -217,27 +215,23 @@ class LineSeriesModel extends SeriesModel<LineSeriesOption> {
getLegendIcon
(
opt
:
LegendSymbolParams
):
ECSymbol
|
Group
{
const
group
=
new
Group
();
// Draw line only if legend.icon is not defined
if
(
!
opt
.
legendIconType
)
{
const
line
=
createSymbol
(
'
line
'
,
0
,
opt
.
itemHeight
/
2
,
opt
.
itemWidth
,
0
,
opt
.
lineStyle
.
stroke
,
false
);
group
.
add
(
line
);
line
.
setStyle
(
opt
.
lineStyle
);
}
const
line
=
createSymbol
(
'
line
'
,
0
,
opt
.
itemHeight
/
2
,
opt
.
itemWidth
,
0
,
opt
.
lineStyle
.
stroke
,
false
);
group
.
add
(
line
);
line
.
setStyle
(
opt
.
lineStyle
);
const
visualType
=
opt
.
series
.
getData
().
getVisual
(
'
symbol
'
);
const
symbolType
=
opt
.
legendIconType
||
(
visualType
===
'
none
'
?
'
circle
'
:
visualType
);
const
visualType
=
this
.
getData
().
getVisual
(
'
symbol
'
);
const
symbolType
=
visualType
===
'
none
'
?
'
circle
'
:
visualType
;
// Symbol size is 80% when there is a line
const
size
=
opt
.
itemHeight
*
(
opt
.
legendIconType
?
1
:
0.8
)
;
const
size
=
opt
.
itemHeight
*
0.8
;
const
symbol
=
createSymbol
(
symbolType
,
(
opt
.
itemWidth
-
size
)
/
2
,
...
...
src/component/legend/LegendModel.ts
浏览文件 @
3966af83
...
...
@@ -140,17 +140,12 @@ export interface LegendTooltipFormatterParams {
}
export
interface
LegendSymbolParams
{
series
:
SeriesModel
,
itemWidth
:
number
,
itemHeight
:
number
,
/**
* symbolType is from legend.icon, legend.data.icon, or series visual
*/
symbolType
:
string
,
/**
* legendIconType is from legend.icon or legend.data.icon
*/
legendIconType
:
string
,
symbolKeepAspect
:
boolean
,
itemStyle
:
PathStyleProps
,
lineStyle
:
LineStyleProps
...
...
src/component/legend/LegendView.ts
浏览文件 @
3966af83
...
...
@@ -353,14 +353,14 @@ class LegendView extends ComponentView {
const
textStyleModel
=
itemModel
.
getModel
(
'
textStyle
'
);
if
(
typeof
seriesModel
.
getLegendIcon
===
'
function
'
)
{
if
(
typeof
seriesModel
.
getLegendIcon
===
'
function
'
&&
!
legendIconType
)
{
// Series has specific way to define legend icon
itemGroup
.
add
(
seriesModel
.
getLegendIcon
({
series
:
seriesModel
,
itemWidth
,
itemHeight
,
symbolType
,
legendIconType
:
legendIconType
,
symbolKeepAspect
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
...
...
@@ -369,11 +369,9 @@ class LegendView extends ComponentView {
else
{
// Use default legend icon policy for most series
itemGroup
.
add
(
getDefaultLegendIcon
({
series
:
seriesModel
,
itemWidth
,
itemHeight
,
symbolType
,
legendIconType
,
symbolKeepAspect
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录