Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
9881368b
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 搜索 >>
提交
9881368b
编写于
7月 31, 2020
作者:
1
100pah
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature: add boxplot transform.
上级
4243980a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
189 addition
and
0 deletion
+189
-0
extension-src/dataTool/boxplotTransform.ts
extension-src/dataTool/boxplotTransform.ts
+70
-0
extension-src/dataTool/index.ts
extension-src/dataTool/index.ts
+3
-0
test/data-transform-external.html
test/data-transform-external.html
+116
-0
未找到文件。
extension-src/dataTool/boxplotTransform.ts
0 → 100644
浏览文件 @
9881368b
/*
* 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.
*/
import
{
DataTransformOption
,
ExternalDataTransform
}
from
'
../../src/data/helper/transform
'
;
import
prepareBoxplotData
from
'
./prepareBoxplotData
'
;
import
{
isArray
,
each
}
from
'
zrender/src/core/util
'
;
// import { throwError, makePrintable } from '../../src/util/log';
export
interface
BoxplotTransformOption
extends
DataTransformOption
{
type
:
'
echarts-extension:boxplot
'
;
config
:
{
boundIQR
?:
number
|
'
none
'
,
layout
?:
'
horizontal
'
|
'
vertical
'
}
}
export
const
boxplotTransform
:
ExternalDataTransform
<
BoxplotTransformOption
>
=
{
type
:
'
echarts-extension:boxplot
'
,
// PEDING: enhance to filter by index rather than create new data
transform
:
function
transform
(
params
)
{
const
source
=
params
.
source
;
const
config
=
params
.
config
||
{};
const
sourceData
=
source
.
data
;
if
(
!
isArray
(
sourceData
)
||
(
sourceData
[
0
]
&&
!
isArray
(
sourceData
[
0
]))
)
{
throw
new
Error
(
'
source data is not applicable for this boxplot transform. Expect number[][].
'
);
}
const
result
=
prepareBoxplotData
(
source
.
data
as
number
[][],
config
);
const
boxData
=
result
.
boxData
as
(
number
|
string
)[][];
each
(
boxData
,
function
(
item
,
dataIdx
)
{
item
.
unshift
(
result
.
axisData
[
dataIdx
]);
});
return
[{
data
:
boxData
},
{
data
:
result
.
outliers
}];
}
};
extension-src/dataTool/index.ts
浏览文件 @
9881368b
...
...
@@ -21,12 +21,14 @@
import
*
as
echarts
from
'
echarts
'
;
import
*
as
gexf
from
'
./gexf
'
;
import
prepareBoxplotData
from
'
./prepareBoxplotData
'
;
import
{
boxplotTransform
}
from
'
./boxplotTransform
'
;
export
const
version
=
'
1.0.0
'
;
export
{
gexf
};
export
{
prepareBoxplotData
};
export
{
boxplotTransform
};
// For backward compatibility, where the namespace `dataTool` will
// be mounted on `echarts` is the extension `dataTool` is imported.
...
...
@@ -36,4 +38,5 @@ if (echarts.dataTool) {
echarts
.
dataTool
.
version
=
version
;
echarts
.
dataTool
.
gexf
=
gexf
;
echarts
.
dataTool
.
prepareBoxplotData
=
prepareBoxplotData
;
echarts
.
dataTool
.
boxplotTransform
=
boxplotTransform
;
}
test/data-transform-external.html
0 → 100644
浏览文件 @
9881368b
<!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=
"main_boxplot"
></div>
<script>
require
([
'
echarts
'
,
'
data/Michelson-Morley.json
'
,
'
extension/dataTool
'
],
function
(
echarts
,
rawData
,
dataTool
)
{
var
boxplotTransform
=
dataTool
.
boxplotTransform
;
echarts
.
registerTransform
(
boxplotTransform
);
var
option
=
{
dataset
:
[{
source
:
rawData
},
{
transform
:
{
type
:
'
echarts-extension:boxplot
'
}
},
{
fromDatasetIndex
:
1
,
fromTransformResult
:
1
}],
title
:
[
{
text
:
'
Michelson-Morley Experiment
'
,
left
:
'
center
'
},
{
text
:
'
upper: Q3 + 1.5 * IRQ
\n
lower: Q1 - 1.5 * IRQ
'
,
borderColor
:
'
#999
'
,
borderWidth
:
1
,
textStyle
:
{
fontSize
:
14
},
left
:
'
10%
'
,
top
:
'
90%
'
}
],
legend
:
{
bottom
:
20
},
tooltip
:
{
},
grid
:
{
bottom
:
80
},
xAxis
:
{
type
:
'
category
'
,
},
yAxis
:
{
type
:
'
value
'
,
name
:
'
km/s minus 299,000
'
,
},
series
:
[{
name
:
'
boxplot
'
,
type
:
'
boxplot
'
,
datasetIndex
:
1
},
{
name
:
'
outlier
'
,
type
:
'
scatter
'
,
datasetIndex
:
2
}]
};
var
chart
=
testHelper
.
create
(
echarts
,
'
main_boxplot
'
,
{
title
:
[
'
Boxplot
'
,
],
option
:
option
});
});
</script>
</body>
</html>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录