Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
cf5812f6
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,发现更多精彩内容 >>
未验证
提交
cf5812f6
编写于
3月 16, 2020
作者:
Y
Yi Shen
提交者:
GitHub
3月 16, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12215 from susiwen8/#11829
Feat: use auto calculate if min /max is null
上级
077b7392
c928a939
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
71 addition
and
16 deletion
+71
-16
src/coord/axisHelper.js
src/coord/axisHelper.js
+31
-15
src/echarts.js
src/echarts.js
+1
-1
test/axis-extrema.html
test/axis-extrema.html
+39
-0
未找到文件。
src/coord/axisHelper.js
浏览文件 @
cf5812f6
...
...
@@ -87,17 +87,6 @@ export function getScaleExtent(scale, model) {
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
// that the results processed by boundaryGap are positive/negative?
if
(
min
==
null
)
{
min
=
scaleType
===
'
ordinal
'
?
(
axisDataLen
?
0
:
NaN
)
:
originalExtent
[
0
]
-
boundaryGap
[
0
]
*
span
;
}
if
(
max
==
null
)
{
max
=
scaleType
===
'
ordinal
'
?
(
axisDataLen
?
axisDataLen
-
1
:
NaN
)
:
originalExtent
[
1
]
+
boundaryGap
[
1
]
*
span
;
}
if
(
min
===
'
dataMin
'
)
{
min
=
originalExtent
[
0
];
}
...
...
@@ -118,6 +107,17 @@ export function getScaleExtent(scale, model) {
});
}
if
(
min
==
null
)
{
min
=
scaleType
===
'
ordinal
'
?
(
axisDataLen
?
0
:
NaN
)
:
originalExtent
[
0
]
-
boundaryGap
[
0
]
*
span
;
}
if
(
max
==
null
)
{
max
=
scaleType
===
'
ordinal
'
?
(
axisDataLen
?
axisDataLen
-
1
:
NaN
)
:
originalExtent
[
1
]
+
boundaryGap
[
1
]
*
span
;
}
(
min
==
null
||
!
isFinite
(
min
))
&&
(
min
=
NaN
);
(
max
==
null
||
!
isFinite
(
max
))
&&
(
max
=
NaN
);
...
...
@@ -208,8 +208,24 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
export
function
niceScaleExtent
(
scale
,
model
)
{
var
extent
=
getScaleExtent
(
scale
,
model
);
var
fixMin
=
model
.
getMin
()
!=
null
;
var
fixMax
=
model
.
getMax
()
!=
null
;
var
min
=
model
.
getMin
();
var
max
=
model
.
getMax
();
var
originalExtent
=
scale
.
getExtent
();
if
(
typeof
min
===
'
function
'
)
{
min
=
min
({
min
:
originalExtent
[
0
],
max
:
originalExtent
[
1
]
});
}
if
(
typeof
max
===
'
function
'
)
{
max
=
max
({
min
:
originalExtent
[
0
],
max
:
originalExtent
[
1
]
});
}
var
splitNumber
=
model
.
get
(
'
splitNumber
'
);
if
(
scale
.
type
===
'
log
'
)
{
...
...
@@ -220,8 +236,8 @@ export function niceScaleExtent(scale, model) {
scale
.
setExtent
(
extent
[
0
],
extent
[
1
]);
scale
.
niceExtent
({
splitNumber
:
splitNumber
,
fixMin
:
fixMin
,
fixMax
:
fixMax
,
fixMin
:
min
!=
null
,
fixMax
:
max
!=
null
,
minInterval
:
(
scaleType
===
'
interval
'
||
scaleType
===
'
time
'
)
?
model
.
get
(
'
minInterval
'
)
:
null
,
maxInterval
:
(
scaleType
===
'
interval
'
||
scaleType
===
'
time
'
)
...
...
src/echarts.js
浏览文件 @
cf5812f6
...
...
@@ -601,7 +601,7 @@ echartsProto.getConnectedDataURL = function (opts) {
each
(
canvasList
,
function
(
item
)
{
var
x
=
item
.
left
-
left
;
var
y
=
item
.
top
-
top
;
content
+=
'
<g transform="translate(
'
+
x
+
"
,
"
content
+=
'
<g transform="translate(
'
+
x
+
'
,
'
+
y
+
'
)">
'
+
item
.
dom
+
'
</g>
'
;
});
zr
.
painter
.
getSvgRoot
().
innerHTML
=
content
;
...
...
test/axis-extrema.html
浏览文件 @
cf5812f6
...
...
@@ -68,6 +68,9 @@ under the License.
<h2>
cartesian value axis | xAxis: {min: function, max: function}
</h2>
<div
class=
"chart"
id=
"main4.1"
></div>
<h2>
cartesian value axis | xAxis: {min: function, max: function}
</h2>
<div
class=
"chart"
id=
"main4.2"
></div>
<h2>
cartesian time axis | xAxis: {min: 'dataMin', max: 'dataMax'}
</h2>
<div
class=
"chart"
id=
"main5"
></div>
...
...
@@ -463,6 +466,42 @@ under the License.
});
</script>
<script>
makeChart
(
'
main4.2
'
,
{
legend
:
{
data
:
[
'
no point
'
,
'
one point
'
,
'
two points
'
],
selectedMode
:
'
single
'
},
tooltip
:
{
trigger
:
'
axis
'
,
axisPointer
:
{
type
:
'
line
'
}
},
xAxis
:
{
min
:
function
(
value
)
{
return
null
},
max
:
function
(
value
)
{
return
null
;
}
},
yAxis
:
{},
series
:
[{
name
:
'
no point
'
,
type
:
'
line
'
,
data
:
[]
},
{
name
:
'
one point
'
,
type
:
'
line
'
,
data
:
[[
2
,
43
]]
},
{
name
:
'
two points
'
,
type
:
'
line
'
,
data
:
[[
2
,
43
],
[
4
,
99
]]
}]
});
</script>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录