提交 44c157fb 编写于 作者: S sushuang

release 4.1.0.rc1

上级 8afaf845
......@@ -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;
此差异已折叠。
......@@ -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;
此差异已折叠。
此差异已折叠。
......@@ -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,
此差异已折叠。
......@@ -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;
此差异已折叠。
......@@ -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;
此差异已折叠。
此差异已折叠。
......@@ -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,
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册