diff --git a/src/chart/line/LineView.js b/src/chart/line/LineView.js index 2698b228da3f9f9fa8e4a4148064b3fa1319cce7..e44fff6ea7fd632b5829bf8142397f89aa623546 100644 --- a/src/chart/line/LineView.js +++ b/src/chart/line/LineView.js @@ -56,7 +56,7 @@ function getStackedOnPoints(coordSys, data, dataCoordInfo) { for (var idx = 0, len = data.count(); idx < len; idx++) { points.push(getStackedOnPoint(dataCoordInfo, coordSys, data, idx)); } -console.log(JSON.stringify(points)); + return points; } diff --git a/src/data/helper/dimensionHelper.js b/src/data/helper/dimensionHelper.js index b3547f2a4ffb3238706cf453aa18de4d2bfe9201..c2094f1523a95f81c659aa6bf2e732f7c3b76043 100644 --- a/src/data/helper/dimensionHelper.js +++ b/src/data/helper/dimensionHelper.js @@ -8,7 +8,7 @@ export var OTHER_DIMENSIONS = createHashMap([ export function summarizeDimensions(data) { var summary = {}; var encode = summary.encode = {}; - var coordDimMap = summary.coordDimMap = createHashMap(); + var notExtraCoordDimMap = createHashMap(); var defaultedLabel = []; each(data.dimensions, function (dimName) { @@ -25,14 +25,16 @@ export function summarizeDimensions(data) { } coordDimArr[dimItem.coordDimIndex] = dimName; - if (!dimItem.isExtraCoord && mayLabelDimType(dimItem.type)) { - // Use the last coord dim (and label friendly) as default label, - // because both show x, y on label is not look good, and usually - // y axis is more focusd conventionally. - defaultedLabel[0] = dimName; - } + if (!dimItem.isExtraCoord) { + notExtraCoordDimMap.set(coordDim, 1); - coordDimMap.set(coordDim, 1); + if (mayLabelDimType(dimItem.type)) { + // Use the last coord dim (and label friendly) as default label, + // because both show x, y on label is not look good, and usually + // y axis is more focusd conventionally. + defaultedLabel[0] = dimName; + } + } } OTHER_DIMENSIONS.each(function (v, otherDim) { @@ -49,12 +51,21 @@ export function summarizeDimensions(data) { }); var dataDimsOnCoord = []; - // ??? FIXME extra coord should not be set in dataDimsOnCoord. - // Fix the case that radar axes. - coordDimMap.each(function (v, coordDim) { - dataDimsOnCoord = dataDimsOnCoord.concat(encode[coordDim]); + var encodeFirstDimNotExtra = {}; + + notExtraCoordDimMap.each(function (v, coordDim) { + var dimArr = encode[coordDim]; + // ??? FIXME extra coord should not be set in dataDimsOnCoord. + // But should fix the case that radar axes: simplify the logic + // of `completeDimension`, remove `extraPrefix`. + encodeFirstDimNotExtra[coordDim] = dimArr[0]; + // Not necessary to remove duplicate, because a data + // dim canot on more than one coordDim. + dataDimsOnCoord = dataDimsOnCoord.concat(dimArr); }); + summary.dataDimsOnCoord = dataDimsOnCoord; + summary.encodeFirstDimNotExtra = encodeFirstDimNotExtra; var encodeLabel = encode.label; // FIXME `encode.label` is not recommanded, because formatter can not be set @@ -72,18 +83,6 @@ export function summarizeDimensions(data) { encode.defaultedLabel = defaultedLabel; encode.defaultedTooltip = defaultedTooltip; - var encodeFirstDimNotExtra = summary.encodeFirstDimNotExtra = {}; - each(encode, function (coordDimArr, coordDim) { - for (var i = 0; i < (coordDimArr || []).length; i++) { - var dim = coordDimArr[i]; - var dimInfo = data.getDimensionInfo(dim); - if (dimInfo && !dimInfo.isExtraCoord) { - encodeFirstDimNotExtra[coordDim] = dim; - break; - } - } - }); - return summary; } diff --git a/test/dataset-category.html b/test/dataset-category.html index 1950823edc090e675b9dfc87d47934eb5c9154f4..926ab2fb8e76fd0623bc0cc00d3ee9716e5307ea 100644 --- a/test/dataset-category.html +++ b/test/dataset-category.html @@ -30,6 +30,10 @@
+ + + + @@ -753,8 +757,6 @@ - - + + + + + + + + + + + + + + + + + + + + + + +