From 1dfbd904e8bc310e22c4f60904f6732adb3e755a Mon Sep 17 00:00:00 2001 From: lang Date: Tue, 29 Dec 2015 16:51:28 +0800 Subject: [PATCH] timeline preprocessor --- src/component/timeline/SliderTimelineView.js | 1 - src/component/timeline/preprocessor.js | 4 +--- src/model/OptionManager.js | 15 ++++++++++----- src/model/globalDefault.js | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/component/timeline/SliderTimelineView.js b/src/component/timeline/SliderTimelineView.js index 4f2004201..c76095191 100644 --- a/src/component/timeline/SliderTimelineView.js +++ b/src/component/timeline/SliderTimelineView.js @@ -120,7 +120,6 @@ define(function (require) { var labelPosOpt = timelineModel.get('label.normal.position'); var orient = timelineModel.get('orient'); var viewRect = getViewRect(timelineModel, api); - // Auto label offset. if (labelPosOpt == null || labelPosOpt === 'auto') { labelPosOpt = orient === 'horizontal' diff --git a/src/component/timeline/preprocessor.js b/src/component/timeline/preprocessor.js index dd50109e9..62521ca4e 100644 --- a/src/component/timeline/preprocessor.js +++ b/src/component/timeline/preprocessor.js @@ -46,9 +46,7 @@ define(function(require) { delete opt.controlPosition; } - var data = opt.data || (opt.data = []); - - zrUtil.each(data, function (dataItem) { + zrUtil.each(opt.data || [], function (dataItem) { if (zrUtil.isObject(dataItem) && !zrUtil.isArray(dataItem)) { if (!has(dataItem, 'value') && has(dataItem, 'name')) { // In ec2, using name as value. diff --git a/src/model/OptionManager.js b/src/model/OptionManager.js index 13b434b3c..cfcc49106 100644 --- a/src/model/OptionManager.js +++ b/src/model/OptionManager.js @@ -261,11 +261,16 @@ define(function (require) { } // Preprocess. - each([baseOption].concat(timelineOptions), function (option) { - each(optionPreprocessorFuncs, function (preProcess) { - preProcess(option); - }); - }); + each([baseOption].concat(timelineOptions) + .concat(zrUtil.map(mediaList, function (media) { + return media.option; + })), + function (option) { + each(optionPreprocessorFuncs, function (preProcess) { + preProcess(option); + }); + } + ); return { baseOption: baseOption, diff --git a/src/model/globalDefault.js b/src/model/globalDefault.js index 60c7c84b9..31e2eea09 100644 --- a/src/model/globalDefault.js +++ b/src/model/globalDefault.js @@ -6,7 +6,7 @@ define(function () { } return { // 全图默认背景 - backgroundColor: 'rgba(0,0,0,0)', + // backgroundColor: 'rgba(0,0,0,0)', // https://dribbble.com/shots/1065960-Infographic-Pie-chart-visualization // color: ['#5793f3', '#d14a61', '#fd9c35', '#675bba', '#fec42c', '#dd4444', '#d4df5a', '#cd4870'], -- GitLab