提交 b23ce3c1 编写于 作者: O Ovilia

Merge branch 'master' of github.com:ecomfe/echarts

...@@ -9013,6 +9013,11 @@ Painter.prototype = { ...@@ -9013,6 +9013,11 @@ Painter.prototype = {
finished = false; finished = false;
} }
if (scope.prevElClipPaths) {
// Needs restore the state. If last drawn element is in the clipping area.
ctx.restore();
}
ctx.restore(); ctx.restore();
} }
...@@ -9048,13 +9053,13 @@ Painter.prototype = { ...@@ -9048,13 +9053,13 @@ Painter.prototype = {
var clipPaths = el.__clipPaths; var clipPaths = el.__clipPaths;
// Optimize when clipping on group with several elements // Optimize when clipping on group with several elements
if (scope.prevClipLayer !== currentLayer if (!scope.prevElClipPaths
|| isClipPathChanged(clipPaths, scope.prevElClipPaths) || isClipPathChanged(clipPaths, scope.prevElClipPaths)
) { ) {
// If has previous clipping state, restore from it // If has previous clipping state, restore from it
if (scope.prevElClipPaths) { if (scope.prevElClipPaths) {
scope.prevClipLayer.ctx.restore(); currentLayer.ctx.restore();
scope.prevClipLayer = scope.prevElClipPaths = null; scope.prevElClipPaths = null;
// Reset prevEl since context has been restored // Reset prevEl since context has been restored
scope.prevEl = null; scope.prevEl = null;
...@@ -9063,7 +9068,6 @@ Painter.prototype = { ...@@ -9063,7 +9068,6 @@ Painter.prototype = {
if (clipPaths) { if (clipPaths) {
ctx.save(); ctx.save();
doClip(clipPaths, ctx); doClip(clipPaths, ctx);
scope.prevClipLayer = currentLayer;
scope.prevElClipPaths = clipPaths; scope.prevElClipPaths = clipPaths;
} }
} }
...@@ -10479,7 +10483,7 @@ var instances$1 = {}; // ZRender实例map索引 ...@@ -10479,7 +10483,7 @@ var instances$1 = {}; // ZRender实例map索引
/** /**
* @type {string} * @type {string}
*/ */
var version$1 = '4.0.0'; var version$1 = '4.0.1';
/** /**
* Initializing a zrender instance * Initializing a zrender instance
...@@ -14539,7 +14543,6 @@ function createPathOptions(str, opts) { ...@@ -14539,7 +14543,6 @@ function createPathOptions(str, opts) {
opts.applyTransform = function (m) { opts.applyTransform = function (m) {
transformPath(pathProxy, m); transformPath(pathProxy, m);
this.dirty(true); this.dirty(true);
}; };
...@@ -20737,13 +20740,20 @@ function compatEC2ItemStyle(opt) { ...@@ -20737,13 +20740,20 @@ function compatEC2ItemStyle(opt) {
} }
} }
function convertNormalEmphasis(opt, optType) { function convertNormalEmphasis(opt, optType, useExtend) {
if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) { if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {
var normalOpt = opt[optType].normal; var normalOpt = opt[optType].normal;
var emphasisOpt = opt[optType].emphasis; var emphasisOpt = opt[optType].emphasis;
if (normalOpt) { if (normalOpt) {
opt[optType] = normalOpt; // Timeline controlStyle has other properties besides normal and emphasis
if (useExtend) {
opt[optType].normal = opt[optType].emphasis = null;
defaults(opt[optType], normalOpt);
}
else {
opt[optType] = normalOpt;
}
} }
if (emphasisOpt) { if (emphasisOpt) {
opt.emphasis = opt.emphasis || {}; opt.emphasis = opt.emphasis || {};
...@@ -20942,7 +20952,7 @@ var compatStyle = function (option, isTheme) { ...@@ -20942,7 +20952,7 @@ var compatStyle = function (option, isTheme) {
compatEC3CommonStyles(timelineOpt); compatEC3CommonStyles(timelineOpt);
convertNormalEmphasis(timelineOpt, 'label'); convertNormalEmphasis(timelineOpt, 'label');
convertNormalEmphasis(timelineOpt, 'itemStyle'); convertNormalEmphasis(timelineOpt, 'itemStyle');
convertNormalEmphasis(timelineOpt, 'controlStyle'); convertNormalEmphasis(timelineOpt, 'controlStyle', true);
convertNormalEmphasis(timelineOpt, 'checkpointStyle'); convertNormalEmphasis(timelineOpt, 'checkpointStyle');
var data = timelineOpt.data; var data = timelineOpt.data;
...@@ -21374,6 +21384,40 @@ function retrieveRawValue(data, dataIndex, dim) { ...@@ -21374,6 +21384,40 @@ function retrieveRawValue(data, dataIndex, dim) {
return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName); return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName);
} }
/**
* Compatible with some cases (in pie, map) like:
* data: [{name: 'xx', value: 5, selected: true}, ...]
* where only sourceFormat is 'original' and 'objectRows' supported.
*
* ??? TODO
* Supported detail options in data item when using 'arrayRows'.
*
* @param {module:echarts/data/List} data
* @param {number} dataIndex
* @param {string} attr like 'selected'
*/
function retrieveRawAttr(data, dataIndex, attr) {
if (!data) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
if (sourceFormat !== SOURCE_FORMAT_ORIGINAL
&& sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS
) {
return;
}
var dataItem = data.getRawDataItem(dataIndex);
if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject$1(dataItem)) {
dataItem = null;
}
if (dataItem) {
return dataItem[attr];
}
}
var DIMENSION_LABEL_REG = /\{@(.+?)\}/g; var DIMENSION_LABEL_REG = /\{@(.+?)\}/g;
// PENDING A little ugly // PENDING A little ugly
...@@ -23550,10 +23594,10 @@ var isFunction = isFunction$1; ...@@ -23550,10 +23594,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1; var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType; var parseClassType = ComponentModel.parseClassType;
var version = '4.0.0'; var version = '4.0.2';
var dependencies = { var dependencies = {
zrender: '4.0.0' zrender: '4.0.1'
}; };
var TEST_FRAME_REMAIN_TIME = 1; var TEST_FRAME_REMAIN_TIME = 1;
...@@ -35932,7 +35976,11 @@ var dataSelectableMixin = { ...@@ -35932,7 +35976,11 @@ var dataSelectableMixin = {
var valueDim = ecList.mapDimension('value'); var valueDim = ecList.mapDimension('value');
var targetList = this._targetList = []; var targetList = this._targetList = [];
for (var i = 0, len = ecList.count(); i < len; i++) { for (var i = 0, len = ecList.count(); i < len; i++) {
targetList.push({name: ecList.getName(i), value: ecList.get(valueDim, i)}); targetList.push({
name: ecList.getName(i),
value: ecList.get(valueDim, i),
selected: retrieveRawAttr(ecList, i, 'selected')
});
} }
} }
this._selectTargetMap = reduce(targetList || [], function (targetMap, target) { this._selectTargetMap = reduce(targetList || [], function (targetMap, target) {
此差异已折叠。
...@@ -9013,6 +9013,11 @@ Painter.prototype = { ...@@ -9013,6 +9013,11 @@ Painter.prototype = {
finished = false; finished = false;
} }
if (scope.prevElClipPaths) {
// Needs restore the state. If last drawn element is in the clipping area.
ctx.restore();
}
ctx.restore(); ctx.restore();
} }
...@@ -9048,13 +9053,13 @@ Painter.prototype = { ...@@ -9048,13 +9053,13 @@ Painter.prototype = {
var clipPaths = el.__clipPaths; var clipPaths = el.__clipPaths;
// Optimize when clipping on group with several elements // Optimize when clipping on group with several elements
if (scope.prevClipLayer !== currentLayer if (!scope.prevElClipPaths
|| isClipPathChanged(clipPaths, scope.prevElClipPaths) || isClipPathChanged(clipPaths, scope.prevElClipPaths)
) { ) {
// If has previous clipping state, restore from it // If has previous clipping state, restore from it
if (scope.prevElClipPaths) { if (scope.prevElClipPaths) {
scope.prevClipLayer.ctx.restore(); currentLayer.ctx.restore();
scope.prevClipLayer = scope.prevElClipPaths = null; scope.prevElClipPaths = null;
// Reset prevEl since context has been restored // Reset prevEl since context has been restored
scope.prevEl = null; scope.prevEl = null;
...@@ -9063,7 +9068,6 @@ Painter.prototype = { ...@@ -9063,7 +9068,6 @@ Painter.prototype = {
if (clipPaths) { if (clipPaths) {
ctx.save(); ctx.save();
doClip(clipPaths, ctx); doClip(clipPaths, ctx);
scope.prevClipLayer = currentLayer;
scope.prevElClipPaths = clipPaths; scope.prevElClipPaths = clipPaths;
} }
} }
...@@ -10479,7 +10483,7 @@ var instances$1 = {}; // ZRender实例map索引 ...@@ -10479,7 +10483,7 @@ var instances$1 = {}; // ZRender实例map索引
/** /**
* @type {string} * @type {string}
*/ */
var version$1 = '4.0.0'; var version$1 = '4.0.1';
/** /**
* Initializing a zrender instance * Initializing a zrender instance
...@@ -14582,7 +14586,6 @@ function createPathOptions(str, opts) { ...@@ -14582,7 +14586,6 @@ function createPathOptions(str, opts) {
opts.applyTransform = function (m) { opts.applyTransform = function (m) {
transformPath(pathProxy, m); transformPath(pathProxy, m);
this.dirty(true); this.dirty(true);
}; };
...@@ -20803,13 +20806,20 @@ function compatEC2ItemStyle(opt) { ...@@ -20803,13 +20806,20 @@ function compatEC2ItemStyle(opt) {
} }
} }
function convertNormalEmphasis(opt, optType) { function convertNormalEmphasis(opt, optType, useExtend) {
if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) { if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {
var normalOpt = opt[optType].normal; var normalOpt = opt[optType].normal;
var emphasisOpt = opt[optType].emphasis; var emphasisOpt = opt[optType].emphasis;
if (normalOpt) { if (normalOpt) {
opt[optType] = normalOpt; // Timeline controlStyle has other properties besides normal and emphasis
if (useExtend) {
opt[optType].normal = opt[optType].emphasis = null;
defaults(opt[optType], normalOpt);
}
else {
opt[optType] = normalOpt;
}
} }
if (emphasisOpt) { if (emphasisOpt) {
opt.emphasis = opt.emphasis || {}; opt.emphasis = opt.emphasis || {};
...@@ -21008,7 +21018,7 @@ var compatStyle = function (option, isTheme) { ...@@ -21008,7 +21018,7 @@ var compatStyle = function (option, isTheme) {
compatEC3CommonStyles(timelineOpt); compatEC3CommonStyles(timelineOpt);
convertNormalEmphasis(timelineOpt, 'label'); convertNormalEmphasis(timelineOpt, 'label');
convertNormalEmphasis(timelineOpt, 'itemStyle'); convertNormalEmphasis(timelineOpt, 'itemStyle');
convertNormalEmphasis(timelineOpt, 'controlStyle'); convertNormalEmphasis(timelineOpt, 'controlStyle', true);
convertNormalEmphasis(timelineOpt, 'checkpointStyle'); convertNormalEmphasis(timelineOpt, 'checkpointStyle');
var data = timelineOpt.data; var data = timelineOpt.data;
...@@ -21440,6 +21450,40 @@ function retrieveRawValue(data, dataIndex, dim) { ...@@ -21440,6 +21450,40 @@ function retrieveRawValue(data, dataIndex, dim) {
return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName); return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName);
} }
/**
* Compatible with some cases (in pie, map) like:
* data: [{name: 'xx', value: 5, selected: true}, ...]
* where only sourceFormat is 'original' and 'objectRows' supported.
*
* ??? TODO
* Supported detail options in data item when using 'arrayRows'.
*
* @param {module:echarts/data/List} data
* @param {number} dataIndex
* @param {string} attr like 'selected'
*/
function retrieveRawAttr(data, dataIndex, attr) {
if (!data) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
if (sourceFormat !== SOURCE_FORMAT_ORIGINAL
&& sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS
) {
return;
}
var dataItem = data.getRawDataItem(dataIndex);
if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject$1(dataItem)) {
dataItem = null;
}
if (dataItem) {
return dataItem[attr];
}
}
var DIMENSION_LABEL_REG = /\{@(.+?)\}/g; var DIMENSION_LABEL_REG = /\{@(.+?)\}/g;
// PENDING A little ugly // PENDING A little ugly
...@@ -23616,10 +23660,10 @@ var isFunction = isFunction$1; ...@@ -23616,10 +23660,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1; var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType; var parseClassType = ComponentModel.parseClassType;
var version = '4.0.0'; var version = '4.0.2';
var dependencies = { var dependencies = {
zrender: '4.0.0' zrender: '4.0.1'
}; };
var TEST_FRAME_REMAIN_TIME = 1; var TEST_FRAME_REMAIN_TIME = 1;
...@@ -36025,7 +36069,11 @@ var selectableMixin = { ...@@ -36025,7 +36069,11 @@ var selectableMixin = {
var valueDim = ecList.mapDimension('value'); var valueDim = ecList.mapDimension('value');
var targetList = this._targetList = []; var targetList = this._targetList = [];
for (var i = 0, len = ecList.count(); i < len; i++) { for (var i = 0, len = ecList.count(); i < len; i++) {
targetList.push({name: ecList.getName(i), value: ecList.get(valueDim, i)}); targetList.push({
name: ecList.getName(i),
value: ecList.get(valueDim, i),
selected: retrieveRawAttr(ecList, i, 'selected')
});
} }
} }
this._selectTargetMap = reduce(targetList || [], function (targetMap, target) { this._selectTargetMap = reduce(targetList || [], function (targetMap, target) {
...@@ -59235,16 +59283,16 @@ SunburstPieceProto.updateData = function ( ...@@ -59235,16 +59283,16 @@ SunburstPieceProto.updateData = function (
var sectorShape = extend({}, layout); var sectorShape = extend({}, layout);
sectorShape.label = null; sectorShape.label = null;
var itemStyleModel = itemModel.getModel('itemStyle');
var visualColor = getNodeColor(node, seriesModel, ecModel); var visualColor = getNodeColor(node, seriesModel, ecModel);
var normalStyle = itemStyleModel.getItemStyle(); var normalStyle = itemModel.getModel('itemStyle').getItemStyle();
var style; var style;
if (state === 'normal') { if (state === 'normal') {
style = normalStyle; style = normalStyle;
} }
else { else {
var stateStyle = itemStyleModel.getModel(state).getItemStyle(); var stateStyle = itemModel.getModel(state + '.itemStyle')
.getItemStyle();
style = merge(stateStyle, normalStyle); style = merge(stateStyle, normalStyle);
} }
style = defaults( style = defaults(
...@@ -59278,7 +59326,8 @@ SunburstPieceProto.updateData = function ( ...@@ -59278,7 +59326,8 @@ SunburstPieceProto.updateData = function (
} }
if (state === 'normal') { if (state === 'normal') {
sector.hoverStyle = itemStyleModel.getModel('emphasis').getItemStyle(); sector.hoverStyle = itemModel.getModel('emphasis.itemStyle')
.getItemStyle();
setHoverStyle(this); setHoverStyle(this);
} }
...@@ -75237,7 +75286,7 @@ TimelineView.extend({ ...@@ -75237,7 +75286,7 @@ TimelineView.extend({
var mainLength = orient === 'vertical' ? viewRect.height : viewRect.width; var mainLength = orient === 'vertical' ? viewRect.height : viewRect.width;
var controlModel = timelineModel.getModel('controlStyle'); var controlModel = timelineModel.getModel('controlStyle');
var showControl = controlModel.get('show'); var showControl = controlModel.get('show', true);
var controlSize = showControl ? controlModel.get('itemSize') : 0; var controlSize = showControl ? controlModel.get('itemSize') : 0;
var controlGap = showControl ? controlModel.get('itemGap') : 0; var controlGap = showControl ? controlModel.get('itemGap') : 0;
var sizePlusGap = controlSize + controlGap; var sizePlusGap = controlSize + controlGap;
...@@ -75251,7 +75300,6 @@ TimelineView.extend({ ...@@ -75251,7 +75300,6 @@ TimelineView.extend({
var nextBtnPosition; var nextBtnPosition;
var axisExtent; var axisExtent;
var controlPosition = controlModel.get('position', true); var controlPosition = controlModel.get('position', true);
var showControl = controlModel.get('show', true);
var showPlayBtn = showControl && controlModel.get('showPlayBtn', true); var showPlayBtn = showControl && controlModel.get('showPlayBtn', true);
var showPrevBtn = showControl && controlModel.get('showPrevBtn', true); var showPrevBtn = showControl && controlModel.get('showPrevBtn', true);
var showNextBtn = showControl && controlModel.get('showNextBtn', true); var showNextBtn = showControl && controlModel.get('showNextBtn', true);
此差异已折叠。
此差异已折叠。
...@@ -8716,6 +8716,11 @@ Painter.prototype = { ...@@ -8716,6 +8716,11 @@ Painter.prototype = {
finished = false; finished = false;
} }
if (scope.prevElClipPaths) {
// Needs restore the state. If last drawn element is in the clipping area.
ctx.restore();
}
ctx.restore(); ctx.restore();
} }
...@@ -8751,13 +8756,13 @@ Painter.prototype = { ...@@ -8751,13 +8756,13 @@ Painter.prototype = {
var clipPaths = el.__clipPaths; var clipPaths = el.__clipPaths;
// Optimize when clipping on group with several elements // Optimize when clipping on group with several elements
if (scope.prevClipLayer !== currentLayer if (!scope.prevElClipPaths
|| isClipPathChanged(clipPaths, scope.prevElClipPaths) || isClipPathChanged(clipPaths, scope.prevElClipPaths)
) { ) {
// If has previous clipping state, restore from it // If has previous clipping state, restore from it
if (scope.prevElClipPaths) { if (scope.prevElClipPaths) {
scope.prevClipLayer.ctx.restore(); currentLayer.ctx.restore();
scope.prevClipLayer = scope.prevElClipPaths = null; scope.prevElClipPaths = null;
// Reset prevEl since context has been restored // Reset prevEl since context has been restored
scope.prevEl = null; scope.prevEl = null;
...@@ -8766,7 +8771,6 @@ Painter.prototype = { ...@@ -8766,7 +8771,6 @@ Painter.prototype = {
if (clipPaths) { if (clipPaths) {
ctx.save(); ctx.save();
doClip(clipPaths, ctx); doClip(clipPaths, ctx);
scope.prevClipLayer = currentLayer;
scope.prevElClipPaths = clipPaths; scope.prevElClipPaths = clipPaths;
} }
} }
...@@ -10165,7 +10169,7 @@ var painterCtors = { ...@@ -10165,7 +10169,7 @@ var painterCtors = {
/** /**
* @type {string} * @type {string}
*/ */
var version$1 = '4.0.0'; var version$1 = '4.0.1';
/** /**
* Initializing a zrender instance * Initializing a zrender instance
...@@ -14169,7 +14173,6 @@ function createPathOptions(str, opts) { ...@@ -14169,7 +14173,6 @@ function createPathOptions(str, opts) {
opts.applyTransform = function (m) { opts.applyTransform = function (m) {
transformPath(pathProxy, m); transformPath(pathProxy, m);
this.dirty(true); this.dirty(true);
}; };
...@@ -20202,13 +20205,20 @@ function compatEC2ItemStyle(opt) { ...@@ -20202,13 +20205,20 @@ function compatEC2ItemStyle(opt) {
} }
} }
function convertNormalEmphasis(opt, optType) { function convertNormalEmphasis(opt, optType, useExtend) {
if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) { if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {
var normalOpt = opt[optType].normal; var normalOpt = opt[optType].normal;
var emphasisOpt = opt[optType].emphasis; var emphasisOpt = opt[optType].emphasis;
if (normalOpt) { if (normalOpt) {
opt[optType] = normalOpt; // Timeline controlStyle has other properties besides normal and emphasis
if (useExtend) {
opt[optType].normal = opt[optType].emphasis = null;
defaults(opt[optType], normalOpt);
}
else {
opt[optType] = normalOpt;
}
} }
if (emphasisOpt) { if (emphasisOpt) {
opt.emphasis = opt.emphasis || {}; opt.emphasis = opt.emphasis || {};
...@@ -20407,7 +20417,7 @@ var compatStyle = function (option, isTheme) { ...@@ -20407,7 +20417,7 @@ var compatStyle = function (option, isTheme) {
compatEC3CommonStyles(timelineOpt); compatEC3CommonStyles(timelineOpt);
convertNormalEmphasis(timelineOpt, 'label'); convertNormalEmphasis(timelineOpt, 'label');
convertNormalEmphasis(timelineOpt, 'itemStyle'); convertNormalEmphasis(timelineOpt, 'itemStyle');
convertNormalEmphasis(timelineOpt, 'controlStyle'); convertNormalEmphasis(timelineOpt, 'controlStyle', true);
convertNormalEmphasis(timelineOpt, 'checkpointStyle'); convertNormalEmphasis(timelineOpt, 'checkpointStyle');
var data = timelineOpt.data; var data = timelineOpt.data;
...@@ -20839,6 +20849,40 @@ function retrieveRawValue(data, dataIndex, dim) { ...@@ -20839,6 +20849,40 @@ function retrieveRawValue(data, dataIndex, dim) {
return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName); return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName);
} }
/**
* Compatible with some cases (in pie, map) like:
* data: [{name: 'xx', value: 5, selected: true}, ...]
* where only sourceFormat is 'original' and 'objectRows' supported.
*
* ??? TODO
* Supported detail options in data item when using 'arrayRows'.
*
* @param {module:echarts/data/List} data
* @param {number} dataIndex
* @param {string} attr like 'selected'
*/
function retrieveRawAttr(data, dataIndex, attr) {
if (!data) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
if (sourceFormat !== SOURCE_FORMAT_ORIGINAL
&& sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS
) {
return;
}
var dataItem = data.getRawDataItem(dataIndex);
if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject$1(dataItem)) {
dataItem = null;
}
if (dataItem) {
return dataItem[attr];
}
}
var DIMENSION_LABEL_REG = /\{@(.+?)\}/g; var DIMENSION_LABEL_REG = /\{@(.+?)\}/g;
// PENDING A little ugly // PENDING A little ugly
...@@ -22980,10 +23024,10 @@ var isFunction = isFunction$1; ...@@ -22980,10 +23024,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1; var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType; var parseClassType = ComponentModel.parseClassType;
var version = '4.0.0'; var version = '4.0.2';
var dependencies = { var dependencies = {
zrender: '4.0.0' zrender: '4.0.1'
}; };
var TEST_FRAME_REMAIN_TIME = 1; var TEST_FRAME_REMAIN_TIME = 1;
...@@ -34739,7 +34783,11 @@ var dataSelectableMixin = { ...@@ -34739,7 +34783,11 @@ var dataSelectableMixin = {
var valueDim = ecList.mapDimension('value'); var valueDim = ecList.mapDimension('value');
var targetList = this._targetList = []; var targetList = this._targetList = [];
for (var i = 0, len = ecList.count(); i < len; i++) { for (var i = 0, len = ecList.count(); i < len; i++) {
targetList.push({name: ecList.getName(i), value: ecList.get(valueDim, i)}); targetList.push({
name: ecList.getName(i),
value: ecList.get(valueDim, i),
selected: retrieveRawAttr(ecList, i, 'selected')
});
} }
} }
this._selectTargetMap = reduce(targetList || [], function (targetMap, target) { this._selectTargetMap = reduce(targetList || [], function (targetMap, target) {
......
此差异已折叠。
...@@ -9013,6 +9013,11 @@ Painter.prototype = { ...@@ -9013,6 +9013,11 @@ Painter.prototype = {
finished = false; finished = false;
} }
if (scope.prevElClipPaths) {
// Needs restore the state. If last drawn element is in the clipping area.
ctx.restore();
}
ctx.restore(); ctx.restore();
} }
...@@ -9048,13 +9053,13 @@ Painter.prototype = { ...@@ -9048,13 +9053,13 @@ Painter.prototype = {
var clipPaths = el.__clipPaths; var clipPaths = el.__clipPaths;
// Optimize when clipping on group with several elements // Optimize when clipping on group with several elements
if (scope.prevClipLayer !== currentLayer if (!scope.prevElClipPaths
|| isClipPathChanged(clipPaths, scope.prevElClipPaths) || isClipPathChanged(clipPaths, scope.prevElClipPaths)
) { ) {
// If has previous clipping state, restore from it // If has previous clipping state, restore from it
if (scope.prevElClipPaths) { if (scope.prevElClipPaths) {
scope.prevClipLayer.ctx.restore(); currentLayer.ctx.restore();
scope.prevClipLayer = scope.prevElClipPaths = null; scope.prevElClipPaths = null;
// Reset prevEl since context has been restored // Reset prevEl since context has been restored
scope.prevEl = null; scope.prevEl = null;
...@@ -9063,7 +9068,6 @@ Painter.prototype = { ...@@ -9063,7 +9068,6 @@ Painter.prototype = {
if (clipPaths) { if (clipPaths) {
ctx.save(); ctx.save();
doClip(clipPaths, ctx); doClip(clipPaths, ctx);
scope.prevClipLayer = currentLayer;
scope.prevElClipPaths = clipPaths; scope.prevElClipPaths = clipPaths;
} }
} }
...@@ -10479,7 +10483,7 @@ var instances$1 = {}; // ZRender实例map索引 ...@@ -10479,7 +10483,7 @@ var instances$1 = {}; // ZRender实例map索引
/** /**
* @type {string} * @type {string}
*/ */
var version$1 = '4.0.0'; var version$1 = '4.0.1';
/** /**
* Initializing a zrender instance * Initializing a zrender instance
...@@ -14539,7 +14543,6 @@ function createPathOptions(str, opts) { ...@@ -14539,7 +14543,6 @@ function createPathOptions(str, opts) {
opts.applyTransform = function (m) { opts.applyTransform = function (m) {
transformPath(pathProxy, m); transformPath(pathProxy, m);
this.dirty(true); this.dirty(true);
}; };
...@@ -20737,13 +20740,20 @@ function compatEC2ItemStyle(opt) { ...@@ -20737,13 +20740,20 @@ function compatEC2ItemStyle(opt) {
} }
} }
function convertNormalEmphasis(opt, optType) { function convertNormalEmphasis(opt, optType, useExtend) {
if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) { if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {
var normalOpt = opt[optType].normal; var normalOpt = opt[optType].normal;
var emphasisOpt = opt[optType].emphasis; var emphasisOpt = opt[optType].emphasis;
if (normalOpt) { if (normalOpt) {
opt[optType] = normalOpt; // Timeline controlStyle has other properties besides normal and emphasis
if (useExtend) {
opt[optType].normal = opt[optType].emphasis = null;
defaults(opt[optType], normalOpt);
}
else {
opt[optType] = normalOpt;
}
} }
if (emphasisOpt) { if (emphasisOpt) {
opt.emphasis = opt.emphasis || {}; opt.emphasis = opt.emphasis || {};
...@@ -20942,7 +20952,7 @@ var compatStyle = function (option, isTheme) { ...@@ -20942,7 +20952,7 @@ var compatStyle = function (option, isTheme) {
compatEC3CommonStyles(timelineOpt); compatEC3CommonStyles(timelineOpt);
convertNormalEmphasis(timelineOpt, 'label'); convertNormalEmphasis(timelineOpt, 'label');
convertNormalEmphasis(timelineOpt, 'itemStyle'); convertNormalEmphasis(timelineOpt, 'itemStyle');
convertNormalEmphasis(timelineOpt, 'controlStyle'); convertNormalEmphasis(timelineOpt, 'controlStyle', true);
convertNormalEmphasis(timelineOpt, 'checkpointStyle'); convertNormalEmphasis(timelineOpt, 'checkpointStyle');
var data = timelineOpt.data; var data = timelineOpt.data;
...@@ -21374,6 +21384,40 @@ function retrieveRawValue(data, dataIndex, dim) { ...@@ -21374,6 +21384,40 @@ function retrieveRawValue(data, dataIndex, dim) {
return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName); return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName);
} }
/**
* Compatible with some cases (in pie, map) like:
* data: [{name: 'xx', value: 5, selected: true}, ...]
* where only sourceFormat is 'original' and 'objectRows' supported.
*
* ??? TODO
* Supported detail options in data item when using 'arrayRows'.
*
* @param {module:echarts/data/List} data
* @param {number} dataIndex
* @param {string} attr like 'selected'
*/
function retrieveRawAttr(data, dataIndex, attr) {
if (!data) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
if (sourceFormat !== SOURCE_FORMAT_ORIGINAL
&& sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS
) {
return;
}
var dataItem = data.getRawDataItem(dataIndex);
if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject$1(dataItem)) {
dataItem = null;
}
if (dataItem) {
return dataItem[attr];
}
}
var DIMENSION_LABEL_REG = /\{@(.+?)\}/g; var DIMENSION_LABEL_REG = /\{@(.+?)\}/g;
// PENDING A little ugly // PENDING A little ugly
...@@ -23608,10 +23652,10 @@ var isFunction = isFunction$1; ...@@ -23608,10 +23652,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1; var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType; var parseClassType = ComponentModel.parseClassType;
var version = '4.0.0'; var version = '4.0.2';
var dependencies = { var dependencies = {
zrender: '4.0.0' zrender: '4.0.1'
}; };
var TEST_FRAME_REMAIN_TIME = 1; var TEST_FRAME_REMAIN_TIME = 1;
...@@ -35990,7 +36034,11 @@ var dataSelectableMixin = { ...@@ -35990,7 +36034,11 @@ var dataSelectableMixin = {
var valueDim = ecList.mapDimension('value'); var valueDim = ecList.mapDimension('value');
var targetList = this._targetList = []; var targetList = this._targetList = [];
for (var i = 0, len = ecList.count(); i < len; i++) { for (var i = 0, len = ecList.count(); i < len; i++) {
targetList.push({name: ecList.getName(i), value: ecList.get(valueDim, i)}); targetList.push({
name: ecList.getName(i),
value: ecList.get(valueDim, i),
selected: retrieveRawAttr(ecList, i, 'selected')
});
} }
} }
this._selectTargetMap = reduce(targetList || [], function (targetMap, target) { this._selectTargetMap = reduce(targetList || [], function (targetMap, target) {
此差异已折叠。
...@@ -9013,6 +9013,11 @@ Painter.prototype = { ...@@ -9013,6 +9013,11 @@ Painter.prototype = {
finished = false; finished = false;
} }
if (scope.prevElClipPaths) {
// Needs restore the state. If last drawn element is in the clipping area.
ctx.restore();
}
ctx.restore(); ctx.restore();
} }
...@@ -9048,13 +9053,13 @@ Painter.prototype = { ...@@ -9048,13 +9053,13 @@ Painter.prototype = {
var clipPaths = el.__clipPaths; var clipPaths = el.__clipPaths;
// Optimize when clipping on group with several elements // Optimize when clipping on group with several elements
if (scope.prevClipLayer !== currentLayer if (!scope.prevElClipPaths
|| isClipPathChanged(clipPaths, scope.prevElClipPaths) || isClipPathChanged(clipPaths, scope.prevElClipPaths)
) { ) {
// If has previous clipping state, restore from it // If has previous clipping state, restore from it
if (scope.prevElClipPaths) { if (scope.prevElClipPaths) {
scope.prevClipLayer.ctx.restore(); currentLayer.ctx.restore();
scope.prevClipLayer = scope.prevElClipPaths = null; scope.prevElClipPaths = null;
// Reset prevEl since context has been restored // Reset prevEl since context has been restored
scope.prevEl = null; scope.prevEl = null;
...@@ -9063,7 +9068,6 @@ Painter.prototype = { ...@@ -9063,7 +9068,6 @@ Painter.prototype = {
if (clipPaths) { if (clipPaths) {
ctx.save(); ctx.save();
doClip(clipPaths, ctx); doClip(clipPaths, ctx);
scope.prevClipLayer = currentLayer;
scope.prevElClipPaths = clipPaths; scope.prevElClipPaths = clipPaths;
} }
} }
...@@ -10479,7 +10483,7 @@ var instances$1 = {}; // ZRender实例map索引 ...@@ -10479,7 +10483,7 @@ var instances$1 = {}; // ZRender实例map索引
/** /**
* @type {string} * @type {string}
*/ */
var version$1 = '4.0.0'; var version$1 = '4.0.1';
/** /**
* Initializing a zrender instance * Initializing a zrender instance
...@@ -14582,7 +14586,6 @@ function createPathOptions(str, opts) { ...@@ -14582,7 +14586,6 @@ function createPathOptions(str, opts) {
opts.applyTransform = function (m) { opts.applyTransform = function (m) {
transformPath(pathProxy, m); transformPath(pathProxy, m);
this.dirty(true); this.dirty(true);
}; };
...@@ -20803,13 +20806,20 @@ function compatEC2ItemStyle(opt) { ...@@ -20803,13 +20806,20 @@ function compatEC2ItemStyle(opt) {
} }
} }
function convertNormalEmphasis(opt, optType) { function convertNormalEmphasis(opt, optType, useExtend) {
if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) { if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {
var normalOpt = opt[optType].normal; var normalOpt = opt[optType].normal;
var emphasisOpt = opt[optType].emphasis; var emphasisOpt = opt[optType].emphasis;
if (normalOpt) { if (normalOpt) {
opt[optType] = normalOpt; // Timeline controlStyle has other properties besides normal and emphasis
if (useExtend) {
opt[optType].normal = opt[optType].emphasis = null;
defaults(opt[optType], normalOpt);
}
else {
opt[optType] = normalOpt;
}
} }
if (emphasisOpt) { if (emphasisOpt) {
opt.emphasis = opt.emphasis || {}; opt.emphasis = opt.emphasis || {};
...@@ -21008,7 +21018,7 @@ var compatStyle = function (option, isTheme) { ...@@ -21008,7 +21018,7 @@ var compatStyle = function (option, isTheme) {
compatEC3CommonStyles(timelineOpt); compatEC3CommonStyles(timelineOpt);
convertNormalEmphasis(timelineOpt, 'label'); convertNormalEmphasis(timelineOpt, 'label');
convertNormalEmphasis(timelineOpt, 'itemStyle'); convertNormalEmphasis(timelineOpt, 'itemStyle');
convertNormalEmphasis(timelineOpt, 'controlStyle'); convertNormalEmphasis(timelineOpt, 'controlStyle', true);
convertNormalEmphasis(timelineOpt, 'checkpointStyle'); convertNormalEmphasis(timelineOpt, 'checkpointStyle');
var data = timelineOpt.data; var data = timelineOpt.data;
...@@ -21440,6 +21450,40 @@ function retrieveRawValue(data, dataIndex, dim) { ...@@ -21440,6 +21450,40 @@ function retrieveRawValue(data, dataIndex, dim) {
return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName); return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName);
} }
/**
* Compatible with some cases (in pie, map) like:
* data: [{name: 'xx', value: 5, selected: true}, ...]
* where only sourceFormat is 'original' and 'objectRows' supported.
*
* ??? TODO
* Supported detail options in data item when using 'arrayRows'.
*
* @param {module:echarts/data/List} data
* @param {number} dataIndex
* @param {string} attr like 'selected'
*/
function retrieveRawAttr(data, dataIndex, attr) {
if (!data) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
if (sourceFormat !== SOURCE_FORMAT_ORIGINAL
&& sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS
) {
return;
}
var dataItem = data.getRawDataItem(dataIndex);
if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject$1(dataItem)) {
dataItem = null;
}
if (dataItem) {
return dataItem[attr];
}
}
var DIMENSION_LABEL_REG = /\{@(.+?)\}/g; var DIMENSION_LABEL_REG = /\{@(.+?)\}/g;
// PENDING A little ugly // PENDING A little ugly
...@@ -23674,10 +23718,10 @@ var isFunction = isFunction$1; ...@@ -23674,10 +23718,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1; var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType; var parseClassType = ComponentModel.parseClassType;
var version = '4.0.0'; var version = '4.0.2';
var dependencies = { var dependencies = {
zrender: '4.0.0' zrender: '4.0.1'
}; };
var TEST_FRAME_REMAIN_TIME = 1; var TEST_FRAME_REMAIN_TIME = 1;
...@@ -36083,7 +36127,11 @@ var selectableMixin = { ...@@ -36083,7 +36127,11 @@ var selectableMixin = {
var valueDim = ecList.mapDimension('value'); var valueDim = ecList.mapDimension('value');
var targetList = this._targetList = []; var targetList = this._targetList = [];
for (var i = 0, len = ecList.count(); i < len; i++) { for (var i = 0, len = ecList.count(); i < len; i++) {
targetList.push({name: ecList.getName(i), value: ecList.get(valueDim, i)}); targetList.push({
name: ecList.getName(i),
value: ecList.get(valueDim, i),
selected: retrieveRawAttr(ecList, i, 'selected')
});
} }
} }
this._selectTargetMap = reduce(targetList || [], function (targetMap, target) { this._selectTargetMap = reduce(targetList || [], function (targetMap, target) {
...@@ -59293,16 +59341,16 @@ SunburstPieceProto.updateData = function ( ...@@ -59293,16 +59341,16 @@ SunburstPieceProto.updateData = function (
var sectorShape = extend({}, layout); var sectorShape = extend({}, layout);
sectorShape.label = null; sectorShape.label = null;
var itemStyleModel = itemModel.getModel('itemStyle');
var visualColor = getNodeColor(node, seriesModel, ecModel); var visualColor = getNodeColor(node, seriesModel, ecModel);
var normalStyle = itemStyleModel.getItemStyle(); var normalStyle = itemModel.getModel('itemStyle').getItemStyle();
var style; var style;
if (state === 'normal') { if (state === 'normal') {
style = normalStyle; style = normalStyle;
} }
else { else {
var stateStyle = itemStyleModel.getModel(state).getItemStyle(); var stateStyle = itemModel.getModel(state + '.itemStyle')
.getItemStyle();
style = merge(stateStyle, normalStyle); style = merge(stateStyle, normalStyle);
} }
style = defaults( style = defaults(
...@@ -59336,7 +59384,8 @@ SunburstPieceProto.updateData = function ( ...@@ -59336,7 +59384,8 @@ SunburstPieceProto.updateData = function (
} }
if (state === 'normal') { if (state === 'normal') {
sector.hoverStyle = itemStyleModel.getModel('emphasis').getItemStyle(); sector.hoverStyle = itemModel.getModel('emphasis.itemStyle')
.getItemStyle();
setHoverStyle(this); setHoverStyle(this);
} }
...@@ -75295,7 +75344,7 @@ TimelineView.extend({ ...@@ -75295,7 +75344,7 @@ TimelineView.extend({
var mainLength = orient === 'vertical' ? viewRect.height : viewRect.width; var mainLength = orient === 'vertical' ? viewRect.height : viewRect.width;
var controlModel = timelineModel.getModel('controlStyle'); var controlModel = timelineModel.getModel('controlStyle');
var showControl = controlModel.get('show'); var showControl = controlModel.get('show', true);
var controlSize = showControl ? controlModel.get('itemSize') : 0; var controlSize = showControl ? controlModel.get('itemSize') : 0;
var controlGap = showControl ? controlModel.get('itemGap') : 0; var controlGap = showControl ? controlModel.get('itemGap') : 0;
var sizePlusGap = controlSize + controlGap; var sizePlusGap = controlSize + controlGap;
...@@ -75309,7 +75358,6 @@ TimelineView.extend({ ...@@ -75309,7 +75358,6 @@ TimelineView.extend({
var nextBtnPosition; var nextBtnPosition;
var axisExtent; var axisExtent;
var controlPosition = controlModel.get('position', true); var controlPosition = controlModel.get('position', true);
var showControl = controlModel.get('show', true);
var showPlayBtn = showControl && controlModel.get('showPlayBtn', true); var showPlayBtn = showControl && controlModel.get('showPlayBtn', true);
var showPrevBtn = showControl && controlModel.get('showPrevBtn', true); var showPrevBtn = showControl && controlModel.get('showPrevBtn', true);
var showNextBtn = showControl && controlModel.get('showNextBtn', true); var showNextBtn = showControl && controlModel.get('showNextBtn', true);
此差异已折叠。
此差异已折叠。
...@@ -8716,6 +8716,11 @@ Painter.prototype = { ...@@ -8716,6 +8716,11 @@ Painter.prototype = {
finished = false; finished = false;
} }
if (scope.prevElClipPaths) {
// Needs restore the state. If last drawn element is in the clipping area.
ctx.restore();
}
ctx.restore(); ctx.restore();
} }
...@@ -8751,13 +8756,13 @@ Painter.prototype = { ...@@ -8751,13 +8756,13 @@ Painter.prototype = {
var clipPaths = el.__clipPaths; var clipPaths = el.__clipPaths;
// Optimize when clipping on group with several elements // Optimize when clipping on group with several elements
if (scope.prevClipLayer !== currentLayer if (!scope.prevElClipPaths
|| isClipPathChanged(clipPaths, scope.prevElClipPaths) || isClipPathChanged(clipPaths, scope.prevElClipPaths)
) { ) {
// If has previous clipping state, restore from it // If has previous clipping state, restore from it
if (scope.prevElClipPaths) { if (scope.prevElClipPaths) {
scope.prevClipLayer.ctx.restore(); currentLayer.ctx.restore();
scope.prevClipLayer = scope.prevElClipPaths = null; scope.prevElClipPaths = null;
// Reset prevEl since context has been restored // Reset prevEl since context has been restored
scope.prevEl = null; scope.prevEl = null;
...@@ -8766,7 +8771,6 @@ Painter.prototype = { ...@@ -8766,7 +8771,6 @@ Painter.prototype = {
if (clipPaths) { if (clipPaths) {
ctx.save(); ctx.save();
doClip(clipPaths, ctx); doClip(clipPaths, ctx);
scope.prevClipLayer = currentLayer;
scope.prevElClipPaths = clipPaths; scope.prevElClipPaths = clipPaths;
} }
} }
...@@ -10165,7 +10169,7 @@ var painterCtors = { ...@@ -10165,7 +10169,7 @@ var painterCtors = {
/** /**
* @type {string} * @type {string}
*/ */
var version$1 = '4.0.0'; var version$1 = '4.0.1';
/** /**
* Initializing a zrender instance * Initializing a zrender instance
...@@ -14169,7 +14173,6 @@ function createPathOptions(str, opts) { ...@@ -14169,7 +14173,6 @@ function createPathOptions(str, opts) {
opts.applyTransform = function (m) { opts.applyTransform = function (m) {
transformPath(pathProxy, m); transformPath(pathProxy, m);
this.dirty(true); this.dirty(true);
}; };
...@@ -20202,13 +20205,20 @@ function compatEC2ItemStyle(opt) { ...@@ -20202,13 +20205,20 @@ function compatEC2ItemStyle(opt) {
} }
} }
function convertNormalEmphasis(opt, optType) { function convertNormalEmphasis(opt, optType, useExtend) {
if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) { if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {
var normalOpt = opt[optType].normal; var normalOpt = opt[optType].normal;
var emphasisOpt = opt[optType].emphasis; var emphasisOpt = opt[optType].emphasis;
if (normalOpt) { if (normalOpt) {
opt[optType] = normalOpt; // Timeline controlStyle has other properties besides normal and emphasis
if (useExtend) {
opt[optType].normal = opt[optType].emphasis = null;
defaults(opt[optType], normalOpt);
}
else {
opt[optType] = normalOpt;
}
} }
if (emphasisOpt) { if (emphasisOpt) {
opt.emphasis = opt.emphasis || {}; opt.emphasis = opt.emphasis || {};
...@@ -20407,7 +20417,7 @@ var compatStyle = function (option, isTheme) { ...@@ -20407,7 +20417,7 @@ var compatStyle = function (option, isTheme) {
compatEC3CommonStyles(timelineOpt); compatEC3CommonStyles(timelineOpt);
convertNormalEmphasis(timelineOpt, 'label'); convertNormalEmphasis(timelineOpt, 'label');
convertNormalEmphasis(timelineOpt, 'itemStyle'); convertNormalEmphasis(timelineOpt, 'itemStyle');
convertNormalEmphasis(timelineOpt, 'controlStyle'); convertNormalEmphasis(timelineOpt, 'controlStyle', true);
convertNormalEmphasis(timelineOpt, 'checkpointStyle'); convertNormalEmphasis(timelineOpt, 'checkpointStyle');
var data = timelineOpt.data; var data = timelineOpt.data;
...@@ -20839,6 +20849,40 @@ function retrieveRawValue(data, dataIndex, dim) { ...@@ -20839,6 +20849,40 @@ function retrieveRawValue(data, dataIndex, dim) {
return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName); return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName);
} }
/**
* Compatible with some cases (in pie, map) like:
* data: [{name: 'xx', value: 5, selected: true}, ...]
* where only sourceFormat is 'original' and 'objectRows' supported.
*
* ??? TODO
* Supported detail options in data item when using 'arrayRows'.
*
* @param {module:echarts/data/List} data
* @param {number} dataIndex
* @param {string} attr like 'selected'
*/
function retrieveRawAttr(data, dataIndex, attr) {
if (!data) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
if (sourceFormat !== SOURCE_FORMAT_ORIGINAL
&& sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS
) {
return;
}
var dataItem = data.getRawDataItem(dataIndex);
if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject$1(dataItem)) {
dataItem = null;
}
if (dataItem) {
return dataItem[attr];
}
}
var DIMENSION_LABEL_REG = /\{@(.+?)\}/g; var DIMENSION_LABEL_REG = /\{@(.+?)\}/g;
// PENDING A little ugly // PENDING A little ugly
...@@ -23038,10 +23082,10 @@ var isFunction = isFunction$1; ...@@ -23038,10 +23082,10 @@ var isFunction = isFunction$1;
var isObject = isObject$1; var isObject = isObject$1;
var parseClassType = ComponentModel.parseClassType; var parseClassType = ComponentModel.parseClassType;
var version = '4.0.0'; var version = '4.0.2';
var dependencies = { var dependencies = {
zrender: '4.0.0' zrender: '4.0.1'
}; };
var TEST_FRAME_REMAIN_TIME = 1; var TEST_FRAME_REMAIN_TIME = 1;
...@@ -34797,7 +34841,11 @@ var dataSelectableMixin = { ...@@ -34797,7 +34841,11 @@ var dataSelectableMixin = {
var valueDim = ecList.mapDimension('value'); var valueDim = ecList.mapDimension('value');
var targetList = this._targetList = []; var targetList = this._targetList = [];
for (var i = 0, len = ecList.count(); i < len; i++) { for (var i = 0, len = ecList.count(); i < len; i++) {
targetList.push({name: ecList.getName(i), value: ecList.get(valueDim, i)}); targetList.push({
name: ecList.getName(i),
value: ecList.get(valueDim, i),
selected: retrieveRawAttr(ecList, i, 'selected')
});
} }
} }
this._selectTargetMap = reduce(targetList || [], function (targetMap, target) { this._selectTargetMap = reduce(targetList || [], function (targetMap, target) {
......
此差异已折叠。
{ {
"name": "echarts", "name": "echarts",
"version": "4.0.0", "version": "4.0.2",
"description": "A powerful charting and visualization library for browser", "description": "A powerful charting and visualization library for browser",
"keywords": [ "keywords": [
"visualization", "visualization",
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"prepublish": "node build/build.js --prepublish" "prepublish": "node build/build.js --prepublish"
}, },
"dependencies": { "dependencies": {
"zrender": "4.0.0" "zrender": "4.0.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.0.0-beta.31", "@babel/core": "7.0.0-beta.31",
...@@ -58,6 +58,6 @@ ...@@ -58,6 +58,6 @@
"rollup": "0.50.0", "rollup": "0.50.0",
"rollup-plugin-node-resolve": "3.0.0", "rollup-plugin-node-resolve": "3.0.0",
"rollup-plugin-uglify": "2.0.1", "rollup-plugin-uglify": "2.0.1",
"zrender": "4.0.0" "zrender": "4.0.1"
} }
} }
...@@ -159,6 +159,12 @@ whiskerBoxDrawProto.updateData = function (data) { ...@@ -159,6 +159,12 @@ whiskerBoxDrawProto.updateData = function (data) {
var oldData = this._data; var oldData = this._data;
var styleUpdater = this.styleUpdater; var styleUpdater = this.styleUpdater;
// There is no old data only when first rendering or switching from
// stream mode to normal mode, where previous elements should be removed.
if (!this._data) {
group.removeAll();
}
data.diff(oldData) data.diff(oldData)
.add(function (newIdx) { .add(function (newIdx) {
if (data.hasValue(newIdx)) { if (data.hasValue(newIdx)) {
...@@ -197,6 +203,20 @@ whiskerBoxDrawProto.updateData = function (data) { ...@@ -197,6 +203,20 @@ whiskerBoxDrawProto.updateData = function (data) {
this._data = data; this._data = data;
}; };
whiskerBoxDrawProto.incrementalPrepareUpdate = function (seriesModel, ecModel, api) {
this.group.removeAll();
this._data = null;
};
whiskerBoxDrawProto.incrementalUpdate = function (params, seriesModel, ecModel, api) {
var data = seriesModel.getData();
for (var idx = params.start; idx < params.end; idx++) {
var symbolEl = new WhiskerBox(data, idx, this.styleUpdater, true);
symbolEl.incremental = true;
this.group.add(symbolEl);
}
};
/** /**
* Remove symbols. * Remove symbols.
* @param {module:echarts/data/List} data * @param {module:echarts/data/List} data
......
...@@ -129,6 +129,14 @@ export var viewMixin = { ...@@ -129,6 +129,14 @@ export var viewMixin = {
this._whiskerBoxDraw.updateData(seriesModel.getData()); this._whiskerBoxDraw.updateData(seriesModel.getData());
}, },
incrementalPrepareRender: function (seriesModel, ecModel, api) {
this._whiskerBoxDraw.incrementalPrepareUpdate(seriesModel, ecModel, api);
},
incrementalRender: function (params, seriesModel, ecModel, api) {
this._whiskerBoxDraw.incrementalUpdate(params, seriesModel, ecModel, api);
},
remove: function (ecModel) { remove: function (ecModel) {
this._whiskerBoxDraw.remove(); this._whiskerBoxDraw.remove();
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
import * as zrUtil from 'zrender/src/core/util'; import * as zrUtil from 'zrender/src/core/util';
import {retrieveRawAttr} from '../../data/helper/dataProvider';
export default { export default {
...@@ -22,7 +23,11 @@ export default { ...@@ -22,7 +23,11 @@ export default {
var valueDim = ecList.mapDimension('value'); var valueDim = ecList.mapDimension('value');
var targetList = this._targetList = []; var targetList = this._targetList = [];
for (var i = 0, len = ecList.count(); i < len; i++) { for (var i = 0, len = ecList.count(); i < len; i++) {
targetList.push({name: ecList.getName(i), value: ecList.get(valueDim, i)}); targetList.push({
name: ecList.getName(i),
value: ecList.get(valueDim, i),
selected: retrieveRawAttr(ecList, i, 'selected')
});
} }
} }
this._selectTargetMap = zrUtil.reduce(targetList || [], function (targetMap, target) { this._selectTargetMap = zrUtil.reduce(targetList || [], function (targetMap, target) {
......
...@@ -147,7 +147,7 @@ export default TimelineView.extend({ ...@@ -147,7 +147,7 @@ export default TimelineView.extend({
var mainLength = orient === 'vertical' ? viewRect.height : viewRect.width; var mainLength = orient === 'vertical' ? viewRect.height : viewRect.width;
var controlModel = timelineModel.getModel('controlStyle'); var controlModel = timelineModel.getModel('controlStyle');
var showControl = controlModel.get('show'); var showControl = controlModel.get('show', true);
var controlSize = showControl ? controlModel.get('itemSize') : 0; var controlSize = showControl ? controlModel.get('itemSize') : 0;
var controlGap = showControl ? controlModel.get('itemGap') : 0; var controlGap = showControl ? controlModel.get('itemGap') : 0;
var sizePlusGap = controlSize + controlGap; var sizePlusGap = controlSize + controlGap;
...@@ -161,7 +161,6 @@ export default TimelineView.extend({ ...@@ -161,7 +161,6 @@ export default TimelineView.extend({
var nextBtnPosition; var nextBtnPosition;
var axisExtent; var axisExtent;
var controlPosition = controlModel.get('position', true); var controlPosition = controlModel.get('position', true);
var showControl = controlModel.get('show', true);
var showPlayBtn = showControl && controlModel.get('showPlayBtn', true); var showPlayBtn = showControl && controlModel.get('showPlayBtn', true);
var showPrevBtn = showControl && controlModel.get('showPrevBtn', true); var showPrevBtn = showControl && controlModel.get('showPrevBtn', true);
var showNextBtn = showControl && controlModel.get('showNextBtn', true); var showNextBtn = showControl && controlModel.get('showNextBtn', true);
......
...@@ -3,13 +3,15 @@ ...@@ -3,13 +3,15 @@
// merge with defaultDimValueGetter? // merge with defaultDimValueGetter?
import {__DEV__} from '../../config'; import {__DEV__} from '../../config';
import {isTypedArray, extend, assert, each} from 'zrender/src/core/util'; import {isTypedArray, extend, assert, each, isObject} from 'zrender/src/core/util';
import {getDataItemValue, isDataItemOption} from '../../util/model'; import {getDataItemValue, isDataItemOption} from '../../util/model';
import {parseDate} from '../../util/number'; import {parseDate} from '../../util/number';
import Source from '../Source'; import Source from '../Source';
import { import {
SOURCE_FORMAT_TYPED_ARRAY, SOURCE_FORMAT_TYPED_ARRAY,
SOURCE_FORMAT_ARRAY_ROWS SOURCE_FORMAT_ARRAY_ROWS,
SOURCE_FORMAT_ORIGINAL,
SOURCE_FORMAT_OBJECT_ROWS
} from './sourceType'; } from './sourceType';
/** /**
...@@ -325,3 +327,37 @@ export function retrieveRawValue(data, dataIndex, dim) { ...@@ -325,3 +327,37 @@ export function retrieveRawValue(data, dataIndex, dim) {
return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName); return rawValueGetters[sourceFormat](dataItem, dataIndex, dimIndex, dimName);
} }
/**
* Compatible with some cases (in pie, map) like:
* data: [{name: 'xx', value: 5, selected: true}, ...]
* where only sourceFormat is 'original' and 'objectRows' supported.
*
* ??? TODO
* Supported detail options in data item when using 'arrayRows'.
*
* @param {module:echarts/data/List} data
* @param {number} dataIndex
* @param {string} attr like 'selected'
*/
export function retrieveRawAttr(data, dataIndex, attr) {
if (!data) {
return;
}
var sourceFormat = data.getProvider().getSource().sourceFormat;
if (sourceFormat !== SOURCE_FORMAT_ORIGINAL
&& sourceFormat !== SOURCE_FORMAT_OBJECT_ROWS
) {
return;
}
var dataItem = data.getRawDataItem(dataIndex);
if (sourceFormat === SOURCE_FORMAT_ORIGINAL && !isObject(dataItem)) {
dataItem = null;
}
if (dataItem) {
return dataItem[attr];
}
}
...@@ -41,10 +41,10 @@ var isFunction = zrUtil.isFunction; ...@@ -41,10 +41,10 @@ var isFunction = zrUtil.isFunction;
var isObject = zrUtil.isObject; var isObject = zrUtil.isObject;
var parseClassType = ComponentModel.parseClassType; var parseClassType = ComponentModel.parseClassType;
export var version = '4.0.0'; export var version = '4.0.2';
export var dependencies = { export var dependencies = {
zrender: '4.0.0' zrender: '4.0.1'
}; };
var TEST_FRAME_REMAIN_TIME = 1; var TEST_FRAME_REMAIN_TIME = 1;
......
...@@ -41,13 +41,20 @@ function compatEC2ItemStyle(opt) { ...@@ -41,13 +41,20 @@ function compatEC2ItemStyle(opt) {
} }
} }
function convertNormalEmphasis(opt, optType) { function convertNormalEmphasis(opt, optType, useExtend) {
if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) { if (opt && opt[optType] && (opt[optType].normal || opt[optType].emphasis)) {
var normalOpt = opt[optType].normal; var normalOpt = opt[optType].normal;
var emphasisOpt = opt[optType].emphasis; var emphasisOpt = opt[optType].emphasis;
if (normalOpt) { if (normalOpt) {
opt[optType] = normalOpt; // Timeline controlStyle has other properties besides normal and emphasis
if (useExtend) {
opt[optType].normal = opt[optType].emphasis = null;
zrUtil.defaults(opt[optType], normalOpt);
}
else {
opt[optType] = normalOpt;
}
} }
if (emphasisOpt) { if (emphasisOpt) {
opt.emphasis = opt.emphasis || {}; opt.emphasis = opt.emphasis || {};
...@@ -246,8 +253,7 @@ export default function (option, isTheme) { ...@@ -246,8 +253,7 @@ export default function (option, isTheme) {
compatEC3CommonStyles(timelineOpt); compatEC3CommonStyles(timelineOpt);
convertNormalEmphasis(timelineOpt, 'label'); convertNormalEmphasis(timelineOpt, 'label');
convertNormalEmphasis(timelineOpt, 'itemStyle'); convertNormalEmphasis(timelineOpt, 'itemStyle');
convertNormalEmphasis(timelineOpt, 'controlStyle'); convertNormalEmphasis(timelineOpt, 'controlStyle', true);
convertNormalEmphasis(timelineOpt, 'checkpointStyle');
var data = timelineOpt.data; var data = timelineOpt.data;
zrUtil.isArray(data) && zrUtil.each(data, function (item) { zrUtil.isArray(data) && zrUtil.each(data, function (item) {
......
...@@ -37,9 +37,10 @@ export default function (seriesType) { ...@@ -37,9 +37,10 @@ export default function (seriesType) {
if (!singleDataColor) { if (!singleDataColor) {
// FIXME Performance // FIXME Performance
var itemModel = dataAll.getItemModel(rawIdx); var itemModel = dataAll.getItemModel(rawIdx);
var color = itemModel.get('itemStyle.color') var color = itemModel.get('itemStyle.color')
|| seriesModel.getColorFromPalette( || seriesModel.getColorFromPalette(
dataAll.getName(rawIdx), seriesModel.__paletteScope, dataAll.getName(rawIdx) || (rawIdx + ''), seriesModel.__paletteScope,
dataAll.count() dataAll.count()
); );
// Legend may use the visual info in data before processed // Legend may use the visual info in data before processed
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
'./scatter-weibo.html', './scatter-weibo.html',
'./lines-flight.html', './lines-flight.html',
'./stream-filter.html', './stream-filter.html',
'./scatter-stream-visual' './scatter-stream-visual.html'
]; ];
......
...@@ -5,17 +5,17 @@ ...@@ -5,17 +5,17 @@
<script src="lib/config.js"></script> <script src="lib/config.js"></script>
<script src="data/pie-texture.js"></script> <script src="data/pie-texture.js"></script>
<script src="lib/dat.gui.min.js"></script> <script src="lib/dat.gui.min.js"></script>
<link rel="stylesheet" href="lib/reset.css" />
<script src="lib/testHelper.js"></script>
</head> </head>
<body> <body>
<style> <style>
html, body, #main {
width: 100%;
height: 100%;
/* background-image: url(old_mathematics.png); */
/* background-repeat: repeat; */
}
</style> </style>
<div id="main"></div> <div id="main"></div>
<div id="main2"></div>
<script> <script>
var chart; var chart;
require([ require([
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
}; };
chart.setOption({ chart.setOption({
legend: { legend: {
data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎'] data: ['直接访问(初始就被选中)','邮件营销','联盟广告','视频广告','搜索引擎']
// data: [] // data: []
}, },
toolbox: { toolbox: {
...@@ -89,7 +89,12 @@ ...@@ -89,7 +89,12 @@
// } // }
// }, // },
data:[ data:[
{value:235, name:'直接访问', cursor: 'move'}, {
value:235,
name:'直接访问(初始就被选中)',
cursor: 'move',
selected: true
},
{value: 163, name: '标签在内部', {value: 163, name: '标签在内部',
label: { label: {
normal: { normal: {
...@@ -291,5 +296,44 @@ ...@@ -291,5 +296,44 @@
}) })
</script> </script>
<script>
require([
'echarts'
], function (echarts) {
var option = {
legend: {},
dataset: {
source: [
{name: 'a', value: 123},
{name: 'b', value: 456},
{name: 'should be selected', value: 789, selected: true}
]
},
series: {
type: 'pie',
selectedMode: 'multiply'
}
};
testHelper.create(echarts, 'main2', {
option: option,
info: option
})
});
</script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -66,9 +66,11 @@ var option = { ...@@ -66,9 +66,11 @@ var option = {
autoPlay: true, autoPlay: true,
// currentIndex: 2, // currentIndex: 2,
playInterval: 1000, playInterval: 1000,
// controlStyle: { controlStyle: {
// position: 'left' showNextBtn: false,
// }, showPrevBtn: false,
position: 'left'
},
data: [ data: [
'2002-01-01','2003-01-01','2004-01-01', '2002-01-01','2003-01-01','2004-01-01',
{ {
......
...@@ -29,9 +29,12 @@ ...@@ -29,9 +29,12 @@
<div><a target="_blank" href="dynamicData2.html">dynamicData2.html</a></div> <div><a target="_blank" href="dynamicData2.html">dynamicData2.html</a></div>
<div><a target="_blank" href="dynamicData3.html">dynamicData3.html</a></div> <div><a target="_blank" href="dynamicData3.html">dynamicData3.html</a></div>
<h1>triggerOn click setOption when trigger axis (keep show)</h1> <h1>triggerOn click setOption when trigger axis (keep show)</h1>
<div class="chart" id="click-setOption1"></div> <!-- <div class="chart" id="click-setOption1"></div> -->
<h1>triggerOn click setOption when trigger item (keep show)</h1>
<div class="chart" id="click-setOption2"></div>
<h1>tooltip should auto show and auto disappear when setOption(..., {notMerge: true})</h1>
<div class="chart" id="setOption2">
</div>
...@@ -98,14 +101,60 @@ ...@@ -98,14 +101,60 @@
var chart = createChart('click-setOption1', echarts, option, baseTop); var chart = createChart('click-setOption1', echarts, option, baseTop);
window.ecClickSetOptionAxisChart = chart; window.ecClickSetOptionAxisChart = chart;
})
</script>
chart.on('showTip', function (params) {
console.log('asdf', params); <script>
chart.setOption({ require([
// tooltip: {} 'echarts'
], function (echarts) {
function genOption() {
return {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross'
}
},
xAxis: {},
yAxis: {},
series: [{
type: 'scatter',
data: [
[Math.random(), Math.random() * 100],
[Math.random(), Math.random() * 100],
[Math.random(), Math.random() * 100]
]
}]
};
}
var chart = echarts.init(document.getElementById('setOption2'));
chart.setOption(genOption());
setTimeout(function () {
chart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: 0
}); });
});
}) setTimeout(function () {
// chart.clear();
chart.dispose();
chart = echarts.init(document.getElementById('setOption2'));
chart.setOption(genOption());
}, 2000)
}, 100);
});
</script> </script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册