Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
348b4c20
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,发现更多精彩内容 >>
提交
348b4c20
编写于
11月 25, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Scatter add large symbol draw
上级
0f1aa933
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
238 addition
and
130 deletion
+238
-130
src/chart/bar/BarView.js
src/chart/bar/BarView.js
+11
-9
src/chart/helper/LargeSymbolDraw.js
src/chart/helper/LargeSymbolDraw.js
+103
-0
src/chart/scatter/ScatterSeries.js
src/chart/scatter/ScatterSeries.js
+4
-0
src/chart/scatter/ScatterView.js
src/chart/scatter/ScatterView.js
+19
-3
src/component/tooltip/TooltipModel.js
src/component/tooltip/TooltipModel.js
+2
-1
src/util/symbol.js
src/util/symbol.js
+99
-117
未找到文件。
src/chart/bar/BarView.js
浏览文件 @
348b4c20
...
...
@@ -98,15 +98,17 @@ define(function (require) {
})
.
remove
(
function
(
idx
)
{
var
rect
=
oldData
.
getItemGraphicEl
(
idx
);
// Not show text when animating
rect
.
style
.
text
=
''
;
api
.
updateGraphicEl
(
rect
,
{
shape
:
{
width
:
0
}
},
function
()
{
group
.
remove
(
rect
);
});
if
(
rect
)
{
// Not show text when animating
rect
.
style
.
text
=
''
;
api
.
updateGraphicEl
(
rect
,
{
shape
:
{
width
:
0
}
},
function
()
{
group
.
remove
(
rect
);
});
}
})
.
execute
();
...
...
src/chart/helper/LargeSymbolDraw.js
0 → 100644
浏览文件 @
348b4c20
define
(
function
(
require
)
{
var
graphic
=
require
(
'
../../util/graphic
'
);
var
symbolUtil
=
require
(
'
../../util/symbol
'
);
var
LargeSymbolPath
=
graphic
.
extendShape
({
shape
:
{
points
:
null
,
sizes
:
null
},
symbolProxy
:
null
,
buildPath
:
function
(
path
,
shape
)
{
var
points
=
shape
.
points
;
var
sizes
=
shape
.
sizes
;
var
symbolProxy
=
this
.
symbolProxy
;
var
symbolProxyShape
=
symbolProxy
.
shape
;
for
(
var
i
=
0
;
i
<
points
.
length
;
i
++
)
{
var
pt
=
points
[
i
];
var
size
=
sizes
[
i
];
if
(
size
<
4
)
{
// Optimize for small symbol
path
.
rect
(
pt
[
0
]
-
size
/
2
,
pt
[
1
]
-
size
/
2
,
size
,
size
);
}
else
{
symbolProxyShape
.
x
=
pt
[
0
]
-
size
/
2
;
symbolProxyShape
.
y
=
pt
[
1
]
-
size
/
2
;
symbolProxyShape
.
width
=
size
;
symbolProxyShape
.
height
=
size
;
symbolProxy
.
buildPath
(
path
,
symbolProxyShape
);
}
}
}
});
function
LargeSymbolDraw
()
{
this
.
group
=
new
graphic
.
Group
();
this
.
_symbolEl
=
new
LargeSymbolPath
({
silent
:
true
});
}
var
largeSymbolProto
=
LargeSymbolDraw
.
prototype
;
/**
* Update symbols draw by new data
* @param {module:echarts/data/List} data
* @param {module:echarts/ExtensionAPI} api
*/
largeSymbolProto
.
updateData
=
function
(
data
,
api
)
{
var
symbolEl
=
this
.
_symbolEl
;
var
seriesModel
=
data
.
hostModel
;
symbolEl
.
setShape
({
points
:
data
.
mapArray
(
data
.
getItemLayout
),
sizes
:
data
.
mapArray
(
function
(
idx
)
{
return
data
.
getItemVisual
(
idx
,
'
symbolSize
'
);
}
)
});
// Create symbolProxy to build path for each data
symbolEl
.
symbolProxy
=
symbolUtil
.
createSymbol
(
data
.
getVisual
(
'
symbol
'
),
0
,
0
,
0
,
0
);
// Use symbolProxy setColor method
symbolEl
.
setColor
=
symbolEl
.
symbolProxy
.
setColor
;
symbolEl
.
setStyle
(
seriesModel
.
getModel
(
'
itemStyle.normal
'
).
getItemStyle
([
'
color
'
])
);
var
visualColor
=
data
.
getVisual
(
'
color
'
);
if
(
visualColor
)
{
symbolEl
.
setColor
(
visualColor
);
}
// Add back
this
.
group
.
add
(
this
.
_symbolEl
);
};
largeSymbolProto
.
updateLayout
=
function
(
seriesModel
)
{
var
data
=
seriesModel
.
getData
();
this
.
_symbolEl
.
setShape
({
points
:
data
.
mapArray
(
data
.
getItemLayout
)
});
};
largeSymbolProto
.
remove
=
function
()
{
this
.
group
.
removeAll
();
};
return
LargeSymbolDraw
;
});
\ No newline at end of file
src/chart/scatter/ScatterSeries.js
浏览文件 @
348b4c20
...
...
@@ -38,6 +38,10 @@ define(function (require) {
symbolSize
:
10
,
// 图形大小,半宽(半径)参数,当图形为方向或菱形则总宽度为symbolSize * 2
// symbolRotate: null, // 图形旋转控制
large
:
false
,
// Available when large is true
largeThreshold
:
2000
,
// label: {
// normal: {
// show: false
...
...
src/chart/scatter/ScatterView.js
浏览文件 @
348b4c20
define
(
function
(
require
)
{
var
SymbolDraw
=
require
(
'
../helper/SymbolDraw
'
);
var
LargeSymbolDraw
=
require
(
'
../helper/LargeSymbolDraw
'
);
require
(
'
../../echarts
'
).
extendChartView
({
type
:
'
scatter
'
,
init
:
function
()
{
this
.
_
s
ymbolDraw
=
new
SymbolDraw
();
this
.
group
.
add
(
this
.
_symbolDraw
.
group
);
this
.
_
normalS
ymbolDraw
=
new
SymbolDraw
();
this
.
_largeSymbolDraw
=
new
LargeSymbolDraw
(
);
},
render
:
function
(
seriesModel
,
ecModel
,
api
)
{
this
.
_symbolDraw
.
updateData
(
seriesModel
.
getData
(),
api
);
var
data
=
seriesModel
.
getData
();
var
largeSymbolDraw
=
this
.
_largeSymbolDraw
;
var
normalSymbolDraw
=
this
.
_normalSymbolDraw
;
var
group
=
this
.
group
;
var
symbolDraw
=
seriesModel
.
get
(
'
large
'
)
&&
data
.
count
()
>
seriesModel
.
get
(
'
largeThreshold
'
)
?
largeSymbolDraw
:
normalSymbolDraw
;
this
.
_symbolDraw
=
symbolDraw
;
symbolDraw
.
updateData
(
data
,
api
);
group
.
add
(
symbolDraw
.
group
);
group
.
remove
(
symbolDraw
===
largeSymbolDraw
?
normalSymbolDraw
.
group
:
largeSymbolDraw
.
group
);
},
updateLayout
:
function
()
{
...
...
src/component/tooltip/TooltipModel.js
浏览文件 @
348b4c20
...
...
@@ -94,7 +94,8 @@ define(function (require) {
}
},
textStyle
:
{
color
:
'
#fff
'
color
:
'
#fff
'
,
fontSize
:
14
}
}
});
...
...
src/util/symbol.js
浏览文件 @
348b4c20
...
...
@@ -172,104 +172,120 @@ define(function(require) {
var
symbolShapeMakers
=
{
line
:
function
(
x
,
y
,
w
,
h
)
{
line
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
// FIXME
return
{
x1
:
x
,
y1
:
y
+
h
/
2
,
x2
:
x
+
w
,
y2
:
y
+
h
/
2
};
shape
.
x1
=
x
;
shape
.
y1
=
y
+
h
/
2
;
shape
.
x2
=
x
+
w
;
shape
.
y2
=
y
+
h
/
2
;
},
rect
:
function
(
x
,
y
,
w
,
h
)
{
return
{
x
:
x
,
y
:
y
,
width
:
w
,
height
:
h
};
rect
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
shape
.
x
=
x
;
shape
.
y
=
y
;
shape
.
width
=
w
;
shape
.
height
=
h
;
},
roundRect
:
function
(
x
,
y
,
w
,
h
,
r
)
{
return
{
x
:
x
,
y
:
y
,
width
:
w
,
height
:
h
,
r
:
r
||
Math
.
min
(
w
,
h
)
/
4
};
roundRect
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
shape
.
x
=
x
;
shape
.
y
=
y
;
shape
.
width
=
w
;
shape
.
height
=
h
;
shape
.
r
=
Math
.
min
(
w
,
h
)
/
4
;
},
square
:
function
(
x
,
y
,
size
)
{
return
{
x
:
x
,
y
:
y
,
width
:
size
/
2
,
height
:
size
/
2
};
square
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
var
size
=
Math
.
min
(
w
,
h
);
shape
.
x
=
x
;
shape
.
y
=
y
;
shape
.
width
=
size
;
shape
.
height
=
size
;
},
circle
:
function
(
x
,
y
,
w
,
h
)
{
circle
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
// Put circle in the center of square
var
size
=
Math
.
min
(
w
,
h
);
return
{
cx
:
x
+
w
/
2
,
cy
:
y
+
h
/
2
,
r
:
size
/
2
};
shape
.
cx
=
x
+
w
/
2
;
shape
.
cy
=
y
+
h
/
2
;
shape
.
r
=
Math
.
min
(
w
,
h
)
/
2
;
},
diamond
:
function
(
x
,
y
,
w
,
h
)
{
return
{
cx
:
x
+
w
/
2
,
cy
:
y
+
h
/
2
,
width
:
w
,
height
:
h
};
diamond
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
shape
.
cx
=
x
+
w
/
2
;
shape
.
cy
=
y
+
h
/
2
;
shape
.
width
=
w
;
shape
.
height
=
h
;
},
pin
:
function
(
x
,
y
,
w
,
h
)
{
return
{
x
:
x
+
w
/
2
,
// FIXME Why not y + h ?
y
:
y
+
h
/
2
,
width
:
w
,
height
:
h
};
pin
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
shape
.
x
=
x
+
w
/
2
;
shape
.
y
=
y
+
h
/
2
;
shape
.
width
=
w
;
shape
.
height
=
h
;
},
arrow
:
function
(
x
,
y
,
w
,
h
)
{
return
{
x
:
x
+
w
/
2
,
y
:
y
+
h
/
2
,
width
:
w
,
height
:
h
};
arrow
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
shape
.
x
=
x
+
w
/
2
;
shape
.
y
=
y
+
h
/
2
;
shape
.
width
=
w
;
shape
.
height
=
h
;
},
triangle
:
function
(
x
,
y
,
w
,
h
)
{
return
{
cx
:
x
+
w
/
2
,
cy
:
y
+
h
/
2
,
width
:
w
,
height
:
h
};
triangle
:
function
(
x
,
y
,
w
,
h
,
shape
)
{
shape
.
cx
=
x
+
w
/
2
;
shape
.
cy
=
y
+
h
/
2
;
shape
.
width
=
w
;
shape
.
height
=
h
;
}
};
var
symbolBuildProxies
=
{};
for
(
var
name
in
symbolCtors
)
{
symbolBuildProxies
[
name
]
=
new
symbolCtors
[
name
]();
}
var
Symbol
=
graphic
.
extendShape
({
type
:
'
symbol
'
,
shape
:
{
symbolType
:
''
,
x
:
0
,
y
:
0
,
width
:
0
,
height
:
0
},
buildPath
:
function
(
ctx
,
shape
)
{
var
proxySymbol
=
symbolBuildProxies
[
shape
.
symbolType
];
if
(
proxySymbol
)
{
symbolShapeMakers
[
shape
.
symbolType
](
shape
.
x
,
shape
.
y
,
shape
.
width
,
shape
.
height
,
proxySymbol
.
shape
);
proxySymbol
.
buildPath
(
ctx
,
proxySymbol
.
shape
);
}
}
});
// 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
);
if
(
this
.
type
!==
'
image
'
)
{
var
symbolStyle
=
this
.
style
;
var
symbolShape
=
this
.
shape
;
if
(
symbolShape
.
symbolType
===
'
line
'
)
{
symbolStyle
.
stroke
=
color
;
}
else
if
(
this
.
__isEmptyBrush
)
{
symbolStyle
.
stroke
=
color
;
symbolStyle
.
fill
=
'
#fff
'
;
}
else
{
// FIXME 判断图形默认是填充还是描边,使用 onlyStroke ?
symbolStyle
.
fill
&&
(
symbolStyle
.
fill
=
color
);
symbolStyle
.
stroke
&&
(
symbolStyle
.
stroke
=
color
);
}
this
.
dirty
();
}
this
.
dirty
();
};
var
symbolUtil
=
{
...
...
@@ -304,19 +320,18 @@ define(function(require) {
symbolPath
=
graphic
.
makePath
(
symbolType
.
slice
(
7
),
{},
new
BoundingRect
(
x
,
y
,
w
,
h
));
}
else
{
// Default rect
if
(
!
symbolShapeMakers
[
symbolType
])
{
symbolType
=
'
rect
'
;
}
symbolPath
=
new
symbolCtors
[
symbolType
]({
shape
:
symbolShapeMakers
[
symbolType
](
x
,
y
,
w
,
h
)
});
}
var
symbolStyle
=
symbolPath
.
style
;
if
(
isEmpty
)
{
symbolStyle
.
set
({
fill
:
'
#fff
'
,
lineWidth
:
2
symbolPath
=
new
Symbol
({
shape
:
{
symbolType
:
symbolType
,
x
:
x
,
y
:
y
,
width
:
w
,
height
:
h
}
});
}
...
...
@@ -327,39 +342,6 @@ define(function(require) {
symbolPath
.
setColor
(
color
);
return
symbolPath
;
},
/**
* Get symbol shape object by given x, y, w, h
* @param {string} symbolType
* @param {number} x
* @param {number} y
* @param {number} w
* @param {number} h
* @return {Object}
*/
getSymbolShape
:
function
(
symbolType
,
x
,
y
,
w
,
h
)
{
if
(
symbolType
.
indexOf
(
'
empty
'
)
===
0
)
{
symbolType
=
symbolType
.
substr
(
5
,
1
).
toLowerCase
()
+
symbolType
.
substr
(
6
);
}
if
(
symbolType
.
indexOf
(
'
image://
'
)
===
0
)
{
return
{
style
:
{
x
:
x
,
y
:
y
,
width
:
w
,
height
:
h
}
};
}
else
if
(
symbolType
.
indexOf
(
'
path://
'
)
!==
0
)
{
if
(
!
symbolShapeMakers
[
symbolType
])
{
symbolType
=
'
rect
'
;
}
return
{
shape
:
symbolShapeMakers
[
symbolType
](
x
,
y
,
w
,
h
)
};
}
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录