Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
da6d0409
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 搜索 >>
提交
da6d0409
编写于
4月 06, 2021
作者:
O
Ovilia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(legend): fix line series icon
上级
c125b4a4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
30 deletion
+34
-30
src/chart/line/LineSeries.ts
src/chart/line/LineSeries.ts
+19
-16
src/component/legend/LegendModel.ts
src/component/legend/LegendModel.ts
+7
-0
src/component/legend/LegendView.ts
src/component/legend/LegendView.ts
+8
-14
未找到文件。
src/chart/line/LineSeries.ts
浏览文件 @
da6d0409
...
...
@@ -217,24 +217,27 @@ class LineSeriesModel extends SeriesModel<LineSeriesOption> {
getLegendIcon
(
opt
:
LegendSymbolParams
):
ECSymbol
|
Group
{
const
group
=
new
Group
();
// Line
const
line
=
createSymbol
(
'
line
'
,
0
,
opt
.
itemHeight
/
2
,
opt
.
itemWidth
,
0
,
opt
.
lineStyle
.
stroke
,
false
);
group
.
add
(
line
);
// 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
);
}
line
.
setStyle
(
opt
.
lineStyle
);
const
visualType
=
opt
.
series
.
getData
().
getVisual
(
'
symbol
'
);
const
symbolType
=
opt
.
legendIconType
||
(
visualType
===
'
none
'
?
'
circle
'
:
visualType
);
// Symbol in the center
const
symbolType
=
opt
.
symbolType
||
opt
.
series
.
getData
().
getVisual
(
'
symbol
'
);
const
size
=
opt
.
itemHeight
*
0.8
;
// Symbol size is 80% when there is a line
const
size
=
opt
.
itemHeight
*
(
opt
.
legendIconType
?
1
:
0.8
);
const
symbol
=
createSymbol
(
symbolType
,
(
opt
.
itemWidth
-
size
)
/
2
,
...
...
src/component/legend/LegendModel.ts
浏览文件 @
da6d0409
...
...
@@ -143,7 +143,14 @@ 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
浏览文件 @
da6d0409
...
...
@@ -27,7 +27,7 @@ import {setLabelStyle, createTextStyle} from '../../label/labelStyle';
import
{
makeBackground
}
from
'
../helper/listComponent
'
;
import
*
as
layoutUtil
from
'
../../util/layout
'
;
import
ComponentView
from
'
../../view/Component
'
;
import
LegendModel
,
{
LegendItemStyleOption
,
LegendLineStyleOption
,
LegendOption
,
LegendSelectorButtonOption
,
LegendTooltipFormatterParams
}
from
'
./LegendModel
'
;
import
LegendModel
,
{
LegendItemStyleOption
,
LegendLineStyleOption
,
LegendOption
,
LegendSelectorButtonOption
,
Legend
SymbolParams
,
Legend
TooltipFormatterParams
}
from
'
./LegendModel
'
;
import
GlobalModel
from
'
../../model/Global
'
;
import
ExtensionAPI
from
'
../../core/ExtensionAPI
'
;
import
{
...
...
@@ -343,8 +343,8 @@ class LegendView extends ComponentView {
const
isSelected
=
legendModel
.
isSelected
(
name
);
const
symbolKeepAspect
=
itemModel
.
get
(
'
symbolKeepAspect
'
);
const
legend
SymbolType
=
itemModel
.
get
(
'
icon
'
)
||
symbolType
;
symbolType
=
legend
S
ymbolType
||
'
roundRect
'
;
const
legend
IconType
=
itemModel
.
get
(
'
icon
'
)
;
symbolType
=
legend
IconType
||
s
ymbolType
||
'
roundRect
'
;
const
legendLineStyle
=
legendModel
.
getModel
(
'
lineStyle
'
);
const
style
=
getLegendStyle
(
symbolType
,
itemModel
,
legendLineStyle
,
lineVisualStyle
,
itemVisualStyle
,
drawType
,
isSelected
);
...
...
@@ -359,7 +359,8 @@ class LegendView extends ComponentView {
series
:
seriesModel
,
itemWidth
,
itemHeight
,
symbolType
:
legendSymbolType
,
symbolType
,
legendIconType
:
legendIconType
,
symbolKeepAspect
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
...
...
@@ -371,7 +372,8 @@ class LegendView extends ComponentView {
series
:
seriesModel
,
itemWidth
,
itemHeight
,
symbolType
:
symbolType
||
'
roundRect
'
,
symbolType
,
legendIconType
,
symbolKeepAspect
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
...
...
@@ -629,15 +631,7 @@ function getLegendStyle(
return
{
itemStyle
,
lineStyle
};
}
function
getDefaultLegendIcon
(
opt
:
{
series
:
SeriesModel
,
itemWidth
:
number
,
itemHeight
:
number
,
symbolType
:
string
,
symbolKeepAspect
:
boolean
,
itemStyle
:
PathStyleProps
,
lineStyle
:
LineStyleProps
}):
ECSymbol
{
function
getDefaultLegendIcon
(
opt
:
LegendSymbolParams
):
ECSymbol
{
const
symboType
=
opt
.
symbolType
||
'
roundRect
'
;
const
symbol
=
createSymbol
(
symboType
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录