Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
x649585723
incubator-echarts
提交
a88b24a1
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 搜索 >>
提交
a88b24a1
编写于
11月 12, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add event
上级
13ddcf9b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
162 addition
and
57 deletion
+162
-57
.jshintrc
.jshintrc
+71
-0
src/component/legend/LegendView.js
src/component/legend/LegendView.js
+2
-3
src/component/legend/legendAction.js
src/component/legend/legendAction.js
+1
-1
src/echarts.js
src/echarts.js
+82
-15
src/model/globalDefault.js
src/model/globalDefault.js
+4
-36
src/scale/Time.js
src/scale/Time.js
+2
-2
未找到文件。
.jshintrc
0 → 100644
浏览文件 @
a88b24a1
{
"bitwise": false,
"camelcase": true,
"curly": true,
"es3": true,
"eqeqeq": false,
"forin": false,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": false,
"noempty": true,
"nonew": true,
"plusplus": false,
"quotmark": "single",
"regexp": false,
"undef": true,
"unused": "vars",
"strict": false,
"trailing": false,
"maxparams": 20,
"maxdepth": 6,
"maxlen": 200,
"asi": false,
"boss": false,
"debug": false,
"eqnull": true,
"esnext": false,
"evil": true,
"expr": true,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": true,
"laxcomma": false,
"loopfunc": false,
"multistr": false,
"onecase": false,
"proto": false,
"regexdash": false,
"scripturl": false,
"smarttabs": false,
"shadow": true,
"sub": true,
"supernew": false,
"validthis": true,
"browser": true,
"couch": false,
"devel": true,
"dojo": false,
"jquery": true,
"mootools": false,
"node": false,
"nonstandard": false,
"prototypejs": false,
"rhino": false,
"wsh": false,
"nomen": false,
"onevar": false,
"passfail": false,
"white": false,
"predef": [
"define",
"require"
]
}
\ No newline at end of file
src/component/legend/LegendView.js
浏览文件 @
a88b24a1
...
...
@@ -9,10 +9,9 @@ define(function (require) {
var
LEGEND_DISABLE_COLOR
=
'
#ccc
'
;
function
createSelectActionDispatcher
(
uid
,
seriesName
,
api
)
{
function
createSelectActionDispatcher
(
seriesName
,
api
)
{
api
.
dispatch
({
type
:
'
legendToggleSelect
'
,
from
:
uid
,
seriesName
:
seriesName
});
}
...
...
@@ -218,7 +217,7 @@ define(function (require) {
this
.
group
.
add
(
itemGroup
);
itemGroup
.
on
(
'
click
'
,
zrUtil
.
curry
(
createSelectActionDispatcher
,
this
.
uid
,
name
,
api
),
this
);
itemGroup
.
on
(
'
click
'
,
zrUtil
.
curry
(
createSelectActionDispatcher
,
name
,
api
),
this
);
}
});
});
\ No newline at end of file
src/component/legend/legendAction.js
浏览文件 @
a88b24a1
...
...
@@ -12,7 +12,7 @@ define(function(require) {
* @property {string} [from]
* @property {string} seriesName
*/
echarts
.
registerAction
(
'
legendToggleSelect
'
,
function
(
event
,
ecModel
)
{
echarts
.
registerAction
(
'
legendToggleSelect
'
,
'
legendSelected
'
,
function
(
event
,
ecModel
)
{
// Update all legend components
ecModel
.
eachComponent
(
'
legend
'
,
function
(
legendModel
)
{
legendModel
&&
legendModel
.
toggleSelected
(
event
.
seriesName
);
...
...
src/echarts.js
浏览文件 @
a88b24a1
...
...
@@ -19,6 +19,7 @@ define(function (require) {
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
colorTool
=
require
(
'
zrender/tool/color
'
);
var
env
=
require
(
'
zrender/core/env
'
);
var
Eventful
=
require
(
'
zrender/mixin/Eventful
'
);
var
each
=
zrUtil
.
each
;
...
...
@@ -88,6 +89,10 @@ define(function (require) {
*/
this
.
_coordinateSystem
=
new
CoordinateSystemManager
();
Eventful
.
call
(
this
);
// Init mouse events
this
.
_initEvents
();
}
var
echartsProto
=
ECharts
.
prototype
;
...
...
@@ -152,7 +157,7 @@ define(function (require) {
* @param {Object} payload
*/
echartsProto
.
update
=
function
(
payload
)
{
console
.
time
&&
console
.
time
(
'
update
'
);
//
console.time && console.time('update');
var
ecModel
=
this
.
_model
;
...
...
@@ -186,7 +191,7 @@ define(function (require) {
}
backgroundColor
&&
(
this
.
_dom
.
style
.
backgroundColor
=
backgroundColor
);
console
.
time
&&
console
.
timeEnd
(
'
update
'
);
//
console.time && console.timeEnd('update');
};
// PENDING
...
...
@@ -239,6 +244,15 @@ define(function (require) {
this
.
update
();
};
/**
* @return {[type]} [description]
*/
echartsProto
.
makeActionFromEvent
=
function
(
eventObj
)
{
var
payload
=
zrUtil
.
extend
({},
eventObj
);
payload
.
type
=
eventActionMap
[
eventObj
.
type
];
return
payload
;
};
/**
* @pubilc
* @param {Object} payload
...
...
@@ -248,9 +262,16 @@ define(function (require) {
echartsProto
.
dispatch
=
function
(
payload
)
{
var
actionWrap
=
actions
[
payload
.
type
];
if
(
actionWrap
)
{
var
updateMethod
=
actionWrap
.
actionInfo
.
update
||
'
update
'
;
var
actionInfo
=
actionWrap
.
actionInfo
;
var
updateMethod
=
actionInfo
.
update
||
'
update
'
;
actionWrap
.
action
(
payload
,
this
.
_model
);
updateMethod
!==
'
none
'
&&
this
[
updateMethod
](
payload
);
// Emit event outside
// Convert type to eventType
var
eventObj
=
zrUtil
.
extend
({},
payload
);
eventObj
.
type
=
actionInfo
.
event
||
eventObj
.
type
;
this
.
trigger
(
eventObj
.
type
,
eventObj
);
}
};
...
...
@@ -279,6 +300,11 @@ define(function (require) {
};
/**
* Prepare charts view instances
* @param {module:echarts/model/Global} ecModel
* @private
*/
echartsProto
.
_prepareCharts
=
function
(
ecModel
)
{
var
chartsList
=
this
.
_chartsList
;
...
...
@@ -327,6 +353,11 @@ define(function (require) {
}
};
/**
* Prepare component view instances
* @param {module:echarts/model/Global} ecModel
* @private
*/
echartsProto
.
_prepareComponents
=
function
(
ecModel
)
{
var
componentsMap
=
this
.
_componentsMap
;
...
...
@@ -418,9 +449,6 @@ define(function (require) {
*/
echartsProto
.
_doLayout
=
function
(
ecModel
,
payload
)
{
var
api
=
this
.
_extensionAPI
;
each
(
this
.
_layouts
,
function
(
layout
)
{
layout
.
update
(
ecModel
,
api
,
payload
);
});
each
(
layoutFuncs
,
function
(
layout
)
{
layout
(
ecModel
,
api
,
payload
);
});
...
...
@@ -475,6 +503,31 @@ define(function (require) {
},
this
);
};
var
MOUSE_EVENT_NAMES
=
[
'
click
'
,
'
dblclick
'
,
'
mouseover
'
,
'
mouseout
'
,
'
globalout
'
];
/**
* @private
*/
echartsProto
.
_initEvents
=
function
()
{
var
zr
=
this
.
_zr
;
each
(
MOUSE_EVENT_NAMES
,
function
(
eveName
)
{
zr
.
on
(
eveName
,
function
(
e
)
{
var
ecModel
=
this
.
getModel
();
var
el
=
e
.
target
;
if
(
el
&&
el
.
dataIndex
!=
null
)
{
var
hostModel
=
el
.
hostModel
||
ecModel
.
getSeriesByIndex
(
el
.
seriesIndex
,
true
);
var
params
=
hostModel
&&
hostModel
.
getDataParams
(
el
.
dataIndex
)
||
{};
params
.
event
=
e
;
params
.
type
=
eveName
;
this
.
trigger
(
eveName
,
params
);
}
},
this
);
},
this
);
};
echartsProto
.
dispose
=
function
()
{
each
(
this
.
_components
,
function
(
component
)
{
component
.
dispose
();
...
...
@@ -486,6 +539,8 @@ define(function (require) {
this
.
zr
.
dispose
();
};
zrUtil
.
mixin
(
ECharts
,
Eventful
);
/**
* @param {module:echarts/model/Series|module:echarts/model/Component} model
* @param {module:echarts/view/Component|module:echarts/view/Chart} view
...
...
@@ -506,6 +561,12 @@ define(function (require) {
*/
var
actions
=
[];
/**
* Map from eventType to actionType
* @type {Object}
*/
var
eventActionMap
=
{};
/**
* @type {Array.<Function>}
* @inner
...
...
@@ -577,21 +638,27 @@ define(function (require) {
*
* @param {(string|Object)} actionInfo
* @param {string} actionInfo.type
* @param {string=} actionInfo.event
* @param {string=} actionInfo.update
* @param {Function=} action
*/
echarts
.
registerAction
=
function
(
actionInfo
,
action
)
{
* @param {string} [actionInfo.event]
* @param {string} [actionInfo.update]
* @param {string} [eventName]
* @param {Function} action
*/
echarts
.
registerAction
=
function
(
actionInfo
,
eventName
,
action
)
{
if
(
typeof
eventName
===
'
function
'
)
{
action
=
eventName
;
eventName
=
''
;
}
var
actionType
=
zrUtil
.
isObject
(
actionInfo
)
?
actionInfo
.
type
:
([
actionInfo
,
actionInfo
=
{}][
0
]);
:
([
actionInfo
,
actionInfo
=
{
event
:
eventName
}][
0
]);
eventName
=
actionInfo
.
event
;
if
(
!
actions
[
actionType
])
{
actions
[
actionType
]
=
{
action
:
action
,
actionInfo
:
actionInfo
};
}
// TODO
// event
eventActionMap
[
eventName
]
=
actionType
;
};
/**
...
...
src/model/globalDefault.js
浏览文件 @
a88b24a1
...
...
@@ -10,7 +10,6 @@ define(function () {
// '#1e90ff','#ff6347','#7b68ee','#00fa9a','#ffd700',
// '#6699FF','#ff6666','#3cb371','#b8860b','#30e0e0'],
// https://dribbble.com/shots/1065960-Infographic-Pie-chart-visualization
color
:
[
'
#5793f3
'
,
'
#d14a61
'
,
'
#fd9c35
'
,
'
#675bba
'
,
'
#fec42c
'
,
'
#dd4444
'
,
'
#d4df5a
'
,
'
#cd4870
'
],
...
...
@@ -28,42 +27,11 @@ define(function () {
fontStyle
:
'
normal
'
,
fontWeight
:
'
normal
'
},
EVENT
:
{
// -------全局通用
REFRESH
:
'
refresh
'
,
RESTORE
:
'
restore
'
,
RESIZE
:
'
resize
'
,
CLICK
:
'
click
'
,
DBLCLICK
:
'
dblclick
'
,
HOVER
:
'
hover
'
,
MOUSEOUT
:
'
mouseout
'
,
// -------业务交互逻辑
DATA_CHANGED
:
'
dataChanged
'
,
DATA_ZOOM
:
'
dataZoom
'
,
DATA_RANGE
:
'
dataRange
'
,
DATA_RANGE_SELECTED
:
'
dataRangeSelected
'
,
DATA_RANGE_HOVERLINK
:
'
dataRangeHoverLink
'
,
LEGEND_SELECTED
:
'
legendSelected
'
,
LEGEND_HOVERLINK
:
'
legendHoverLink
'
,
MAP_SELECTED
:
'
mapSelected
'
,
PIE_SELECTED
:
'
pieSelected
'
,
MAGIC_TYPE_CHANGED
:
'
magicTypeChanged
'
,
DATA_VIEW_CHANGED
:
'
dataViewChanged
'
,
TIMELINE_CHANGED
:
'
timelineChanged
'
,
MAP_ROAM
:
'
mapRoam
'
,
FORCE_LAYOUT_END
:
'
forceLayoutEnd
'
,
// -------内部通信
TOOLTIP_HOVER
:
'
tooltipHover
'
,
TOOLTIP_IN_GRID
:
'
tooltipInGrid
'
,
TOOLTIP_OUT_GRID
:
'
tooltipOutGrid
'
,
ROAMCONTROLLER
:
'
roamController
'
},
// 主题,默认标志图形类型列表
symbolList
:
[
'
circle
'
,
'
rectangle
'
,
'
triangle
'
,
'
diamond
'
,
'
emptyCircle
'
,
'
emptyRectangle
'
,
'
emptyTriangle
'
,
'
emptyDiamond
'
],
//
symbolList: [
//
'circle', 'rectangle', 'triangle', 'diamond',
//
'emptyCircle', 'emptyRectangle', 'emptyTriangle', 'emptyDiamond'
//
],
animation
:
true
,
// 过渡动画是否开启
animationThreshold
:
2000
,
// 动画元素阀值,产生的图形原素超过2000不出动画
animationDuration
:
1000
,
// 过渡动画参数:进入
...
...
src/scale/Time.js
浏览文件 @
a88b24a1
...
...
@@ -139,7 +139,7 @@ define(function (require) {
TimeScale
.
prototype
[
methodName
]
=
function
(
val
)
{
val
=
+
parseDate
(
val
);
return
intervalScaleProto
[
methodName
].
call
(
this
,
val
);
}
}
;
});
zrUtil
.
inherits
(
TimeScale
,
IntervalScale
);
...
...
@@ -174,7 +174,7 @@ define(function (require) {
*/
TimeScale
.
create
=
function
()
{
return
new
TimeScale
();
}
}
;
require
(
'
./scale
'
).
register
(
TimeScale
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录