Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
00a6a0bc
I
incubator-echarts
项目概览
missman
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
00a6a0bc
编写于
10月 05, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
markPoint and symbol improve
上级
01f33e47
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
60 addition
and
27 deletion
+60
-27
src/chart/helper/DataSymbol.js
src/chart/helper/DataSymbol.js
+7
-6
src/component/markPoint.js
src/component/markPoint.js
+1
-1
src/component/marker/MarkPointModel.js
src/component/marker/MarkPointModel.js
+1
-1
src/data/List.js
src/data/List.js
+4
-5
src/util/symbol.js
src/util/symbol.js
+30
-10
test/markPoint.html
test/markPoint.html
+17
-4
未找到文件。
src/chart/helper/DataSymbol.js
浏览文件 @
00a6a0bc
...
...
@@ -25,14 +25,14 @@ define(function (require) {
symbolSize
=
normalizeSymbolSize
(
symbolSize
);
// FIXME
var
x
=
-
0.5
;
var
y
=
-
0.5
;
var
w
=
1
;
var
h
=
1
;
// FIXME
if
(
symbolType
.
match
(
/
(
pin|Pin
)
$/
))
{
y
=
-
1
;
h
=
2
;
y
=
-
0.8
;
h
=
1.6
;
}
var
symbolEl
=
symbolCreators
.
createSymbol
(
symbolType
,
x
,
y
,
w
,
h
,
color
...
...
@@ -70,7 +70,6 @@ define(function (require) {
}
function
DataSymbol
()
{
this
.
group
=
new
Group
();
}
...
...
@@ -131,7 +130,7 @@ define(function (require) {
// Update color
// FIXME emptyXXX ?
var
newColor
=
data
.
getItemVisual
(
newIdx
,
'
color
'
);
el
.
set
Style
(
'
fill
'
,
newColor
);
el
.
set
Color
(
newColor
);
// TODO Merge animateTo and attr methods into one
if
(
enableAnimation
)
{
...
...
@@ -141,8 +140,10 @@ define(function (require) {
},
300
,
'
cubicOut
'
);
}
else
{
// May still have animation. Must stop
el
.
stopAnimation
();
el
.
attr
({
scale
:
symbolSize
,
scale
:
symbolSize
.
slice
()
,
position
:
point
.
slice
()
});
}
...
...
src/component/markPoint.js
浏览文件 @
00a6a0bc
...
...
@@ -82,9 +82,9 @@ define(function (require) {
var
min
=
extent
[
0
];
var
max
=
extent
[
1
];
var
val
=
(
max
-
min
)
*
percent
+
min
;
valueArr
[
valueIndex
]
=
val
;
var
dataIndex
=
data
.
indexOfNearest
(
valueAxisDim
,
val
);
valueArr
[
1
-
valueIndex
]
=
data
.
get
(
baseAxisDim
,
dataIndex
);
valueArr
[
valueIndex
]
=
data
.
get
(
valueAxisDim
,
dataIndex
,
true
);
return
valueArr
;
};
...
...
src/component/marker/MarkPointModel.js
浏览文件 @
00a6a0bc
...
...
@@ -53,7 +53,7 @@ define(function (require) {
z
:
5
,
clickable
:
true
,
symbol
:
'
pin
'
,
// 标注类型
symbolSize
:
2
0
,
// 标注大小
symbolSize
:
2
5
,
// 标注大小
// symbolRotate: null, // 标注旋转控制
large
:
false
,
effect
:
{
...
...
src/data/List.js
浏览文件 @
00a6a0bc
...
...
@@ -377,19 +377,18 @@ define(function (require) {
* Retreive the index of nearest value
* @param {number} idx
* @param {number} value
* @param {boolean} stack If given value is after stacked
* @return {number}
*/
listProto
.
indexOfNearest
=
function
(
dim
,
value
)
{
listProto
.
indexOfNearest
=
function
(
dim
,
value
,
stack
)
{
var
storage
=
this
.
_storage
;
var
dimData
=
storage
[
dim
];
var
indices
=
this
.
indices
;
if
(
dimData
)
{
var
minDist
=
Number
.
MAX_VALUE
;
var
nearestIdx
=
-
1
;
for
(
var
i
=
0
,
len
=
indices
.
length
;
i
<
len
;
i
++
)
{
var
rawIndex
=
indices
[
i
];
var
dist
=
Math
.
abs
(
dimData
[
rawIndex
]
-
value
);
for
(
var
i
=
0
,
len
=
this
.
count
();
i
<
len
;
i
++
)
{
var
dist
=
Math
.
abs
(
this
.
get
(
dim
,
i
,
stack
)
-
value
);
if
(
dist
<=
minDist
)
{
minDist
=
dist
;
nearestIdx
=
i
;
...
...
src/util/symbol.js
浏览文件 @
00a6a0bc
...
...
@@ -5,6 +5,7 @@ define(function(require) {
var
graphic
=
require
(
'
./graphic
'
);
var
BoundingRect
=
require
(
'
zrender/core/BoundingRect
'
);
var
zrUtil
=
require
(
'
zrender/core/util
'
);
/**
* Diamond shape
...
...
@@ -56,6 +57,9 @@ define(function(require) {
// Dist on x with tangent point and circle center
var
dx
=
Math
.
cos
(
angle
)
*
r
;
var
tanX
=
Math
.
sin
(
angle
);
var
tanY
=
Math
.
cos
(
angle
);
path
.
arc
(
x
,
cy
,
...
...
@@ -64,14 +68,16 @@ define(function(require) {
Math
.
PI
*
2
+
angle
);
var
cpLen
=
r
*
0.6
;
var
cpLen2
=
r
*
0.7
;
path
.
bezierCurveTo
(
x
+
dx
,
cy
+
dy
,
x
,
y
-
r
*
0.6
,
x
+
dx
-
tanX
*
cpLen
,
cy
+
dy
+
tanY
*
cpLen
,
x
,
y
-
cpLen2
,
x
,
y
);
path
.
bezierCurveTo
(
x
,
y
-
r
*
0.6
,
x
-
dx
,
cy
+
dy
,
x
,
y
-
cpLen2
,
x
-
dx
+
tanX
*
cpLen
,
cy
+
dy
+
tanY
*
cpLen
,
x
-
dx
,
cy
+
dy
);
}
...
...
@@ -176,6 +182,20 @@ define(function(require) {
};
// Provide setColor helper method to avoid determine if set the fill or stroke outside
var
symbolPathSetColor
=
function
(
color
)
{
var
symbolStyle
=
this
.
style
;
if
(
this
.
__isEmptyBrush
)
{
symbolStyle
.
stroke
=
color
;
}
else
{
// FIXME 判断图形默认是填充还是描边,使用 onlyStroke ?
symbolStyle
.
fill
&&
(
symbolStyle
.
fill
=
color
);
symbolStyle
.
stroke
&&
(
symbolStyle
.
stroke
=
color
);
}
this
.
dirty
();
};
return
{
/**
* Create a symbol element with given symbol configuration: shape, x, y, width, height, color
...
...
@@ -211,16 +231,16 @@ define(function(require) {
var
symbolStyle
=
symbolPath
.
style
;
if
(
isEmpty
)
{
symbolStyle
.
set
({
stroke
:
color
,
fill
:
'
#fff
'
,
lineWidth
:
2
});
}
else
{
// FIXME 判断图形默认是填充还是描边,使用 onlyStroke ?
symbolStyle
.
fill
&&
(
symbolStyle
.
fill
=
color
);
symbolStyle
.
stroke
&&
(
symbolStyle
.
stroke
=
color
);
}
symbolPath
.
__isEmptyBrush
=
isEmpty
;
symbolPath
.
setColor
=
symbolPathSetColor
;
symbolPath
.
setColor
(
color
);
return
symbolPath
;
}
...
...
test/markPoint.html
浏览文件 @
00a6a0bc
...
...
@@ -32,11 +32,10 @@
var
data2
=
[];
var
data3
=
[];
for
(
var
i
=
0
;
i
<
10
0
;
i
++
)
{
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
xAxisData
.
push
(
'
类目
'
+
i
);
data1
.
push
(
+
Math
.
random
().
toFixed
(
3
));
data2
.
push
(
+
Math
.
random
().
toFixed
(
3
));
data3
.
push
(
+
Math
.
random
().
toFixed
(
3
));
}
chart
.
setOption
({
...
...
@@ -67,12 +66,26 @@
name
:
'
line
'
,
type
:
'
line
'
,
stack
:
'
all
'
,
symbol
:
'
none
'
,
symbolSize
:
10
,
symbolSize
:
6
,
data
:
data1
,
markPoint
:
{
data
:
[{
name
:
'
最大值
'
,
type
:
'
max
'
,
value
:
1
}]
}
},
{
name
:
'
line2
'
,
type
:
'
line
'
,
stack
:
'
all
'
,
symbolSize
:
6
,
data
:
data2
,
markPoint
:
{
data
:
[{
name
:
'
最大值
'
,
type
:
'
max
'
,
value
:
1
}]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录