Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
半栈学徒
incubator-echarts
提交
0f1aa933
I
incubator-echarts
项目概览
半栈学徒
/
incubator-echarts
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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 搜索 >>
提交
0f1aa933
编写于
11月 25, 2015
作者:
L
lang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Line highlight, other tweaks
上级
c5a49ea4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
113 addition
and
25 deletion
+113
-25
src/chart/helper/Symbol.js
src/chart/helper/Symbol.js
+23
-0
src/chart/line/LineView.js
src/chart/line/LineView.js
+65
-1
src/component/title.js
src/component/title.js
+0
-1
src/component/tooltip.js
src/component/tooltip.js
+14
-12
src/data/List.js
src/data/List.js
+9
-7
src/visual/dataColor.js
src/visual/dataColor.js
+2
-4
未找到文件。
src/chart/helper/Symbol.js
浏览文件 @
0f1aa933
...
...
@@ -49,6 +49,29 @@ define(function (require) {
this
.
add
(
symbolPath
);
};
/**
* Highlight symbol
*/
symbolProto
.
highlight
=
function
()
{
this
.
childAt
(
0
).
trigger
(
'
emphasis
'
);
};
/**
* Downplay symbol
*/
symbolProto
.
downplay
=
function
()
{
this
.
childAt
(
0
).
trigger
(
'
normal
'
);
};
/**
* @param {number} zlevel
* @param {number} z
*/
symbolProto
.
setZ
=
function
(
zlevel
,
z
)
{
var
symbolPath
=
this
.
childAt
(
0
);
symbolPath
.
zlevel
=
zlevel
;
symbolPath
.
z
=
z
;
};
/**
* Update symbol properties
* @param {module:echarts/data/List} data
...
...
src/chart/line/LineView.js
浏览文件 @
0f1aa933
...
...
@@ -4,11 +4,14 @@ define(function(require) {
var
zrUtil
=
require
(
'
zrender/core/util
'
);
var
SymbolDraw
=
require
(
'
../helper/SymbolDraw
'
);
var
Symbol
=
require
(
'
../helper/Symbol
'
);
var
lineAnimationDiff
=
require
(
'
./lineAnimationDiff
'
);
var
graphic
=
require
(
'
../../util/graphic
'
);
var
polyHelper
=
require
(
'
./poly
'
);
var
ChartView
=
require
(
'
../../view/Chart
'
);
function
isPointsSame
(
points1
,
points2
)
{
if
(
points1
.
length
!==
points2
.
length
)
{
return
;
...
...
@@ -77,7 +80,16 @@ define(function(require) {
},
true
);
}
return
require
(
'
../../echarts
'
).
extendChartView
({
function
queryDataIndex
(
data
,
payload
)
{
if
(
payload
.
dataIndex
!=
null
)
{
return
payload
.
dataIndex
;
}
else
if
(
payload
.
name
!=
null
)
{
return
data
.
indexOfName
(
payload
.
name
);
}
}
return
ChartView
.
extend
({
type
:
'
line
'
,
...
...
@@ -220,6 +232,58 @@ define(function(require) {
this
.
_points
=
points
;
},
highlight
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
var
data
=
seriesModel
.
getData
();
var
dataIndex
=
queryDataIndex
(
data
,
payload
);
if
(
dataIndex
>=
0
)
{
var
symbol
=
data
.
getItemGraphicEl
(
dataIndex
);
if
(
!
symbol
)
{
// Create a temporary symbol if it is not exists
symbol
=
new
Symbol
(
data
,
dataIndex
,
api
);
symbol
.
position
=
data
.
getItemLayout
(
dataIndex
);
symbol
.
setZ
(
seriesModel
.
get
(
'
zlevel
'
),
seriesModel
.
get
(
'
z
'
)
);
symbol
.
__temp
=
true
;
data
.
setItemGraphicEl
(
dataIndex
,
symbol
);
this
.
group
.
add
(
symbol
);
}
symbol
.
highlight
();
}
else
{
// Highlight whole series
ChartView
.
prototype
.
highlight
.
call
(
this
,
seriesModel
,
ecModel
,
api
,
payload
);
}
},
downplay
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
var
data
=
seriesModel
.
getData
();
var
dataIndex
=
queryDataIndex
(
data
,
payload
);
if
(
dataIndex
>=
0
)
{
var
symbol
=
data
.
getItemGraphicEl
(
dataIndex
);
if
(
symbol
)
{
if
(
symbol
.
__temp
)
{
data
.
setItemGraphicEl
(
dataIndex
,
null
);
this
.
group
.
remove
(
symbol
);
}
else
{
symbol
.
downplay
();
}
}
}
else
{
// Downplay whole series
ChartView
.
prototype
.
downplay
.
call
(
this
,
seriesModel
,
ecModel
,
api
,
payload
);
}
},
/**
* @param {module:zrender/container/Group} group
* @param {Array.<Array.<number>>} points
...
...
src/component/title.js
浏览文件 @
0f1aa933
...
...
@@ -5,7 +5,6 @@ define(function(require) {
var
echarts
=
require
(
'
../echarts
'
);
var
graphic
=
require
(
'
../util/graphic
'
);
var
layout
=
require
(
'
../util/layout
'
);
var
formatUtil
=
require
(
'
../util/format
'
);
// Model
echarts
.
extendComponentModel
({
...
...
src/component/tooltip.js
浏览文件 @
0f1aa933
...
...
@@ -282,7 +282,6 @@ define(function (require) {
_showAxisTooltip
:
function
(
tooltipModel
,
ecModel
,
e
)
{
var
axisPointerModel
=
tooltipModel
.
getModel
(
'
axisPointer
'
);
var
axisPointerType
=
axisPointerModel
.
get
(
'
type
'
);
var
api
=
this
.
_api
;
if
(
axisPointerType
===
'
cross
'
)
{
var
el
=
e
.
target
;
...
...
@@ -646,25 +645,28 @@ define(function (require) {
var
val
=
value
[
baseAxis
.
dim
===
'
x
'
?
0
:
1
];
var
dataIndex
=
data
.
indexOfNearest
(
baseAxis
.
dim
,
val
);
// FIXME Not here
var
lastHover
=
this
.
_lastHover
;
if
(
lastHover
.
seriesIndex
!=
null
)
{
if
(
lastHover
.
seriesIndex
!=
null
&&
!
contentNotChange
)
{
this
.
_api
.
dispatch
({
type
:
'
downplay
'
,
seriesIndex
:
lastHover
.
seriesIndex
,
dataIndex
:
lastHover
.
dataIndex
});
}
var
seriesIndices
=
zrUtil
.
map
(
seriesList
,
function
(
series
)
{
return
series
.
seriesIndex
;
});
// Dispatch highlight action
this
.
_api
.
dispatch
({
type
:
'
highlight
'
,
seriesIndex
:
seriesIndices
,
dataIndex
:
dataIndex
});
lastHover
.
seriesIndex
=
seriesIndices
;
lastHover
.
dataIndex
=
dataIndex
;
if
(
!
contentNotChange
)
{
var
seriesIndices
=
zrUtil
.
map
(
seriesList
,
function
(
series
)
{
return
series
.
seriesIndex
;
});
this
.
_api
.
dispatch
({
type
:
'
highlight
'
,
seriesIndex
:
seriesIndices
,
dataIndex
:
dataIndex
});
lastHover
.
seriesIndex
=
seriesIndices
;
lastHover
.
dataIndex
=
dataIndex
;
}
if
(
baseAxis
&&
rootTooltipModel
.
get
(
'
showContent
'
))
{
...
...
src/data/List.js
浏览文件 @
0f1aa933
...
...
@@ -909,13 +909,15 @@ define(function (require) {
listProto
.
setItemGraphicEl
=
function
(
idx
,
el
)
{
var
hostModel
=
this
.
hostModel
;
if
(
zrUtil
.
isArray
(
el
))
{
zrUtil
.
each
(
el
,
function
(
singleEl
)
{
addIndexToGraphicEl
(
singleEl
,
idx
,
hostModel
);
});
}
else
{
addIndexToGraphicEl
(
el
,
idx
,
hostModel
);
if
(
el
)
{
if
(
zrUtil
.
isArray
(
el
))
{
zrUtil
.
each
(
el
,
function
(
singleEl
)
{
addIndexToGraphicEl
(
singleEl
,
idx
,
hostModel
);
});
}
else
{
addIndexToGraphicEl
(
el
,
idx
,
hostModel
);
}
}
this
.
_graphicEls
[
idx
]
=
el
;
...
...
src/visual/dataColor.js
浏览文件 @
0f1aa933
...
...
@@ -2,10 +2,9 @@
define
(
function
(
require
)
{
return
function
(
seriesType
,
ecModel
)
{
var
offset
=
0
;
var
colorList
=
ecModel
.
get
(
'
color
'
);
ecModel
.
each
Raw
SeriesByType
(
seriesType
,
function
(
seriesModel
)
{
ecModel
.
eachSeriesByType
(
seriesType
,
function
(
seriesModel
)
{
var
dataAll
=
seriesModel
.
getRawData
();
if
(
!
ecModel
.
isSeriesFiltered
(
seriesModel
))
{
var
data
=
seriesModel
.
getData
();
...
...
@@ -13,13 +12,12 @@ define(function (require) {
var
itemModel
=
data
.
getItemModel
(
idx
);
var
rawIdx
=
data
.
getRawIndex
(
idx
);
var
color
=
itemModel
.
get
(
'
itemStyle.normal.color
'
)
||
colorList
[
(
offset
+
rawIdx
)
%
colorList
.
length
];
||
colorList
[
rawIdx
%
colorList
.
length
];
// Legend may use the visual info in data before processed
dataAll
.
setItemVisual
(
rawIdx
,
'
color
'
,
color
);
data
.
setItemVisual
(
idx
,
'
color
'
,
color
);
});
}
offset
+=
dataAll
.
count
();
});
};
});
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录