Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
强哥很慌张
Echarts
提交
d3a7d182
E
Echarts
项目概览
强哥很慌张
/
Echarts
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
Echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d3a7d182
编写于
3月 13, 2020
作者:
P
pissang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ts: add types for radar
上级
15a464e2
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
273 addition
and
172 deletion
+273
-172
src/chart/radar/RadarSeries.ts
src/chart/radar/RadarSeries.ts
+71
-19
src/chart/radar/RadarView.ts
src/chart/radar/RadarView.ts
+58
-37
src/chart/radar/radarLayout.ts
src/chart/radar/radarLayout.ts
+9
-7
src/component/radar/RadarView.ts
src/component/radar/RadarView.ts
+35
-26
src/coord/Axis.ts
src/coord/Axis.ts
+1
-1
src/coord/axisCommonTypes.ts
src/coord/axisCommonTypes.ts
+2
-2
src/coord/axisHelper.ts
src/coord/axisHelper.ts
+73
-65
src/coord/axisModelCommonMixin.ts
src/coord/axisModelCommonMixin.ts
+4
-4
src/helper.ts
src/helper.ts
+4
-3
src/layout/barGrid.ts
src/layout/barGrid.ts
+6
-2
src/model/mixin/textStyle.ts
src/model/mixin/textStyle.ts
+4
-1
src/scale/Log.ts
src/scale/Log.ts
+2
-2
src/scale/Ordinal.ts
src/scale/Ordinal.ts
+2
-1
src/scale/Scale.ts
src/scale/Scale.ts
+2
-2
未找到文件。
src/chart/radar/RadarSeries.ts
浏览文件 @
d3a7d182
...
...
@@ -17,24 +17,74 @@
* under the License.
*/
// @ts-nocheck
import
SeriesModel
from
'
../../model/Series
'
;
import
createListSimply
from
'
../helper/createListSimply
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
{
encodeHTML
}
from
'
../../util/format
'
;
import
LegendVisualProvider
from
'
../../visual/LegendVisualProvider
'
;
import
{
SeriesOption
,
LineStyleOption
,
LabelOption
,
SymbolOptionMixin
,
ItemStyleOption
,
AreaStyleOption
,
OptionDataValue
}
from
'
../../util/types
'
;
import
GlobalModel
from
'
../../model/Global
'
;
import
List
from
'
../../data/List
'
;
import
Radar
from
'
../../coord/radar/Radar
'
;
type
RadarSeriesDataValue
=
OptionDataValue
[];
export
interface
RadarSeriesDataItemOption
extends
SymbolOptionMixin
{
lineStyle
?:
LineStyleOption
areaStyle
?:
AreaStyleOption
label
?:
LabelOption
itemStyle
?:
ItemStyleOption
emphasis
?:
{
lineStyle
?:
LineStyleOption
areaStyle
?:
AreaStyleOption
label
?:
LabelOption
itemStyle
?:
ItemStyleOption
}
value
?:
RadarSeriesDataValue
}
export
interface
RadarSeriesOption
extends
SeriesOption
,
SymbolOptionMixin
{
type
?:
'
radar
'
coordinateSystem
:
'
radar
'
radarIndex
?:
number
radarId
?:
string
var
RadarSeries
=
SeriesModel
.
extend
({
lineStyle
?:
LineStyleOption
areaStyle
?:
AreaStyleOption
label
?:
LabelOption
itemStyle
?:
ItemStyleOption
type
:
'
series.radar
'
,
emphasis
?:
{
lineStyle
?:
LineStyleOption
areaStyle
?:
AreaStyleOption
label
?:
LabelOption
itemStyle
?:
ItemStyleOption
}
}
class
RadarSeriesModel
extends
SeriesModel
<
RadarSeriesOption
>
{
dependencies
:
[
'
radar
'
],
static
readonly
type
=
'
series.radar
'
readonly
type
=
RadarSeriesModel
.
type
dependencies
=
[
'
radar
'
]
coordinateSystem
:
Radar
// Overwrite
init
:
function
(
o
ption
)
{
RadarSeries
.
superApply
(
this
,
'
init
'
,
arguments
);
init
(
option
:
RadarSeriesO
ption
)
{
super
.
init
.
apply
(
this
,
arguments
as
any
);
// Enable legend selection for each data item
// Use a function instead of direct access because data reference may changed
...
...
@@ -42,16 +92,16 @@ var RadarSeries = SeriesModel.extend({
zrUtil
.
bind
(
this
.
getData
,
this
),
zrUtil
.
bind
(
this
.
getRawData
,
this
)
);
}
,
}
getInitialData
:
function
(
option
,
ecModel
)
{
getInitialData
(
option
:
RadarSeriesOption
,
ecModel
:
GlobalModel
):
List
{
return
createListSimply
(
this
,
{
generateCoord
:
'
indicator_
'
,
generateCoordCount
:
Infinity
});
}
,
}
formatTooltip
:
function
(
dataIndex
)
{
formatTooltip
(
dataIndex
:
number
)
{
var
data
=
this
.
getData
();
var
coordSys
=
this
.
coordinateSystem
;
var
indicatorAxes
=
coordSys
.
getIndicatorAxes
();
...
...
@@ -61,31 +111,31 @@ var RadarSeries = SeriesModel.extend({
var
val
=
data
.
get
(
data
.
mapDimension
(
axis
.
dim
),
dataIndex
);
return
encodeHTML
(
axis
.
name
+
'
:
'
+
val
);
}).
join
(
'
<br />
'
);
}
,
}
/**
* @implement
*/
getTooltipPosition
:
function
(
dataIndex
)
{
getTooltipPosition
(
dataIndex
:
number
)
{
if
(
dataIndex
!=
null
)
{
var
data
=
this
.
getData
();
var
coordSys
=
this
.
coordinateSystem
;
var
values
=
data
.
getValues
(
zrUtil
.
map
(
coordSys
.
dimensions
,
function
(
dim
)
{
return
data
.
mapDimension
(
dim
);
}),
dataIndex
,
true
}),
dataIndex
);
for
(
var
i
=
0
,
len
=
values
.
length
;
i
<
len
;
i
++
)
{
if
(
!
isNaN
(
values
[
i
]))
{
if
(
!
isNaN
(
values
[
i
]
as
number
))
{
var
indicatorAxes
=
coordSys
.
getIndicatorAxes
();
return
coordSys
.
coordToPoint
(
indicatorAxes
[
i
].
dataToCoord
(
values
[
i
]),
i
);
}
}
}
}
,
}
defaultOption
:
{
static
defaultOption
:
RadarSeriesOption
=
{
zlevel
:
0
,
z
:
2
,
coordinateSystem
:
'
radar
'
,
...
...
@@ -105,6 +155,8 @@ var RadarSeries = SeriesModel.extend({
symbolSize
:
4
// symbolRotate: null
}
});
}
SeriesModel
.
registerClass
(
RadarSeriesModel
);
export
default
RadarSeries
;
\ No newline at end of file
export
default
RadarSeriesModel
;
\ No newline at end of file
src/chart/radar/RadarView.ts
浏览文件 @
d3a7d182
...
...
@@ -17,34 +17,43 @@
* under the License.
*/
// @ts-nocheck
import
*
as
echarts
from
'
../../echarts
'
;
import
*
as
graphic
from
'
../../util/graphic
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
*
as
symbolUtil
from
'
../../util/symbol
'
;
function
normalizeSymbolSize
(
symbolSize
)
{
import
ChartView
from
'
../../view/Chart
'
;
import
RadarSeriesModel
,
{
RadarSeriesDataItemOption
}
from
'
./RadarSeries
'
;
import
ExtensionAPI
from
'
../../ExtensionAPI
'
;
import
List
from
'
../../data/List
'
;
import
{
ZRColor
,
DisplayState
,
ECElement
}
from
'
../../util/types
'
;
import
GlobalModel
from
'
../../model/Global
'
;
function
normalizeSymbolSize
(
symbolSize
:
number
|
number
[])
{
if
(
!
zrUtil
.
isArray
(
symbolSize
))
{
symbolSize
=
[
+
symbolSize
,
+
symbolSize
];
}
return
symbolSize
;
}
export
default
echarts
.
extendChartView
({
type
RadarSymbol
=
ReturnType
<
typeof
symbolUtil
.
createSymbol
>
&
{
__dimIdx
:
number
}
class
RadarView
extends
ChartView
{
static
type
=
'
radar
'
type
=
RadarView
.
type
type
:
'
radar
'
,
private
_data
:
List
<
RadarSeriesModel
>
render
:
function
(
seriesModel
,
ecModel
,
api
)
{
render
(
seriesModel
:
RadarSeriesModel
,
ecModel
:
GlobalModel
,
api
:
ExtensionAPI
)
{
var
polar
=
seriesModel
.
coordinateSystem
;
var
group
=
this
.
group
;
var
data
=
seriesModel
.
getData
();
var
oldData
=
this
.
_data
;
function
createSymbol
(
data
,
idx
)
{
var
symbolType
=
data
.
getItemVisual
(
idx
,
'
symbol
'
)
||
'
circle
'
;
var
color
=
data
.
getItemVisual
(
idx
,
'
color
'
);
function
createSymbol
(
data
:
List
<
RadarSeriesModel
>
,
idx
:
number
)
{
var
symbolType
=
data
.
getItemVisual
(
idx
,
'
symbol
'
)
as
string
||
'
circle
'
;
var
color
=
data
.
getItemVisual
(
idx
,
'
color
'
)
as
ZRColor
;
if
(
symbolType
===
'
none
'
)
{
return
;
}
...
...
@@ -61,10 +70,17 @@ export default echarts.extendChartView({
z2
:
100
,
scale
:
[
symbolSize
[
0
]
/
2
,
symbolSize
[
1
]
/
2
]
});
return
symbolPath
;
return
symbolPath
as
RadarSymbol
;
}
function
updateSymbols
(
oldPoints
,
newPoints
,
symbolGroup
,
data
,
idx
,
isInit
)
{
function
updateSymbols
(
oldPoints
:
number
[][],
newPoints
:
number
[][],
symbolGroup
:
graphic
.
Group
,
data
:
List
<
RadarSeriesModel
>
,
idx
:
number
,
isInit
?:
boolean
)
{
// Simply rerender all
symbolGroup
.
removeAll
();
for
(
var
i
=
0
;
i
<
newPoints
.
length
-
1
;
i
++
)
{
...
...
@@ -87,7 +103,7 @@ export default echarts.extendChartView({
}
}
function
getInitialPoints
(
points
)
{
function
getInitialPoints
(
points
:
number
[][]
)
{
return
zrUtil
.
map
(
points
,
function
(
pt
)
{
return
[
polar
.
cx
,
polar
.
cy
];
});
...
...
@@ -124,10 +140,10 @@ export default echarts.extendChartView({
data
.
setItemGraphicEl
(
idx
,
itemGroup
);
})
.
update
(
function
(
newIdx
,
oldIdx
)
{
var
itemGroup
=
oldData
.
getItemGraphicEl
(
oldIdx
);
var
polyline
=
itemGroup
.
childAt
(
0
);
var
polygon
=
itemGroup
.
childAt
(
1
);
var
symbolGroup
=
itemGroup
.
childAt
(
2
);
var
itemGroup
=
oldData
.
getItemGraphicEl
(
oldIdx
)
as
graphic
.
Group
;
var
polyline
=
itemGroup
.
childAt
(
0
)
as
graphic
.
Polyline
;
var
polygon
=
itemGroup
.
childAt
(
1
)
as
graphic
.
Polygon
;
var
symbolGroup
=
itemGroup
.
childAt
(
2
)
as
graphic
.
Group
;
var
target
=
{
shape
:
{
points
:
data
.
getItemLayout
(
newIdx
)
...
...
@@ -138,7 +154,12 @@ export default echarts.extendChartView({
return
;
}
updateSymbols
(
polyline
.
shape
.
points
,
target
.
shape
.
points
,
symbolGroup
,
data
,
newIdx
,
false
polyline
.
shape
.
points
,
target
.
shape
.
points
,
symbolGroup
,
data
,
newIdx
,
false
);
graphic
.
updateProps
(
polyline
,
target
,
seriesModel
);
...
...
@@ -151,11 +172,11 @@ export default echarts.extendChartView({
})
.
execute
();
data
.
eachItemGraphicEl
(
function
(
itemGroup
,
idx
)
{
var
itemModel
=
data
.
getItemModel
(
idx
);
var
polyline
=
itemGroup
.
childAt
(
0
);
var
polygon
=
itemGroup
.
childAt
(
1
);
var
symbolGroup
=
itemGroup
.
childAt
(
2
);
data
.
eachItemGraphicEl
(
function
(
itemGroup
:
graphic
.
Group
,
idx
)
{
var
itemModel
=
data
.
getItemModel
<
RadarSeriesDataItemOption
>
(
idx
);
var
polyline
=
itemGroup
.
childAt
(
0
)
as
graphic
.
Polyline
;
var
polygon
=
itemGroup
.
childAt
(
1
)
as
graphic
.
Polygon
;
var
symbolGroup
=
itemGroup
.
childAt
(
2
)
as
graphic
.
Group
;
var
color
=
data
.
getItemVisual
(
idx
,
'
color
'
);
group
.
add
(
itemGroup
);
...
...
@@ -169,10 +190,10 @@ export default echarts.extendChartView({
}
)
);
polyline
.
hoverStyle
=
itemModel
.
getModel
(
'
emphasis.lineStyle
'
).
getLineStyle
();
polyline
.
hoverStyle
=
itemModel
.
getModel
(
[
'
emphasis
'
,
'
lineStyle
'
]
).
getLineStyle
();
var
areaStyleModel
=
itemModel
.
getModel
(
'
areaStyle
'
);
var
hoverAreaStyleModel
=
itemModel
.
getModel
(
'
emphasis.areaStyle
'
);
var
hoverAreaStyleModel
=
itemModel
.
getModel
(
[
'
emphasis
'
,
'
areaStyle
'
]
);
var
polygonIgnore
=
areaStyleModel
.
isEmpty
()
&&
areaStyleModel
.
parentModel
.
isEmpty
();
var
hoverPolygonIgnore
=
hoverAreaStyleModel
.
isEmpty
()
&&
hoverAreaStyleModel
.
parentModel
.
isEmpty
();
...
...
@@ -191,14 +212,14 @@ export default echarts.extendChartView({
polygon
.
hoverStyle
=
hoverAreaStyleModel
.
getAreaStyle
();
var
itemStyle
=
itemModel
.
getModel
(
'
itemStyle
'
).
getItemStyle
([
'
color
'
]);
var
itemHoverStyle
=
itemModel
.
getModel
(
'
emphasis.itemStyle
'
).
getItemStyle
();
var
itemHoverStyle
=
itemModel
.
getModel
(
[
'
emphasis
'
,
'
itemStyle
'
]
).
getItemStyle
();
var
labelModel
=
itemModel
.
getModel
(
'
label
'
);
var
labelHoverModel
=
itemModel
.
getModel
(
'
emphasis.label
'
);
symbolGroup
.
eachChild
(
function
(
symbolPath
)
{
var
labelHoverModel
=
itemModel
.
getModel
(
[
'
emphasis
'
,
'
label
'
]
);
symbolGroup
.
eachChild
(
function
(
symbolPath
:
RadarSymbol
)
{
symbolPath
.
setStyle
(
itemStyle
);
symbolPath
.
hoverStyle
=
zrUtil
.
clone
(
itemHoverStyle
);
var
defaultText
=
data
.
get
(
data
.
dimensions
[
symbolPath
.
__dimIdx
],
idx
);
(
defaultText
==
null
||
isNaN
(
defaultText
))
&&
(
defaultText
=
''
);
(
defaultText
==
null
||
isNaN
(
defaultText
as
number
))
&&
(
defaultText
=
''
);
graphic
.
setLabelStyle
(
symbolPath
.
style
,
symbolPath
.
hoverStyle
,
labelModel
,
labelHoverModel
,
...
...
@@ -206,26 +227,26 @@ export default echarts.extendChartView({
labelFetcher
:
data
.
hostModel
,
labelDataIndex
:
idx
,
labelDimIndex
:
symbolPath
.
__dimIdx
,
defaultText
:
defaultText
,
defaultText
:
defaultText
+
''
,
autoColor
:
color
,
isRectText
:
true
}
);
});
itemGroup
.
highDownOnUpdate
=
function
(
fromState
,
to
State
)
{
(
itemGroup
as
ECElement
).
highDownOnUpdate
=
function
(
fromState
:
DisplayState
,
toState
:
Display
State
)
{
polygon
.
attr
(
'
ignore
'
,
toState
===
'
emphasis
'
?
hoverPolygonIgnore
:
polygonIgnore
);
};
graphic
.
setHoverStyle
(
itemGroup
);
});
this
.
_data
=
data
;
}
,
}
remove
:
function
()
{
remove
()
{
this
.
group
.
removeAll
();
this
.
_data
=
null
;
},
}
}
dispose
:
function
()
{}
});
\ No newline at end of file
ChartView
.
registerClass
(
RadarView
);
\ No newline at end of file
src/chart/radar/radarLayout.ts
浏览文件 @
d3a7d182
...
...
@@ -17,14 +17,16 @@
* under the License.
*/
// @ts-nocheck
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
GlobalModel
from
'
../../model/Global
'
;
import
RadarSeriesModel
from
'
./RadarSeries
'
;
import
Radar
from
'
../../coord/radar/Radar
'
;
export
default
function
(
ecModel
)
{
ecModel
.
eachSeriesByType
(
'
radar
'
,
function
(
seriesModel
)
{
type
Point
=
number
[];
export
default
function
(
ecModel
:
GlobalModel
)
{
ecModel
.
eachSeriesByType
(
'
radar
'
,
function
(
seriesModel
:
RadarSeriesModel
)
{
var
data
=
seriesModel
.
getData
();
var
points
=
[];
var
points
:
Point
[][]
=
[];
var
coordSys
=
seriesModel
.
coordinateSystem
;
if
(
!
coordSys
)
{
return
;
...
...
@@ -57,11 +59,11 @@ export default function (ecModel) {
});
}
function
isValidPoint
(
point
)
{
function
isValidPoint
(
point
:
Point
)
{
return
!
isNaN
(
point
[
0
])
&&
!
isNaN
(
point
[
1
]);
}
function
getValueMissingPoint
(
coordSys
)
{
function
getValueMissingPoint
(
coordSys
:
Radar
):
Point
{
// It is error-prone to input [NaN, NaN] into polygon, polygon.
// (probably cause problem when refreshing or animating)
return
[
coordSys
.
cx
,
coordSys
.
cy
];
...
...
src/component/radar/RadarView.ts
浏览文件 @
d3a7d182
...
...
@@ -17,31 +17,34 @@
* under the License.
*/
// @ts-nocheck
import
{
__DEV__
}
from
'
../../config
'
;
import
*
as
echarts
from
'
../../echarts
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
AxisBuilder
from
'
../axis/AxisBuilder
'
;
import
*
as
graphic
from
'
../../util/graphic
'
;
import
ComponentView
from
'
../../view/Component
'
;
import
RadarModel
from
'
../../coord/radar/RadarModel
'
;
import
GlobalModel
from
'
../../model/Global
'
;
import
ExtensionAPI
from
'
../../ExtensionAPI
'
;
import
{
ZRColor
}
from
'
../../util/types
'
;
var
axisBuilderAttrs
=
[
'
axisLine
'
,
'
axisTickLabel
'
,
'
axisName
'
];
]
as
const
;
export
default
echarts
.
extendComponentView
(
{
class
RadarView
extends
ComponentView
{
type
:
'
radar
'
,
static
type
=
'
radar
'
type
=
RadarView
.
type
render
:
function
(
radarModel
,
ecModel
,
api
)
{
render
(
radarModel
:
RadarModel
,
ecModel
:
GlobalModel
,
api
:
ExtensionAPI
)
{
var
group
=
this
.
group
;
group
.
removeAll
();
this
.
_buildAxes
(
radarModel
);
this
.
_buildSplitLineAndArea
(
radarModel
);
}
,
}
_buildAxes
:
function
(
r
adarModel
)
{
_buildAxes
(
radarModel
:
R
adarModel
)
{
var
radar
=
radarModel
.
coordinateSystem
;
var
indicatorAxes
=
radar
.
getIndicatorAxes
();
var
axisBuilders
=
zrUtil
.
map
(
indicatorAxes
,
function
(
indicatorAxis
)
{
...
...
@@ -59,9 +62,9 @@ export default echarts.extendComponentView({
zrUtil
.
each
(
axisBuilderAttrs
,
axisBuilder
.
add
,
axisBuilder
);
this
.
group
.
add
(
axisBuilder
.
getGroup
());
},
this
);
}
,
}
_buildSplitLineAndArea
:
function
(
r
adarModel
)
{
_buildSplitLineAndArea
(
radarModel
:
R
adarModel
)
{
var
radar
=
radarModel
.
coordinateSystem
;
var
indicatorAxes
=
radar
.
getIndicatorAxes
();
if
(
!
indicatorAxes
.
length
)
{
...
...
@@ -78,13 +81,17 @@ export default echarts.extendComponentView({
var
splitLineColors
=
lineStyleModel
.
get
(
'
color
'
);
var
splitAreaColors
=
areaStyleModel
.
get
(
'
color
'
);
splitLineColors
=
zrUtil
.
isArray
(
splitLineColors
)
?
splitLineColors
:
[
splitLineColors
];
splitAreaColors
=
zrUtil
.
isArray
(
splitAreaColors
)
?
splitAreaColors
:
[
splitAreaColors
];
var
splitLineColorsArr
=
zrUtil
.
isArray
(
splitLineColors
)
?
splitLineColors
:
[
splitLineColors
];
var
splitAreaColorsArr
=
zrUtil
.
isArray
(
splitAreaColors
)
?
splitAreaColors
:
[
splitAreaColors
];
var
splitLines
=
[];
var
splitAreas
=
[];
var
splitLines
:
(
graphic
.
Circle
|
graphic
.
Polyline
)[][]
=
[];
var
splitAreas
:
(
graphic
.
Ring
|
graphic
.
Polygon
)[][]
=
[];
function
getColorIndex
(
areaOrLine
,
areaOrLineColorList
,
idx
)
{
function
getColorIndex
(
areaOrLine
:
any
[][],
areaOrLineColorList
:
ZRColor
[],
idx
:
number
)
{
var
colorIndex
=
idx
%
areaOrLineColorList
.
length
;
areaOrLine
[
colorIndex
]
=
areaOrLine
[
colorIndex
]
||
[];
return
colorIndex
;
...
...
@@ -96,7 +103,7 @@ export default echarts.extendComponentView({
var
cy
=
radar
.
cy
;
for
(
var
i
=
0
;
i
<
ticksRadius
.
length
;
i
++
)
{
if
(
showSplitLine
)
{
var
colorIndex
=
getColorIndex
(
splitLines
,
splitLineColors
,
i
);
var
colorIndex
=
getColorIndex
(
splitLines
,
splitLineColors
Arr
,
i
);
splitLines
[
colorIndex
].
push
(
new
graphic
.
Circle
({
shape
:
{
cx
:
cx
,
...
...
@@ -106,7 +113,7 @@ export default echarts.extendComponentView({
}));
}
if
(
showSplitArea
&&
i
<
ticksRadius
.
length
-
1
)
{
var
colorIndex
=
getColorIndex
(
splitAreas
,
splitAreaColors
,
i
);
var
colorIndex
=
getColorIndex
(
splitAreas
,
splitAreaColors
Arr
,
i
);
splitAreas
[
colorIndex
].
push
(
new
graphic
.
Ring
({
shape
:
{
cx
:
cx
,
...
...
@@ -120,7 +127,7 @@ export default echarts.extendComponentView({
}
// Polyyon
else
{
var
realSplitNumber
;
var
realSplitNumber
:
number
;
var
axesTicksPoints
=
zrUtil
.
map
(
indicatorAxes
,
function
(
indicatorAxis
,
idx
)
{
var
ticksCoords
=
indicatorAxis
.
getTicksCoords
();
realSplitNumber
=
realSplitNumber
==
null
...
...
@@ -131,9 +138,9 @@ export default echarts.extendComponentView({
});
});
var
prevPoints
=
[];
var
prevPoints
:
number
[][]
=
[];
for
(
var
i
=
0
;
i
<=
realSplitNumber
;
i
++
)
{
var
points
=
[];
var
points
:
number
[][]
=
[];
for
(
var
j
=
0
;
j
<
indicatorAxes
.
length
;
j
++
)
{
points
.
push
(
axesTicksPoints
[
j
][
i
]);
}
...
...
@@ -148,7 +155,7 @@ export default echarts.extendComponentView({
}
if
(
showSplitLine
)
{
var
colorIndex
=
getColorIndex
(
splitLines
,
splitLineColors
,
i
);
var
colorIndex
=
getColorIndex
(
splitLines
,
splitLineColors
Arr
,
i
);
splitLines
[
colorIndex
].
push
(
new
graphic
.
Polyline
({
shape
:
{
points
:
points
...
...
@@ -156,7 +163,7 @@ export default echarts.extendComponentView({
}));
}
if
(
showSplitArea
&&
prevPoints
)
{
var
colorIndex
=
getColorIndex
(
splitAreas
,
splitAreaColors
,
i
-
1
);
var
colorIndex
=
getColorIndex
(
splitAreas
,
splitAreaColors
Arr
,
i
-
1
);
splitAreas
[
colorIndex
].
push
(
new
graphic
.
Polygon
({
shape
:
{
points
:
points
.
concat
(
prevPoints
)
...
...
@@ -175,7 +182,7 @@ export default echarts.extendComponentView({
splitAreas
,
{
style
:
zrUtil
.
defaults
({
stroke
:
'
none
'
,
fill
:
splitAreaColors
[
idx
%
splitAreaColors
.
length
]
fill
:
splitAreaColors
Arr
[
idx
%
splitAreaColorsArr
.
length
]
},
areaStyle
),
silent
:
true
}
...
...
@@ -187,7 +194,7 @@ export default echarts.extendComponentView({
splitLines
,
{
style
:
zrUtil
.
defaults
({
fill
:
'
none
'
,
stroke
:
splitLineColors
[
idx
%
splitLineColors
.
length
]
stroke
:
splitLineColors
Arr
[
idx
%
splitLineColorsArr
.
length
]
},
lineStyle
),
silent
:
true
}
...
...
@@ -195,4 +202,6 @@ export default echarts.extendComponentView({
},
this
);
}
});
\ No newline at end of file
}
ComponentView
.
registerClass
(
RadarView
);
\ No newline at end of file
src/coord/Axis.ts
浏览文件 @
d3a7d182
...
...
@@ -219,7 +219,7 @@ class Axis {
return
createAxisLabels
(
this
).
labels
;
}
getLabelModel
():
Model
{
getLabelModel
():
Model
<
AxisBaseOption
[
'
axisLabel
'
]
>
{
return
this
.
model
.
getModel
(
'
axisLabel
'
);
}
...
...
src/coord/axisCommonTypes.ts
浏览文件 @
d3a7d182
...
...
@@ -74,12 +74,12 @@ export interface AxisBaseOption extends ComponentOption,
// + a number
// + 'dataMin': use the min value in data.
// + null/undefined: auto decide min value (consider pretty look and boundaryGap).
min
?:
OptionDataValue
|
'
dataMin
'
;
min
?:
number
|
'
dataMin
'
|
((
extent
:
{
min
:
number
,
max
:
number
})
=>
number
)
;
// Max value of the axis. can be:
// + a number
// + 'dataMax': use the max value in data.
// + null/undefined: auto decide max value (consider pretty look and boundaryGap).
max
?:
OptionDataValue
|
'
dataMax
'
;
max
?:
number
|
'
dataMax
'
|
((
extent
:
{
min
:
number
,
max
:
number
})
=>
number
)
;
// Readonly prop, specifies start value of the range when using data zoom.
// Only for internal usage.
rangeStart
?:
number
;
...
...
src/coord/axisHelper.ts
浏览文件 @
d3a7d182
...
...
@@ -17,8 +17,6 @@
* under the License.
*/
// @ts-nocheck
import
{
__DEV__
}
from
'
../config
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
OrdinalScale
from
'
../scale/Ordinal
'
;
...
...
@@ -30,18 +28,23 @@ import {
makeColumnLayout
,
retrieveColumnLayout
}
from
'
../layout/barGrid
'
;
import
BoundingRect
from
'
zrender/src/core/BoundingRect
'
;
import
BoundingRect
,
{
RectLike
}
from
'
zrender/src/core/BoundingRect
'
;
import
'
../scale/Log
'
;
import
TimeScale
from
'
../scale/Time
'
;
import
{
ComponentOption
}
from
'
../util/types
'
;
import
Model
from
'
../model/Model
'
;
import
{
AxisBaseModel
}
from
'
./AxisBaseModel
'
;
import
LogScale
from
'
../scale/Log
'
;
import
Axis
from
'
./Axis
'
;
import
{
AxisBaseOption
}
from
'
./axisCommonTypes
'
;
import
type
CartesianAxisModel
from
'
./cartesian/AxisModel
'
;
type
BarWidthAndOffset
=
ReturnType
<
typeof
makeColumnLayout
>
/**
* Get axis scale extent before niced.
* Item of returned array can only be number (including Infinity and NaN).
*/
export
function
getScaleExtent
(
scale
,
m
odel
)
{
export
function
getScaleExtent
(
scale
:
Scale
,
model
:
AxisBaseM
odel
)
{
var
scaleType
=
scale
.
type
;
var
min
=
model
.
getMin
();
...
...
@@ -51,27 +54,29 @@ export function getScaleExtent(scale, model) {
var
originalExtent
=
scale
.
getExtent
();
var
axisDataLen
;
var
boundaryGap
;
var
boundaryGap
Inner
:
number
[]
;
var
span
;
if
(
scaleType
===
'
ordinal
'
)
{
axisDataLen
=
model
.
getCategories
().
length
;
}
else
{
boundaryGap
=
model
.
get
(
'
boundaryGap
'
);
if
(
!
zrUtil
.
isArray
(
boundaryGap
))
{
boundaryGap
=
[
boundaryGap
||
0
,
boundaryGap
||
0
];
}
if
(
typeof
boundaryGap
[
0
]
===
'
boolean
'
)
{
var
boundaryGap
=
model
.
get
(
'
boundaryGap
'
);
var
boundaryGapArr
=
zrUtil
.
isArray
(
boundaryGap
)
?
boundaryGap
:
[
boundaryGap
||
0
,
boundaryGap
||
0
];
if
(
typeof
boundaryGap
Arr
[
0
]
===
'
boolean
'
||
typeof
boundaryGapArr
[
1
]
===
'
boolean
'
)
{
if
(
__DEV__
)
{
console
.
warn
(
'
Boolean type for boundaryGap is only
'
+
'
allowed for ordinal axis. Please use string in
'
+
'
percentage instead, e.g., "20%". Currently,
'
+
'
boundaryGap is set to be 0.
'
);
}
boundaryGap
=
[
0
,
0
];
boundaryGapInner
=
[
0
,
0
];
}
else
{
boundaryGapInner
[
0
]
=
numberUtil
.
parsePercent
(
boundaryGapArr
[
0
],
1
);
boundaryGapInner
[
1
]
=
numberUtil
.
parsePercent
(
boundaryGapArr
[
1
],
1
);
}
boundaryGap
[
0
]
=
numberUtil
.
parsePercent
(
boundaryGap
[
0
],
1
);
boundaryGap
[
1
]
=
numberUtil
.
parsePercent
(
boundaryGap
[
1
],
1
);
span
=
(
originalExtent
[
1
]
-
originalExtent
[
0
])
||
Math
.
abs
(
originalExtent
[
0
]);
}
...
...
@@ -94,12 +99,12 @@ export function getScaleExtent(scale, model) {
if
(
min
==
null
)
{
min
=
scaleType
===
'
ordinal
'
?
(
axisDataLen
?
0
:
NaN
)
:
originalExtent
[
0
]
-
boundaryGap
[
0
]
*
span
;
:
originalExtent
[
0
]
-
boundaryGap
Inner
[
0
]
*
span
;
}
if
(
max
==
null
)
{
max
=
scaleType
===
'
ordinal
'
?
(
axisDataLen
?
axisDataLen
-
1
:
NaN
)
:
originalExtent
[
1
]
+
boundaryGap
[
1
]
*
span
;
:
originalExtent
[
1
]
+
boundaryGap
Inner
[
1
]
*
span
;
}
if
(
min
===
'
dataMin
'
)
{
...
...
@@ -128,7 +133,7 @@ export function getScaleExtent(scale, model) {
scale
.
setBlank
(
zrUtil
.
eqNaN
(
min
)
||
zrUtil
.
eqNaN
(
max
)
||
(
scaleType
===
'
ordinal
'
&&
!
scale
.
getOrdinalMeta
().
categories
.
length
)
||
(
(
scale
instanceof
OrdinalScale
)
&&
!
scale
.
getOrdinalMeta
().
categories
.
length
)
);
// Evaluate if axis needs cross zero
...
...
@@ -155,18 +160,19 @@ export function getScaleExtent(scale, model) {
var
ecModel
=
model
.
ecModel
;
if
(
ecModel
&&
(
scaleType
===
'
time
'
/*|| scaleType === 'interval' */
))
{
var
barSeriesModels
=
prepareLayoutBarSeries
(
'
bar
'
,
ecModel
);
var
isBaseAxisAndHasBarSeries
;
var
isBaseAxisAndHasBarSeries
=
false
;
zrUtil
.
each
(
barSeriesModels
,
function
(
seriesModel
)
{
isBaseAxisAndHasBarSeries
|=
seriesModel
.
getBaseAxis
()
===
model
.
axis
;
isBaseAxisAndHasBarSeries
=
isBaseAxisAndHasBarSeries
||
seriesModel
.
getBaseAxis
()
===
model
.
axis
;
});
if
(
isBaseAxisAndHasBarSeries
)
{
// Calculate placement of bars on axis
// Calculate placement of bars on axis. TODO should be decoupled
// with barLayout
var
barWidthAndOffset
=
makeColumnLayout
(
barSeriesModels
);
// Adjust axis min and max to account for overflow
var
adjustedScale
=
adjustScaleForOverflow
(
min
,
max
,
model
,
barWidthAndOffset
);
var
adjustedScale
=
adjustScaleForOverflow
(
min
,
max
,
model
as
CartesianAxisModel
,
barWidthAndOffset
);
min
=
adjustedScale
.
min
;
max
=
adjustedScale
.
max
;
}
...
...
@@ -175,7 +181,12 @@ export function getScaleExtent(scale, model) {
return
[
min
,
max
];
}
function
adjustScaleForOverflow
(
min
,
max
,
model
,
barWidthAndOffset
)
{
function
adjustScaleForOverflow
(
min
:
number
,
max
:
number
,
model
:
CartesianAxisModel
,
// Onlhy support cartesian coord yet.
barWidthAndOffset
:
BarWidthAndOffset
)
{
// Get Axis Length
var
axisExtent
=
model
.
axis
.
getExtent
();
...
...
@@ -210,13 +221,13 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
return
{
min
:
min
,
max
:
max
};
}
export
function
niceScaleExtent
(
scale
,
m
odel
)
{
export
function
niceScaleExtent
(
scale
:
Scale
,
model
:
AxisBaseM
odel
)
{
var
extent
=
getScaleExtent
(
scale
,
model
);
var
fixMin
=
model
.
getMin
()
!=
null
;
var
fixMax
=
model
.
getMax
()
!=
null
;
var
splitNumber
=
model
.
get
(
'
splitNumber
'
);
if
(
scale
.
type
===
'
log
'
)
{
if
(
scale
instanceof
LogScale
)
{
scale
.
base
=
model
.
get
(
'
logBase
'
);
}
...
...
@@ -239,14 +250,14 @@ export function niceScaleExtent(scale, model) {
// FIXME
var
interval
=
model
.
get
(
'
interval
'
);
if
(
interval
!=
null
)
{
scale
.
setInterval
&&
scale
.
setInterval
(
interval
);
(
scale
as
IntervalScale
).
setInterval
&&
(
scale
as
IntervalScale
)
.
setInterval
(
interval
);
}
}
/**
* @param axisType Default retrieve from model.type
*/
export
function
createScaleByModel
(
model
:
Model
<
ComponentOption
>
,
axisType
?:
string
):
Scale
{
export
function
createScaleByModel
(
model
:
AxisBaseModel
,
axisType
?:
string
):
Scale
{
axisType
=
axisType
||
model
.
get
(
'
type
'
);
if
(
axisType
)
{
switch
(
axisType
)
{
...
...
@@ -272,7 +283,7 @@ export function createScaleByModel(model: Model<ComponentOption>, axisType?: str
/**
* Check if the axis corss 0
*/
export
function
ifAxisCrossZero
(
axis
)
{
export
function
ifAxisCrossZero
(
axis
:
Axis
)
{
var
dataExtent
=
axis
.
scale
.
getExtent
();
var
min
=
dataExtent
[
0
];
var
max
=
dataExtent
[
1
];
...
...
@@ -280,51 +291,51 @@ export function ifAxisCrossZero(axis) {
}
/**
* @param
{module:echarts/coord/Axis}
axis
* @return
{Function}
Label formatter function.
* @param axis
* @return Label formatter function.
* param: {number} tickValue,
* param: {number} idx, the index in all ticks.
* If category axis, this param is not requied.
* return: {string} label string.
*/
export
function
makeLabelFormatter
(
axis
)
{
export
function
makeLabelFormatter
(
axis
:
Axis
)
{
var
labelFormatter
=
axis
.
getLabelModel
().
get
(
'
formatter
'
);
var
categoryTickStart
=
axis
.
type
===
'
category
'
?
axis
.
scale
.
getExtent
()[
0
]
:
null
;
if
(
typeof
labelFormatter
===
'
string
'
)
{
labelFormatter
=
(
function
(
tpl
)
{
return
function
(
val
)
{
return
(
function
(
tpl
)
{
return
function
(
val
:
number
|
string
)
{
// For category axis, get raw value; for numeric axis,
// get foramtted label like '1,333,444'.
val
=
axis
.
scale
.
getLabel
(
val
);
return
tpl
.
replace
(
'
{value}
'
,
val
!=
null
?
val
:
''
);
};
})(
labelFormatter
);
// Consider empty array
return
labelFormatter
;
}
else
if
(
typeof
labelFormatter
===
'
function
'
)
{
return
function
(
tickValue
,
idx
)
{
// The original intention of `idx` is "the index of the tick in all ticks".
// But the previous implementation of category axis do not consider the
// `axisLabel.interval`, which cause that, for example, the `interval` is
// `1`, then the ticks "name5", "name7", "name9" are displayed, where the
// corresponding `idx` are `0`, `2`, `4`, but not `0`, `1`, `2`. So we keep
// the definition here for back compatibility.
if
(
categoryTickStart
!=
null
)
{
idx
=
tickValue
-
categoryTickStart
;
}
return
labelFormatter
(
getAxisRawValue
(
axis
,
tickValue
),
idx
);
};
return
(
function
(
cb
)
{
return
function
(
tickValue
:
number
,
idx
:
number
)
{
// The original intention of `idx` is "the index of the tick in all ticks".
// But the previous implementation of category axis do not consider the
// `axisLabel.interval`, which cause that, for example, the `interval` is
// `1`, then the ticks "name5", "name7", "name9" are displayed, where the
// corresponding `idx` are `0`, `2`, `4`, but not `0`, `1`, `2`. So we keep
// the definition here for back compatibility.
if
(
categoryTickStart
!=
null
)
{
idx
=
tickValue
-
categoryTickStart
;
}
return
cb
(
getAxisRawValue
(
axis
,
tickValue
),
idx
);
};
})(
labelFormatter
);
}
else
{
return
function
(
tick
)
{
return
function
(
tick
:
number
)
{
return
axis
.
scale
.
getLabel
(
tick
);
};
}
}
export
function
getAxisRawValue
(
axis
,
value
)
{
export
function
getAxisRawValue
(
axis
:
Axis
,
value
:
number
|
string
):
number
|
string
{
// In category axis with data zoom, tick is not the original
// index of axis.data. So tick should not be exposed to user
// in category axis.
...
...
@@ -332,25 +343,23 @@ export function getAxisRawValue(axis, value) {
}
/**
* @param
{module:echarts/coord/Axis}
axis
* @return
{module:zrender/core/BoundingRect}
Be null/undefined if no labels.
* @param axis
* @return Be null/undefined if no labels.
*/
export
function
estimateLabelUnionRect
(
axis
)
{
export
function
estimateLabelUnionRect
(
axis
:
Axis
)
{
var
axisModel
=
axis
.
model
;
var
scale
=
axis
.
scale
;
if
(
!
axisModel
.
get
(
'
axisLabel.show
'
)
||
scale
.
isBlank
())
{
if
(
!
axisModel
.
get
(
[
'
axisLabel
'
,
'
show
'
]
)
||
scale
.
isBlank
())
{
return
;
}
var
isCategory
=
axis
.
type
===
'
category
'
;
var
realNumberScaleTicks
;
var
tickCount
;
var
categoryScaleExtent
=
scale
.
getExtent
();
// Optimize for large category data, avoid call `getTicks()`.
if
(
isCategory
)
{
if
(
scale
instanceof
OrdinalScale
)
{
tickCount
=
scale
.
count
();
}
else
{
...
...
@@ -369,7 +378,7 @@ export function estimateLabelUnionRect(axis) {
}
for
(
var
i
=
0
;
i
<
tickCount
;
i
+=
step
)
{
var
tickValue
=
realNumberScaleTicks
?
realNumberScaleTicks
[
i
]
:
categoryScaleExtent
[
0
]
+
i
;
var
label
=
labelFormatter
(
tickValue
);
var
label
=
labelFormatter
(
tickValue
,
i
);
var
unrotatedSingleRect
=
axisLabelModel
.
getTextRect
(
label
);
var
singleRect
=
rotateTextRect
(
unrotatedSingleRect
,
axisLabelModel
.
get
(
'
rotate
'
)
||
0
);
...
...
@@ -379,23 +388,22 @@ export function estimateLabelUnionRect(axis) {
return
rect
;
}
function
rotateTextRect
(
textRect
,
rotate
)
{
function
rotateTextRect
(
textRect
:
RectLike
,
rotate
:
number
)
{
var
rotateRadians
=
rotate
*
Math
.
PI
/
180
;
var
boundingBox
=
textRect
.
plain
();
var
beforeWidth
=
boundingBox
.
width
;
var
beforeHeight
=
boundingBox
.
height
;
var
beforeWidth
=
textRect
.
width
;
var
beforeHeight
=
textRect
.
height
;
var
afterWidth
=
beforeWidth
*
Math
.
cos
(
rotateRadians
)
+
beforeHeight
*
Math
.
sin
(
rotateRadians
);
var
afterHeight
=
beforeWidth
*
Math
.
sin
(
rotateRadians
)
+
beforeHeight
*
Math
.
cos
(
rotateRadians
);
var
rotatedRect
=
new
BoundingRect
(
boundingBox
.
x
,
boundingBox
.
y
,
afterWidth
,
afterHeight
);
var
rotatedRect
=
new
BoundingRect
(
textRect
.
x
,
textRect
.
y
,
afterWidth
,
afterHeight
);
return
rotatedRect
;
}
/**
* @param
{module:echarts/src/model/Model}
model axisLabelModel or axisTickModel
* @param model axisLabelModel or axisTickModel
* @return {number|String} Can be null|'auto'|number|function
*/
export
function
getOptionCategoryInterval
(
model
)
{
export
function
getOptionCategoryInterval
(
model
:
Model
<
AxisBaseOption
[
'
axisLabel
'
]
>
)
{
var
interval
=
model
.
get
(
'
interval
'
);
return
interval
==
null
?
'
auto
'
:
interval
;
}
...
...
@@ -406,7 +414,7 @@ export function getOptionCategoryInterval(model) {
* @param {Object} axis axisModel.axis
* @return {boolean}
*/
export
function
shouldShowAllLabels
(
axis
)
{
export
function
shouldShowAllLabels
(
axis
:
Axis
)
{
return
axis
.
type
===
'
category
'
&&
getOptionCategoryInterval
(
axis
.
getLabelModel
())
===
0
;
}
...
...
src/coord/axisModelCommonMixin.ts
浏览文件 @
d3a7d182
...
...
@@ -33,7 +33,7 @@ class AxisModelCommonMixin<Opt extends AxisBaseOption> {
/**
* @return min value or 'dataMin' or null/undefined (means auto) or NaN
*/
getMin
(
origin
?:
boolean
):
number
|
'
dataMin
'
{
getMin
(
origin
?:
boolean
):
AxisBaseOption
[
'
min
'
]
|
number
{
var
option
=
this
.
option
;
var
min
=
(
!
origin
&&
option
.
rangeStart
!=
null
)
?
option
.
rangeStart
:
option
.
min
;
...
...
@@ -46,13 +46,13 @@ class AxisModelCommonMixin<Opt extends AxisBaseOption> {
)
{
min
=
this
.
axis
.
scale
.
parse
(
min
);
}
return
min
as
any
;
return
min
;
}
/**
* @return max value or 'dataMax' or null/undefined (means auto) or NaN
*/
getMax
(
origin
?:
boolean
):
number
|
'
dataMax
'
{
getMax
(
origin
?:
boolean
):
AxisBaseOption
[
'
max
'
]
|
number
{
var
option
=
this
.
option
;
var
max
=
(
!
origin
&&
option
.
rangeEnd
!=
null
)
?
option
.
rangeEnd
:
option
.
max
;
...
...
@@ -65,7 +65,7 @@ class AxisModelCommonMixin<Opt extends AxisBaseOption> {
)
{
max
=
this
.
axis
.
scale
.
parse
(
max
);
}
return
max
as
any
;
return
max
;
}
getNeedCrossZero
():
boolean
{
...
...
src/helper.ts
浏览文件 @
d3a7d182
...
...
@@ -30,6 +30,7 @@ import {
getStackedDimension
}
from
'
./data/helper/dataStackHelper
'
;
import
SeriesModel
from
'
./model/Series
'
;
import
{
AxisBaseModel
}
from
'
./coord/AxisBaseModel
'
;
/**
* Create a muti dimension List structure from seriesModel.
...
...
@@ -71,7 +72,7 @@ export {createSymbol} from './util/symbol';
* @param {Object|module:echarts/Model} option If `optoin.type`
* is secified, it can only be `'value'` currently.
*/
export
function
createScale
(
dataExtent
:
number
[],
option
:
object
|
Model
)
{
export
function
createScale
(
dataExtent
:
number
[],
option
:
object
|
AxisBase
Model
)
{
var
axisModel
=
option
;
if
(
!
(
option
instanceof
Model
))
{
axisModel
=
new
Model
(
option
);
...
...
@@ -85,10 +86,10 @@ export function createScale(dataExtent: number[], option: object | Model) {
// zrUtil.mixin(axisModel, AxisModelCommonMixin);
}
var
scale
=
axisHelper
.
createScaleByModel
(
axisModel
as
Model
);
var
scale
=
axisHelper
.
createScaleByModel
(
axisModel
as
AxisBase
Model
);
scale
.
setExtent
(
dataExtent
[
0
],
dataExtent
[
1
]);
axisHelper
.
niceScaleExtent
(
scale
,
axisModel
);
axisHelper
.
niceScaleExtent
(
scale
,
axisModel
as
AxisBaseModel
);
return
scale
;
}
...
...
src/layout/barGrid.ts
浏览文件 @
d3a7d182
...
...
@@ -411,10 +411,13 @@ function doCalBarWidthAndOffset(seriesInfoList: LayoutSeriesInfo[]) {
* @param seriesModel If not provided, return all.
* @return {stackId: {offset, width}} or {offset, width} if seriesModel provided.
*/
export
function
retrieveColumnLayout
(
function
retrieveColumnLayout
(
barWidthAndOffset
:
BarWidthAndOffset
,
axis
:
Axis2D
):
typeof
barWidthAndOffset
[
string
]
// eslint-disable-next-line max-len
function
retrieveColumnLayout
(
barWidthAndOffset
:
BarWidthAndOffset
,
axis
:
Axis2D
,
seriesModel
:
BarSeriesModel
):
typeof
barWidthAndOffset
[
string
][
string
]
function
retrieveColumnLayout
(
barWidthAndOffset
:
BarWidthAndOffset
,
axis
:
Axis2D
,
seriesModel
:
BarSeriesModel
seriesModel
?
:
BarSeriesModel
)
{
if
(
barWidthAndOffset
&&
axis
)
{
var
result
=
barWidthAndOffset
[
getAxisKey
(
axis
)];
...
...
@@ -424,6 +427,7 @@ export function retrieveColumnLayout(
return
result
;
}
}
export
{
retrieveColumnLayout
};
export
function
layout
(
seriesType
:
string
,
ecModel
:
GlobalModel
)
{
...
...
src/model/mixin/textStyle.ts
浏览文件 @
d3a7d182
...
...
@@ -25,6 +25,9 @@ import { LabelOption, ColorString } from '../../util/types';
var
PATH_COLOR
=
[
'
textStyle
'
,
'
color
'
]
as
const
;
type
LabelFontOption
=
Pick
<
LabelOption
,
'
fontStyle
'
|
'
fontWeight
'
|
'
fontSize
'
|
'
fontFamily
'
>
type
LabelRectRelatedOption
=
Pick
<
LabelOption
,
'
align
'
|
'
verticalAlign
'
|
'
padding
'
|
'
lineHeight
'
|
'
baseline
'
|
'
rich
'
>
&
LabelFontOption
;
class
TextStyleMixin
{
/**
...
...
@@ -52,7 +55,7 @@ class TextStyleMixin {
},
this
.
ecModel
);
}
getTextRect
(
this
:
Model
<
LabelOption
>
&
TextStyleMixin
,
text
:
string
):
graphicUtil
.
BoundingRect
{
getTextRect
(
this
:
Model
<
Label
RectRelated
Option
>
&
TextStyleMixin
,
text
:
string
):
graphicUtil
.
BoundingRect
{
return
textContain
.
getBoundingRect
(
text
,
this
.
getFont
(),
...
...
src/scale/Log.ts
浏览文件 @
d3a7d182
...
...
@@ -42,9 +42,9 @@ var mathLog = Math.log;
class
LogScale
extends
Scale
{
type
=
'
log
'
;
readonly
type
=
'
log
'
;
private
base
=
10
;
base
=
10
;
private
_originalScale
:
IntervalScale
=
new
IntervalScale
();
...
...
src/scale/Ordinal.ts
浏览文件 @
d3a7d182
...
...
@@ -30,6 +30,7 @@ import OrdinalMeta from '../data/OrdinalMeta';
import
List
from
'
../data/List
'
;
import
*
as
scaleHelper
from
'
./helper
'
;
import
{
OrdinalRawValue
,
OrdinalNumber
,
DimensionLoose
}
from
'
../util/types
'
;
import
{
AxisBaseOption
}
from
'
../coord/axisCommonTypes
'
;
class
OrdinalScale
extends
Scale
{
...
...
@@ -40,7 +41,7 @@ class OrdinalScale extends Scale {
constructor
(
setting
?:
{
ordinalMeta
?:
OrdinalMeta
|
OrdinalRawValue
[
],
ordinalMeta
?:
OrdinalMeta
|
AxisBaseOption
[
'
data
'
],
extent
?:
[
number
,
number
]
})
{
super
(
setting
);
...
...
src/scale/Scale.ts
浏览文件 @
d3a7d182
...
...
@@ -23,7 +23,6 @@ import { Dictionary } from 'zrender/src/core/types';
import
List
from
'
../data/List
'
;
import
{
DimensionName
,
ScaleDataValue
,
OptionDataValue
}
from
'
../util/types
'
;
abstract
class
Scale
{
type
:
string
;
...
...
@@ -152,12 +151,13 @@ abstract class Scale {
*/
abstract
getLabel
(
tick
:
any
):
string
;
abstract
getTicks
(
expandToNicedExtent
:
boolean
):
number
[];
abstract
getTicks
(
expandToNicedExtent
?
:
boolean
):
number
[];
abstract
getMinorTicks
(
splitNumber
:
number
):
number
[][];
static
registerClass
:
clazzUtil
.
ClassManager
[
'
registerClass
'
];
static
getClass
:
clazzUtil
.
ClassManager
[
'
getClass
'
];
}
type
ScaleConstructor
=
typeof
Scale
&
clazzUtil
.
ClassManager
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录