Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
0607db01
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 搜索 >>
提交
0607db01
编写于
1月 10, 2020
作者:
Y
yufeng04
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug #11517 the precision of markLine
上级
83ba4691
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
171 addition
and
2 deletion
+171
-2
src/component/marker/MarkLineModel.js
src/component/marker/MarkLineModel.js
+1
-1
src/component/marker/MarkLineView.js
src/component/marker/MarkLineView.js
+4
-1
test/markLine-precision.html
test/markLine-precision.html
+166
-0
未找到文件。
src/component/marker/MarkLineModel.js
浏览文件 @
0607db01
...
...
@@ -32,7 +32,7 @@ export default MarkerModel.extend({
//symbolRotate: 0,
precision
:
2
,
//
precision: 2,
tooltip
:
{
trigger
:
'
item
'
},
...
...
src/component/marker/MarkLineView.js
浏览文件 @
0607db01
...
...
@@ -67,9 +67,12 @@ var markLineTransform = function (seriesModel, coordSys, mlModel, item) {
mlTo
.
coord
[
baseIndex
]
=
Infinity
;
var
precision
=
mlModel
.
get
(
'
precision
'
);
if
(
precision
>=
0
&&
typeof
value
===
'
number
'
)
{
if
(
precision
&&
precision
>=
0
&&
typeof
value
===
'
number
'
)
{
value
=
+
value
.
toFixed
(
Math
.
min
(
precision
,
20
));
}
if
(
precision
==
null
&&
mlType
===
'
average
'
)
{
value
=
+
value
.
toFixed
(
2
);
}
mlFrom
.
coord
[
valueIndex
]
=
mlTo
.
coord
[
valueIndex
]
=
value
;
...
...
test/markLine-precision.html
0 → 100644
浏览文件 @
0607db01
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<script
src=
"lib/esl.js"
></script>
<script
src=
"lib/config.js"
></script>
<script
src=
"lib/jquery.min.js"
></script>
<script
src=
"lib/facePrint.js"
></script>
<script
src=
"lib/testHelper.js"
></script>
<!-- <script src="ut/lib/canteen.js"></script> -->
<link
rel=
"stylesheet"
href=
"lib/reset.css"
/>
</head>
<body>
<style>
</style>
<div
id=
"main0"
></div>
<div
id=
"main1"
></div>
<script>
require
([
'
echarts
'
/*, 'map/js/china' */
],
function
(
echarts
)
{
var
option0
;
var
option1
;
// $.getJSON('./data/nutrients.json', function (data) {});
option0
=
{
xAxis
:
{
type
:
'
category
'
,
boundaryGap
:
false
,
data
:
[
'
周一
'
,
'
周二
'
,
'
周三
'
,
'
周四
'
,
'
周五
'
,
'
周六
'
,
'
周日
'
]
},
yAxis
:
{
type
:
'
value
'
},
series
:
[
{
type
:
'
line
'
,
data
:
[.
012345
,
-
.
0234
,
.
0257
,
.
084678
,
.
038245
,
.
002578
,
0.0546
],
markLine
:
{
data
:
[
{
type
:
'
max
'
},
{
type
:
'
min
'
},
{
type
:
'
average
'
},
{
type
:
'
median
'
},
{
xAxis
:
'
周二
'
},
{
yAxis
:
0.01234567
}
]
}
}
]
};
var
chart0
=
testHelper
.
create
(
echarts
,
'
main0
'
,
{
title
:
[
'
Configuration without precision
'
,
'
The precision of average is 2
'
,
'
The precision of other type is the precision of value
'
],
option
:
option0
// height: 300,
// buttons: [{text: 'btn-txt', onclick: function () {}}],
// recordCanvas: true,
});
option1
=
{
xAxis
:
{
type
:
'
category
'
,
boundaryGap
:
false
,
data
:
[
'
周一
'
,
'
周二
'
,
'
周三
'
,
'
周四
'
,
'
周五
'
,
'
周六
'
,
'
周日
'
]
},
yAxis
:
{
type
:
'
value
'
},
series
:
[
{
type
:
'
line
'
,
data
:
[.
01238
,
-
.
02323
,
.
02299
,
.
08
,
.
03152
,
.
00212
,
0.0386
],
markLine
:
{
data
:
[
{
type
:
'
max
'
},
{
type
:
'
min
'
},
{
type
:
'
average
'
},
{
type
:
'
median
'
},
{
xAxis
:
'
周二
'
},
{
yAxis
:
0.01234567
}
],
precision
:
3
}
}
]
};
var
chart1
=
testHelper
.
create
(
echarts
,
'
main1
'
,
{
title
:
[
'
Precision of configuration is 3
'
,
'
The precision of max is 2, because the value is 0.08
'
,
'
The precision of other type is 3
'
],
option
:
option1
// height: 300,
// buttons: [{text: 'btn-txt', onclick: function () {}}],
// recordCanvas: true,
});
});
</script>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录