Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
f40e0dd1
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,发现更多精彩内容 >>
提交
f40e0dd1
编写于
6月 23, 2020
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(label): change label default color to black/white, 'inherit' to set color same with element
上级
7db0a9c0
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
45 addition
and
44 deletion
+45
-44
src/chart/bar/BarView.ts
src/chart/bar/BarView.ts
+1
-1
src/chart/bar/PictorialBarView.ts
src/chart/bar/PictorialBarView.ts
+1
-1
src/chart/custom.ts
src/chart/custom.ts
+1
-1
src/chart/gauge/GaugeView.ts
src/chart/gauge/GaugeView.ts
+3
-3
src/chart/helper/Line.ts
src/chart/helper/Line.ts
+1
-1
src/chart/helper/Symbol.ts
src/chart/helper/Symbol.ts
+1
-1
src/chart/pie/PieSeries.ts
src/chart/pie/PieSeries.ts
+1
-0
src/chart/pie/PieView.ts
src/chart/pie/PieView.ts
+2
-3
src/chart/radar/RadarView.ts
src/chart/radar/RadarView.ts
+1
-1
src/chart/treemap/TreemapView.ts
src/chart/treemap/TreemapView.ts
+1
-1
src/component/marker/MarkAreaView.ts
src/component/marker/MarkAreaView.ts
+1
-1
src/util/graphic.ts
src/util/graphic.ts
+31
-30
未找到文件。
src/chart/bar/BarView.ts
浏览文件 @
f40e0dd1
...
@@ -566,7 +566,7 @@ function updateStyle(
...
@@ -566,7 +566,7 @@ function updateStyle(
labelFetcher
:
seriesModel
,
labelFetcher
:
seriesModel
,
labelDataIndex
:
dataIndex
,
labelDataIndex
:
dataIndex
,
defaultText
:
getDefaultLabel
(
seriesModel
.
getData
(),
dataIndex
),
defaultText
:
getDefaultLabel
(
seriesModel
.
getData
(),
dataIndex
),
auto
Color
:
style
.
fill
as
ColorString
,
inherit
Color
:
style
.
fill
as
ColorString
,
defaultOutsidePosition
:
labelPositionOutside
defaultOutsidePosition
:
labelPositionOutside
}
}
);
);
...
...
src/chart/bar/PictorialBarView.ts
浏览文件 @
f40e0dd1
...
@@ -952,7 +952,7 @@ function updateCommon(
...
@@ -952,7 +952,7 @@ function updateCommon(
labelFetcher
:
opt
.
seriesModel
,
labelFetcher
:
opt
.
seriesModel
,
labelDataIndex
:
dataIndex
,
labelDataIndex
:
dataIndex
,
defaultText
:
getDefaultLabel
(
opt
.
seriesModel
.
getData
(),
dataIndex
),
defaultText
:
getDefaultLabel
(
opt
.
seriesModel
.
getData
(),
dataIndex
),
auto
Color
:
symbolMeta
.
style
.
fill
as
ColorString
,
inherit
Color
:
symbolMeta
.
style
.
fill
as
ColorString
,
defaultOutsidePosition
:
barPositionOutside
defaultOutsidePosition
:
barPositionOutside
}
}
);
);
...
...
src/chart/custom.ts
浏览文件 @
f40e0dd1
...
@@ -482,7 +482,7 @@ function makeRenderItem(customSeries, data, ecModel, api) {
...
@@ -482,7 +482,7 @@ function makeRenderItem(customSeries, data, ecModel, api) {
:
currLabelNormalModel
;
:
currLabelNormalModel
;
const
textStyle
=
graphicUtil
.
createTextStyle
(
labelModel
,
null
,
{
const
textStyle
=
graphicUtil
.
createTextStyle
(
labelModel
,
null
,
{
auto
Color
:
currVisualColor
,
inherit
Color
:
currVisualColor
,
isRectText
:
true
isRectText
:
true
});
});
...
...
src/chart/gauge/GaugeView.ts
浏览文件 @
f40e0dd1
...
@@ -262,7 +262,7 @@ class GaugeView extends ChartView {
...
@@ -262,7 +262,7 @@ class GaugeView extends ChartView {
y
:
unitY
*
(
r
-
splitLineLen
-
distance
)
+
cy
,
y
:
unitY
*
(
r
-
splitLineLen
-
distance
)
+
cy
,
verticalAlign
:
unitY
<
-
0.4
?
'
top
'
:
(
unitY
>
0.4
?
'
bottom
'
:
'
middle
'
),
verticalAlign
:
unitY
<
-
0.4
?
'
top
'
:
(
unitY
>
0.4
?
'
bottom
'
:
'
middle
'
),
align
:
unitX
<
-
0.4
?
'
left
'
:
(
unitX
>
0.4
?
'
right
'
:
'
center
'
)
align
:
unitX
<
-
0.4
?
'
left
'
:
(
unitX
>
0.4
?
'
right
'
:
'
center
'
)
},
{
auto
Color
:
autoColor
}),
},
{
inherit
Color
:
autoColor
}),
silent
:
true
silent
:
true
}));
}));
}
}
...
@@ -423,7 +423,7 @@ class GaugeView extends ChartView {
...
@@ -423,7 +423,7 @@ class GaugeView extends ChartView {
text
:
data
.
getName
(
0
),
text
:
data
.
getName
(
0
),
align
:
'
center
'
,
align
:
'
center
'
,
verticalAlign
:
'
middle
'
verticalAlign
:
'
middle
'
},
{
auto
Color
:
autoColor
})
},
{
inherit
Color
:
autoColor
})
}));
}));
}
}
}
}
...
@@ -463,7 +463,7 @@ class GaugeView extends ChartView {
...
@@ -463,7 +463,7 @@ class GaugeView extends ChartView {
height
:
isNaN
(
height
)
?
null
:
height
,
height
:
isNaN
(
height
)
?
null
:
height
,
align
:
'
center
'
,
align
:
'
center
'
,
verticalAlign
:
'
middle
'
verticalAlign
:
'
middle
'
},
{
auto
Color
:
autoColor
})
},
{
inherit
Color
:
autoColor
})
}));
}));
}
}
}
}
...
...
src/chart/helper/Line.ts
浏览文件 @
f40e0dd1
...
@@ -256,7 +256,7 @@ class Line extends graphic.Group {
...
@@ -256,7 +256,7 @@ class Line extends graphic.Group {
label
.
useStyle
(
graphic
.
createTextStyle
(
labelModel
,
{
label
.
useStyle
(
graphic
.
createTextStyle
(
labelModel
,
{
text
:
normalText
as
string
text
:
normalText
as
string
},
{
},
{
auto
Color
:
defaultLabelColor
inherit
Color
:
defaultLabelColor
}));
}));
label
.
__align
=
label
.
style
.
align
;
label
.
__align
=
label
.
style
.
align
;
...
...
src/chart/helper/Symbol.ts
浏览文件 @
f40e0dd1
...
@@ -266,7 +266,7 @@ class Symbol extends graphic.Group {
...
@@ -266,7 +266,7 @@ class Symbol extends graphic.Group {
labelFetcher
:
seriesModel
,
labelFetcher
:
seriesModel
,
labelDataIndex
:
idx
,
labelDataIndex
:
idx
,
defaultText
:
getLabelDefaultText
,
defaultText
:
getLabelDefaultText
,
auto
Color
:
visualColor
as
ColorString
inherit
Color
:
visualColor
as
ColorString
}
}
);
);
...
...
src/chart/pie/PieSeries.ts
浏览文件 @
f40e0dd1
...
@@ -244,6 +244,7 @@ class PieSeriesModel extends SeriesModel<PieSeriesOption> {
...
@@ -244,6 +244,7 @@ class PieSeriesModel extends SeriesModel<PieSeriesOption> {
height
:
null
,
height
:
null
,
label
:
{
label
:
{
color
:
'
inherit
'
,
// If rotate around circle
// If rotate around circle
rotate
:
0
,
rotate
:
0
,
show
:
true
,
show
:
true
,
...
...
src/chart/pie/PieView.ts
浏览文件 @
f40e0dd1
...
@@ -182,6 +182,7 @@ class PiePiece extends graphic.Sector {
...
@@ -182,6 +182,7 @@ class PiePiece extends graphic.Sector {
{
{
labelFetcher
:
data
.
hostModel
as
PieSeriesModel
,
labelFetcher
:
data
.
hostModel
as
PieSeriesModel
,
labelDataIndex
:
idx
,
labelDataIndex
:
idx
,
inheritColor
:
visualColor
,
defaultText
:
seriesModel
.
getFormattedLabel
(
idx
,
'
normal
'
)
defaultText
:
seriesModel
.
getFormattedLabel
(
idx
,
'
normal
'
)
||
data
.
getName
(
idx
)
||
data
.
getName
(
idx
)
},
},
...
@@ -193,9 +194,7 @@ class PiePiece extends graphic.Sector {
...
@@ -193,9 +194,7 @@ class PiePiece extends graphic.Sector {
// Set textConfig on sector.
// Set textConfig on sector.
sector
.
setTextConfig
({
sector
.
setTextConfig
({
local
:
true
,
local
:
true
,
insideStroke
:
visualColor
,
outsideFill
:
labelModel
.
get
(
'
color
'
)
===
'
inherit
'
?
visualColor
:
'
auto
'
// insideFill: 'auto',
outsideFill
:
visualColor
});
});
// Make sure update style on labelText after setLabelStyle.
// Make sure update style on labelText after setLabelStyle.
...
...
src/chart/radar/RadarView.ts
浏览文件 @
f40e0dd1
...
@@ -237,7 +237,7 @@ class RadarView extends ChartView {
...
@@ -237,7 +237,7 @@ class RadarView extends ChartView {
labelDataIndex
:
idx
,
labelDataIndex
:
idx
,
labelDimIndex
:
symbolPath
.
__dimIdx
,
labelDimIndex
:
symbolPath
.
__dimIdx
,
defaultText
:
defaultText
as
string
,
defaultText
:
defaultText
as
string
,
auto
Color
:
color
as
ColorString
inherit
Color
:
color
as
ColorString
}
}
);
);
});
});
...
...
src/chart/treemap/TreemapView.ts
浏览文件 @
f40e0dd1
...
@@ -936,7 +936,7 @@ function renderNode(
...
@@ -936,7 +936,7 @@ function renderNode(
rectEl
,
normalLabelModel
,
emphasisLabelModel
,
rectEl
,
normalLabelModel
,
emphasisLabelModel
,
{
{
defaultText
:
isShow
?
text
:
null
,
defaultText
:
isShow
?
text
:
null
,
auto
Color
:
visualColor
inherit
Color
:
visualColor
}
}
);
);
...
...
src/component/marker/MarkAreaView.ts
浏览文件 @
f40e0dd1
...
@@ -300,7 +300,7 @@ class MarkAreaView extends MarkerView {
...
@@ -300,7 +300,7 @@ class MarkAreaView extends MarkerView {
labelFetcher
:
maModel
,
labelFetcher
:
maModel
,
labelDataIndex
:
idx
,
labelDataIndex
:
idx
,
defaultText
:
areaData
.
getName
(
idx
)
||
''
,
defaultText
:
areaData
.
getName
(
idx
)
||
''
,
auto
Color
:
typeof
style
.
fill
===
'
string
'
inherit
Color
:
typeof
style
.
fill
===
'
string
'
?
colorUtil
.
modifyAlpha
(
style
.
fill
,
1
)
:
'
#000
'
?
colorUtil
.
modifyAlpha
(
style
.
fill
,
1
)
:
'
#000
'
}
}
);
);
...
...
src/util/graphic.ts
浏览文件 @
f40e0dd1
...
@@ -122,10 +122,10 @@ type TextCommonParams = {
...
@@ -122,10 +122,10 @@ type TextCommonParams = {
*/
*/
disableBox
?:
boolean
disableBox
?:
boolean
/**
/**
* Specify a color when color is '
auto
',
* Specify a color when color is '
inherit
',
*
for textFill, textStroke, textBackgroundColor, and textBorderColor. If auto
Color specified, it is used as default textFill.
*
If inherit
Color specified, it is used as default textFill.
*/
*/
auto
Color
?:
ColorString
inherit
Color
?:
ColorString
getTextPosition
?:
(
textStyleModel
:
Model
,
isEmphasis
?:
boolean
)
=>
string
|
string
[]
|
number
[]
getTextPosition
?:
(
textStyleModel
:
Model
,
isEmphasis
?:
boolean
)
=>
string
|
string
[]
|
number
[]
...
@@ -816,7 +816,7 @@ export {setLabelStyle};
...
@@ -816,7 +816,7 @@ export {setLabelStyle};
export
function
createTextStyle
(
export
function
createTextStyle
(
textStyleModel
:
Model
,
textStyleModel
:
Model
,
specifiedTextStyle
?:
TextStyleProps
,
// Can be overrided by settings in model.
specifiedTextStyle
?:
TextStyleProps
,
// Can be overrided by settings in model.
opt
?:
Pick
<
TextCommonParams
,
'
auto
Color
'
|
'
disableBox
'
>
,
opt
?:
Pick
<
TextCommonParams
,
'
inherit
Color
'
|
'
disableBox
'
>
,
isNotNormal
?:
boolean
,
isNotNormal
?:
boolean
,
isAttached
?:
boolean
// If text is attached on an element. If so, auto color will handling in zrender.
isAttached
?:
boolean
// If text is attached on an element. If so, auto color will handling in zrender.
)
{
)
{
...
@@ -831,7 +831,7 @@ export function createTextStyle(
...
@@ -831,7 +831,7 @@ export function createTextStyle(
export
function
createTextConfig
(
export
function
createTextConfig
(
textStyle
:
TextStyleProps
,
textStyle
:
TextStyleProps
,
textStyleModel
:
Model
,
textStyleModel
:
Model
,
opt
?:
Pick
<
TextCommonParams
,
'
getTextPosition
'
|
'
defaultOutsidePosition
'
|
'
auto
Color
'
>
,
opt
?:
Pick
<
TextCommonParams
,
'
getTextPosition
'
|
'
defaultOutsidePosition
'
|
'
inherit
Color
'
>
,
isNotNormal
?:
boolean
isNotNormal
?:
boolean
)
{
)
{
const
textConfig
:
ElementTextConfig
=
{};
const
textConfig
:
ElementTextConfig
=
{};
...
@@ -868,19 +868,10 @@ export function createTextConfig(
...
@@ -868,19 +868,10 @@ export function createTextConfig(
}
}
// fill and auto is determined by the color of path fill if it's not specified by developers.
// fill and auto is determined by the color of path fill if it's not specified by developers.
textConfig
.
outsideFill
=
opt
.
autoColor
||
null
;
// if (!textStyle.fill) {
textConfig
.
outsideFill
=
textStyleModel
.
get
(
'
color
'
)
===
'
inherit
'
// textConfig.insideFill = 'auto';
?
(
opt
.
inheritColor
||
null
)
// textConfig.outsideFill = opt.autoColor || null;
:
'
auto
'
;
// }
// if (!textStyle.stroke) {
// textConfig.insideStroke = 'auto';
// }
// else if (opt.autoColor) {
// // TODO: stroke set to autoColor. if label is inside?
// textConfig.insideStroke = opt.autoColor;
// }
return
textConfig
;
return
textConfig
;
}
}
...
@@ -898,7 +889,7 @@ export function createTextConfig(
...
@@ -898,7 +889,7 @@ export function createTextConfig(
function
setTextStyleCommon
(
function
setTextStyleCommon
(
textStyle
:
TextStyleProps
,
textStyle
:
TextStyleProps
,
textStyleModel
:
Model
,
textStyleModel
:
Model
,
opt
?:
Pick
<
TextCommonParams
,
'
auto
Color
'
|
'
disableBox
'
>
,
opt
?:
Pick
<
TextCommonParams
,
'
inherit
Color
'
|
'
disableBox
'
>
,
isNotNormal
?:
boolean
,
isNotNormal
?:
boolean
,
isAttached
?:
boolean
isAttached
?:
boolean
)
{
)
{
...
@@ -1003,7 +994,7 @@ function setTokenTextStyle(
...
@@ -1003,7 +994,7 @@ function setTokenTextStyle(
textStyle
:
TextStyleProps
[
'
rich
'
][
string
],
textStyle
:
TextStyleProps
[
'
rich
'
][
string
],
textStyleModel
:
Model
<
LabelOption
>
,
textStyleModel
:
Model
<
LabelOption
>
,
globalTextStyle
:
LabelOption
,
globalTextStyle
:
LabelOption
,
opt
?:
Pick
<
TextCommonParams
,
'
auto
Color
'
|
'
disableBox
'
>
,
opt
?:
Pick
<
TextCommonParams
,
'
inherit
Color
'
|
'
disableBox
'
>
,
isNotNormal
?:
boolean
,
isNotNormal
?:
boolean
,
isAttached
?:
boolean
,
isAttached
?:
boolean
,
isBlock
?:
boolean
isBlock
?:
boolean
...
@@ -1011,14 +1002,24 @@ function setTokenTextStyle(
...
@@ -1011,14 +1002,24 @@ function setTokenTextStyle(
// In merge mode, default value should not be given.
// In merge mode, default value should not be given.
globalTextStyle
=
!
isNotNormal
&&
globalTextStyle
||
EMPTY_OBJ
;
globalTextStyle
=
!
isNotNormal
&&
globalTextStyle
||
EMPTY_OBJ
;
const
autoColor
=
opt
&&
opt
.
auto
Color
;
const
inheritColor
=
opt
&&
opt
.
inherit
Color
;
let
fillColor
=
textStyleModel
.
getShallow
(
'
color
'
);
let
fillColor
=
textStyleModel
.
getShallow
(
'
color
'
);
let
strokeColor
=
textStyleModel
.
getShallow
(
'
textBorderColor
'
);
let
strokeColor
=
textStyleModel
.
getShallow
(
'
textBorderColor
'
);
if
(
fillColor
===
'
auto
'
&&
autoColor
)
{
if
(
fillColor
===
'
inherit
'
)
{
fillColor
=
autoColor
;
if
(
inheritColor
)
{
fillColor
=
inheritColor
;
}
else
{
fillColor
=
null
;
}
}
if
(
strokeColor
===
'
inherit
'
&&
inheritColor
)
{
if
(
inheritColor
)
{
strokeColor
=
inheritColor
;
}
else
{
strokeColor
=
inheritColor
;
}
}
if
(
strokeColor
===
'
auto
'
&&
autoColor
)
{
strokeColor
=
autoColor
;
}
}
fillColor
=
fillColor
||
globalTextStyle
.
color
;
fillColor
=
fillColor
||
globalTextStyle
.
color
;
strokeColor
=
strokeColor
||
globalTextStyle
.
textBorderColor
;
strokeColor
=
strokeColor
||
globalTextStyle
.
textBorderColor
;
...
@@ -1040,8 +1041,8 @@ function setTokenTextStyle(
...
@@ -1040,8 +1041,8 @@ function setTokenTextStyle(
// TODO
// TODO
if
(
!
isNotNormal
&&
!
isAttached
)
{
if
(
!
isNotNormal
&&
!
isAttached
)
{
// Set default finally.
// Set default finally.
if
(
textStyle
.
fill
==
null
&&
opt
.
auto
Color
)
{
if
(
textStyle
.
fill
==
null
&&
opt
.
inherit
Color
)
{
textStyle
.
fill
=
opt
.
auto
Color
;
textStyle
.
fill
=
opt
.
inherit
Color
;
}
}
}
}
...
@@ -1073,11 +1074,11 @@ function setTokenTextStyle(
...
@@ -1073,11 +1074,11 @@ function setTokenTextStyle(
if
(
!
isBlock
||
!
opt
.
disableBox
)
{
if
(
!
isBlock
||
!
opt
.
disableBox
)
{
if
(
textStyle
.
backgroundColor
===
'
auto
'
&&
auto
Color
)
{
if
(
textStyle
.
backgroundColor
===
'
auto
'
&&
inherit
Color
)
{
textStyle
.
backgroundColor
=
auto
Color
;
textStyle
.
backgroundColor
=
inherit
Color
;
}
}
if
(
textStyle
.
borderColor
===
'
auto
'
&&
auto
Color
)
{
if
(
textStyle
.
borderColor
===
'
auto
'
&&
inherit
Color
)
{
textStyle
.
borderColor
=
auto
Color
;
textStyle
.
borderColor
=
inherit
Color
;
}
}
for
(
let
i
=
0
;
i
<
TEXT_PROPS_BOX
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
TEXT_PROPS_BOX
.
length
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录