Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
1f1648dd
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 搜索 >>
提交
1f1648dd
编写于
11月 17, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Symbol enhancement
上级
9bb02242
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
150 addition
and
14 deletion
+150
-14
src/chart/bar/BarSeries.js
src/chart/bar/BarSeries.js
+0
-1
src/chart/helper/SymbolDraw.js
src/chart/helper/SymbolDraw.js
+1
-1
src/chart/line/LineSeries.js
src/chart/line/LineSeries.js
+0
-4
src/chart/scatter/ScatterSeries.js
src/chart/scatter/ScatterSeries.js
+0
-1
src/util/graphic.js
src/util/graphic.js
+1
-1
src/util/symbol.js
src/util/symbol.js
+45
-4
src/view/Chart.js
src/view/Chart.js
+6
-2
test/symbol.html
test/symbol.html
+97
-0
未找到文件。
src/chart/bar/BarSeries.js
浏览文件 @
1f1648dd
...
...
@@ -19,7 +19,6 @@ define(function(require) {
zlevel
:
0
,
// 一级层叠
z
:
2
,
// 二级层叠
coordinateSystem
:
'
cartesian2d
'
,
clickable
:
true
,
legendHoverLink
:
true
,
// stack: null
...
...
src/chart/helper/SymbolDraw.js
浏览文件 @
1f1648dd
...
...
@@ -47,7 +47,7 @@ define(function (require) {
z2
:
100
});
if
(
enableAnimation
)
{
if
(
enableAnimation
&&
symbolEl
.
shape
)
{
// FIXME Use scale to improve performance
var
zeroShape
=
symbolUtil
.
getSymbolShape
(
symbolType
,
0
,
0
,
0
,
0
...
...
src/chart/line/LineSeries.js
浏览文件 @
1f1648dd
...
...
@@ -19,14 +19,10 @@ define(function(require) {
zlevel
:
0
,
// 一级层叠
z
:
2
,
// 二级层叠
coordinateSystem
:
'
cartesian2d
'
,
clickable
:
true
,
legendHoverLink
:
true
,
// stack: null
xAxisIndex
:
0
,
yAxisIndex
:
0
,
gridIndex
:
0
,
// 'nearest', 'min', 'max', 'average'
dataFilter
:
'
nearest
'
,
label
:
{
normal
:
{
...
...
src/chart/scatter/ScatterSeries.js
浏览文件 @
1f1648dd
...
...
@@ -24,7 +24,6 @@ define(function (require) {
coordinateSystem
:
'
cartesian2d
'
,
zlevel
:
0
,
// 一级层叠
z
:
2
,
// 二级层叠
clickable
:
true
,
legendHoverLink
:
true
,
// Cartesian coordinate system
...
...
src/util/graphic.js
浏览文件 @
1f1648dd
...
...
@@ -79,7 +79,7 @@ define(function(require) {
var
pathRect
=
path
.
getBoundingRect
();
var
m
=
rect
.
calculateTransform
(
pathR
ect
);
var
m
=
pathRect
.
calculateTransform
(
r
ect
);
path
.
applyTransform
(
m
);
};
...
...
src/util/symbol.js
浏览文件 @
1f1648dd
...
...
@@ -6,8 +6,32 @@ define(function(require) {
var
graphic
=
require
(
'
./graphic
'
);
var
BoundingRect
=
require
(
'
zrender/core/BoundingRect
'
);
/**
* Triangle shape
* @inner
*/
var
Triangle
=
graphic
.
extendShape
({
type
:
'
triangle
'
,
shape
:
{
cx
:
0
,
cy
:
0
,
width
:
0
,
height
:
0
},
buildPath
:
function
(
path
,
shape
)
{
var
cx
=
shape
.
cx
;
var
cy
=
shape
.
cy
;
var
width
=
shape
.
width
/
2
;
var
height
=
shape
.
height
/
2
;
path
.
moveTo
(
cx
,
cy
-
height
);
path
.
lineTo
(
cx
+
width
,
cy
+
height
);
path
.
lineTo
(
cx
-
width
,
cy
+
height
);
path
.
closePath
();
}
});
/**
* Diamond shape
* @inner
*/
var
Diamond
=
graphic
.
extendShape
({
type
:
'
diamond
'
,
...
...
@@ -31,6 +55,7 @@ define(function(require) {
/**
* Pin shape
* @inner
*/
var
Pin
=
graphic
.
extendShape
({
type
:
'
pin
'
,
...
...
@@ -84,6 +109,7 @@ define(function(require) {
/**
* Arrow shape
* @inner
*/
var
Arrow
=
graphic
.
extendShape
({
...
...
@@ -110,6 +136,10 @@ define(function(require) {
}
});
/**
* Map of path contructors
* @type {Object.<string, module:zrender/graphic/Path>}
*/
var
symbolCtors
=
{
line
:
graphic
.
Line
,
...
...
@@ -125,7 +155,9 @@ define(function(require) {
pin
:
Pin
,
arrow
:
Arrow
arrow
:
Arrow
,
triangle
:
Triangle
};
var
symbolShapeMakers
=
{
...
...
@@ -146,7 +178,7 @@ define(function(require) {
y
:
y
,
width
:
w
,
height
:
h
}
}
;
},
roundRect
:
function
(
x
,
y
,
w
,
h
,
r
)
{
...
...
@@ -204,6 +236,15 @@ define(function(require) {
width
:
w
,
height
:
h
};
},
triangle
:
function
(
x
,
y
,
w
,
h
)
{
return
{
cx
:
x
+
w
/
2
,
cy
:
y
+
h
/
2
,
width
:
w
,
height
:
h
};
}
};
...
...
@@ -250,7 +291,7 @@ define(function(require) {
});
}
else
if
(
symbolType
.
indexOf
(
'
path://
'
)
===
0
)
{
symbolPath
=
graphic
.
makePath
(
symbolType
.
slice
(
7
),
new
BoundingRect
(
x
,
y
,
w
,
h
));
symbolPath
=
graphic
.
makePath
(
symbolType
.
slice
(
7
),
{},
new
BoundingRect
(
x
,
y
,
w
,
h
));
}
else
{
if
(
!
symbolShapeMakers
[
symbolType
])
{
...
...
@@ -301,7 +342,7 @@ define(function(require) {
}
};
}
else
if
(
!
(
symbolType
.
indexOf
(
'
path://
'
)
===
0
)
)
{
else
if
(
symbolType
.
indexOf
(
'
path://
'
)
!==
0
)
{
if
(
!
symbolShapeMakers
[
symbolType
])
{
symbolType
=
'
rect
'
;
}
...
...
src/view/Chart.js
浏览文件 @
1f1648dd
...
...
@@ -46,7 +46,9 @@ define(function (require) {
* @param {Object} payload
*/
highlight
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
toggleHighlight
(
seriesModel
.
getData
(),
payload
,
'
emphasis
'
);
if
(
seriesModel
.
get
(
'
legendHoverLink
'
))
{
toggleHighlight
(
seriesModel
.
getData
(),
payload
,
'
emphasis
'
);
}
},
/**
...
...
@@ -57,7 +59,9 @@ define(function (require) {
* @param {Object} payload
*/
downplay
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
toggleHighlight
(
seriesModel
.
getData
(),
payload
,
'
normal
'
);
if
(
seriesModel
.
get
(
'
legendHoverLink
'
))
{
toggleHighlight
(
seriesModel
.
getData
(),
payload
,
'
normal
'
);
}
},
/**
...
...
test/symbol.html
0 → 100644
浏览文件 @
1f1648dd
<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/scatter
'
,
'
echarts/component/legend
'
,
'
echarts/component/grid
'
,
'
echarts/component/tooltip
'
],
function
(
echarts
)
{
var
chart
=
echarts
.
init
(
document
.
getElementById
(
'
main
'
),
null
,
{
renderer
:
'
canvas
'
});
var
symbolList
=
[
'
circle
'
,
'
triangle
'
,
'
diamond
'
,
'
pin
'
,
'
image://http://echarts.baidu.com/doc/asset/img/echarts-logo.png
'
,
'
path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891
'
,
'
emptyPath://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891
'
];
function
random
(
max
)
{
return
(
Math
.
random
()
*
max
).
toFixed
(
3
);
}
var
series
=
symbolList
.
map
(
function
(
symbol
,
idx
)
{
var
seriesData
=
[];
for
(
var
i
=
0
;
i
<
20
;
i
++
)
{
seriesData
.
push
([
random
(
10
),
random
(
10
),
(
+
random
(
0.5
)
+
0.2
).
toFixed
(
3
)]);
}
return
{
name
:
symbol
.
split
(
'
://
'
)[
0
],
type
:
'
scatter
'
,
symbol
:
symbol
,
symbolSize
:
function
(
val
)
{
if
(
symbol
.
indexOf
(
'
path
'
)
>=
0
||
symbol
.
indexOf
(
'
Path
'
)
>=
0
)
{
return
[
val
[
2
]
*
60
,
val
[
2
]
*
40
];
}
else
{
return
val
[
2
]
*
60
;
}
},
label
:
{
emphasis
:
{
show
:
false
}
},
data
:
seriesData
};
});
chart
.
setOption
({
legend
:
{
data
:
series
.
map
(
function
(
series
)
{
return
series
.
name
;})
},
tooltip
:
{
trigger
:
'
axis
'
,
axisPointer
:
{
type
:
'
cross
'
}
},
xAxis
:
{
type
:
'
value
'
,
splitLine
:
{
show
:
false
}
},
yAxis
:
{
type
:
'
value
'
,
splitLine
:
{
show
:
false
}
},
series
:
series
});
});
</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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录