Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
c06dfcf8
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 搜索 >>
提交
c06dfcf8
编写于
3月 24, 2021
作者:
O
Ovilia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WIP(legend): fix legendSymbol
上级
5b10d82e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
42 addition
and
76 deletion
+42
-76
src/chart/bar/install.ts
src/chart/bar/install.ts
+0
-8
src/chart/boxplot/boxplotVisual.ts
src/chart/boxplot/boxplotVisual.ts
+0
-3
src/chart/candlestick/candlestickVisual.ts
src/chart/candlestick/candlestickVisual.ts
+0
-2
src/chart/line/LineSeries.ts
src/chart/line/LineSeries.ts
+4
-3
src/component/legend/LegendView.ts
src/component/legend/LegendView.ts
+38
-60
未找到文件。
src/chart/bar/install.ts
浏览文件 @
c06dfcf8
...
...
@@ -36,14 +36,6 @@ export function install(registers: EChartsExtensionInstallRegisters) {
// only exist in this module, but probably also exist in other modules, like `barPolar`.
registers
.
registerLayout
(
registers
.
PRIORITY
.
VISUAL
.
PROGRESSIVE_LAYOUT
,
largeLayout
);
registers
.
registerVisual
({
seriesType
:
'
bar
'
,
reset
:
function
(
seriesModel
)
{
// Visual coding for legend
seriesModel
.
getData
().
setVisual
(
'
legendSymbol
'
,
'
roundRect
'
);
}
});
// Down sample after filter
registers
.
registerProcessor
(
registers
.
PRIORITY
.
PROCESSOR
.
STATISTIC
,
...
...
src/chart/boxplot/boxplotVisual.ts
浏览文件 @
c06dfcf8
...
...
@@ -22,8 +22,5 @@ import ExtensionAPI from '../../core/ExtensionAPI';
import
BoxplotSeriesModel
from
'
./BoxplotSeries
'
;
export
default
function
boxplotVisual
(
ecModel
:
GlobalModel
,
api
:
ExtensionAPI
)
{
ecModel
.
eachRawSeriesByType
(
'
boxplot
'
,
function
(
seriesModel
:
BoxplotSeriesModel
)
{
seriesModel
.
getData
().
setVisual
(
'
legendSymbol
'
,
'
roundRect
'
);
});
}
\ No newline at end of file
src/chart/candlestick/candlestickVisual.ts
浏览文件 @
c06dfcf8
...
...
@@ -53,8 +53,6 @@ const candlestickVisual: StageHandler = {
const
data
=
seriesModel
.
getData
();
data
.
setVisual
(
'
legendSymbol
'
,
'
roundRect
'
);
// Only visible series has each data be visual encoded
if
(
ecModel
.
isSeriesFiltered
(
seriesModel
))
{
return
;
...
...
src/chart/line/LineSeries.ts
浏览文件 @
c06dfcf8
...
...
@@ -129,7 +129,6 @@ class LineSeriesModel extends SeriesModel<LineSeriesOption> {
coordinateSystem
:
Cartesian2D
|
Polar
;
hasSymbolVisual
=
true
;
legendSymbol
=
'
line
'
;
getInitialData
(
option
:
LineSeriesOption
):
List
{
if
(
__DEV__
)
{
...
...
@@ -240,9 +239,11 @@ class LineSeriesModel extends SeriesModel<LineSeriesOption> {
line
.
setStyle
(
opt
.
lineStyle
);
// Symbol in the center
const
symbolType
=
opt
.
symbolType
||
opt
.
series
.
getData
().
getVisual
(
'
symbol
'
);
const
size
=
opt
.
itemHeight
*
0.8
;
const
symbol
=
createSymbol
(
opt
.
symbolType
,
symbolType
,
(
opt
.
itemWidth
-
size
)
/
2
,
(
opt
.
itemHeight
-
size
)
/
2
,
size
,
...
...
@@ -254,7 +255,7 @@ class LineSeriesModel extends SeriesModel<LineSeriesOption> {
symbol
.
setStyle
(
opt
.
itemStyle
);
if
(
opt
.
symbolType
.
indexOf
(
'
empty
'
)
>
-
1
)
{
if
(
symbolType
.
indexOf
(
'
empty
'
)
>
-
1
)
{
symbol
.
style
.
stroke
=
symbol
.
style
.
fill
;
symbol
.
style
.
fill
=
'
#fff
'
;
}
...
...
src/component/legend/LegendView.ts
浏览文件 @
c06dfcf8
...
...
@@ -207,20 +207,11 @@ class LegendView extends ComponentView {
*/
const
style
=
data
.
getVisual
(
'
style
'
);
// Using rect symbol defaultly
const
legendSymbolType
=
data
.
getVisual
(
'
legendSymbol
'
)
||
'
roundRect
'
;
const
symbolType
=
data
.
getVisual
(
'
symbol
'
);
const
symbolSize
=
data
.
getVisual
(
'
symbolSize
'
);
const
drawType
=
seriesModel
.
visualDrawType
;
data
.
getVisual
(
'
symbolSize
'
);
const
itemGroup
=
this
.
_createItem
(
seriesModel
,
name
,
dataIndex
,
legendItemModel
,
legendModel
,
legendSymbolType
,
symbolType
,
symbolSize
,
itemAlign
,
lineVisualStyle
,
style
,
drawType
,
selectMode
seriesModel
,
name
,
dataIndex
,
legendItemModel
,
legendModel
,
itemAlign
,
lineVisualStyle
,
style
,
selectMode
);
itemGroup
.
on
(
'
click
'
,
curry
(
dispatchSelectAction
,
name
,
null
,
api
,
excludeSeriesId
))
...
...
@@ -257,14 +248,9 @@ class LegendView extends ComponentView {
style
.
fill
=
stringify
(
colorArr
,
'
rgba
'
);
}
const
legendSymbolType
=
'
roundRect
'
;
const
drawType
=
seriesModel
.
visualDrawType
;
const
itemGroup
=
this
.
_createItem
(
seriesModel
,
name
,
dataIndex
,
legendItemModel
,
legendModel
,
legendSymbolType
,
null
,
null
,
itemAlign
,
{},
style
,
drawType
,
selectMode
seriesModel
,
name
,
dataIndex
,
legendItemModel
,
legendModel
,
itemAlign
,
{},
style
,
selectMode
);
// FIXME: consider different series has items with the same name.
...
...
@@ -336,67 +322,58 @@ class LegendView extends ComponentView {
}
private
_createItem
(
seriesModel
:
SeriesModel
,
seriesModel
:
SeriesModel
<
SeriesOption
&
SymbolOptionMixin
>
,
name
:
string
,
dataIndex
:
number
,
itemModel
:
LegendModel
[
'
_data
'
][
number
],
legendModel
:
LegendModel
,
legendSymbolType
:
string
,
dataSymbolType
:
string
,
dataSymbolSize
:
number
|
number
[],
itemAlign
:
LegendOption
[
'
align
'
],
lineVisualStyle
:
LineStyleProps
,
itemVisualStyle
:
PathStyleProps
,
drawType
:
'
fill
'
|
'
stroke
'
,
selectMode
:
LegendOption
[
'
selectedMode
'
]
)
{
const
drawType
=
seriesModel
.
visualDrawType
;
const
itemWidth
=
legendModel
.
get
(
'
itemWidth
'
);
const
itemHeight
=
legendModel
.
get
(
'
itemHeight
'
);
const
isSelected
=
legendModel
.
isSelected
(
name
);
const
symbolKeepAspect
=
itemModel
.
get
(
'
symbolKeepAspect
'
);
const
itemIcon
=
itemModel
.
get
(
'
icon
'
);
let
symbolSize
;
const
legendSymbolSize
=
itemModel
.
get
(
'
symbolSize
'
);
if
(
legendSymbolSize
===
'
auto
'
)
{
// auto: 80% itemHeight if has line, 100% elsewise
const
hasHorizontalLine
=
!
itemIcon
&&
dataSymbolType
&&
((
dataSymbolType
!==
legendSymbolType
)
||
dataSymbolType
===
'
none
'
);
symbolSize
=
hasHorizontalLine
?
itemHeight
*
0.8
:
[
itemWidth
,
itemHeight
];
}
else
if
(
legendSymbolSize
!==
'
inherit
'
)
{
// number: legend.symbolSize
symbolSize
=
legendSymbolSize
;
}
else
{
// inherit: series.symbolSize
symbolSize
=
dataSymbolSize
;
}
dataSymbolType
=
dataSymbolType
||
'
roundRect
'
;
const
data
=
seriesModel
.
getData
();
const
legendSymbolType
=
itemModel
.
get
(
'
icon
'
)
||
data
.
getVisual
(
'
legendSymbol
'
);
const
symbolType
=
legendSymbolType
||
'
roundRect
'
;
const
legendLineStyle
=
legendModel
.
getModel
(
'
lineStyle
'
);
const
style
=
getLegendStyle
(
dataS
ymbolType
,
itemModel
,
legendLineStyle
,
lineVisualStyle
,
itemVisualStyle
,
drawType
,
isSelected
);
const
style
=
getLegendStyle
(
s
ymbolType
,
itemModel
,
legendLineStyle
,
lineVisualStyle
,
itemVisualStyle
,
drawType
,
isSelected
);
const
itemGroup
=
new
Group
();
const
textStyleModel
=
itemModel
.
getModel
(
'
textStyle
'
);
const
getLegendIcon
=
typeof
seriesModel
.
getLegendIcon
===
'
function
'
?
seriesModel
.
getLegendIcon
:
getDefaultLegendIcon
;
itemGroup
.
add
(
getLegendIcon
({
series
:
seriesModel
,
itemWidth
,
itemHeight
,
symbolType
:
dataSymbolType
||
'
roundRect
'
,
symbolKeepAspect
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
}));
if
(
typeof
seriesModel
.
getLegendIcon
===
'
function
'
)
{
// Series has specific way to define legend icon
itemGroup
.
add
(
seriesModel
.
getLegendIcon
({
series
:
seriesModel
,
itemWidth
,
itemHeight
,
symbolType
:
legendSymbolType
,
symbolKeepAspect
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
}));
}
else
{
// Use default legend icon policy for most series
itemGroup
.
add
(
getDefaultLegendIcon
({
series
:
seriesModel
,
itemWidth
,
itemHeight
,
symbolType
:
symbolType
||
'
roundRect
'
,
symbolKeepAspect
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
}));
}
const
textX
=
itemAlign
===
'
left
'
?
itemWidth
+
5
:
-
5
;
const
textAlign
=
itemAlign
as
ZRTextAlign
;
...
...
@@ -639,8 +616,9 @@ function getDefaultLegendIcon(opt: {
itemStyle
:
PathStyleProps
,
lineStyle
:
LineStyleProps
}):
ECSymbol
{
const
symboType
=
opt
.
symbolType
||
'
roundRect
'
;
const
symbol
=
createSymbol
(
opt
.
symbol
Type
,
symbo
Type
,
0
,
0
,
opt
.
itemWidth
,
...
...
@@ -651,7 +629,7 @@ function getDefaultLegendIcon(opt: {
symbol
.
setStyle
(
opt
.
itemStyle
);
if
(
opt
.
symbol
Type
.
indexOf
(
'
empty
'
)
>
-
1
)
{
if
(
symbo
Type
.
indexOf
(
'
empty
'
)
>
-
1
)
{
symbol
.
style
.
stroke
=
symbol
.
style
.
fill
;
symbol
.
style
.
fill
=
'
#fff
'
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录