Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
3ef37dd9
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,发现更多精彩内容 >>
提交
3ef37dd9
编写于
11月 27, 2015
作者:
P
pah100
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
parallel tweak
上级
1544676e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
114 addition
and
113 deletion
+114
-113
src/chart/parallel/ParallelView.js
src/chart/parallel/ParallelView.js
+28
-36
src/chart/parallel/parallelVisual.js
src/chart/parallel/parallelVisual.js
+5
-31
src/component/helper/SelectController.js
src/component/helper/SelectController.js
+1
-1
src/coord/parallel/Parallel.js
src/coord/parallel/Parallel.js
+42
-7
src/coord/parallel/ParallelAxis.js
src/coord/parallel/ParallelAxis.js
+9
-8
src/data/List.js
src/data/List.js
+10
-20
test/parallel-aqi.html
test/parallel-aqi.html
+19
-10
未找到文件。
src/chart/parallel/ParallelView.js
浏览文件 @
3ef37dd9
...
...
@@ -2,7 +2,6 @@ define(function (require) {
var
graphic
=
require
(
'
../../util/graphic
'
);
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
each
=
zrUtil
.
each
;
var
ParallelView
=
require
(
'
../../view/Chart
'
).
extend
({
...
...
@@ -52,7 +51,8 @@ define(function (require) {
function
add
(
newDataIndex
)
{
var
values
=
data
.
getValues
(
dimensionNames
,
newDataIndex
);
var
els
=
[];
var
elGroup
=
new
graphic
.
Group
();
dataGroup
.
add
(
elGroup
);
eachAxisPair
(
values
,
dimensions
,
coordSys
,
...
...
@@ -60,52 +60,52 @@ define(function (require) {
// FIXME
// init animation
if
(
pointPair
)
{
el
s
[
pairIndex
]
=
createEl
(
pointPair
,
dataGroup
);
el
Group
.
add
(
createEl
(
pointPair
)
);
}
}
);
setStyle
(
el
s
,
data
,
newDataIndex
,
lineStyle
);
data
.
setItemGraphicEl
(
newDataIndex
,
el
s
);
setStyle
(
el
Group
,
data
,
newDataIndex
,
lineStyle
);
data
.
setItemGraphicEl
(
newDataIndex
,
el
Group
);
}
function
update
(
newDataIndex
,
oldDataIndex
)
{
var
values
=
data
.
getValues
(
dimensionNames
,
newDataIndex
);
var
els
=
oldData
.
getItemGraphicEl
(
oldDataIndex
);
var
elGroup
=
oldData
.
getItemGraphicEl
(
oldDataIndex
);
var
newEls
=
[];
var
elGroupIndex
=
0
;
eachAxisPair
(
values
,
dimensions
,
coordSys
,
function
(
pointPair
,
pairIndex
)
{
var
el
=
el
s
[
pairIndex
]
;
var
el
=
el
Group
.
childAt
(
elGroupIndex
++
)
;
if
(
pointPair
&&
!
el
)
{
els
[
pairIndex
]
=
createEl
(
pointPair
,
dataGroup
);
newEls
.
push
(
createEl
(
pointPair
)
);
}
else
if
(
pointPair
)
{
el
.
setShape
({
points
:
pointPair
});
}
else
{
els
[
pairIndex
]
=
null
;
dataGroup
.
remove
(
el
);
}
}
);
// Remove redundent els
for
(
var
i
=
axisPairCount
(
dimensions
),
len
=
els
.
length
;
i
<
len
;
i
++
)
{
els
[
i
]
=
null
;
dataGroup
.
remove
(
els
[
i
]);
for
(
var
i
=
elGroup
.
childCount
()
-
1
;
i
>=
elGroupIndex
;
i
--
)
{
elGroup
.
remove
(
elGroup
.
childAt
(
i
));
}
// Add new els
for
(
var
i
=
0
,
len
=
newEls
.
length
;
i
<
len
;
i
++
)
{
elGroup
.
add
(
newEls
[
i
]);
}
setStyle
(
el
s
,
data
,
newDataIndex
,
lineStyle
);
data
.
setItemGraphicEl
(
newDataIndex
,
el
s
);
setStyle
(
el
Group
,
data
,
newDataIndex
,
lineStyle
);
data
.
setItemGraphicEl
(
newDataIndex
,
el
Group
);
}
function
remove
(
oldDataIndex
)
{
var
els
=
oldData
.
getItemGraphicEl
(
oldDataIndex
);
each
(
els
,
function
(
el
)
{
el
&&
dataGroup
.
remove
(
el
);
});
var
elGroup
=
oldData
.
getItemGraphicEl
(
oldDataIndex
);
dataGroup
.
remove
(
elGroup
);
}
},
...
...
@@ -114,15 +114,12 @@ define(function (require) {
*/
remove
:
function
()
{
this
.
_dataGroup
&&
this
.
_dataGroup
.
removeAll
();
this
.
_data
=
null
;
}
});
function
axisPairCount
(
dimensions
)
{
return
dimensions
.
length
-
1
;
}
function
eachAxisPair
(
values
,
dimensions
,
coordSys
,
cb
)
{
for
(
var
i
=
0
,
len
=
axisPairCount
(
dimensions
)
;
i
<
len
;
i
++
)
{
for
(
var
i
=
0
,
len
=
dimensions
.
length
-
1
;
i
<
len
;
i
++
)
{
var
dimA
=
dimensions
[
i
];
var
dimB
=
dimensions
[
i
+
1
];
var
valueA
=
values
[
i
];
...
...
@@ -140,23 +137,18 @@ define(function (require) {
}
}
function
createEl
(
pointPair
,
dataGroup
)
{
var
el
=
new
graphic
.
Polyline
({
function
createEl
(
pointPair
)
{
return
new
graphic
.
Polyline
({
shape
:
{
points
:
pointPair
},
silent
:
true
});
dataGroup
.
add
(
el
);
return
el
;
}
function
setStyle
(
els
,
data
,
dataIndex
,
lineStyle
)
{
each
(
els
,
function
(
el
,
pairIndex
)
{
if
(
!
el
)
{
return
;
}
function
setStyle
(
elGroup
,
data
,
dataIndex
,
lineStyle
)
{
elGroup
.
eachChild
(
function
(
el
)
{
el
.
setStyle
(
lineStyle
);
var
opacity
=
data
.
getItemVisual
(
dataIndex
,
'
opacity
'
,
true
);
opacity
!=
null
&&
el
.
setStyle
(
'
opacity
'
,
opacity
);
el
.
setStyle
(
'
opacity
'
,
opacity
);
});
}
...
...
src/chart/parallel/parallelVisual.js
浏览文件 @
3ef37dd9
...
...
@@ -16,46 +16,20 @@ define(function (require) {
||
globalColors
[
seriesModel
.
seriesIndex
%
globalColors
.
length
];
var
inactiveOpacity
=
seriesModel
.
get
(
'
inactiveOpacity
'
);
var
activeOpacity
=
seriesModel
.
get
(
'
activeOpacity
'
);
var
lineStyle
=
seriesModel
.
getModel
(
'
lineStyle.normal
'
).
getLineStyle
();
var
coordSys
=
seriesModel
.
coordinateSystem
;
var
dimensions
=
coordSys
.
dimensions
;
var
dimensionNames
=
coordSys
.
getDimensionNames
();
var
data
=
seriesModel
.
getData
();
var
opacityMap
=
{
all
:
null
,
normal
:
lineStyle
.
opacity
,
active
:
activeOpacity
,
inactive
:
inactiveOpacity
};
var
hasActiveSet
=
false
;
for
(
var
j
=
0
,
lenj
=
dimensions
.
length
;
j
<
lenj
;
j
++
)
{
if
(
coordSys
.
getAxis
(
dimensions
[
j
].
name
).
isActive
()
!==
null
)
{
hasActiveSet
=
true
;
}
}
for
(
var
i
=
0
,
len
=
data
.
count
();
i
<
len
;
i
++
)
{
var
values
=
data
.
getValues
(
dimensionNames
,
i
);
var
activeState
;
if
(
!
hasActiveSet
)
{
activeState
=
'
all
'
;
}
else
{
activeState
=
'
inactive
'
;
for
(
var
j
=
0
,
lenj
=
dimensions
.
length
;
j
<
lenj
;
j
++
)
{
var
dimName
=
dimensions
[
j
].
name
;
if
(
coordSys
.
getAxis
(
dimName
).
isActive
(
values
[
j
],
j
))
{
activeState
=
'
active
'
;
break
;
}
}
}
data
.
setItemVisual
(
i
,
'
opacity
'
,
opacityMap
[
activeState
]);
}
coordSys
.
eachActiveState
(
data
,
function
(
activeState
,
dataIndex
)
{
data
.
setItemVisual
(
dataIndex
,
'
opacity
'
,
opacityMap
[
activeState
]);
});
data
.
setVisual
(
'
color
'
,
color
);
});
...
...
src/component/helper/SelectController.js
浏览文件 @
3ef37dd9
...
...
@@ -15,7 +15,7 @@ define(function (require) {
var
mathMax
=
Math
.
max
;
var
mathPow
=
Math
.
pow
;
var
UNSELECT_THRESHOLD
=
3
;
var
UNSELECT_THRESHOLD
=
2
;
var
EVENTS
=
[
'
mousedown
'
,
'
mousemove
'
,
'
mouseup
'
];
/**
...
...
src/coord/parallel/Parallel.js
浏览文件 @
3ef37dd9
...
...
@@ -216,6 +216,48 @@ define(function(require) {
);
},
/**
* @param {module:echarts/data/List} data
* @param {Functio} cb param: {string} activeState 'active' or 'inactive' or 'normal'
* {number} dataIndex
* @param {Object} context
*/
eachActiveState
:
function
(
data
,
callback
,
context
)
{
var
dimensions
=
this
.
dimensions
;
var
dimensionNames
=
this
.
getDimensionNames
();
var
axesMap
=
this
.
_axesMap
;
var
hasActiveSet
=
false
;
for
(
var
j
=
0
,
lenj
=
dimensions
.
length
;
j
<
lenj
;
j
++
)
{
if
(
axesMap
[
dimensions
[
j
].
name
].
getActiveState
()
!==
'
normal
'
)
{
hasActiveSet
=
true
;
}
}
for
(
var
i
=
0
,
len
=
data
.
count
();
i
<
len
;
i
++
)
{
var
values
=
data
.
getValues
(
dimensionNames
,
i
);
var
activeState
;
if
(
!
hasActiveSet
)
{
activeState
=
'
normal
'
;
}
else
{
activeState
=
'
active
'
;
for
(
var
j
=
0
,
lenj
=
dimensions
.
length
;
j
<
lenj
;
j
++
)
{
var
dimName
=
dimensions
[
j
].
name
;
var
state
=
axesMap
[
dimName
].
getActiveState
(
values
[
j
],
j
);
if
(
state
===
'
inactive
'
)
{
activeState
=
'
inactive
'
;
break
;
}
}
}
callback
.
call
(
context
,
activeState
,
i
);
}
},
/**
* Convert coords of each axis to Point.
* Return point. For example: [10, 20]
...
...
@@ -230,13 +272,6 @@ define(function(require) {
return
point
;
},
/**
* Get axis
*/
getAxis
:
function
(
dim
)
{
return
this
.
_axesMap
[
dim
];
},
/**
* Get axis layout.
*/
...
...
src/coord/parallel/ParallelAxis.js
浏览文件 @
3ef37dd9
...
...
@@ -63,29 +63,30 @@ define(function (require) {
},
/**
* @param {number} [value] When attempting to detect 'no activeIntervals set',
* @param {number
|string
} [value] When attempting to detect 'no activeIntervals set',
* value can not be input.
* @return {boolean|string} When no activeIntervals set, it returns null,
* which means active.
* @return {string} 'normal': no activeIntervals set,
* 'active',
* 'inactive'.
* @public
*/
isActiv
e
:
function
(
value
)
{
getActiveStat
e
:
function
(
value
)
{
var
activeIntervals
=
this
.
_activeIntervals
;
if
(
!
activeIntervals
)
{
return
null
;
return
'
normal
'
;
}
if
(
value
==
null
)
{
return
false
;
return
'
inactive
'
;
}
for
(
var
i
=
0
,
len
=
activeIntervals
.
length
;
i
<
len
;
i
++
)
{
if
(
activeIntervals
[
i
][
0
]
<=
value
&&
value
<=
activeIntervals
[
i
][
1
])
{
return
true
;
return
'
active
'
;
}
}
return
false
;
return
'
inactive
'
;
}
};
...
...
src/data/List.js
浏览文件 @
3ef37dd9
...
...
@@ -909,33 +909,23 @@ define(function (require) {
};
/**
* @param {number} idx
* @param {module:zrender/Element
|Array.<module:zrender/Element>
} el
* @param {module:zrender/Element} el
*/
listProto
.
setItemGraphicEl
=
function
(
idx
,
el
)
{
var
hostModel
=
this
.
hostModel
;
if
(
zrUtil
.
isArray
(
el
))
{
zrUtil
.
each
(
el
,
function
(
singleEl
)
{
singleEl
&&
addIndexToGraphicEl
(
singleEl
,
idx
,
hostModel
);
});
}
else
{
addIndexToGraphicEl
(
el
,
idx
,
hostModel
);
if
(
el
)
{
// Add data index and series index for indexing the data by element
// Useful in tooltip
el
.
dataIndex
=
idx
;
el
.
seriesIndex
=
hostModel
&&
hostModel
.
seriesIndex
;
if
(
el
.
type
===
'
group
'
)
{
el
.
traverse
(
setItemDataAndSeriesIndex
,
el
);
}
this
.
_graphicEls
[
idx
]
=
el
;
}
this
.
_graphicEls
[
idx
]
=
el
;
};
function
addIndexToGraphicEl
(
el
,
dataIndex
,
hostModel
)
{
// Add data index and series index for indexing the data by element
// Useful in tooltip
el
.
dataIndex
=
dataIndex
;
el
.
seriesIndex
=
hostModel
&&
hostModel
.
seriesIndex
;
if
(
el
.
type
===
'
group
'
)
{
el
.
traverse
(
setItemDataAndSeriesIndex
,
el
);
}
}
/**
* @param {number} idx
* @return {module:zrender/Element}
...
...
test/parallel-aqi.html
浏览文件 @
3ef37dd9
...
...
@@ -24,7 +24,8 @@
{
name
:
'
PM10
'
,
index
:
3
,
text
:
'
PM10
'
},
{
name
:
'
CO
'
,
index
:
4
,
text
:
'
一氧化碳(CO)
'
},
{
name
:
'
NO2
'
,
index
:
5
,
text
:
'
二氧化氮(NO2)
'
},
{
name
:
'
SO2
'
,
index
:
6
,
text
:
'
二氧化硫(SO2)
'
}
{
name
:
'
SO2
'
,
index
:
6
,
text
:
'
二氧化硫(SO2)
'
},
{
name
:
'
等级
'
,
index
:
7
,
text
:
'
等级
'
}
];
require
([
...
...
@@ -92,7 +93,9 @@
{
dim
:
'
dim3
'
,
name
:
schema
[
3
].
text
},
{
dim
:
'
dim4
'
,
name
:
schema
[
4
].
text
},
{
dim
:
'
dim5
'
,
name
:
schema
[
5
].
text
},
{
dim
:
'
dim6
'
,
name
:
schema
[
6
].
text
}
{
dim
:
'
dim6
'
,
name
:
schema
[
6
].
text
},
{
dim
:
'
dim7
'
,
name
:
schema
[
7
].
text
,
type
:
'
category
'
,
data
:
[
'
优
'
,
'
良
'
,
'
轻度污染
'
,
'
重度污染
'
,
'
严重污染
'
]}
],
parallel
:
{
y2
:
100
,
...
...
@@ -130,20 +133,26 @@
name
:
'
北京
'
,
type
:
'
parallel
'
,
lineStyle
:
lineStyle
,
data
:
dataBJ
// data: dataBJ
data
:
[
[
1
,
32
,
12
,
19
,
28
,
1.39
,
24
,
8
,
"
优
"
],
]
},
{
name
:
'
上海
'
,
type
:
'
parallel
'
,
lineStyle
:
lineStyle
,
data
:
dataSH
// data: dataSH
data
:
[
[
1
,
332
,
212
,
119
,
128
,
12.39
,
124
,
18
,
"
良
"
],
]
},
{
name
:
'
广州
'
,
type
:
'
parallel
'
,
lineStyle
:
lineStyle
,
data
:
dataGZ
}
//
{
//
name: '广州',
//
type: 'parallel',
//
lineStyle: lineStyle,
//
data: dataGZ
//
}
]
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录