Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
1be0144b
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,发现更多精彩内容 >>
提交
1be0144b
编写于
1月 14, 2018
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix parallels and candlestick.
上级
fb1886a7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
331 addition
and
8 deletion
+331
-8
src/chart/helper/whiskerBoxCommon.js
src/chart/helper/whiskerBoxCommon.js
+14
-6
src/chart/parallel/ParallelView.js
src/chart/parallel/ParallelView.js
+1
-1
src/coord/parallel/Parallel.js
src/coord/parallel/Parallel.js
+4
-1
src/data/helper/completeDimensions.js
src/data/helper/completeDimensions.js
+4
-0
test/dataset-charts.html
test/dataset-charts.html
+308
-0
未找到文件。
src/chart/helper/whiskerBoxCommon.js
浏览文件 @
1be0144b
...
...
@@ -2,6 +2,7 @@
import
createListSimply
from
'
../helper/createListSimply
'
;
import
WhiskerBoxDraw
from
'
../helper/WhiskerBoxDraw
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
{
getDimensionTypeByAxis
}
from
'
../../data/helper/dimensionHelper
'
;
export
var
seriesModelMixin
=
{
...
...
@@ -19,7 +20,7 @@ export var seriesModelMixin = {
// needed to be specified by user. Otherwise, layout can be
// judged by which axis is category.
var
categories
;
var
ordinalMeta
;
var
xAxisModel
=
ecModel
.
getComponent
(
'
xAxis
'
,
this
.
get
(
'
xAxisIndex
'
));
var
yAxisModel
=
ecModel
.
getComponent
(
'
yAxis
'
,
this
.
get
(
'
yAxisIndex
'
));
...
...
@@ -32,12 +33,12 @@ export var seriesModelMixin = {
if
(
xAxisType
===
'
category
'
)
{
option
.
layout
=
'
horizontal
'
;
categories
=
xAxisModel
.
getCategories
();
ordinalMeta
=
xAxisModel
.
getOrdinalMeta
();
addOrdinal
=
true
;
}
else
if
(
yAxisType
===
'
category
'
)
{
option
.
layout
=
'
vertical
'
;
categories
=
yAxisModel
.
getCategories
();
ordinalMeta
=
yAxisModel
.
getOrdinalMeta
();
addOrdinal
=
true
;
}
else
{
...
...
@@ -48,8 +49,12 @@ export var seriesModelMixin = {
var
baseAxisDimIndex
=
option
.
layout
===
'
horizontal
'
?
0
:
1
;
var
baseAxisDim
=
this
.
_baseAxisDim
=
coordDims
[
baseAxisDimIndex
];
var
otherAxisDim
=
coordDims
[
1
-
baseAxisDimIndex
];
var
axisModels
=
[
xAxisModel
,
yAxisModel
];
var
baseAxisType
=
axisModels
[
baseAxisDimIndex
].
get
(
'
type
'
);
var
otherAxisType
=
axisModels
[
1
-
baseAxisDimIndex
].
get
(
'
type
'
);
var
data
=
option
.
data
;
// ??? FIXME make a stage to perform data transfrom.
addOrdinal
&&
zrUtil
.
each
(
data
,
function
(
item
,
index
)
{
if
(
item
.
value
&&
zrUtil
.
isArray
(
item
.
value
))
{
item
.
value
.
unshift
(
index
);
...
...
@@ -65,17 +70,20 @@ export var seriesModelMixin = {
{
coordDimensions
:
[{
name
:
baseAxisDim
,
type
:
getDimensionTypeByAxis
(
baseAxisType
),
ordinalMeta
:
ordinalMeta
,
otherDims
:
{
tooltip
:
false
tooltip
:
false
,
itemName
:
0
},
dimsDef
:
[
'
base
'
]
},
{
name
:
otherAxisDim
,
type
:
getDimensionTypeByAxis
(
otherAxisType
),
dimsDef
:
defaultValueDimensions
.
slice
()
}],
dimensionsCount
:
defaultValueDimensions
.
length
+
1
},
categories
&&
categories
.
slice
()
}
);
},
...
...
src/chart/parallel/ParallelView.js
浏览文件 @
1be0144b
...
...
@@ -164,7 +164,7 @@ function createLinePoints(data, dataIndex, dimensions, coordSys) {
var
points
=
[];
for
(
var
i
=
0
;
i
<
dimensions
.
length
;
i
++
)
{
var
dimName
=
dimensions
[
i
];
var
value
=
data
.
get
(
d
imName
,
dataIndex
);
var
value
=
data
.
get
(
d
ata
.
mapDimension
(
dimName
)
,
dataIndex
);
if
(
!
isEmptyValue
(
value
,
coordSys
.
getAxis
(
dimName
).
type
))
{
points
.
push
(
coordSys
.
dataToPoint
(
value
,
dimName
));
}
...
...
src/coord/parallel/Parallel.js
浏览文件 @
1be0144b
...
...
@@ -339,11 +339,14 @@ Parallel.prototype = {
*/
eachActiveState
:
function
(
data
,
callback
,
context
)
{
var
dimensions
=
this
.
dimensions
;
var
dataDimensions
=
zrUtil
.
map
(
dimensions
,
function
(
axisDim
)
{
return
data
.
mapDimension
(
axisDim
);
});
var
axesMap
=
this
.
_axesMap
;
var
hasActiveSet
=
this
.
hasAxisBrushed
();
for
(
var
i
=
0
,
len
=
data
.
count
();
i
<
len
;
i
++
)
{
var
values
=
data
.
getValues
(
dimensions
,
i
);
var
values
=
data
.
getValues
(
d
ataD
imensions
,
i
);
var
activeState
;
if
(
!
hasActiveSet
)
{
...
...
src/data/helper/completeDimensions.js
浏览文件 @
1be0144b
...
...
@@ -22,6 +22,7 @@ import {OTHER_DIMENSIONS} from './dimensionHelper';
* properties: 'name', 'type', 'displayName'.
* `name` of each item provides default coord name.
* [{dimsDef: [string...]}, ...] can be specified to give names.
* [{ordinalMeta}] can be specified.
* @param {module:echarts/data/Source|Array|Object} source or data (for compatibal with pervious)
* @param {Object} [opt]
* @param {Array.<Object|string>} [opt.dimsDef] option.series.dimensions User defined dimensions
...
...
@@ -115,7 +116,10 @@ function completeDimensions(sysDims, source, opt) {
}
else
{
coordDim
=
sysDimItem
.
name
;
var
ordinalMeta
=
sysDimItem
.
ordinalMeta
;
sysDimItem
.
ordinalMeta
=
null
;
sysDimItem
=
clone
(
sysDimItem
);
sysDimItem
.
ordinalMeta
=
ordinalMeta
;
// `coordDimIndex` should not be set directly.
sysDimItemDimsDef
=
sysDimItem
.
dimsDef
;
sysDimItemOtherDims
=
sysDimItem
.
otherDims
;
...
...
test/dataset-charts.html
浏览文件 @
1be0144b
...
...
@@ -4,6 +4,7 @@
<meta
charset=
"utf-8"
>
<script
src=
"lib/esl.js"
></script>
<script
src=
"lib/config.js"
></script>
<script
src=
"lib/jquery.min.js"
></script>
<script
src=
"lib/testHelper.js"
></script>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<link
rel=
"stylesheet"
href=
"lib/reset.css"
/>
...
...
@@ -29,6 +30,10 @@
<div
id=
"layout3"
></div>
<div
id=
"layout4"
></div>
<div
id=
"layout5"
></div>
<div
id=
"layout6"
></div>
<div
id=
"layout7"
></div>
<div
id=
"layout8"
></div>
<div
id=
"layout9"
></div>
...
...
@@ -76,6 +81,27 @@
[
55.2
,
5312
,
67.1
,
3266
,
69.2
,
1354
]
];
var
errorData
=
[
[
'
name
'
,
'
Price
'
,
'
Prime cost
'
,
'
Prime cost min
'
,
'
Prime cost max
'
,
'
Price min
'
,
'
Price max
'
],
[
'
Blouse "Blue Viola"
'
,
101.88
,
99.75
,
76.75
,
116.75
,
69.88
,
119.88
],
[
'
Dress "Daisy"
'
,
155.8
,
144.03
,
126.03
,
156.03
,
129.8
,
188.8
],
[
'
Trousers "Cutesy Classic"
'
,
203.25
,
173.56
,
151.56
,
187.56
,
183.25
,
249.25
],
[
'
Dress "Morning Dew"
'
,
256
,
120.5
,
98.5
,
136.5
,
236
,
279
],
[
'
Turtleneck "Dark Chocolate"
'
,
408.89
,
294.75
,
276.75
,
316.75
,
385.89
,
427.89
],
[
'
Jumper "Early Spring"
'
,
427.36
,
430.24
,
407.24
,
452.24
,
399.36
,
461.36
],
[
'
Breeches "Summer Mood"
'
,
356
,
135.5
,
123.5
,
151.5
,
333
,
387
],
[
'
Dress "Mauve Chamomile"
'
,
406
,
95.5
,
73.5
,
111.5
,
366
,
429
],
[
'
Dress "Flying Tits"
'
,
527.36
,
503.24
,
488.24
,
525.24
,
485.36
,
551.36
],
[
'
Dress "Singing Nightingales"
'
,
587.36
,
543.24
,
518.24
,
555.24
,
559.36
,
624.36
],
[
'
Sundress "Cloudy weather"
'
,
603.36
,
407.24
,
392.24
,
419.24
,
581.36
,
627.36
],
[
'
Sundress "East motives"
'
,
633.36
,
477.24
,
445.24
,
487.24
,
594.36
,
652.36
],
[
'
Sweater "Cold morning"
'
,
517.36
,
437.24
,
416.24
,
454.24
,
488.36
,
565.36
],
[
'
Trousers "Lavender Fields"
'
,
443.36
,
387.24
,
370.24
,
413.24
,
412.36
,
484.36
],
[
'
Jumper "Coffee with Milk"
'
,
543.36
,
307.24
,
288.24
,
317.24
,
509.36
,
574.36
],
[
'
Blouse "Blooming Cactus"
'
,
790.36
,
277.24
,
254.24
,
295.24
,
764.36
,
818.36
],
[
'
Sweater "Fluffy Comfort"
'
,
790.34
,
678.34
,
660.34
,
690.34
,
762.34
,
824.34
]
];
// No 北京 上海 江苏
var
nameValueGeo0
=
[
{
name
:
'
天津
'
,
value
:
514
},
...
...
@@ -401,5 +427,287 @@
<script>
require
([
'
echarts
'
],
function
(
echarts
)
{
function
renderItem
(
params
,
api
)
{
var
children
=
[];
var
coordDims
=
[
'
x
'
,
'
y
'
];
for
(
var
baseDimIdx
=
0
;
baseDimIdx
<
2
;
baseDimIdx
++
)
{
var
otherDimIdx
=
1
-
baseDimIdx
;
var
encode
=
params
.
encode
;
var
baseValue
=
api
.
value
(
encode
[
coordDims
[
baseDimIdx
]][
0
]);
var
param
=
[];
param
[
baseDimIdx
]
=
baseValue
;
param
[
otherDimIdx
]
=
api
.
value
(
encode
[
coordDims
[
otherDimIdx
]][
1
]);
var
highPoint
=
api
.
coord
(
param
);
param
[
otherDimIdx
]
=
api
.
value
(
encode
[
coordDims
[
otherDimIdx
]][
2
]);
var
lowPoint
=
api
.
coord
(
param
);
var
halfWidth
=
5
;
var
style
=
api
.
style
({
stroke
:
api
.
visual
(
'
color
'
),
fill
:
null
});
children
.
push
({
type
:
'
line
'
,
shape
:
makeShape
(
baseDimIdx
,
highPoint
[
baseDimIdx
]
-
halfWidth
,
highPoint
[
otherDimIdx
],
highPoint
[
baseDimIdx
]
+
halfWidth
,
highPoint
[
otherDimIdx
]
),
style
:
style
},
{
type
:
'
line
'
,
shape
:
makeShape
(
baseDimIdx
,
highPoint
[
baseDimIdx
],
highPoint
[
otherDimIdx
],
lowPoint
[
baseDimIdx
],
lowPoint
[
otherDimIdx
]
),
style
:
style
},
{
type
:
'
line
'
,
shape
:
makeShape
(
baseDimIdx
,
lowPoint
[
baseDimIdx
]
-
halfWidth
,
lowPoint
[
otherDimIdx
],
lowPoint
[
baseDimIdx
]
+
halfWidth
,
lowPoint
[
otherDimIdx
]
),
style
:
style
});
}
function
makeShape
(
baseDimIdx
,
base1
,
value1
,
base2
,
value2
)
{
var
shape
=
{};
shape
[
coordDims
[
baseDimIdx
]
+
'
1
'
]
=
base1
;
shape
[
coordDims
[
1
-
baseDimIdx
]
+
'
1
'
]
=
value1
;
shape
[
coordDims
[
baseDimIdx
]
+
'
2
'
]
=
base2
;
shape
[
coordDims
[
1
-
baseDimIdx
]
+
'
2
'
]
=
value2
;
return
shape
;
}
return
{
type
:
'
group
'
,
children
:
children
};
}
var
option
=
{
dataset
:
{
source
:
errorData
},
tooltip
:
{
},
legend
:
{
},
dataZoom
:
[{
type
:
'
slider
'
},
{
type
:
'
inside
'
}],
visualMap
:
{
min
:
0
,
max
:
1000
,
dimension
:
1
,
calculable
:
true
},
xAxis
:
{},
yAxis
:
{},
series
:
[{
type
:
'
scatter
'
,
name
:
'
error
'
,
encode
:
{
x
:
2
,
y
:
1
,
tooltip
:
[
2
,
1
,
3
,
4
,
5
,
6
],
itemName
:
0
},
itemStyle
:
{
normal
:
{
color
:
'
#77bef7
'
}
}
},
{
type
:
'
custom
'
,
name
:
'
error
'
,
renderItem
:
renderItem
,
encode
:
{
x
:
[
2
,
3
,
4
],
y
:
[
1
,
5
,
6
],
tooltip
:
[
2
,
1
,
3
,
4
,
5
,
6
],
itemName
:
0
},
z
:
100
}]
};
testHelper
.
create
(
echarts
,
'
layout6
'
,
{
title
:
'
error data (custom)
'
,
height
:
400
,
dataTables
:
[
errorData
],
option
:
option
});
});
</script>
<script>
require
([
'
echarts
'
,
'
data/stock-DJI.json
'
],
function
(
echarts
,
source
)
{
var
option
=
{
legend
:
{},
tooltip
:
{
trigger
:
'
axis
'
},
xAxis
:
{
type
:
'
category
'
},
yAxis
:
{},
dataset
:
[{
source
:
source
}],
dataZoom
:
[{},
{
type
:
'
inside
'
}],
animation
:
false
,
series
:
[{
type
:
'
candlestick
'
,
encode
:
{
x
:
0
,
y
:
[
1
,
2
,
3
,
4
]
}
}]
};
testHelper
.
create
(
echarts
,
'
layout7
'
,
{
height
:
400
,
option
:
option
,
dataTables
:
[
source
],
info
:
{
series
:
option
.
series
}
});
});
</script>
<script>
require
([
'
echarts
'
,
'
data/stock-DJI.json
'
],
function
(
echarts
,
source
)
{
var
option
=
{
legend
:
{},
tooltip
:
{
trigger
:
'
axis
'
},
xAxis
:
{
type
:
'
time
'
},
yAxis
:
{},
dataset
:
[{
source
:
source
}],
dataZoom
:
[{},
{
type
:
'
inside
'
}],
animation
:
false
,
series
:
[{
type
:
'
candlestick
'
,
encode
:
{
x
:
0
,
y
:
[
1
,
2
,
3
,
4
]
}
}]
};
testHelper
.
create
(
echarts
,
'
layout8
'
,
{
title
:
'
time axis
'
,
height
:
400
,
option
:
option
,
dataTables
:
[
source
],
info
:
{
series
:
option
.
series
}
});
});
</script>
<script>
require
([
'
echarts
'
],
function
(
echarts
,
source
)
{
var
option
=
{
legend
:
{},
dataset
:
[{
source
:
arrayRows1
}],
parallelAxis
:
[
{
dim
:
0
,
type
:
'
category
'
},
{
dim
:
1
},
{
dim
:
2
},
{
dim
:
3
}
],
parallel
:
{
axisExpandable
:
true
,
axisExpandCenter
:
15
,
axisExpandCount
:
10
,
axisExpandWidth
:
60
,
axisExpandTriggerOn
:
'
mousemove
'
,
parallelAxisDefault
:
{
type
:
'
value
'
,
nameLocation
:
'
end
'
,
nameGap
:
20
,
tooltip
:
{
show
:
true
},
nameTextStyle
:
{
fontSize
:
14
},
splitLine
:
{
show
:
false
}
}
},
series
:
[{
type
:
'
parallel
'
}]
};
testHelper
.
create
(
echarts
,
'
layout9
'
,
{
height
:
400
,
option
:
option
,
dataTables
:
[
arrayRows1
]
});
});
</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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录