Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
missman
incubator-echarts
提交
95e8c728
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,发现更多精彩内容 >>
提交
95e8c728
编写于
12月 29, 2017
作者:
S
sushuang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tweak the pipeline and fix legend on stream charts.
上级
a4760703
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
101 addition
and
75 deletion
+101
-75
src/chart/chord.js
src/chart/chord.js
+2
-3
src/chart/funnel.js
src/chart/funnel.js
+2
-3
src/chart/pie.js
src/chart/pie.js
+2
-2
src/chart/radar.js
src/chart/radar.js
+2
-3
src/chart/themeRiver.js
src/chart/themeRiver.js
+1
-2
src/chart/treemap/treemapLayout.js
src/chart/treemap/treemapLayout.js
+7
-8
src/chart/treemap/treemapVisual.js
src/chart/treemap/treemapVisual.js
+5
-7
src/component/dataZoom/dataZoomProcessor.js
src/component/dataZoom/dataZoomProcessor.js
+1
-1
src/echarts.js
src/echarts.js
+1
-1
src/model/Global.js
src/model/Global.js
+14
-2
src/processor/dataFilter.js
src/processor/dataFilter.js
+22
-19
src/stream/Scheduler.js
src/stream/Scheduler.js
+21
-15
src/visual/dataColor.js
src/visual/dataColor.js
+21
-9
未找到文件。
src/chart/chord.js
浏览文件 @
95e8c728
import
*
as
echarts
from
'
../echarts
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
'
./chord/ChordSeries
'
;
import
'
./chord/ChordView
'
;
...
...
@@ -9,5 +8,5 @@ import dataColor from '../visual/dataColor';
import
dataFilter
from
'
../processor/dataFilter
'
;
echarts
.
registerLayout
(
chordCircularLayout
);
echarts
.
registerVisual
(
zrUtil
.
curry
(
dataColor
,
'
chord
'
));
echarts
.
registerProcessor
(
zrUtil
.
curry
(
dataFilter
,
'
pie
'
));
\ No newline at end of file
echarts
.
registerVisual
(
dataColor
(
'
chord
'
));
echarts
.
registerProcessor
(
dataFilter
(
'
pie
'
));
\ No newline at end of file
src/chart/funnel.js
浏览文件 @
95e8c728
import
*
as
echarts
from
'
../echarts
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
'
./funnel/FunnelSeries
'
;
import
'
./funnel/FunnelView
'
;
...
...
@@ -8,6 +7,6 @@ import dataColor from '../visual/dataColor';
import
funnelLayout
from
'
./funnel/funnelLayout
'
;
import
dataFilter
from
'
../processor/dataFilter
'
;
echarts
.
registerVisual
(
zrUtil
.
curry
(
dataColor
,
'
funnel
'
));
echarts
.
registerVisual
(
dataColor
(
'
funnel
'
));
echarts
.
registerLayout
(
funnelLayout
);
echarts
.
registerProcessor
(
zrUtil
.
curry
(
dataFilter
,
'
funnel
'
));
\ No newline at end of file
echarts
.
registerProcessor
(
dataFilter
(
'
funnel
'
));
\ No newline at end of file
src/chart/pie.js
浏览文件 @
95e8c728
...
...
@@ -23,6 +23,6 @@ createDataSelectAction('pie', [{
method
:
'
unSelect
'
}]);
echarts
.
registerVisual
(
zrUtil
.
curry
(
dataColor
,
'
pie
'
));
echarts
.
registerVisual
(
dataColor
(
'
pie
'
));
echarts
.
registerLayout
(
zrUtil
.
curry
(
pieLayout
,
'
pie
'
));
echarts
.
registerProcessor
(
zrUtil
.
curry
(
dataFilter
,
'
pie
'
));
\ No newline at end of file
echarts
.
registerProcessor
(
dataFilter
(
'
pie
'
));
\ No newline at end of file
src/chart/radar.js
浏览文件 @
95e8c728
import
*
as
echarts
from
'
../echarts
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
// Must use radar component
import
'
../component/radar
'
;
...
...
@@ -13,8 +12,8 @@ import radarLayout from './radar/radarLayout';
import
dataFilter
from
'
../processor/dataFilter
'
;
import
backwardCompat
from
'
./radar/backwardCompat
'
;
echarts
.
registerVisual
(
zrUtil
.
curry
(
dataColor
,
'
radar
'
));
echarts
.
registerVisual
(
dataColor
(
'
radar
'
));
echarts
.
registerVisual
(
visualSymbol
(
'
radar
'
,
'
circle
'
));
echarts
.
registerLayout
(
radarLayout
);
echarts
.
registerProcessor
(
zrUtil
.
curry
(
dataFilter
,
'
radar
'
));
echarts
.
registerProcessor
(
dataFilter
(
'
radar
'
));
echarts
.
registerPreprocessor
(
backwardCompat
);
\ No newline at end of file
src/chart/themeRiver.js
浏览文件 @
95e8c728
import
*
as
echarts
from
'
../echarts
'
;
import
*
as
zrUtil
from
'
zrender/src/core/util
'
;
import
'
../component/singleAxis
'
;
import
'
./themeRiver/ThemeRiverSeries
'
;
...
...
@@ -11,4 +10,4 @@ import dataFilter from '../processor/dataFilter';
echarts
.
registerLayout
(
themeRiverLayout
);
echarts
.
registerVisual
(
themeRiverVisual
);
echarts
.
registerProcessor
(
zrUtil
.
curry
(
dataFilter
,
'
themeRiver
'
));
\ No newline at end of file
echarts
.
registerProcessor
(
dataFilter
(
'
themeRiver
'
));
\ No newline at end of file
src/chart/treemap/treemapLayout.js
浏览文件 @
95e8c728
...
...
@@ -17,12 +17,11 @@ var PATH_UPPER_LABEL_HEIGHT = ['upperLabel', 'height'];
/**
* @public
*/
export
default
function
(
ecModel
,
api
,
payload
)
{
// Layout result in each node:
// {x, y, width, height, area, borderWidth}
var
condition
=
{
mainType
:
'
series
'
,
subType
:
'
treemap
'
,
query
:
payload
};
ecModel
.
eachComponent
(
condition
,
function
(
seriesModel
)
{
export
default
{
seriesType
:
'
treemap
'
,
reset
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
// Layout result in each node:
// {x, y, width, height, area, borderWidth}
var
ecWidth
=
api
.
getWidth
();
var
ecHeight
=
api
.
getHeight
();
var
seriesOption
=
seriesModel
.
option
;
...
...
@@ -118,8 +117,8 @@ export default function (ecModel, api, payload) {
viewRoot
,
0
);
}
);
}
}
}
;
/**
* Layout treemap with squarify algorithm.
...
...
src/chart/treemap/treemapVisual.js
浏览文件 @
95e8c728
...
...
@@ -6,11 +6,9 @@ var isArray = zrUtil.isArray;
var
ITEM_STYLE_NORMAL
=
'
itemStyle
'
;
export
default
function
(
ecModel
,
api
,
payload
)
{
var
condition
=
{
mainType
:
'
series
'
,
subType
:
'
treemap
'
,
query
:
payload
};
ecModel
.
eachComponent
(
condition
,
function
(
seriesModel
)
{
export
default
{
seriesType
:
'
treemap
'
,
reset
:
function
(
seriesModel
,
ecModel
,
api
,
payload
)
{
var
tree
=
seriesModel
.
getData
().
tree
;
var
root
=
tree
.
root
;
var
seriesItemStyleModel
=
seriesModel
.
getModel
(
ITEM_STYLE_NORMAL
);
...
...
@@ -31,8 +29,8 @@ export default function (ecModel, api, payload) {
seriesModel
.
getViewRoot
().
getAncestors
(),
seriesModel
);
}
);
}
}
}
;
function
travelTree
(
node
,
designatedVisual
,
levelItemStyles
,
seriesItemStyleModel
,
...
...
src/component/dataZoom/dataZoomProcessor.js
浏览文件 @
95e8c728
import
*
as
echarts
from
'
../../echarts
'
;
echarts
.
registerProcessor
({
getTargetSeries
:
function
(
ecModel
,
api
)
{
getTargetSeries
:
function
(
ecModel
)
{
var
seriesModels
=
[];
ecModel
.
eachComponent
(
'
dataZoom
'
,
function
(
dataZoomModel
)
{
dataZoomModel
.
eachTargetAxis
(
function
(
dimNames
,
axisIndex
,
dataZoomModel
)
{
...
...
src/echarts.js
浏览文件 @
95e8c728
...
...
@@ -768,7 +768,7 @@ var updateMethods = {
return
;
}
ecModel
.
restoreData
();
ecModel
.
restoreData
(
payload
);
scheduler
.
performSeriesTasks
(
ecModel
);
...
...
src/model/Global.js
浏览文件 @
95e8c728
...
...
@@ -572,7 +572,7 @@ var GlobalModel = Model.extend({
createSeriesIndices
(
this
,
filteredSeries
);
},
restoreData
:
function
()
{
restoreData
:
function
(
payload
)
{
var
componentsMap
=
this
.
_componentsMap
;
createSeriesIndices
(
this
,
componentsMap
.
get
(
'
series
'
));
...
...
@@ -587,7 +587,8 @@ var GlobalModel = Model.extend({
ComponentModel
.
getAllClassMainTypes
(),
function
(
componentType
,
dependencies
)
{
each
(
componentsMap
.
get
(
componentType
),
function
(
component
)
{
component
.
restoreData
();
(
componentType
!==
'
series
'
||
!
isNotTargetSeries
(
component
,
payload
))
&&
component
.
restoreData
();
});
}
);
...
...
@@ -595,6 +596,17 @@ var GlobalModel = Model.extend({
});
function
isNotTargetSeries
(
seriesModel
,
payload
)
{
if
(
payload
)
{
var
index
=
payload
.
seiresIndex
;
var
id
=
payload
.
seriesId
;
var
name
=
payload
.
seriesName
;
return
(
index
!=
null
&&
seriesModel
.
componentIndex
!==
index
)
||
(
id
!=
null
&&
seriesModel
.
id
!==
id
)
||
(
name
!=
null
&&
seriesModel
.
name
!==
name
);
}
}
/**
* @inner
*/
...
...
src/processor/dataFilter.js
浏览文件 @
95e8c728
export
default
function
(
seriesType
,
ecModel
)
{
var
legendModels
=
ecModel
.
findComponents
({
mainType
:
'
legend
'
});
if
(
!
legendModels
||
!
legendModels
.
length
)
{
return
;
}
ecModel
.
eachSeriesByType
(
seriesType
,
function
(
series
)
{
var
data
=
series
.
getData
();
data
.
filterSelf
(
function
(
idx
)
{
var
name
=
data
.
getName
(
idx
);
// If in any legend component the status is not selected.
for
(
var
i
=
0
;
i
<
legendModels
.
length
;
i
++
)
{
if
(
!
legendModels
[
i
].
isSelected
(
name
))
{
return
false
;
}
export
default
function
(
seriesType
)
{
return
{
seriesType
:
seriesType
,
reset
:
function
(
seriesModel
,
ecModel
)
{
var
legendModels
=
ecModel
.
findComponents
({
mainType
:
'
legend
'
});
if
(
!
legendModels
||
!
legendModels
.
length
)
{
return
;
}
return
true
;
},
this
);
},
this
);
var
data
=
seriesModel
.
getData
();
data
.
filterSelf
(
function
(
idx
)
{
var
name
=
data
.
getName
(
idx
);
// If in any legend component the status is not selected.
for
(
var
i
=
0
;
i
<
legendModels
.
length
;
i
++
)
{
if
(
!
legendModels
[
i
].
isSelected
(
name
))
{
return
false
;
}
}
return
true
;
},
this
);
}
};
}
\ No newline at end of file
src/stream/Scheduler.js
浏览文件 @
95e8c728
...
...
@@ -270,36 +270,40 @@ function createOverallStageTask(scheduler, stageHandler, stageHandlerRecord, ecM
{
ecModel
:
ecModel
,
api
:
api
,
overallReset
:
stageHandler
.
overallReset
}
);
// Consider 2 cases:
// 1) An overall task with seriesType detected or has `getTargetSeries`, we add
// stub in each pipelines, it will set the overall task dirty when the pipeline
// progress. Moreover, to avoid call the overall task each frame (too frequent),
// we set the pipeline block.
// 2) Otherwise, (usually it is legancy case), the overall task will only be
// executed when upstream dirty. Otherwise the progressive rendering of all
// pipelines will be disabled unexpectedly.
// Reuse orignal stubs.
var
stubs
=
overallTask
.
agentStubs
=
overallTask
.
agentStubs
||
[];
var
stubIndex
=
0
;
var
seriesType
=
stageHandler
.
seriesType
;
var
getTargetSeries
=
stageHandler
.
getTargetSeries
;
var
overallProgress
=
true
;
// An overall task with seriesType detected or has `getTargetSeries`, we add
// stub in each pipelines, it will set the overall task dirty when the pipeline
// progress. Moreover, to avoid call the overall task each frame (too frequent),
// we set the pipeline block.
if
(
seriesType
)
{
ecModel
.
eachRawSeriesByType
(
seriesType
,
createStub
);
}
else
if
(
getTargetSeries
)
{
each
(
getTargetSeries
(
ecModel
,
api
),
createStub
);
}
// Otherwise, (usually it is legancy case), the overall task will only be
// executed when upstream dirty. Otherwise the progressive rendering of all
// pipelines will be disabled unexpectedly.
else
{
overallProgress
=
false
;
each
(
ecModel
.
getSeries
(),
createStub
);
}
function
createStub
(
seriesModel
)
{
var
stub
=
stubs
[
stubIndex
]
=
stubs
[
stubIndex
]
||
createTask
(
{
plan
:
prepareData
,
reset
:
stubReset
,
onDirty
:
stubOnDirty
},
{
model
:
seriesModel
}
{
model
:
seriesModel
,
overallProgress
:
overallProgress
}
);
stubIndex
++
;
stub
.
agent
=
overallTask
;
stub
.
__block
=
true
;
stub
.
__block
=
overallProgress
;
pipe
(
scheduler
,
seriesModel
,
stub
);
}
...
...
@@ -315,7 +319,7 @@ function overallTaskReset(context) {
function
stubReset
(
context
,
upstreamContext
)
{
pullData
(
context
,
upstreamContext
);
return
stubProgress
;
return
context
.
overallProgress
&&
stubProgress
;
}
function
stubProgress
()
{
...
...
@@ -324,7 +328,7 @@ function stubProgress() {
}
function
stubOnDirty
()
{
this
.
agent
&&
(
this
.
agent
.
_dirty
=
true
);
this
.
agent
&&
this
.
agent
.
dirty
(
);
}
function
seriesTaskPlan
(
context
,
upstreamContext
)
{
...
...
@@ -447,8 +451,10 @@ mockMethods(apiMock, ExtensionAPI);
ecModelMock
.
eachSeriesByType
=
ecModelMock
.
eachRawSeriesByType
=
function
(
type
)
{
seriesType
=
type
;
};
ecModelMock
.
filterSeries
=
function
()
{
seriesType
=
'
ALL_SERIES
'
;
ecModelMock
.
eachComponent
=
function
(
cond
)
{
if
(
cond
.
mainType
===
'
series
'
&&
cond
.
subType
)
{
seriesType
=
cond
.
subType
;
}
};
function
mockMethods
(
target
,
Clz
)
{
...
...
src/visual/dataColor.js
浏览文件 @
95e8c728
...
...
@@ -2,18 +2,28 @@
// Applicable for charts that require applying color palette
// in data level (like pie, funnel, chord).
export
default
function
(
seriesType
,
ecModel
)
{
// Pie and funnel may use diferrent scope
var
paletteScope
=
{};
ecModel
.
eachRawSeriesByType
(
seriesType
,
function
(
seriesModel
)
{
var
dataAll
=
seriesModel
.
getRawData
();
var
idxMap
=
{};
if
(
!
ecModel
.
isSeriesFiltered
(
seriesModel
))
{
export
default
function
(
seriesType
)
{
return
{
getTargetSeries
:
function
(
ecModel
)
{
// Pie and funnel may use diferrent scope
var
paletteScope
=
{};
var
seiresModels
=
[];
ecModel
.
eachSeriesByType
(
seriesType
,
function
(
seriesModel
)
{
seriesModel
.
__paletteScope
=
paletteScope
;
seriesModel
.
push
(
seriesModel
);
});
return
seiresModels
;
},
overallReset
:
function
(
seriesModel
,
ecModel
)
{
var
dataAll
=
seriesModel
.
getRawData
();
var
idxMap
=
{};
var
data
=
seriesModel
.
getData
();
data
.
each
(
function
(
idx
)
{
var
rawIdx
=
data
.
getRawIndex
(
idx
);
idxMap
[
rawIdx
]
=
idx
;
});
dataAll
.
each
(
function
(
rawIdx
)
{
var
filteredIdx
=
idxMap
[
rawIdx
];
...
...
@@ -25,7 +35,9 @@ export default function (seriesType, ecModel) {
// FIXME Performance
var
itemModel
=
dataAll
.
getItemModel
(
rawIdx
);
var
color
=
itemModel
.
get
(
'
itemStyle.color
'
)
||
seriesModel
.
getColorFromPalette
(
dataAll
.
getName
(
rawIdx
),
paletteScope
);
||
seriesModel
.
getColorFromPalette
(
dataAll
.
getName
(
rawIdx
),
seriesModel
.
__paletteScope
);
// Legend may use the visual info in data before processed
dataAll
.
setItemVisual
(
rawIdx
,
'
color
'
,
color
);
...
...
@@ -40,5 +52,5 @@ export default function (seriesType, ecModel) {
}
});
}
}
)
;
};
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录