Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Five-菜鸟级
echarts
提交
b65e590a
E
echarts
项目概览
Five-菜鸟级
/
echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b65e590a
编写于
5月 14, 2021
作者:
O
Ovilia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(legend): no rotation when icon is defined
上级
589249fe
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
32 addition
and
30 deletion
+32
-30
src/chart/custom/install.ts
src/chart/custom/install.ts
+1
-1
src/chart/map/MapSeries.ts
src/chart/map/MapSeries.ts
+0
-6
src/chart/map/mapSymbolLayout.ts
src/chart/map/mapSymbolLayout.ts
+1
-1
src/component/helper/MapDraw.ts
src/component/helper/MapDraw.ts
+1
-1
src/component/legend/LegendView.ts
src/component/legend/LegendView.ts
+14
-12
src/component/radar/install.ts
src/component/radar/install.ts
+2
-2
src/data/List.ts
src/data/List.ts
+1
-1
src/model/Series.ts
src/model/Series.ts
+1
-1
src/visual/symbol.ts
src/visual/symbol.ts
+3
-3
test/legend-style.html
test/legend-style.html
+8
-2
未找到文件。
src/chart/custom/install.ts
浏览文件 @
b65e590a
...
...
@@ -327,7 +327,7 @@ const NON_STYLE_VISUAL_PROPS = {
symbol
:
1
,
symbolSize
:
1
,
symbolKeepAspect
:
1
,
legend
Symbol
:
1
,
legend
Icon
:
1
,
visualMeta
:
1
,
liftZ
:
1
,
decal
:
1
...
...
src/chart/map/MapSeries.ts
浏览文件 @
b65e590a
...
...
@@ -242,12 +242,6 @@ class MapSeries extends SeriesModel<MapSeriesOption> {
// Map do not use itemStyle.borderWidth as border width
symbol
.
style
.
stroke
=
'
none
'
;
const
symbolRotate
=
opt
.
symbolRotate
===
'
inherit
'
?
0
:
(
opt
.
symbolRotate
||
0
);
symbol
.
rotation
=
symbolRotate
*
Math
.
PI
/
180
;
symbol
.
setOrigin
([
opt
.
itemWidth
/
2
,
opt
.
itemHeight
/
2
]);
if
(
symbolType
.
indexOf
(
'
empty
'
)
>
-
1
)
{
symbol
.
style
.
stroke
=
symbol
.
style
.
fill
;
symbol
.
style
.
fill
=
'
#fff
'
;
...
...
src/chart/map/mapSymbolLayout.ts
浏览文件 @
b65e590a
...
...
@@ -66,7 +66,7 @@ export default function mapSymbolLayout(ecModel: GlobalModel) {
}
});
// Show label of those region not has legend
Symbol
(which is offset 0)
// Show label of those region not has legend
Icon
(which is offset 0)
const
data
=
mapSeries
.
getData
();
data
.
each
(
function
(
idx
)
{
const
name
=
data
.
getName
(
idx
);
...
...
src/component/helper/MapDraw.ts
浏览文件 @
b65e590a
...
...
@@ -682,7 +682,7 @@ function resetLabelForRegion(
// In the following cases label will be drawn
// 1. In map series and data value is NaN
// 2. In geo component
// 3. Region has no series legend
Symbol
, which will be add a showLabel flag in mapSymbolLayout
// 3. Region has no series legend
Icon
, which will be add a showLabel flag in mapSymbolLayout
if
(
((
isGeo
||
isDataNaN
))
||
(
itemLayout
&&
itemLayout
.
showLabel
)
...
...
src/component/legend/LegendView.ts
浏览文件 @
b65e590a
...
...
@@ -207,7 +207,7 @@ class LegendView extends ComponentView {
if
(
seriesModel
)
{
const
data
=
seriesModel
.
getData
();
const
lineVisualStyle
=
data
.
getVisual
(
'
legendLineStyle
'
)
||
{};
const
symbolType
=
data
.
getVisual
(
'
legendSymbol
'
);
const
legendIcon
=
data
.
getVisual
(
'
legendIcon
'
);
/**
* `data.getVisual('style')` may be the color from the register
...
...
@@ -218,7 +218,7 @@ class LegendView extends ComponentView {
const
itemGroup
=
this
.
_createItem
(
seriesModel
,
name
,
dataIndex
,
legendItemModel
,
legendModel
,
itemAlign
,
lineVisualStyle
,
style
,
symbolType
,
selectMode
lineVisualStyle
,
style
,
legendIcon
,
selectMode
);
itemGroup
.
on
(
'
click
'
,
curry
(
dispatchSelectAction
,
name
,
null
,
api
,
excludeSeriesId
))
...
...
@@ -245,7 +245,7 @@ class LegendView extends ComponentView {
const
idx
=
provider
.
indexOfName
(
name
);
const
style
=
provider
.
getItemVisual
(
idx
,
'
style
'
)
as
PathStyleProps
;
const
symbolType
=
provider
.
getItemVisual
(
idx
,
'
legendSymbol
'
);
const
legendIcon
=
provider
.
getItemVisual
(
idx
,
'
legendIcon
'
);
const
colorArr
=
parse
(
style
.
fill
as
ColorString
);
// Color may be set to transparent in visualMap when data is out of range.
...
...
@@ -259,7 +259,7 @@ class LegendView extends ComponentView {
const
itemGroup
=
this
.
_createItem
(
seriesModel
,
name
,
dataIndex
,
legendItemModel
,
legendModel
,
itemAlign
,
{},
style
,
symbolType
,
selectMode
{},
style
,
legendIcon
,
selectMode
);
// FIXME: consider different series has items with the same name.
...
...
@@ -339,7 +339,7 @@ class LegendView extends ComponentView {
itemAlign
:
LegendOption
[
'
align
'
],
lineVisualStyle
:
LineStyleProps
,
itemVisualStyle
:
PathStyleProps
,
symbolType
:
string
,
legendIcon
:
string
,
selectMode
:
LegendOption
[
'
selectedMode
'
]
)
{
const
drawType
=
seriesModel
.
visualDrawType
;
...
...
@@ -350,11 +350,11 @@ class LegendView extends ComponentView {
let
symbolRotate
=
itemModel
.
get
(
'
symbolRotate
'
);
const
legendIconType
=
itemModel
.
get
(
'
icon
'
);
symbolType
=
legendIconType
||
symbolType
||
'
roundRect
'
;
legendIcon
=
legendIconType
||
legendIcon
||
'
roundRect
'
;
const
legendLineStyle
=
legendModel
.
getModel
(
'
lineStyle
'
);
const
style
=
getLegendStyle
(
symbolType
,
legendIcon
,
itemModel
,
legendLineStyle
,
lineVisualStyle
,
...
...
@@ -374,7 +374,7 @@ class LegendView extends ComponentView {
itemGroup
.
add
(
seriesModel
.
getLegendIcon
({
itemWidth
,
itemHeight
,
symbolType
,
symbolType
:
legendIcon
,
symbolRotate
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
...
...
@@ -382,13 +382,15 @@ class LegendView extends ComponentView {
}
else
{
// Use default legend icon policy for most series
const
rotate
=
symbolRotate
===
'
inherit
'
?
seriesModel
.
get
(
'
symbolRotate
'
)
:
symbolRotate
;
const
rotate
=
legendIconType
===
'
inherit
'
&&
legendIcon
?
(
symbolRotate
===
'
inherit
'
?
seriesModel
.
get
(
'
symbolRotate
'
)
:
symbolRotate
)
:
0
;
// No rotation for no icon
itemGroup
.
add
(
getDefaultLegendIcon
({
itemWidth
,
itemHeight
,
symbolType
,
symbolType
:
legendIcon
,
symbolRotate
:
rotate
,
itemStyle
:
style
.
itemStyle
,
lineStyle
:
style
.
lineStyle
...
...
src/component/radar/install.ts
浏览文件 @
b65e590a
...
...
@@ -34,10 +34,10 @@ export function install(registers: EChartsExtensionInstallRegisters) {
const
data
=
seriesModel
.
getData
();
// itemVisual symbol is for selected data
data
.
each
(
function
(
idx
)
{
data
.
setItemVisual
(
idx
,
'
legend
Symbol
'
,
'
roundRect
'
);
data
.
setItemVisual
(
idx
,
'
legend
Icon
'
,
'
roundRect
'
);
});
// visual is for unselected data
data
.
setVisual
(
'
legend
Symbol
'
,
'
roundRect
'
);
data
.
setVisual
(
'
legend
Icon
'
,
'
roundRect
'
);
}
});
}
src/data/List.ts
浏览文件 @
b65e590a
...
...
@@ -141,7 +141,7 @@ export interface DefaultDataVisual {
liftZ
?:
number
// For legend.
legend
Symbol
?:
string
legend
Icon
?:
string
legendLineStyle
?:
LineStyleProps
// visualMap will inject visualMeta data
...
...
src/model/Series.ts
浏览文件 @
b65e590a
...
...
@@ -175,7 +175,7 @@ class SeriesModel<Opt extends SeriesOption = SeriesOption> extends ComponentMode
// Default symbol type.
defaultSymbol
:
string
;
// Symbol provide to legend.
legend
Symbol
:
string
;
legend
Icon
:
string
;
// ---------------------------------------
// Props about data selection
...
...
src/visual/symbol.ts
浏览文件 @
b65e590a
...
...
@@ -46,8 +46,8 @@ const seriesSymbolTask: StageHandler = {
)
{
const
data
=
seriesModel
.
getData
();
if
(
seriesModel
.
legend
Symbol
)
{
data
.
setVisual
(
'
legend
Symbol
'
,
seriesModel
.
legendSymbol
);
if
(
seriesModel
.
legend
Icon
)
{
data
.
setVisual
(
'
legend
Icon
'
,
seriesModel
.
legendIcon
);
}
if
(
!
seriesModel
.
hasSymbolVisual
)
{
...
...
@@ -74,7 +74,7 @@ const seriesSymbolTask: StageHandler = {
const
seriesSymbolOffset
=
!
hasSymbolOffsetCallback
?
symbolOffset
:
null
;
data
.
setVisual
({
legend
Symbol
:
seriesModel
.
legendSymbol
||
seriesSymbol
as
string
,
legend
Icon
:
seriesModel
.
legendIcon
||
seriesSymbol
as
string
,
// If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
// to bring trouble, we do not pick a reuslt from one of its calling on data item here,
// but just use the default value. Callback on `symbol` or `symbolSize` is convenient in
...
...
test/legend-style.html
浏览文件 @
b65e590a
...
...
@@ -230,7 +230,8 @@ under the License.
name
:
'
Line C
'
,
symbolRotate
:
-
30
,
icon
:
'
emptyTriangle
'
}
},
'
Bar D
'
],
symbolRotate
:
30
,
itemWidth
:
100
...
...
@@ -254,6 +255,10 @@ under the License.
name
:
'
Line C
'
,
symbol
:
'
emptyTriangle
'
,
symbolKeepAspect
:
true
},
{
data
:
getData
(
0
),
type
:
'
bar
'
,
name
:
'
Bar D
'
}],
animation
:
0
};
...
...
@@ -263,7 +268,8 @@ under the License.
'
**Legend options should work**
'
,
'
Line A: the rect in the legend should be placed at the center with rotation of 30 degrees
'
,
'
Line B: the triangle in the legend should be placed at the center with rotation of 30 degrees
'
,
'
Line C: the triangle in the legend should be placed at the center with rotation of -30 degrees
'
'
Line C: should not have rotate in legend
'
,
'
Bar D: should not have rotate in legend
'
],
option
:
option
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录