You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by su...@apache.org on 2018/04/26 22:54:41 UTC
[incubator-echarts] 02/02: release 4.1.0.rc1
This is an automated email from the ASF dual-hosted git repository.
sushuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
commit 44c157fb2b74c1a9c48ab45ba50d0701176db174
Author: sushuang <su...@gmail.com>
AuthorDate: Fri Apr 27 06:54:08 2018 +0800
release 4.1.0.rc1
---
dist/echarts-en.common.js | 145 +++++++++++++++++++++------------------
dist/echarts-en.common.min.js | 2 +-
dist/echarts-en.js | 156 +++++++++++++++++++++++-------------------
dist/echarts-en.js.map | 2 +-
dist/echarts-en.min.js | 2 +-
dist/echarts-en.simple.js | 140 +++++++++++++++++++------------------
dist/echarts-en.simple.min.js | 2 +-
dist/echarts.common.js | 145 +++++++++++++++++++++------------------
dist/echarts.common.min.js | 2 +-
dist/echarts.js | 156 +++++++++++++++++++++++-------------------
dist/echarts.js.map | 2 +-
dist/echarts.min.js | 2 +-
dist/echarts.simple.js | 140 +++++++++++++++++++------------------
dist/echarts.simple.min.js | 2 +-
14 files changed, 484 insertions(+), 414 deletions(-)
diff --git a/dist/echarts-en.common.js b/dist/echarts-en.common.js
index c33bd9d..96e2ddd 100644
--- a/dist/echarts-en.common.js
+++ b/dist/echarts-en.common.js
@@ -29717,17 +29717,29 @@ function enableDataStack(seriesModel, dimensionInfoList, opt) {
/**
* @param {module:echarts/data/List} data
* @param {string} stackedDim
+ */
+function isDimensionStacked(data, stackedDim /*, stackedByDim*/) {
+ // Each single series only maps to one pair of axis. So we do not need to
+ // check stackByDim, whatever stacked by a dimension or stacked by index.
+ return !!stackedDim && stackedDim === data.getCalculationInfo('stackedDimension');
+ // && (
+ // stackedByDim != null
+ // ? stackedByDim === data.getCalculationInfo('stackedByDimension')
+ // : data.getCalculationInfo('isStackedByIndex')
+ // );
+}
+
+/**
+ * @param {module:echarts/data/List} data
+ * @param {string} targetDim
* @param {string} [stackedByDim] If not input this parameter, check whether
* stacked by index.
+ * @return {string} dimension
*/
-function isDimensionStacked(data, stackedDim, stackedByDim) {
- return stackedDim
- && stackedDim === data.getCalculationInfo('stackedDimension')
- && (
- stackedByDim != null
- ? stackedByDim === data.getCalculationInfo('stackedByDimension')
- : data.getCalculationInfo('isStackedByIndex')
- );
+function getStackedDimension(data, targetDim) {
+ return isDimensionStacked(data, targetDim)
+ ? data.getCalculationInfo('stackResultDimension')
+ : targetDim;
}
/*
@@ -30866,7 +30878,7 @@ function layout(seriesType, ecModel) {
var valueDim = data.mapDimension(valueAxis.dim);
var baseDim = data.mapDimension(baseAxis.dim);
- var stacked = isDimensionStacked(data, valueDim, baseDim);
+ var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
var isValueAxisH = valueAxis.isHorizontal();
var valueAxisStart = getValueAxisStart(baseAxis, valueAxis, stacked);
@@ -32286,7 +32298,8 @@ function createList(seriesModel) {
var dataStack$1 = {
isDimensionStacked: isDimensionStacked,
- enableDataStack: enableDataStack
+ enableDataStack: enableDataStack,
+ getStackedDimension: getStackedDimension
};
/**
@@ -32732,7 +32745,14 @@ function createAxisTicks(axis, tickModel) {
function makeCategoryLabels(axis) {
var labelModel = axis.getLabelModel();
+ var result = makeCategoryLabelsActually(axis, labelModel);
+ return (!labelModel.get('show') || axis.scale.isBlank())
+ ? {labels: [], labelCategoryInterval: result.labelCategoryInterval}
+ : result;
+}
+
+function makeCategoryLabelsActually(axis, labelModel) {
var labelsCache = getListCache(axis, 'labels');
var optionLabelInterval = getOptionCategoryInterval(labelModel);
var result = listCacheGet(labelsCache, optionLabelInterval);
@@ -32744,10 +32764,7 @@ function makeCategoryLabels(axis) {
var labels;
var numericLabelInterval;
- if (!labelModel.get('show') || axis.scale.isBlank()) {
- labels = [];
- }
- else if (isFunction$1(optionLabelInterval)) {
+ if (isFunction$1(optionLabelInterval)) {
labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);
}
else {
@@ -32772,7 +32789,7 @@ function makeCategoryTicks(axis, tickModel) {
}
var ticks;
- var numericTickInterval = optionTickInterval;
+ var tickCategoryInterval;
// Optimize for the case that large category data and no label displayed,
// we should not return all ticks.
@@ -32780,31 +32797,27 @@ function makeCategoryTicks(axis, tickModel) {
ticks = [];
}
- if (isFunction$1(numericTickInterval)) {
- ticks = makeLabelsByCustomizedCategoryInterval(axis, numericTickInterval, true);
+ if (isFunction$1(optionTickInterval)) {
+ ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);
+ }
+ // Always use label interval by default despite label show. Consider this
+ // scenario, Use multiple grid with the xAxis sync, and only one xAxis shows
+ // labels. `splitLine` and `axisTick` should be consistent in this case.
+ else if (optionTickInterval === 'auto') {
+ var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());
+ tickCategoryInterval = labelsResult.labelCategoryInterval;
+ ticks = map(labelsResult.labels, function (labelItem) {
+ return labelItem.tickValue;
+ });
}
- // Always use label interval by default.
else {
- if (numericTickInterval === 'auto') {
- var labelsResult = makeCategoryLabels(axis);
- numericTickInterval = labelsResult.labelCategoryInterval;
- if (numericTickInterval != null) {
- ticks = map(labelsResult.labels, function (labelItem) {
- return labelItem.tickValue;
- });
- }
- else {
- numericTickInterval = makeAutoCategoryInterval(axis, true);
- }
- }
- if (ticks == null) {
- ticks = makeLabelsByNumericCategoryInterval(axis, numericTickInterval, true);
- }
+ tickCategoryInterval = optionTickInterval;
+ ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);
}
// Cache to avoid calling interval function repeatly.
return listCacheSet(ticksCache, optionTickInterval, {
- ticks: ticks, tickCategoryInterval: numericTickInterval
+ ticks: ticks, tickCategoryInterval: tickCategoryInterval
});
}
@@ -32843,16 +32856,11 @@ function listCacheSet(cache, key, value) {
return value;
}
-function makeAutoCategoryInterval(axis, hideLabel) {
- var cacheKey = hideLabel ? 'tickAutoInterval' : 'autoInterval';
- var result = inner$6(axis)[cacheKey];
- if (result != null) {
- return result;
- }
-
- return (
- inner$6(axis)[cacheKey] = axis.calculateCategoryInterval(hideLabel)
- );
+function makeAutoCategoryInterval(axis) {
+ var result = inner$6(axis).autoInterval;
+ return result != null
+ ? result
+ : (inner$6(axis).autoInterval = axis.calculateCategoryInterval());
}
/**
@@ -32860,7 +32868,7 @@ function makeAutoCategoryInterval(axis, hideLabel) {
* To get precise result, at least one of `getRotate` and `isHorizontal`
* should be implemented in axis.
*/
-function calculateCategoryInterval(axis, hideLabel) {
+function calculateCategoryInterval(axis) {
var params = fetchAutoCategoryIntervalCalculationParams(axis);
var labelFormatter = makeLabelFormatter(axis);
var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
@@ -32895,17 +32903,15 @@ function calculateCategoryInterval(axis, hideLabel) {
var width = 0;
var height = 0;
- if (!hideLabel) {
- // Polar is also calculated in assumptive linear layout here.
- // Not precise, do not consider align and vertical align
- // and each distance from axis line yet.
- var rect = getBoundingRect(
- labelFormatter(tickValue), params.font, 'center', 'top'
- );
- // Magic number
- width = rect.width * 1.3;
- height = rect.height * 1.3;
- }
+ // Polar is also calculated in assumptive linear layout here.
+ // Not precise, do not consider align and vertical align
+ // and each distance from axis line yet.
+ var rect = getBoundingRect(
+ labelFormatter(tickValue), params.font, 'center', 'top'
+ );
+ // Magic number
+ width = rect.width * 1.3;
+ height = rect.height * 1.3;
// Min size, void long loop.
maxW = Math.max(maxW, width, 7);
@@ -33309,11 +33315,10 @@ Axis.prototype = {
/**
* Only be called in category axis.
* Can be overrided, consider other axes like in 3D.
- * @param {boolean} hideLabel
* @return {number} Auto interval for cateogry axis tick and label
*/
- calculateCategoryInterval: function (hideLabel) {
- return calculateCategoryInterval(this, hideLabel);
+ calculateCategoryInterval: function () {
+ return calculateCategoryInterval(this);
}
};
@@ -34184,10 +34189,10 @@ function prepareDataCoordInfo(coordSys, data, valueOrigin) {
var stacked;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (stacked |= isDimensionStacked(data, dims[0], dims[1])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[0] /*, dims[1]*/)) { // jshint ignore:line
dims[0] = stackResultDim;
}
- if (stacked |= isDimensionStacked(data, dims[1], dims[0])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[1] /*, dims[0]*/)) { // jshint ignore:line
dims[1] = stackResultDim;
}
@@ -35748,10 +35753,10 @@ var pointsLayout = function (seriesType) {
var dimLen = dims.length;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (isDimensionStacked(data, dims[0], dims[1])) {
+ if (isDimensionStacked(data, dims[0] /*, dims[1]*/)) {
dims[0] = stackResultDim;
}
- if (isDimensionStacked(data, dims[1], dims[0])) {
+ if (isDimensionStacked(data, dims[1] /*, dims[0]*/)) {
dims[1] = stackResultDim;
}
@@ -37192,7 +37197,12 @@ gridProto._updateScale = function (ecModel, gridModel) {
function unionExtent(data, axis, seriesModel) {
each$1(data.mapDimension(axis.dim, true), function (dim) {
- axis.scale.unionExtentFromData(data, dim);
+ axis.scale.unionExtentFromData(
+ // For example, the extent of the orginal dimension
+ // is [0.1, 0.5], the extent of the `stackResultDimension`
+ // is [7, 9], the final extent should not include [0.1, 0.5].
+ data, getStackedDimension(data, dim)
+ );
});
}
};
@@ -38710,8 +38720,9 @@ var CartesianAxisView = AxisView.extend({
}
var colorIndex = (lineCount++) % lineColors.length;
+ var tickValue = ticksCoords[i].tickValue;
this._axisGroup.add(new Line(subPixelOptimizeLine({
- anid: 'line_' + ticksCoords[i].tickValue,
+ anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,
shape: {
x1: p1[0],
y1: p1[1],
@@ -38800,7 +38811,7 @@ var CartesianAxisView = AxisView.extend({
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
this._axisGroup.add(new Rect({
- anid: 'area_' + tickValue,
+ anid: tickValue != null ? 'area_' + tickValue : null,
shape: {
x: x,
y: y,
@@ -46793,7 +46804,7 @@ function markerTypeCalculatorWithExtent(
) {
var coordArr = [];
- var stacked = isDimensionStacked(data, targetDataDim, otherDataDim);
+ var stacked = isDimensionStacked(data, targetDataDim /*, otherDataDim*/);
var calcDataDim = stacked
? data.getCalculationInfo('stackResultDimension')
: targetDataDim;
diff --git a/dist/echarts-en.common.min.js b/dist/echarts-en.common.min.js
index 69ce984..8852a36 100644
--- a/dist/echarts-en.common.min.js
+++ b/dist/echarts-en.common.min.js
@@ -18,4 +18,4 @@
* under the License.
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(Op=null),Pp[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=Mp.call(t);if("[object Array]"===i){if(!z(t)){e=[];for(var r=0,o=t.length;r<o;r++)e[r]=n(t[r])}}else if(Sp[i]){if(!z(t)){var a=t.constructor;if(t.constructor.from)e=a.from(t);else{e=new a( [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(Ep=null),Op[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=Cp.call(t);if("[object Array]"===i){if(!z(t)){e=[];for(var r=0,o=t.length;r<o;r++)e[r]=n(t[r])}}else if(Ip[i]){if(!z(t)){var a=t.constructor;if(t.constructor.from)e=a.from(t);else{e=new a( [...]
diff --git a/dist/echarts-en.js b/dist/echarts-en.js
index edde6a1..d55c22c 100644
--- a/dist/echarts-en.js
+++ b/dist/echarts-en.js
@@ -29783,17 +29783,29 @@ function enableDataStack(seriesModel, dimensionInfoList, opt) {
/**
* @param {module:echarts/data/List} data
* @param {string} stackedDim
+ */
+function isDimensionStacked(data, stackedDim /*, stackedByDim*/) {
+ // Each single series only maps to one pair of axis. So we do not need to
+ // check stackByDim, whatever stacked by a dimension or stacked by index.
+ return !!stackedDim && stackedDim === data.getCalculationInfo('stackedDimension');
+ // && (
+ // stackedByDim != null
+ // ? stackedByDim === data.getCalculationInfo('stackedByDimension')
+ // : data.getCalculationInfo('isStackedByIndex')
+ // );
+}
+
+/**
+ * @param {module:echarts/data/List} data
+ * @param {string} targetDim
* @param {string} [stackedByDim] If not input this parameter, check whether
* stacked by index.
+ * @return {string} dimension
*/
-function isDimensionStacked(data, stackedDim, stackedByDim) {
- return stackedDim
- && stackedDim === data.getCalculationInfo('stackedDimension')
- && (
- stackedByDim != null
- ? stackedByDim === data.getCalculationInfo('stackedByDimension')
- : data.getCalculationInfo('isStackedByIndex')
- );
+function getStackedDimension(data, targetDim) {
+ return isDimensionStacked(data, targetDim)
+ ? data.getCalculationInfo('stackResultDimension')
+ : targetDim;
}
/*
@@ -30959,7 +30971,7 @@ function layout(seriesType, ecModel) {
var valueDim = data.mapDimension(valueAxis.dim);
var baseDim = data.mapDimension(baseAxis.dim);
- var stacked = isDimensionStacked(data, valueDim, baseDim);
+ var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
var isValueAxisH = valueAxis.isHorizontal();
var valueAxisStart = getValueAxisStart(baseAxis, valueAxis, stacked);
@@ -32379,7 +32391,8 @@ function createList(seriesModel) {
var dataStack$1 = {
isDimensionStacked: isDimensionStacked,
- enableDataStack: enableDataStack
+ enableDataStack: enableDataStack,
+ getStackedDimension: getStackedDimension
};
/**
@@ -32825,7 +32838,14 @@ function createAxisTicks(axis, tickModel) {
function makeCategoryLabels(axis) {
var labelModel = axis.getLabelModel();
+ var result = makeCategoryLabelsActually(axis, labelModel);
+
+ return (!labelModel.get('show') || axis.scale.isBlank())
+ ? {labels: [], labelCategoryInterval: result.labelCategoryInterval}
+ : result;
+}
+function makeCategoryLabelsActually(axis, labelModel) {
var labelsCache = getListCache(axis, 'labels');
var optionLabelInterval = getOptionCategoryInterval(labelModel);
var result = listCacheGet(labelsCache, optionLabelInterval);
@@ -32837,10 +32857,7 @@ function makeCategoryLabels(axis) {
var labels;
var numericLabelInterval;
- if (!labelModel.get('show') || axis.scale.isBlank()) {
- labels = [];
- }
- else if (isFunction$1(optionLabelInterval)) {
+ if (isFunction$1(optionLabelInterval)) {
labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);
}
else {
@@ -32865,7 +32882,7 @@ function makeCategoryTicks(axis, tickModel) {
}
var ticks;
- var numericTickInterval = optionTickInterval;
+ var tickCategoryInterval;
// Optimize for the case that large category data and no label displayed,
// we should not return all ticks.
@@ -32873,31 +32890,27 @@ function makeCategoryTicks(axis, tickModel) {
ticks = [];
}
- if (isFunction$1(numericTickInterval)) {
- ticks = makeLabelsByCustomizedCategoryInterval(axis, numericTickInterval, true);
+ if (isFunction$1(optionTickInterval)) {
+ ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);
+ }
+ // Always use label interval by default despite label show. Consider this
+ // scenario, Use multiple grid with the xAxis sync, and only one xAxis shows
+ // labels. `splitLine` and `axisTick` should be consistent in this case.
+ else if (optionTickInterval === 'auto') {
+ var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());
+ tickCategoryInterval = labelsResult.labelCategoryInterval;
+ ticks = map(labelsResult.labels, function (labelItem) {
+ return labelItem.tickValue;
+ });
}
- // Always use label interval by default.
else {
- if (numericTickInterval === 'auto') {
- var labelsResult = makeCategoryLabels(axis);
- numericTickInterval = labelsResult.labelCategoryInterval;
- if (numericTickInterval != null) {
- ticks = map(labelsResult.labels, function (labelItem) {
- return labelItem.tickValue;
- });
- }
- else {
- numericTickInterval = makeAutoCategoryInterval(axis, true);
- }
- }
- if (ticks == null) {
- ticks = makeLabelsByNumericCategoryInterval(axis, numericTickInterval, true);
- }
+ tickCategoryInterval = optionTickInterval;
+ ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);
}
// Cache to avoid calling interval function repeatly.
return listCacheSet(ticksCache, optionTickInterval, {
- ticks: ticks, tickCategoryInterval: numericTickInterval
+ ticks: ticks, tickCategoryInterval: tickCategoryInterval
});
}
@@ -32936,16 +32949,11 @@ function listCacheSet(cache, key, value) {
return value;
}
-function makeAutoCategoryInterval(axis, hideLabel) {
- var cacheKey = hideLabel ? 'tickAutoInterval' : 'autoInterval';
- var result = inner$6(axis)[cacheKey];
- if (result != null) {
- return result;
- }
-
- return (
- inner$6(axis)[cacheKey] = axis.calculateCategoryInterval(hideLabel)
- );
+function makeAutoCategoryInterval(axis) {
+ var result = inner$6(axis).autoInterval;
+ return result != null
+ ? result
+ : (inner$6(axis).autoInterval = axis.calculateCategoryInterval());
}
/**
@@ -32953,7 +32961,7 @@ function makeAutoCategoryInterval(axis, hideLabel) {
* To get precise result, at least one of `getRotate` and `isHorizontal`
* should be implemented in axis.
*/
-function calculateCategoryInterval(axis, hideLabel) {
+function calculateCategoryInterval(axis) {
var params = fetchAutoCategoryIntervalCalculationParams(axis);
var labelFormatter = makeLabelFormatter(axis);
var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
@@ -32988,17 +32996,15 @@ function calculateCategoryInterval(axis, hideLabel) {
var width = 0;
var height = 0;
- if (!hideLabel) {
- // Polar is also calculated in assumptive linear layout here.
- // Not precise, do not consider align and vertical align
- // and each distance from axis line yet.
- var rect = getBoundingRect(
- labelFormatter(tickValue), params.font, 'center', 'top'
- );
- // Magic number
- width = rect.width * 1.3;
- height = rect.height * 1.3;
- }
+ // Polar is also calculated in assumptive linear layout here.
+ // Not precise, do not consider align and vertical align
+ // and each distance from axis line yet.
+ var rect = getBoundingRect(
+ labelFormatter(tickValue), params.font, 'center', 'top'
+ );
+ // Magic number
+ width = rect.width * 1.3;
+ height = rect.height * 1.3;
// Min size, void long loop.
maxW = Math.max(maxW, width, 7);
@@ -33402,11 +33408,10 @@ Axis.prototype = {
/**
* Only be called in category axis.
* Can be overrided, consider other axes like in 3D.
- * @param {boolean} hideLabel
* @return {number} Auto interval for cateogry axis tick and label
*/
- calculateCategoryInterval: function (hideLabel) {
- return calculateCategoryInterval(this, hideLabel);
+ calculateCategoryInterval: function () {
+ return calculateCategoryInterval(this);
}
};
@@ -34277,10 +34282,10 @@ function prepareDataCoordInfo(coordSys, data, valueOrigin) {
var stacked;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (stacked |= isDimensionStacked(data, dims[0], dims[1])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[0] /*, dims[1]*/)) { // jshint ignore:line
dims[0] = stackResultDim;
}
- if (stacked |= isDimensionStacked(data, dims[1], dims[0])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[1] /*, dims[0]*/)) { // jshint ignore:line
dims[1] = stackResultDim;
}
@@ -35841,10 +35846,10 @@ var pointsLayout = function (seriesType) {
var dimLen = dims.length;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (isDimensionStacked(data, dims[0], dims[1])) {
+ if (isDimensionStacked(data, dims[0] /*, dims[1]*/)) {
dims[0] = stackResultDim;
}
- if (isDimensionStacked(data, dims[1], dims[0])) {
+ if (isDimensionStacked(data, dims[1] /*, dims[0]*/)) {
dims[1] = stackResultDim;
}
@@ -37285,7 +37290,12 @@ gridProto._updateScale = function (ecModel, gridModel) {
function unionExtent(data, axis, seriesModel) {
each$1(data.mapDimension(axis.dim, true), function (dim) {
- axis.scale.unionExtentFromData(data, dim);
+ axis.scale.unionExtentFromData(
+ // For example, the extent of the orginal dimension
+ // is [0.1, 0.5], the extent of the `stackResultDimension`
+ // is [7, 9], the final extent should not include [0.1, 0.5].
+ data, getStackedDimension(data, dim)
+ );
});
}
};
@@ -38803,8 +38813,9 @@ var CartesianAxisView = AxisView.extend({
}
var colorIndex = (lineCount++) % lineColors.length;
+ var tickValue = ticksCoords[i].tickValue;
this._axisGroup.add(new Line(subPixelOptimizeLine({
- anid: 'line_' + ticksCoords[i].tickValue,
+ anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,
shape: {
x1: p1[0],
y1: p1[1],
@@ -38893,7 +38904,7 @@ var CartesianAxisView = AxisView.extend({
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
this._axisGroup.add(new Rect({
- anid: 'area_' + tickValue,
+ anid: tickValue != null ? 'area_' + tickValue : null,
shape: {
x: x,
y: y,
@@ -71559,7 +71570,7 @@ function barLayoutPolar(seriesType, ecModel, api) {
var valueDim = data.mapDimension(valueAxis.dim);
var baseDim = data.mapDimension(baseAxis.dim);
- var stacked = isDimensionStacked(data, valueDim, baseDim);
+ var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
var valueAxisStart = valueAxis.getExtent()[0];
@@ -72295,7 +72306,6 @@ extendComponentModel({
// TODO Axis scale
-// 依赖 PolarModel 做预处理
/**
* Resize method bound to the polar
* @param {module:echarts/coord/polar/PolarModel} polarModel
@@ -72332,10 +72342,14 @@ function updatePolarScale(ecModel, api) {
if (seriesModel.coordinateSystem === polar) {
var data = seriesModel.getData();
each$1(data.mapDimension('radius', true), function (dim) {
- radiusAxis.scale.unionExtentFromData(data, dim);
+ radiusAxis.scale.unionExtentFromData(
+ data, getStackedDimension(data, dim)
+ );
});
each$1(data.mapDimension('angle', true), function (dim) {
- angleAxis.scale.unionExtentFromData(data, dim);
+ angleAxis.scale.unionExtentFromData(
+ data, getStackedDimension(data, dim)
+ );
});
}
});
@@ -82617,7 +82631,7 @@ function markerTypeCalculatorWithExtent(
) {
var coordArr = [];
- var stacked = isDimensionStacked(data, targetDataDim, otherDataDim);
+ var stacked = isDimensionStacked(data, targetDataDim /*, otherDataDim*/);
var calcDataDim = stacked
? data.getCalculationInfo('stackResultDimension')
: targetDataDim;
diff --git a/dist/echarts-en.js.map b/dist/echarts-en.js.map
index 3002192..c2b980b 100644
--- a/dist/echarts-en.js.map
+++ b/dist/echarts-en.js.map
@@ -1 +1 @@
-{"version":3,"file":"echarts-en.js","sources":["../src/config.js","../../zrender/src/core/guid.js","../../zrender/src/core/env.js","../../zrender/src/core/util.js","../../zrender/src/core/vector.js","../../zrender/src/mixin/Draggable.js","../../zrender/src/mixin/Eventful.js","../../zrender/src/Handler.js","../../zrender/src/core/matrix.js","../../zrender/src/mixin/Transformable.js","../../zrender/src/animation/easing.js","../../zrender/src/animation/Clip.js","../../zrender/src/core/LRU.j [...]
\ No newline at end of file
+{"version":3,"file":"echarts-en.js","sources":["../src/config.js","../../zrender/src/core/guid.js","../../zrender/src/core/env.js","../../zrender/src/core/util.js","../../zrender/src/core/vector.js","../../zrender/src/mixin/Draggable.js","../../zrender/src/mixin/Eventful.js","../../zrender/src/Handler.js","../../zrender/src/core/matrix.js","../../zrender/src/mixin/Transformable.js","../../zrender/src/animation/easing.js","../../zrender/src/animation/Clip.js","../../zrender/src/core/LRU.j [...]
\ No newline at end of file
diff --git a/dist/echarts-en.min.js b/dist/echarts-en.min.js
index cd01035..0cc5f5b 100644
--- a/dist/echarts-en.min.js
+++ b/dist/echarts-en.min.js
@@ -18,4 +18,4 @@
* under the License.
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(m_=null),p_[t]=e}function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=s_.call(t);if("[object Array]"===n){if(!O(t)){e=[];for(var o=0,a=t.length;o<a;o++)e[o]=i(t[o])}}else if(r_[n]){if(!O(t)){var r=t.constructor;if(t.constructor.from)e=r.from(t);else{e=new r( [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(y_=null),m_[t]=e}function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=u_.call(t);if("[object Array]"===n){if(!O(t)){e=[];for(var o=0,a=t.length;o<a;o++)e[o]=i(t[o])}}else if(l_[n]){if(!O(t)){var r=t.constructor;if(t.constructor.from)e=r.from(t);else{e=new r( [...]
diff --git a/dist/echarts-en.simple.js b/dist/echarts-en.simple.js
index 7808928..e41af00 100644
--- a/dist/echarts-en.simple.js
+++ b/dist/echarts-en.simple.js
@@ -29147,17 +29147,29 @@ function enableDataStack(seriesModel, dimensionInfoList, opt) {
/**
* @param {module:echarts/data/List} data
* @param {string} stackedDim
+ */
+function isDimensionStacked(data, stackedDim /*, stackedByDim*/) {
+ // Each single series only maps to one pair of axis. So we do not need to
+ // check stackByDim, whatever stacked by a dimension or stacked by index.
+ return !!stackedDim && stackedDim === data.getCalculationInfo('stackedDimension');
+ // && (
+ // stackedByDim != null
+ // ? stackedByDim === data.getCalculationInfo('stackedByDimension')
+ // : data.getCalculationInfo('isStackedByIndex')
+ // );
+}
+
+/**
+ * @param {module:echarts/data/List} data
+ * @param {string} targetDim
* @param {string} [stackedByDim] If not input this parameter, check whether
* stacked by index.
+ * @return {string} dimension
*/
-function isDimensionStacked(data, stackedDim, stackedByDim) {
- return stackedDim
- && stackedDim === data.getCalculationInfo('stackedDimension')
- && (
- stackedByDim != null
- ? stackedByDim === data.getCalculationInfo('stackedByDimension')
- : data.getCalculationInfo('isStackedByIndex')
- );
+function getStackedDimension(data, targetDim) {
+ return isDimensionStacked(data, targetDim)
+ ? data.getCalculationInfo('stackResultDimension')
+ : targetDim;
}
/*
@@ -30420,10 +30432,10 @@ function prepareDataCoordInfo(coordSys, data, valueOrigin) {
var stacked;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (stacked |= isDimensionStacked(data, dims[0], dims[1])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[0] /*, dims[1]*/)) { // jshint ignore:line
dims[0] = stackResultDim;
}
- if (stacked |= isDimensionStacked(data, dims[1], dims[0])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[1] /*, dims[0]*/)) { // jshint ignore:line
dims[1] = stackResultDim;
}
@@ -31984,10 +31996,10 @@ var layoutPoints = function (seriesType) {
var dimLen = dims.length;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (isDimensionStacked(data, dims[0], dims[1])) {
+ if (isDimensionStacked(data, dims[0] /*, dims[1]*/)) {
dims[0] = stackResultDim;
}
- if (isDimensionStacked(data, dims[1], dims[0])) {
+ if (isDimensionStacked(data, dims[1] /*, dims[0]*/)) {
dims[1] = stackResultDim;
}
@@ -33147,7 +33159,7 @@ function layout(seriesType, ecModel) {
var valueDim = data.mapDimension(valueAxis.dim);
var baseDim = data.mapDimension(baseAxis.dim);
- var stacked = isDimensionStacked(data, valueDim, baseDim);
+ var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
var isValueAxisH = valueAxis.isHorizontal();
var valueAxisStart = getValueAxisStart(baseAxis, valueAxis, stacked);
@@ -34387,7 +34399,14 @@ function createAxisTicks(axis, tickModel) {
function makeCategoryLabels(axis) {
var labelModel = axis.getLabelModel();
+ var result = makeCategoryLabelsActually(axis, labelModel);
+
+ return (!labelModel.get('show') || axis.scale.isBlank())
+ ? {labels: [], labelCategoryInterval: result.labelCategoryInterval}
+ : result;
+}
+function makeCategoryLabelsActually(axis, labelModel) {
var labelsCache = getListCache(axis, 'labels');
var optionLabelInterval = getOptionCategoryInterval(labelModel);
var result = listCacheGet(labelsCache, optionLabelInterval);
@@ -34399,10 +34418,7 @@ function makeCategoryLabels(axis) {
var labels;
var numericLabelInterval;
- if (!labelModel.get('show') || axis.scale.isBlank()) {
- labels = [];
- }
- else if (isFunction$1(optionLabelInterval)) {
+ if (isFunction$1(optionLabelInterval)) {
labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);
}
else {
@@ -34427,7 +34443,7 @@ function makeCategoryTicks(axis, tickModel) {
}
var ticks;
- var numericTickInterval = optionTickInterval;
+ var tickCategoryInterval;
// Optimize for the case that large category data and no label displayed,
// we should not return all ticks.
@@ -34435,31 +34451,27 @@ function makeCategoryTicks(axis, tickModel) {
ticks = [];
}
- if (isFunction$1(numericTickInterval)) {
- ticks = makeLabelsByCustomizedCategoryInterval(axis, numericTickInterval, true);
+ if (isFunction$1(optionTickInterval)) {
+ ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);
+ }
+ // Always use label interval by default despite label show. Consider this
+ // scenario, Use multiple grid with the xAxis sync, and only one xAxis shows
+ // labels. `splitLine` and `axisTick` should be consistent in this case.
+ else if (optionTickInterval === 'auto') {
+ var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());
+ tickCategoryInterval = labelsResult.labelCategoryInterval;
+ ticks = map(labelsResult.labels, function (labelItem) {
+ return labelItem.tickValue;
+ });
}
- // Always use label interval by default.
else {
- if (numericTickInterval === 'auto') {
- var labelsResult = makeCategoryLabels(axis);
- numericTickInterval = labelsResult.labelCategoryInterval;
- if (numericTickInterval != null) {
- ticks = map(labelsResult.labels, function (labelItem) {
- return labelItem.tickValue;
- });
- }
- else {
- numericTickInterval = makeAutoCategoryInterval(axis, true);
- }
- }
- if (ticks == null) {
- ticks = makeLabelsByNumericCategoryInterval(axis, numericTickInterval, true);
- }
+ tickCategoryInterval = optionTickInterval;
+ ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);
}
// Cache to avoid calling interval function repeatly.
return listCacheSet(ticksCache, optionTickInterval, {
- ticks: ticks, tickCategoryInterval: numericTickInterval
+ ticks: ticks, tickCategoryInterval: tickCategoryInterval
});
}
@@ -34498,16 +34510,11 @@ function listCacheSet(cache, key, value) {
return value;
}
-function makeAutoCategoryInterval(axis, hideLabel) {
- var cacheKey = hideLabel ? 'tickAutoInterval' : 'autoInterval';
- var result = inner$6(axis)[cacheKey];
- if (result != null) {
- return result;
- }
-
- return (
- inner$6(axis)[cacheKey] = axis.calculateCategoryInterval(hideLabel)
- );
+function makeAutoCategoryInterval(axis) {
+ var result = inner$6(axis).autoInterval;
+ return result != null
+ ? result
+ : (inner$6(axis).autoInterval = axis.calculateCategoryInterval());
}
/**
@@ -34515,7 +34522,7 @@ function makeAutoCategoryInterval(axis, hideLabel) {
* To get precise result, at least one of `getRotate` and `isHorizontal`
* should be implemented in axis.
*/
-function calculateCategoryInterval(axis, hideLabel) {
+function calculateCategoryInterval(axis) {
var params = fetchAutoCategoryIntervalCalculationParams(axis);
var labelFormatter = makeLabelFormatter(axis);
var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
@@ -34550,17 +34557,15 @@ function calculateCategoryInterval(axis, hideLabel) {
var width = 0;
var height = 0;
- if (!hideLabel) {
- // Polar is also calculated in assumptive linear layout here.
- // Not precise, do not consider align and vertical align
- // and each distance from axis line yet.
- var rect = getBoundingRect(
- labelFormatter(tickValue), params.font, 'center', 'top'
- );
- // Magic number
- width = rect.width * 1.3;
- height = rect.height * 1.3;
- }
+ // Polar is also calculated in assumptive linear layout here.
+ // Not precise, do not consider align and vertical align
+ // and each distance from axis line yet.
+ var rect = getBoundingRect(
+ labelFormatter(tickValue), params.font, 'center', 'top'
+ );
+ // Magic number
+ width = rect.width * 1.3;
+ height = rect.height * 1.3;
// Min size, void long loop.
maxW = Math.max(maxW, width, 7);
@@ -34964,11 +34969,10 @@ Axis.prototype = {
/**
* Only be called in category axis.
* Can be overrided, consider other axes like in 3D.
- * @param {boolean} hideLabel
* @return {number} Auto interval for cateogry axis tick and label
*/
- calculateCategoryInterval: function (hideLabel) {
- return calculateCategoryInterval(this, hideLabel);
+ calculateCategoryInterval: function () {
+ return calculateCategoryInterval(this);
}
};
@@ -36165,7 +36169,12 @@ gridProto._updateScale = function (ecModel, gridModel) {
function unionExtent(data, axis, seriesModel) {
each$1(data.mapDimension(axis.dim, true), function (dim) {
- axis.scale.unionExtentFromData(data, dim);
+ axis.scale.unionExtentFromData(
+ // For example, the extent of the orginal dimension
+ // is [0.1, 0.5], the extent of the `stackResultDimension`
+ // is [7, 9], the final extent should not include [0.1, 0.5].
+ data, getStackedDimension(data, dim)
+ );
});
}
};
@@ -37434,8 +37443,9 @@ var CartesianAxisView = AxisView.extend({
}
var colorIndex = (lineCount++) % lineColors.length;
+ var tickValue = ticksCoords[i].tickValue;
this._axisGroup.add(new Line(subPixelOptimizeLine({
- anid: 'line_' + ticksCoords[i].tickValue,
+ anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,
shape: {
x1: p1[0],
y1: p1[1],
@@ -37524,7 +37534,7 @@ var CartesianAxisView = AxisView.extend({
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
this._axisGroup.add(new Rect({
- anid: 'area_' + tickValue,
+ anid: tickValue != null ? 'area_' + tickValue : null,
shape: {
x: x,
y: y,
diff --git a/dist/echarts-en.simple.min.js b/dist/echarts-en.simple.min.js
index fb5d9ab..9da1c58 100644
--- a/dist/echarts-en.simple.min.js
+++ b/dist/echarts-en.simple.min.js
@@ -18,4 +18,4 @@
* under the License.
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(Ah=null),Dh[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=wh.call(t);if("[object Array]"===i){if(!E(t)){e=[];for(var r=0,a=t.length;r<a;r++)e[r]=n(t[r])}}else if(xh[i]){if(!E(t)){var o=t.constructor;if(t.constructor.from)e=o.from(t);else{e=new o( [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(Ph=null),Ah[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=Sh.call(t);if("[object Array]"===i){if(!E(t)){e=[];for(var r=0,a=t.length;r<a;r++)e[r]=n(t[r])}}else if(bh[i]){if(!E(t)){var o=t.constructor;if(t.constructor.from)e=o.from(t);else{e=new o( [...]
diff --git a/dist/echarts.common.js b/dist/echarts.common.js
index 3f41da5..4a2fbf6 100644
--- a/dist/echarts.common.js
+++ b/dist/echarts.common.js
@@ -29775,17 +29775,29 @@ function enableDataStack(seriesModel, dimensionInfoList, opt) {
/**
* @param {module:echarts/data/List} data
* @param {string} stackedDim
+ */
+function isDimensionStacked(data, stackedDim /*, stackedByDim*/) {
+ // Each single series only maps to one pair of axis. So we do not need to
+ // check stackByDim, whatever stacked by a dimension or stacked by index.
+ return !!stackedDim && stackedDim === data.getCalculationInfo('stackedDimension');
+ // && (
+ // stackedByDim != null
+ // ? stackedByDim === data.getCalculationInfo('stackedByDimension')
+ // : data.getCalculationInfo('isStackedByIndex')
+ // );
+}
+
+/**
+ * @param {module:echarts/data/List} data
+ * @param {string} targetDim
* @param {string} [stackedByDim] If not input this parameter, check whether
* stacked by index.
+ * @return {string} dimension
*/
-function isDimensionStacked(data, stackedDim, stackedByDim) {
- return stackedDim
- && stackedDim === data.getCalculationInfo('stackedDimension')
- && (
- stackedByDim != null
- ? stackedByDim === data.getCalculationInfo('stackedByDimension')
- : data.getCalculationInfo('isStackedByIndex')
- );
+function getStackedDimension(data, targetDim) {
+ return isDimensionStacked(data, targetDim)
+ ? data.getCalculationInfo('stackResultDimension')
+ : targetDim;
}
/*
@@ -30924,7 +30936,7 @@ function layout(seriesType, ecModel) {
var valueDim = data.mapDimension(valueAxis.dim);
var baseDim = data.mapDimension(baseAxis.dim);
- var stacked = isDimensionStacked(data, valueDim, baseDim);
+ var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
var isValueAxisH = valueAxis.isHorizontal();
var valueAxisStart = getValueAxisStart(baseAxis, valueAxis, stacked);
@@ -32344,7 +32356,8 @@ function createList(seriesModel) {
var dataStack$1 = {
isDimensionStacked: isDimensionStacked,
- enableDataStack: enableDataStack
+ enableDataStack: enableDataStack,
+ getStackedDimension: getStackedDimension
};
/**
@@ -32790,7 +32803,14 @@ function createAxisTicks(axis, tickModel) {
function makeCategoryLabels(axis) {
var labelModel = axis.getLabelModel();
+ var result = makeCategoryLabelsActually(axis, labelModel);
+ return (!labelModel.get('show') || axis.scale.isBlank())
+ ? {labels: [], labelCategoryInterval: result.labelCategoryInterval}
+ : result;
+}
+
+function makeCategoryLabelsActually(axis, labelModel) {
var labelsCache = getListCache(axis, 'labels');
var optionLabelInterval = getOptionCategoryInterval(labelModel);
var result = listCacheGet(labelsCache, optionLabelInterval);
@@ -32802,10 +32822,7 @@ function makeCategoryLabels(axis) {
var labels;
var numericLabelInterval;
- if (!labelModel.get('show') || axis.scale.isBlank()) {
- labels = [];
- }
- else if (isFunction$1(optionLabelInterval)) {
+ if (isFunction$1(optionLabelInterval)) {
labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);
}
else {
@@ -32830,7 +32847,7 @@ function makeCategoryTicks(axis, tickModel) {
}
var ticks;
- var numericTickInterval = optionTickInterval;
+ var tickCategoryInterval;
// Optimize for the case that large category data and no label displayed,
// we should not return all ticks.
@@ -32838,31 +32855,27 @@ function makeCategoryTicks(axis, tickModel) {
ticks = [];
}
- if (isFunction$1(numericTickInterval)) {
- ticks = makeLabelsByCustomizedCategoryInterval(axis, numericTickInterval, true);
+ if (isFunction$1(optionTickInterval)) {
+ ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);
+ }
+ // Always use label interval by default despite label show. Consider this
+ // scenario, Use multiple grid with the xAxis sync, and only one xAxis shows
+ // labels. `splitLine` and `axisTick` should be consistent in this case.
+ else if (optionTickInterval === 'auto') {
+ var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());
+ tickCategoryInterval = labelsResult.labelCategoryInterval;
+ ticks = map(labelsResult.labels, function (labelItem) {
+ return labelItem.tickValue;
+ });
}
- // Always use label interval by default.
else {
- if (numericTickInterval === 'auto') {
- var labelsResult = makeCategoryLabels(axis);
- numericTickInterval = labelsResult.labelCategoryInterval;
- if (numericTickInterval != null) {
- ticks = map(labelsResult.labels, function (labelItem) {
- return labelItem.tickValue;
- });
- }
- else {
- numericTickInterval = makeAutoCategoryInterval(axis, true);
- }
- }
- if (ticks == null) {
- ticks = makeLabelsByNumericCategoryInterval(axis, numericTickInterval, true);
- }
+ tickCategoryInterval = optionTickInterval;
+ ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);
}
// Cache to avoid calling interval function repeatly.
return listCacheSet(ticksCache, optionTickInterval, {
- ticks: ticks, tickCategoryInterval: numericTickInterval
+ ticks: ticks, tickCategoryInterval: tickCategoryInterval
});
}
@@ -32901,16 +32914,11 @@ function listCacheSet(cache, key, value) {
return value;
}
-function makeAutoCategoryInterval(axis, hideLabel) {
- var cacheKey = hideLabel ? 'tickAutoInterval' : 'autoInterval';
- var result = inner$6(axis)[cacheKey];
- if (result != null) {
- return result;
- }
-
- return (
- inner$6(axis)[cacheKey] = axis.calculateCategoryInterval(hideLabel)
- );
+function makeAutoCategoryInterval(axis) {
+ var result = inner$6(axis).autoInterval;
+ return result != null
+ ? result
+ : (inner$6(axis).autoInterval = axis.calculateCategoryInterval());
}
/**
@@ -32918,7 +32926,7 @@ function makeAutoCategoryInterval(axis, hideLabel) {
* To get precise result, at least one of `getRotate` and `isHorizontal`
* should be implemented in axis.
*/
-function calculateCategoryInterval(axis, hideLabel) {
+function calculateCategoryInterval(axis) {
var params = fetchAutoCategoryIntervalCalculationParams(axis);
var labelFormatter = makeLabelFormatter(axis);
var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
@@ -32953,17 +32961,15 @@ function calculateCategoryInterval(axis, hideLabel) {
var width = 0;
var height = 0;
- if (!hideLabel) {
- // Polar is also calculated in assumptive linear layout here.
- // Not precise, do not consider align and vertical align
- // and each distance from axis line yet.
- var rect = getBoundingRect(
- labelFormatter(tickValue), params.font, 'center', 'top'
- );
- // Magic number
- width = rect.width * 1.3;
- height = rect.height * 1.3;
- }
+ // Polar is also calculated in assumptive linear layout here.
+ // Not precise, do not consider align and vertical align
+ // and each distance from axis line yet.
+ var rect = getBoundingRect(
+ labelFormatter(tickValue), params.font, 'center', 'top'
+ );
+ // Magic number
+ width = rect.width * 1.3;
+ height = rect.height * 1.3;
// Min size, void long loop.
maxW = Math.max(maxW, width, 7);
@@ -33367,11 +33373,10 @@ Axis.prototype = {
/**
* Only be called in category axis.
* Can be overrided, consider other axes like in 3D.
- * @param {boolean} hideLabel
* @return {number} Auto interval for cateogry axis tick and label
*/
- calculateCategoryInterval: function (hideLabel) {
- return calculateCategoryInterval(this, hideLabel);
+ calculateCategoryInterval: function () {
+ return calculateCategoryInterval(this);
}
};
@@ -34242,10 +34247,10 @@ function prepareDataCoordInfo(coordSys, data, valueOrigin) {
var stacked;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (stacked |= isDimensionStacked(data, dims[0], dims[1])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[0] /*, dims[1]*/)) { // jshint ignore:line
dims[0] = stackResultDim;
}
- if (stacked |= isDimensionStacked(data, dims[1], dims[0])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[1] /*, dims[0]*/)) { // jshint ignore:line
dims[1] = stackResultDim;
}
@@ -35806,10 +35811,10 @@ var pointsLayout = function (seriesType) {
var dimLen = dims.length;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (isDimensionStacked(data, dims[0], dims[1])) {
+ if (isDimensionStacked(data, dims[0] /*, dims[1]*/)) {
dims[0] = stackResultDim;
}
- if (isDimensionStacked(data, dims[1], dims[0])) {
+ if (isDimensionStacked(data, dims[1] /*, dims[0]*/)) {
dims[1] = stackResultDim;
}
@@ -37250,7 +37255,12 @@ gridProto._updateScale = function (ecModel, gridModel) {
function unionExtent(data, axis, seriesModel) {
each$1(data.mapDimension(axis.dim, true), function (dim) {
- axis.scale.unionExtentFromData(data, dim);
+ axis.scale.unionExtentFromData(
+ // For example, the extent of the orginal dimension
+ // is [0.1, 0.5], the extent of the `stackResultDimension`
+ // is [7, 9], the final extent should not include [0.1, 0.5].
+ data, getStackedDimension(data, dim)
+ );
});
}
};
@@ -38768,8 +38778,9 @@ var CartesianAxisView = AxisView.extend({
}
var colorIndex = (lineCount++) % lineColors.length;
+ var tickValue = ticksCoords[i].tickValue;
this._axisGroup.add(new Line(subPixelOptimizeLine({
- anid: 'line_' + ticksCoords[i].tickValue,
+ anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,
shape: {
x1: p1[0],
y1: p1[1],
@@ -38858,7 +38869,7 @@ var CartesianAxisView = AxisView.extend({
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
this._axisGroup.add(new Rect({
- anid: 'area_' + tickValue,
+ anid: tickValue != null ? 'area_' + tickValue : null,
shape: {
x: x,
y: y,
@@ -46851,7 +46862,7 @@ function markerTypeCalculatorWithExtent(
) {
var coordArr = [];
- var stacked = isDimensionStacked(data, targetDataDim, otherDataDim);
+ var stacked = isDimensionStacked(data, targetDataDim /*, otherDataDim*/);
var calcDataDim = stacked
? data.getCalculationInfo('stackResultDimension')
: targetDataDim;
diff --git a/dist/echarts.common.min.js b/dist/echarts.common.min.js
index 4029961..c9d7323 100644
--- a/dist/echarts.common.min.js
+++ b/dist/echarts.common.min.js
@@ -18,4 +18,4 @@
* under the License.
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(Op=null),Pp[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=Sp.call(t);if("[object Array]"===i){if(!z(t)){e=[];for(var r=0,o=t.length;r<o;r++)e[r]=n(t[r])}}else if(Mp[i]){if(!z(t)){var a=t.constructor;if(t.constructor.from)e=a.from(t);else{e=new a( [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(Ep=null),Op[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=Cp.call(t);if("[object Array]"===i){if(!z(t)){e=[];for(var r=0,o=t.length;r<o;r++)e[r]=n(t[r])}}else if(Ip[i]){if(!z(t)){var a=t.constructor;if(t.constructor.from)e=a.from(t);else{e=new a( [...]
diff --git a/dist/echarts.js b/dist/echarts.js
index b6078dc..c307c36 100644
--- a/dist/echarts.js
+++ b/dist/echarts.js
@@ -29841,17 +29841,29 @@ function enableDataStack(seriesModel, dimensionInfoList, opt) {
/**
* @param {module:echarts/data/List} data
* @param {string} stackedDim
+ */
+function isDimensionStacked(data, stackedDim /*, stackedByDim*/) {
+ // Each single series only maps to one pair of axis. So we do not need to
+ // check stackByDim, whatever stacked by a dimension or stacked by index.
+ return !!stackedDim && stackedDim === data.getCalculationInfo('stackedDimension');
+ // && (
+ // stackedByDim != null
+ // ? stackedByDim === data.getCalculationInfo('stackedByDimension')
+ // : data.getCalculationInfo('isStackedByIndex')
+ // );
+}
+
+/**
+ * @param {module:echarts/data/List} data
+ * @param {string} targetDim
* @param {string} [stackedByDim] If not input this parameter, check whether
* stacked by index.
+ * @return {string} dimension
*/
-function isDimensionStacked(data, stackedDim, stackedByDim) {
- return stackedDim
- && stackedDim === data.getCalculationInfo('stackedDimension')
- && (
- stackedByDim != null
- ? stackedByDim === data.getCalculationInfo('stackedByDimension')
- : data.getCalculationInfo('isStackedByIndex')
- );
+function getStackedDimension(data, targetDim) {
+ return isDimensionStacked(data, targetDim)
+ ? data.getCalculationInfo('stackResultDimension')
+ : targetDim;
}
/*
@@ -31017,7 +31029,7 @@ function layout(seriesType, ecModel) {
var valueDim = data.mapDimension(valueAxis.dim);
var baseDim = data.mapDimension(baseAxis.dim);
- var stacked = isDimensionStacked(data, valueDim, baseDim);
+ var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
var isValueAxisH = valueAxis.isHorizontal();
var valueAxisStart = getValueAxisStart(baseAxis, valueAxis, stacked);
@@ -32437,7 +32449,8 @@ function createList(seriesModel) {
var dataStack$1 = {
isDimensionStacked: isDimensionStacked,
- enableDataStack: enableDataStack
+ enableDataStack: enableDataStack,
+ getStackedDimension: getStackedDimension
};
/**
@@ -32883,7 +32896,14 @@ function createAxisTicks(axis, tickModel) {
function makeCategoryLabels(axis) {
var labelModel = axis.getLabelModel();
+ var result = makeCategoryLabelsActually(axis, labelModel);
+
+ return (!labelModel.get('show') || axis.scale.isBlank())
+ ? {labels: [], labelCategoryInterval: result.labelCategoryInterval}
+ : result;
+}
+function makeCategoryLabelsActually(axis, labelModel) {
var labelsCache = getListCache(axis, 'labels');
var optionLabelInterval = getOptionCategoryInterval(labelModel);
var result = listCacheGet(labelsCache, optionLabelInterval);
@@ -32895,10 +32915,7 @@ function makeCategoryLabels(axis) {
var labels;
var numericLabelInterval;
- if (!labelModel.get('show') || axis.scale.isBlank()) {
- labels = [];
- }
- else if (isFunction$1(optionLabelInterval)) {
+ if (isFunction$1(optionLabelInterval)) {
labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);
}
else {
@@ -32923,7 +32940,7 @@ function makeCategoryTicks(axis, tickModel) {
}
var ticks;
- var numericTickInterval = optionTickInterval;
+ var tickCategoryInterval;
// Optimize for the case that large category data and no label displayed,
// we should not return all ticks.
@@ -32931,31 +32948,27 @@ function makeCategoryTicks(axis, tickModel) {
ticks = [];
}
- if (isFunction$1(numericTickInterval)) {
- ticks = makeLabelsByCustomizedCategoryInterval(axis, numericTickInterval, true);
+ if (isFunction$1(optionTickInterval)) {
+ ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);
+ }
+ // Always use label interval by default despite label show. Consider this
+ // scenario, Use multiple grid with the xAxis sync, and only one xAxis shows
+ // labels. `splitLine` and `axisTick` should be consistent in this case.
+ else if (optionTickInterval === 'auto') {
+ var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());
+ tickCategoryInterval = labelsResult.labelCategoryInterval;
+ ticks = map(labelsResult.labels, function (labelItem) {
+ return labelItem.tickValue;
+ });
}
- // Always use label interval by default.
else {
- if (numericTickInterval === 'auto') {
- var labelsResult = makeCategoryLabels(axis);
- numericTickInterval = labelsResult.labelCategoryInterval;
- if (numericTickInterval != null) {
- ticks = map(labelsResult.labels, function (labelItem) {
- return labelItem.tickValue;
- });
- }
- else {
- numericTickInterval = makeAutoCategoryInterval(axis, true);
- }
- }
- if (ticks == null) {
- ticks = makeLabelsByNumericCategoryInterval(axis, numericTickInterval, true);
- }
+ tickCategoryInterval = optionTickInterval;
+ ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);
}
// Cache to avoid calling interval function repeatly.
return listCacheSet(ticksCache, optionTickInterval, {
- ticks: ticks, tickCategoryInterval: numericTickInterval
+ ticks: ticks, tickCategoryInterval: tickCategoryInterval
});
}
@@ -32994,16 +33007,11 @@ function listCacheSet(cache, key, value) {
return value;
}
-function makeAutoCategoryInterval(axis, hideLabel) {
- var cacheKey = hideLabel ? 'tickAutoInterval' : 'autoInterval';
- var result = inner$6(axis)[cacheKey];
- if (result != null) {
- return result;
- }
-
- return (
- inner$6(axis)[cacheKey] = axis.calculateCategoryInterval(hideLabel)
- );
+function makeAutoCategoryInterval(axis) {
+ var result = inner$6(axis).autoInterval;
+ return result != null
+ ? result
+ : (inner$6(axis).autoInterval = axis.calculateCategoryInterval());
}
/**
@@ -33011,7 +33019,7 @@ function makeAutoCategoryInterval(axis, hideLabel) {
* To get precise result, at least one of `getRotate` and `isHorizontal`
* should be implemented in axis.
*/
-function calculateCategoryInterval(axis, hideLabel) {
+function calculateCategoryInterval(axis) {
var params = fetchAutoCategoryIntervalCalculationParams(axis);
var labelFormatter = makeLabelFormatter(axis);
var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
@@ -33046,17 +33054,15 @@ function calculateCategoryInterval(axis, hideLabel) {
var width = 0;
var height = 0;
- if (!hideLabel) {
- // Polar is also calculated in assumptive linear layout here.
- // Not precise, do not consider align and vertical align
- // and each distance from axis line yet.
- var rect = getBoundingRect(
- labelFormatter(tickValue), params.font, 'center', 'top'
- );
- // Magic number
- width = rect.width * 1.3;
- height = rect.height * 1.3;
- }
+ // Polar is also calculated in assumptive linear layout here.
+ // Not precise, do not consider align and vertical align
+ // and each distance from axis line yet.
+ var rect = getBoundingRect(
+ labelFormatter(tickValue), params.font, 'center', 'top'
+ );
+ // Magic number
+ width = rect.width * 1.3;
+ height = rect.height * 1.3;
// Min size, void long loop.
maxW = Math.max(maxW, width, 7);
@@ -33460,11 +33466,10 @@ Axis.prototype = {
/**
* Only be called in category axis.
* Can be overrided, consider other axes like in 3D.
- * @param {boolean} hideLabel
* @return {number} Auto interval for cateogry axis tick and label
*/
- calculateCategoryInterval: function (hideLabel) {
- return calculateCategoryInterval(this, hideLabel);
+ calculateCategoryInterval: function () {
+ return calculateCategoryInterval(this);
}
};
@@ -34335,10 +34340,10 @@ function prepareDataCoordInfo(coordSys, data, valueOrigin) {
var stacked;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (stacked |= isDimensionStacked(data, dims[0], dims[1])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[0] /*, dims[1]*/)) { // jshint ignore:line
dims[0] = stackResultDim;
}
- if (stacked |= isDimensionStacked(data, dims[1], dims[0])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[1] /*, dims[0]*/)) { // jshint ignore:line
dims[1] = stackResultDim;
}
@@ -35899,10 +35904,10 @@ var pointsLayout = function (seriesType) {
var dimLen = dims.length;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (isDimensionStacked(data, dims[0], dims[1])) {
+ if (isDimensionStacked(data, dims[0] /*, dims[1]*/)) {
dims[0] = stackResultDim;
}
- if (isDimensionStacked(data, dims[1], dims[0])) {
+ if (isDimensionStacked(data, dims[1] /*, dims[0]*/)) {
dims[1] = stackResultDim;
}
@@ -37343,7 +37348,12 @@ gridProto._updateScale = function (ecModel, gridModel) {
function unionExtent(data, axis, seriesModel) {
each$1(data.mapDimension(axis.dim, true), function (dim) {
- axis.scale.unionExtentFromData(data, dim);
+ axis.scale.unionExtentFromData(
+ // For example, the extent of the orginal dimension
+ // is [0.1, 0.5], the extent of the `stackResultDimension`
+ // is [7, 9], the final extent should not include [0.1, 0.5].
+ data, getStackedDimension(data, dim)
+ );
});
}
};
@@ -38861,8 +38871,9 @@ var CartesianAxisView = AxisView.extend({
}
var colorIndex = (lineCount++) % lineColors.length;
+ var tickValue = ticksCoords[i].tickValue;
this._axisGroup.add(new Line(subPixelOptimizeLine({
- anid: 'line_' + ticksCoords[i].tickValue,
+ anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,
shape: {
x1: p1[0],
y1: p1[1],
@@ -38951,7 +38962,7 @@ var CartesianAxisView = AxisView.extend({
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
this._axisGroup.add(new Rect({
- anid: 'area_' + tickValue,
+ anid: tickValue != null ? 'area_' + tickValue : null,
shape: {
x: x,
y: y,
@@ -71617,7 +71628,7 @@ function barLayoutPolar(seriesType, ecModel, api) {
var valueDim = data.mapDimension(valueAxis.dim);
var baseDim = data.mapDimension(baseAxis.dim);
- var stacked = isDimensionStacked(data, valueDim, baseDim);
+ var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
var valueAxisStart = valueAxis.getExtent()[0];
@@ -72353,7 +72364,6 @@ extendComponentModel({
// TODO Axis scale
-// 依赖 PolarModel 做预处理
/**
* Resize method bound to the polar
* @param {module:echarts/coord/polar/PolarModel} polarModel
@@ -72390,10 +72400,14 @@ function updatePolarScale(ecModel, api) {
if (seriesModel.coordinateSystem === polar) {
var data = seriesModel.getData();
each$1(data.mapDimension('radius', true), function (dim) {
- radiusAxis.scale.unionExtentFromData(data, dim);
+ radiusAxis.scale.unionExtentFromData(
+ data, getStackedDimension(data, dim)
+ );
});
each$1(data.mapDimension('angle', true), function (dim) {
- angleAxis.scale.unionExtentFromData(data, dim);
+ angleAxis.scale.unionExtentFromData(
+ data, getStackedDimension(data, dim)
+ );
});
}
});
@@ -82675,7 +82689,7 @@ function markerTypeCalculatorWithExtent(
) {
var coordArr = [];
- var stacked = isDimensionStacked(data, targetDataDim, otherDataDim);
+ var stacked = isDimensionStacked(data, targetDataDim /*, otherDataDim*/);
var calcDataDim = stacked
? data.getCalculationInfo('stackResultDimension')
: targetDataDim;
diff --git a/dist/echarts.js.map b/dist/echarts.js.map
index 807b038..2bef076 100644
--- a/dist/echarts.js.map
+++ b/dist/echarts.js.map
@@ -1 +1 @@
-{"version":3,"file":"echarts.js","sources":["../src/config.js","../../zrender/src/core/guid.js","../../zrender/src/core/env.js","../../zrender/src/core/util.js","../../zrender/src/core/vector.js","../../zrender/src/mixin/Draggable.js","../../zrender/src/mixin/Eventful.js","../../zrender/src/Handler.js","../../zrender/src/core/matrix.js","../../zrender/src/mixin/Transformable.js","../../zrender/src/animation/easing.js","../../zrender/src/animation/Clip.js","../../zrender/src/core/LRU.js", [...]
\ No newline at end of file
+{"version":3,"file":"echarts.js","sources":["../src/config.js","../../zrender/src/core/guid.js","../../zrender/src/core/env.js","../../zrender/src/core/util.js","../../zrender/src/core/vector.js","../../zrender/src/mixin/Draggable.js","../../zrender/src/mixin/Eventful.js","../../zrender/src/Handler.js","../../zrender/src/core/matrix.js","../../zrender/src/mixin/Transformable.js","../../zrender/src/animation/easing.js","../../zrender/src/animation/Clip.js","../../zrender/src/core/LRU.js", [...]
\ No newline at end of file
diff --git a/dist/echarts.min.js b/dist/echarts.min.js
index 3c18cd8..5407fb0 100644
--- a/dist/echarts.min.js
+++ b/dist/echarts.min.js
@@ -18,4 +18,4 @@
* under the License.
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(m_=null),p_[t]=e}function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=s_.call(t);if("[object Array]"===n){if(!O(t)){e=[];for(var o=0,a=t.length;o<a;o++)e[o]=i(t[o])}}else if(r_[n]){if(!O(t)){var r=t.constructor;if(t.constructor.from)e=r.from(t);else{e=new r( [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(y_=null),m_[t]=e}function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=u_.call(t);if("[object Array]"===n){if(!O(t)){e=[];for(var o=0,a=t.length;o<a;o++)e[o]=i(t[o])}}else if(l_[n]){if(!O(t)){var r=t.constructor;if(t.constructor.from)e=r.from(t);else{e=new r( [...]
diff --git a/dist/echarts.simple.js b/dist/echarts.simple.js
index f396680..fd516b1 100644
--- a/dist/echarts.simple.js
+++ b/dist/echarts.simple.js
@@ -29205,17 +29205,29 @@ function enableDataStack(seriesModel, dimensionInfoList, opt) {
/**
* @param {module:echarts/data/List} data
* @param {string} stackedDim
+ */
+function isDimensionStacked(data, stackedDim /*, stackedByDim*/) {
+ // Each single series only maps to one pair of axis. So we do not need to
+ // check stackByDim, whatever stacked by a dimension or stacked by index.
+ return !!stackedDim && stackedDim === data.getCalculationInfo('stackedDimension');
+ // && (
+ // stackedByDim != null
+ // ? stackedByDim === data.getCalculationInfo('stackedByDimension')
+ // : data.getCalculationInfo('isStackedByIndex')
+ // );
+}
+
+/**
+ * @param {module:echarts/data/List} data
+ * @param {string} targetDim
* @param {string} [stackedByDim] If not input this parameter, check whether
* stacked by index.
+ * @return {string} dimension
*/
-function isDimensionStacked(data, stackedDim, stackedByDim) {
- return stackedDim
- && stackedDim === data.getCalculationInfo('stackedDimension')
- && (
- stackedByDim != null
- ? stackedByDim === data.getCalculationInfo('stackedByDimension')
- : data.getCalculationInfo('isStackedByIndex')
- );
+function getStackedDimension(data, targetDim) {
+ return isDimensionStacked(data, targetDim)
+ ? data.getCalculationInfo('stackResultDimension')
+ : targetDim;
}
/*
@@ -30478,10 +30490,10 @@ function prepareDataCoordInfo(coordSys, data, valueOrigin) {
var stacked;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (stacked |= isDimensionStacked(data, dims[0], dims[1])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[0] /*, dims[1]*/)) { // jshint ignore:line
dims[0] = stackResultDim;
}
- if (stacked |= isDimensionStacked(data, dims[1], dims[0])) { // jshint ignore:line
+ if (stacked |= isDimensionStacked(data, dims[1] /*, dims[0]*/)) { // jshint ignore:line
dims[1] = stackResultDim;
}
@@ -32042,10 +32054,10 @@ var layoutPoints = function (seriesType) {
var dimLen = dims.length;
var stackResultDim = data.getCalculationInfo('stackResultDimension');
- if (isDimensionStacked(data, dims[0], dims[1])) {
+ if (isDimensionStacked(data, dims[0] /*, dims[1]*/)) {
dims[0] = stackResultDim;
}
- if (isDimensionStacked(data, dims[1], dims[0])) {
+ if (isDimensionStacked(data, dims[1] /*, dims[0]*/)) {
dims[1] = stackResultDim;
}
@@ -33205,7 +33217,7 @@ function layout(seriesType, ecModel) {
var valueDim = data.mapDimension(valueAxis.dim);
var baseDim = data.mapDimension(baseAxis.dim);
- var stacked = isDimensionStacked(data, valueDim, baseDim);
+ var stacked = isDimensionStacked(data, valueDim /*, baseDim*/);
var isValueAxisH = valueAxis.isHorizontal();
var valueAxisStart = getValueAxisStart(baseAxis, valueAxis, stacked);
@@ -34445,7 +34457,14 @@ function createAxisTicks(axis, tickModel) {
function makeCategoryLabels(axis) {
var labelModel = axis.getLabelModel();
+ var result = makeCategoryLabelsActually(axis, labelModel);
+
+ return (!labelModel.get('show') || axis.scale.isBlank())
+ ? {labels: [], labelCategoryInterval: result.labelCategoryInterval}
+ : result;
+}
+function makeCategoryLabelsActually(axis, labelModel) {
var labelsCache = getListCache(axis, 'labels');
var optionLabelInterval = getOptionCategoryInterval(labelModel);
var result = listCacheGet(labelsCache, optionLabelInterval);
@@ -34457,10 +34476,7 @@ function makeCategoryLabels(axis) {
var labels;
var numericLabelInterval;
- if (!labelModel.get('show') || axis.scale.isBlank()) {
- labels = [];
- }
- else if (isFunction$1(optionLabelInterval)) {
+ if (isFunction$1(optionLabelInterval)) {
labels = makeLabelsByCustomizedCategoryInterval(axis, optionLabelInterval);
}
else {
@@ -34485,7 +34501,7 @@ function makeCategoryTicks(axis, tickModel) {
}
var ticks;
- var numericTickInterval = optionTickInterval;
+ var tickCategoryInterval;
// Optimize for the case that large category data and no label displayed,
// we should not return all ticks.
@@ -34493,31 +34509,27 @@ function makeCategoryTicks(axis, tickModel) {
ticks = [];
}
- if (isFunction$1(numericTickInterval)) {
- ticks = makeLabelsByCustomizedCategoryInterval(axis, numericTickInterval, true);
+ if (isFunction$1(optionTickInterval)) {
+ ticks = makeLabelsByCustomizedCategoryInterval(axis, optionTickInterval, true);
+ }
+ // Always use label interval by default despite label show. Consider this
+ // scenario, Use multiple grid with the xAxis sync, and only one xAxis shows
+ // labels. `splitLine` and `axisTick` should be consistent in this case.
+ else if (optionTickInterval === 'auto') {
+ var labelsResult = makeCategoryLabelsActually(axis, axis.getLabelModel());
+ tickCategoryInterval = labelsResult.labelCategoryInterval;
+ ticks = map(labelsResult.labels, function (labelItem) {
+ return labelItem.tickValue;
+ });
}
- // Always use label interval by default.
else {
- if (numericTickInterval === 'auto') {
- var labelsResult = makeCategoryLabels(axis);
- numericTickInterval = labelsResult.labelCategoryInterval;
- if (numericTickInterval != null) {
- ticks = map(labelsResult.labels, function (labelItem) {
- return labelItem.tickValue;
- });
- }
- else {
- numericTickInterval = makeAutoCategoryInterval(axis, true);
- }
- }
- if (ticks == null) {
- ticks = makeLabelsByNumericCategoryInterval(axis, numericTickInterval, true);
- }
+ tickCategoryInterval = optionTickInterval;
+ ticks = makeLabelsByNumericCategoryInterval(axis, tickCategoryInterval, true);
}
// Cache to avoid calling interval function repeatly.
return listCacheSet(ticksCache, optionTickInterval, {
- ticks: ticks, tickCategoryInterval: numericTickInterval
+ ticks: ticks, tickCategoryInterval: tickCategoryInterval
});
}
@@ -34556,16 +34568,11 @@ function listCacheSet(cache, key, value) {
return value;
}
-function makeAutoCategoryInterval(axis, hideLabel) {
- var cacheKey = hideLabel ? 'tickAutoInterval' : 'autoInterval';
- var result = inner$6(axis)[cacheKey];
- if (result != null) {
- return result;
- }
-
- return (
- inner$6(axis)[cacheKey] = axis.calculateCategoryInterval(hideLabel)
- );
+function makeAutoCategoryInterval(axis) {
+ var result = inner$6(axis).autoInterval;
+ return result != null
+ ? result
+ : (inner$6(axis).autoInterval = axis.calculateCategoryInterval());
}
/**
@@ -34573,7 +34580,7 @@ function makeAutoCategoryInterval(axis, hideLabel) {
* To get precise result, at least one of `getRotate` and `isHorizontal`
* should be implemented in axis.
*/
-function calculateCategoryInterval(axis, hideLabel) {
+function calculateCategoryInterval(axis) {
var params = fetchAutoCategoryIntervalCalculationParams(axis);
var labelFormatter = makeLabelFormatter(axis);
var rotation = (params.axisRotate - params.labelRotate) / 180 * Math.PI;
@@ -34608,17 +34615,15 @@ function calculateCategoryInterval(axis, hideLabel) {
var width = 0;
var height = 0;
- if (!hideLabel) {
- // Polar is also calculated in assumptive linear layout here.
- // Not precise, do not consider align and vertical align
- // and each distance from axis line yet.
- var rect = getBoundingRect(
- labelFormatter(tickValue), params.font, 'center', 'top'
- );
- // Magic number
- width = rect.width * 1.3;
- height = rect.height * 1.3;
- }
+ // Polar is also calculated in assumptive linear layout here.
+ // Not precise, do not consider align and vertical align
+ // and each distance from axis line yet.
+ var rect = getBoundingRect(
+ labelFormatter(tickValue), params.font, 'center', 'top'
+ );
+ // Magic number
+ width = rect.width * 1.3;
+ height = rect.height * 1.3;
// Min size, void long loop.
maxW = Math.max(maxW, width, 7);
@@ -35022,11 +35027,10 @@ Axis.prototype = {
/**
* Only be called in category axis.
* Can be overrided, consider other axes like in 3D.
- * @param {boolean} hideLabel
* @return {number} Auto interval for cateogry axis tick and label
*/
- calculateCategoryInterval: function (hideLabel) {
- return calculateCategoryInterval(this, hideLabel);
+ calculateCategoryInterval: function () {
+ return calculateCategoryInterval(this);
}
};
@@ -36223,7 +36227,12 @@ gridProto._updateScale = function (ecModel, gridModel) {
function unionExtent(data, axis, seriesModel) {
each$1(data.mapDimension(axis.dim, true), function (dim) {
- axis.scale.unionExtentFromData(data, dim);
+ axis.scale.unionExtentFromData(
+ // For example, the extent of the orginal dimension
+ // is [0.1, 0.5], the extent of the `stackResultDimension`
+ // is [7, 9], the final extent should not include [0.1, 0.5].
+ data, getStackedDimension(data, dim)
+ );
});
}
};
@@ -37492,8 +37501,9 @@ var CartesianAxisView = AxisView.extend({
}
var colorIndex = (lineCount++) % lineColors.length;
+ var tickValue = ticksCoords[i].tickValue;
this._axisGroup.add(new Line(subPixelOptimizeLine({
- anid: 'line_' + ticksCoords[i].tickValue,
+ anid: tickValue != null ? 'line_' + ticksCoords[i].tickValue : null,
shape: {
x1: p1[0],
y1: p1[1],
@@ -37582,7 +37592,7 @@ var CartesianAxisView = AxisView.extend({
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
this._axisGroup.add(new Rect({
- anid: 'area_' + tickValue,
+ anid: tickValue != null ? 'area_' + tickValue : null,
shape: {
x: x,
y: y,
diff --git a/dist/echarts.simple.min.js b/dist/echarts.simple.min.js
index a5c0bf8..36cb2fa 100644
--- a/dist/echarts.simple.min.js
+++ b/dist/echarts.simple.min.js
@@ -18,4 +18,4 @@
* under the License.
*/
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(Ah=null),Dh[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=wh.call(t);if("[object Array]"===i){if(!E(t)){e=[];for(var r=0,a=t.length;r<a;r++)e[r]=n(t[r])}}else if(xh[i]){if(!E(t)){var o=t.constructor;if(t.constructor.from)e=o.from(t);else{e=new o( [...]
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(Ph=null),Ah[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=Mh.call(t);if("[object Array]"===i){if(!E(t)){e=[];for(var r=0,a=t.length;r<a;r++)e[r]=n(t[r])}}else if(bh[i]){if(!E(t)){var o=t.constructor;if(t.constructor.from)e=o.from(t);else{e=new o( [...]
--
To stop receiving notification emails like this one, please contact
sushuang@apache.org.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org