Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alon@wen
echarts
提交
4ed2b265
E
echarts
项目概览
alon@wen
/
echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
echarts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4ed2b265
编写于
9月 08, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve bar layout, legendAction parameters remove legendModel
上级
d8d34c3a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
60 addition
and
19 deletion
+60
-19
src/component/axis.js
src/component/axis.js
+6
-3
src/component/legend/LegendView.js
src/component/legend/LegendView.js
+12
-8
src/component/legend/legendAction.js
src/component/legend/legendAction.js
+12
-3
src/layout/barGrid.js
src/layout/barGrid.js
+7
-3
src/model/Global.js
src/model/Global.js
+23
-2
未找到文件。
src/component/axis.js
浏览文件 @
4ed2b265
...
...
@@ -181,7 +181,8 @@ define(function(require) {
},
style
:
{
lineWidth
:
tickLineWidth
}
},
silent
:
true
})));
}
var
tickEl
=
api
.
mergePath
(
tickLines
,
{
...
...
@@ -356,7 +357,8 @@ define(function(require) {
},
style
:
{
lineWidth
:
lineWidth
}
},
silent
:
true
})));
}
...
...
@@ -427,7 +429,8 @@ define(function(require) {
y
:
y
,
width
:
width
,
height
:
height
}
},
silent
:
true
}));
prevX
=
x
+
width
;
...
...
src/component/legend/LegendView.js
浏览文件 @
4ed2b265
define
(
function
(
require
)
{
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
numberUtil
=
require
(
'
../../util/number
'
);
var
symbolCreator
=
require
(
'
../../util/symbol
'
);
function
createSelectActionDispatcher
(
uid
,
seriesName
,
api
)
{
api
.
dispatch
({
type
:
'
legendToggleSelect
'
,
from
:
uid
,
seriesName
:
seriesName
});
}
return
require
(
'
../../echarts
'
).
extendComponentView
({
type
:
'
legend
'
,
...
...
@@ -65,14 +74,9 @@ define(function (require) {
group
.
add
(
legendSymbol
);
group
.
add
(
text
);
legendSymbol
.
on
(
'
click
'
,
function
()
{
api
.
dispatch
({
type
:
'
legendSelected
'
,
from
:
this
.
uid
,
legendModel
:
legendModel
,
seriesName
:
seriesName
});
},
this
);
var
onClick
=
zrUtil
.
curry
(
createSelectActionDispatcher
,
this
.
uid
,
seriesName
,
api
);
legendSymbol
.
on
(
'
click
'
,
onClick
,
this
);
text
.
on
(
'
click
'
,
onClick
,
this
);
},
this
);
var
groupRect
=
group
.
getBoundingRect
();
...
...
src/component/legend/legendAction.js
浏览文件 @
4ed2b265
...
...
@@ -5,8 +5,17 @@ define(function(require) {
var
echarts
=
require
(
'
../../echarts
'
);
echarts
.
registerAction
(
'
legendSelected
'
,
function
(
event
,
ecModel
)
{
event
.
legendModel
.
toggleSelected
(
event
.
seriesName
);
/**
* @event legendToggleSelect
* @type {Object}
* @property {string} type 'legendToggleSelect'
* @property {string} [from]
* @property {string} seriesName
*/
echarts
.
registerAction
(
'
legendToggleSelect
'
,
function
(
event
,
ecModel
)
{
// Update all legend components
ecModel
.
eachComponent
(
'
legend
'
,
function
(
legendModel
)
{
legendModel
&&
legendModel
.
toggleSelected
(
event
.
seriesName
);
});
});
});
\ No newline at end of file
src/layout/barGrid.js
浏览文件 @
4ed2b265
...
...
@@ -142,8 +142,10 @@ define(function(require) {
var
valueAxis
=
cartesian
.
getOtherAxis
(
columnLayoutInfo
.
axis
);
if
(
data
.
type
===
'
list
'
)
{
var
valueAxisStart
=
valueAxis
.
getExtent
()[
0
];
var
coords
=
cartesian
.
dataToCoords
(
data
);
lastStackCoords
[
stackId
]
=
lastStackCoords
[
stackId
]
||
[];
data
.
each
(
function
(
dataItem
,
dataIndex
)
{
var
value
=
dataItem
.
getValue
(
true
);
...
...
@@ -153,22 +155,24 @@ define(function(require) {
}
var
coord
=
coords
[
dataIndex
];
var
lastCoord
=
lastStackCoords
[
stackId
][
dataIndex
]
||
valueAxis
.
dataToCoord
(
0
)
;
var
lastCoord
=
lastStackCoords
[
stackId
][
dataIndex
]
||
valueAxis
Start
;
var
x
,
y
,
width
,
height
;
if
(
valueAxis
.
isHorizontal
())
{
x
=
Math
.
min
(
lastCoord
,
coord
[
0
]);
y
=
coord
[
1
]
+
columnOffset
;
width
=
Math
.
abs
(
coord
[
0
]
-
lastCoord
);
height
=
columnWidth
;
last
StackCoords
[
stackId
][
dataIndex
]
=
x
;
last
Coord
+=
coord
[
0
]
-
lastCoord
;
}
else
{
x
=
coord
[
0
]
+
columnOffset
;
y
=
Math
.
min
(
lastCoord
,
coord
[
1
]);
width
=
columnWidth
;
height
=
Math
.
abs
(
coord
[
1
]
-
lastCoord
);
last
StackCoords
[
stackId
][
dataIndex
]
=
y
;
last
Coord
+=
coord
[
1
]
-
lastCoord
;
}
lastStackCoords
[
stackId
][
dataIndex
]
=
lastCoord
;
dataItem
.
layout
=
{
x
:
x
,
y
:
y
,
...
...
src/model/Global.js
浏览文件 @
4ed2b265
...
...
@@ -2,8 +2,11 @@
* ECharts global model
*
* @module {echarts/model/Global}
*
*/
// FIXME Filter 后 series 是否能够被 getComponent 或者 getComponenentById 获取?
define
(
function
(
require
)
{
var
zrUtil
=
require
(
'
zrender/core/util
'
);
...
...
@@ -42,6 +45,12 @@ define(function (require) {
*/
this
.
_componentsMap
=
{};
/**
* @type {Object.<string, module:echarts/model/Model>}
* @private
*/
this
.
_componentsIdMap
=
{};
/**
* @type {Object.<string, module:echarts/model/Model>}
* @private
...
...
@@ -88,7 +97,6 @@ define(function (require) {
var
option
=
this
.
option
;
var
componentsMap
=
this
.
_componentsMap
;
var
components
=
this
.
_components
;
var
componentTypes
=
[];
// 如果不存在对应的 component model 则直接 merge
...
...
@@ -140,7 +148,10 @@ define(function (require) {
this
.
_getComponentsByTypes
(
dependencies
),
i
);
componentsMap
[
componentType
][
i
]
=
componentModel
;
components
.
push
(
componentModel
);
// Merge option is incremental
this
.
_components
.
push
(
componentModel
);
this
.
_componentsIdMap
[
componentModel
.
uid
]
=
componentModel
;
}
}
},
this
);
...
...
@@ -159,6 +170,8 @@ define(function (require) {
},
/**
* @param {string} type
* @param {number} [idx=0]
* @return {module:echarts/model/Component}
*/
getComponent
:
function
(
type
,
idx
)
{
...
...
@@ -168,6 +181,14 @@ define(function (require) {
}
},
/**
* @param {string} uid
* @return {module:echarts/model/Component}
*/
getComponentById
:
function
(
uid
)
{
return
this
.
_componentsIdMap
[
uid
];
},
/**
* @param {string} type
* @param {Function} cb
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录