Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
b93bd09d
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,发现更多精彩内容 >>
提交
b93bd09d
编写于
10月 21, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Two category axis bug fix
上级
24ee6345
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
362 addition
and
48 deletion
+362
-48
src/component/legend/LegendView.js
src/component/legend/LegendView.js
+1
-2
src/component/title.js
src/component/title.js
+1
-2
src/data/List.js
src/data/List.js
+25
-39
src/scale/Interval.js
src/scale/Interval.js
+2
-2
test/area2.html
test/area2.html
+4
-3
test/pie2.html
test/pie2.html
+235
-0
test/punchCard.html
test/punchCard.html
+94
-0
未找到文件。
src/component/legend/LegendView.js
浏览文件 @
b93bd09d
...
...
@@ -156,8 +156,7 @@ define(function (require) {
fill
:
legendModel
.
get
(
'
backgroundColor
'
),
lineWidth
:
legendModel
.
get
(
'
borderWidth
'
)
},
// Behind item elements
z2
:
-
1
silent
:
true
});
graphic
.
subPixelOptimizeRect
(
rect
);
...
...
src/component/title.js
浏览文件 @
b93bd09d
...
...
@@ -178,8 +178,7 @@ define(function(require) {
fill
:
titleModel
.
get
(
'
backgroundColor
'
),
lineWidth
:
titleModel
.
get
(
'
borderWidth
'
)
},
// Behind item elements
z2
:
-
1
silent
:
true
});
graphic
.
subPixelOptimizeRect
(
rect
);
...
...
src/data/List.js
浏览文件 @
b93bd09d
...
...
@@ -26,8 +26,7 @@ define(function (require) {
var
isObject
=
zrUtil
.
isObject
;
var
IMMUTABLE_PROPERTIES
=
[
'
stackedOn
'
,
'
_nameList
'
,
'
_rawValueDims
'
,
'
_optionModels
'
'
stackedOn
'
,
'
_nameList
'
,
'
_rawData
'
,
'
_optionModels
'
];
var
transferImmuProperties
=
function
(
a
,
b
)
{
...
...
@@ -95,12 +94,6 @@ define(function (require) {
*/
this
.
indices
=
[];
/**
* Dimensions hint for regenerating the raw value
* @type {Array.<string>}
*/
this
.
_rawValueDims
=
[
'
x
'
];
/**
* Data storage
* @type {Object.<key, TypedArray|Array>}
...
...
@@ -151,6 +144,11 @@ define(function (require) {
* @private
*/
this
.
_graphicEls
=
[];
/**
* Raw data
*/
this
.
_rawData
=
[];
}
var
listProto
=
List
.
prototype
;
...
...
@@ -170,6 +168,9 @@ define(function (require) {
* @param {Array.<string>} [nameList]
*/
listProto
.
initData
=
function
(
data
,
nameList
)
{
this
.
_rawData
=
data
;
// Clear
var
optionModels
=
this
.
_optionModels
=
[];
var
storage
=
this
.
_storage
=
{};
...
...
@@ -202,7 +203,10 @@ define(function (require) {
);
for
(
var
idx
=
0
;
idx
<
data
.
length
;
idx
++
)
{
var
value
=
data
[
idx
];
// Each data item contains value and option
// Each data item contains value and other option
// {
// value: []
// }
if
(
data
[
idx
]
!=
null
&&
data
[
idx
].
hasOwnProperty
(
'
value
'
))
{
value
=
data
[
idx
].
value
;
var
model
=
new
Model
(
data
[
idx
],
this
.
hostModel
);
...
...
@@ -253,8 +257,6 @@ define(function (require) {
indices
.
push
(
idx
);
}
this
.
_rawValueDims
=
rawValueTo1D
?
dimensions
.
slice
(
1
,
2
)
:
dimensions
.
slice
();
// Use the name in option as data id in two value axis case
for
(
var
i
=
0
;
i
<
optionModelIndices
.
length
;
i
++
)
{
if
(
!
nameList
[
i
])
{
...
...
@@ -336,24 +338,16 @@ define(function (require) {
var
min
=
Infinity
;
var
max
=
-
Infinity
;
var
value
;
var
dimInfo
=
this
.
_dimensionInfos
[
dim
];
//
var dimInfo = this._dimensionInfos[dim];
if
(
dimData
)
{
var
count
=
this
.
count
();
if
(
dimInfo
.
type
===
'
ordinal
'
)
{
// Ordinal data must be incremental
var
first
=
this
.
get
(
dim
,
0
);
var
last
=
this
.
get
(
dim
,
count
-
1
);
var
indexOf
=
zrUtil
.
indexOf
;
if
(
isNaN
(
first
))
{
// Is string
first
=
indexOf
(
dimData
,
first
);
}
if
(
isNaN
(
last
))
{
// Is string
last
=
indexOf
(
dimData
,
last
);
}
return
[
first
,
last
];
}
for
(
var
i
=
0
,
len
=
count
;
i
<
len
;
i
++
)
{
// var isOrdinal = dimInfo.type === 'ordinal';
for
(
var
i
=
0
,
len
=
this
.
count
();
i
<
len
;
i
++
)
{
value
=
this
.
get
(
dim
,
i
,
stack
);
// FIXME
// if (isOrdinal && typeof value === 'string') {
// value = zrUtil.indexOf(dimData, value);
// console.log(value);
// }
value
<
min
&&
(
min
=
value
);
value
>
max
&&
(
max
=
value
);
}
...
...
@@ -385,19 +379,11 @@ define(function (require) {
* @return {number}
*/
listProto
.
getRawValue
=
function
(
idx
)
{
var
rawValueDims
=
this
.
_rawValueDims
;
var
storage
=
this
.
_storage
;
if
(
rawValueDims
.
length
===
1
)
{
var
dimData
=
storage
[
rawValueDims
[
0
]];
return
dimData
&&
dimData
[
idx
];
}
else
{
var
value
=
[];
for
(
var
i
=
0
;
i
<
rawValueDims
.
length
;
i
++
)
{
value
[
i
]
=
this
.
get
(
rawValueDims
[
i
],
idx
);
}
return
value
;
var
itemOpt
=
this
.
_rawData
[
idx
];
if
(
itemOpt
&&
itemOpt
.
hasOwnProperty
(
'
value
'
))
{
return
itemOpt
.
value
;
}
return
itemOpt
;
};
/**
...
...
src/scale/Interval.js
浏览文件 @
b93bd09d
...
...
@@ -153,7 +153,7 @@ define(function (require) {
var
labels
=
[];
var
ticks
=
this
.
getTicks
();
for
(
var
i
=
0
;
i
<
ticks
.
length
;
i
++
)
{
labels
.
push
(
t
icks
[
i
].
toString
(
));
labels
.
push
(
t
his
.
getLabel
(
ticks
[
i
]
));
}
return
labels
;
},
...
...
@@ -164,7 +164,7 @@ define(function (require) {
*/
// FIXME addCommas
getLabel
:
function
(
data
)
{
return
data
;
return
data
+
''
;
},
/**
...
...
test/area2.html
浏览文件 @
b93bd09d
...
...
@@ -20,6 +20,7 @@
'
echarts/component/legend
'
,
'
echarts/component/grid
'
,
'
echarts/component/tooltip
'
,
'
echarts/component/title
'
,
'
echarts/component/dataZoom
'
],
function
(
echarts
)
{
...
...
@@ -127,13 +128,13 @@
{
name
:
'
流量(m^3/s)
'
,
type
:
'
value
'
,
max
:
500
,
inverse
:
true
max
:
500
},
{
name
:
'
降雨量(mm)
'
,
type
:
'
value
'
,
position
:
'
right
'
position
:
'
right
'
,
inverse
:
true
}
],
series
:
[
...
...
test/pie2.html
0 → 100644
浏览文件 @
b93bd09d
<html>
<head>
<meta
charset=
"utf-8"
>
<script
src=
"esl.js"
></script>
<script
src=
"config.js"
></script>
</head>
<body>
<style>
html
,
body
,
#main
{
width
:
100%
;
height
:
100%
;
}
</style>
<div
id=
"main"
></div>
<script>
require
([
'
echarts
'
,
'
echarts/chart/pie
'
,
'
echarts/component/title
'
,
'
echarts/component/legend
'
,
'
echarts/component/grid
'
,
'
echarts/component/tooltip
'
],
function
(
echarts
)
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
main
'
),
null
,
{
renderer
:
'
canvas
'
});
var
labelTop
=
{
normal
:
{
label
:
{
show
:
true
,
position
:
'
center
'
,
formatter
:
'
{b}
'
,
textStyle
:
{
baseline
:
'
bottom
'
}
},
labelLine
:
{
show
:
false
}
}
};
var
labelFromatter
=
{
normal
:
{
label
:
{
formatter
:
function
(
params
){
return
100
-
params
.
value
+
'
%
'
},
textStyle
:
{
baseline
:
'
top
'
}
}
},
}
var
labelBottom
=
{
normal
:
{
color
:
'
#ccc
'
,
label
:
{
show
:
true
,
position
:
'
center
'
},
labelLine
:
{
show
:
false
}
}
};
var
radius
=
[
40
,
55
];
chart
.
setOption
({
legend
:
{
x
:
'
center
'
,
y
:
'
center
'
,
data
:[
'
GoogleMaps
'
,
'
Facebook
'
,
'
Youtube
'
,
'
Google+
'
,
'
Weixin
'
,
'
Twitter
'
,
'
Skype
'
,
'
Messenger
'
,
'
Whatsapp
'
,
'
Instagram
'
]
},
title
:
{
text
:
'
The App World
'
,
subtext
:
'
from global web index
'
,
x
:
'
center
'
},
toolbox
:
{
show
:
true
,
feature
:
{
dataView
:
{
show
:
true
,
readOnly
:
false
},
magicType
:
{
show
:
true
,
type
:
[
'
pie
'
,
'
funnel
'
],
option
:
{
funnel
:
{
width
:
'
20%
'
,
height
:
'
30%
'
,
itemStyle
:
{
normal
:
{
label
:
{
formatter
:
function
(
params
){
return
'
other
\n
'
+
params
.
value
+
'
%
\n
'
},
textStyle
:
{
baseline
:
'
middle
'
}
}
},
}
}
}
},
restore
:
{
show
:
true
},
saveAsImage
:
{
show
:
true
}
}
},
series
:
[
{
type
:
'
pie
'
,
center
:
[
'
10%
'
,
'
30%
'
],
radius
:
radius
,
x
:
'
0%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
46
,
itemStyle
:
labelBottom
},
{
name
:
'
GoogleMaps
'
,
value
:
54
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
30%
'
,
'
30%
'
],
radius
:
radius
,
x
:
'
20%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
56
,
itemStyle
:
labelBottom
},
{
name
:
'
Facebook
'
,
value
:
44
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
50%
'
,
'
30%
'
],
radius
:
radius
,
x
:
'
40%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
65
,
itemStyle
:
labelBottom
},
{
name
:
'
Youtube
'
,
value
:
35
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
70%
'
,
'
30%
'
],
radius
:
radius
,
x
:
'
60%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
70
,
itemStyle
:
labelBottom
},
{
name
:
'
Google+
'
,
value
:
30
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
90%
'
,
'
30%
'
],
radius
:
radius
,
x
:
'
80%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
73
,
itemStyle
:
labelBottom
},
{
name
:
'
Weixin
'
,
value
:
27
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
10%
'
,
'
70%
'
],
radius
:
radius
,
y
:
'
55%
'
,
// for funnel
x
:
'
0%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
78
,
itemStyle
:
labelBottom
},
{
name
:
'
Twitter
'
,
value
:
22
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
30%
'
,
'
70%
'
],
radius
:
radius
,
y
:
'
55%
'
,
// for funnel
x
:
'
20%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
78
,
itemStyle
:
labelBottom
},
{
name
:
'
Skype
'
,
value
:
22
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
50%
'
,
'
70%
'
],
radius
:
radius
,
y
:
'
55%
'
,
// for funnel
x
:
'
40%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
78
,
itemStyle
:
labelBottom
},
{
name
:
'
Messenger
'
,
value
:
22
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
70%
'
,
'
70%
'
],
radius
:
radius
,
y
:
'
55%
'
,
// for funnel
x
:
'
60%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
83
,
itemStyle
:
labelBottom
},
{
name
:
'
Whatsapp
'
,
value
:
17
,
itemStyle
:
labelTop
}
]
},
{
type
:
'
pie
'
,
center
:
[
'
90%
'
,
'
70%
'
],
radius
:
radius
,
y
:
'
55%
'
,
// for funnel
x
:
'
80%
'
,
// for funnel
itemStyle
:
labelFromatter
,
data
:
[
{
name
:
'
other
'
,
value
:
89
,
itemStyle
:
labelBottom
},
{
name
:
'
Instagram
'
,
value
:
11
,
itemStyle
:
labelTop
}
]
}
]
});
})
</script>
</body>
</html>
\ No newline at end of file
test/
chartCoo
rd.html
→
test/
punchCa
rd.html
浏览文件 @
b93bd09d
...
...
@@ -26,30 +26,65 @@
renderer
:
'
canvas
'
});
var
hours
=
[
'
12a
'
,
'
1a
'
,
'
2a
'
,
'
3a
'
,
'
4a
'
,
'
5a
'
,
'
6a
'
,
'
7a
'
,
'
8a
'
,
'
9a
'
,
'
10a
'
,
'
11a
'
,
'
12p
'
,
'
1p
'
,
'
2p
'
,
'
3p
'
,
'
4p
'
,
'
5p
'
,
'
6p
'
,
'
7p
'
,
'
8p
'
,
'
9p
'
,
'
10p
'
,
'
11p
'
];
var
days
=
[
'
Saturday
'
,
'
Friday
'
,
'
Thursday
'
,
'
Wednesday
'
,
'
Tuesday
'
,
'
Monday
'
,
'
Sunday
'
];
var
usedMap
=
{};
var
data
=
[];
for
(
var
i
=
0
;
i
<
100
;
i
++
)
{
do
{
var
x
=
Math
.
round
(
Math
.
random
()
*
(
hours
.
length
-
1
));
var
y
=
Math
.
round
(
Math
.
random
()
*
(
days
.
length
-
1
));
var
key
=
y
*
100
+
x
;
}
while
(
usedMap
[
key
])
usedMap
[
key
]
=
true
;
data
.
push
([
x
,
y
,
Math
.
random
()
])
}
chart
.
setOption
({
legend
:
{
data
:
[
'
Chart coord
'
]
},
xAxis
:
{
type
:
'
category
'
,
data
:
[
'
Line
'
,
'
Bar
'
,
'
Scatter
'
]
data
:
hours
,
splitLine
:
{
show
:
false
},
axisLine
:
{
show
:
false
}
},
yAxis
:
{
type
:
'
category
'
,
data
:
[
'
Cartesian
'
,
'
Polar
'
,
'
Geo
'
]
data
:
days
,
axisLine
:
{
show
:
false
}
},
series
:
[{
name
:
'
Chart coord
'
,
type
:
'
scatter
'
,
symbolSize
:
100
,
data
:
[
[
'
Line
'
,
'
Cartesian
'
],
[
'
Line
'
,
'
Polar
'
],
[
'
Bar
'
,
'
Cartesian
'
]
,
[
'
Scatter
'
,
'
Cartesian
'
],
[
'
Scatter
'
,
'
Polar
'
],
[
'
Scatter
'
,
'
Geo
'
]
]
itemStyle
:
{
normal
:
{
color
:
'
#d14a61
'
}
}
,
symbolSize
:
function
(
val
)
{
return
val
[
2
]
*
30
;
},
data
:
data
}]
});
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录