From e10277eeab5ad62878b9044972acd97100f99da3 Mon Sep 17 00:00:00 2001 From: lang Date: Wed, 26 Aug 2015 17:08:55 +0800 Subject: [PATCH] =?UTF-8?q?List=20entry=20=E4=B8=8D=E6=B7=B7=E6=B7=86=20ge?= =?UTF-8?q?tY=20=E5=92=8C=20getValue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/coord/cartesian/Cartesian2D.js | 2 +- src/coord/cartesian/Grid.js | 2 +- src/data/List.js | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/coord/cartesian/Cartesian2D.js b/src/coord/cartesian/Cartesian2D.js index b3a9010a3..42b94b312 100644 --- a/src/coord/cartesian/Cartesian2D.js +++ b/src/coord/cartesian/Cartesian2D.js @@ -34,7 +34,7 @@ define(function(require) { var categoryAxis = this.getAxesByScale('ordinal')[0]; var swapAxis = categoryAxis && categoryAxis.dim === 'y'; var x = dataItem.getX(); - var y = dataItem.getY(); + var y = categoryAxis ? dataItem.getValue() : dataItem.getY(); var coord = []; coord[xIndex] = xAxis.dataToCoord(swapAxis ? y : x); diff --git a/src/coord/cartesian/Grid.js b/src/coord/cartesian/Grid.js index 7681a34dc..624e1e43a 100644 --- a/src/coord/cartesian/Grid.js +++ b/src/coord/cartesian/Grid.js @@ -254,7 +254,7 @@ define(function(require, factory) { }); } else { - data.eachY(function (value) { + data.eachValue(function (value) { axisData[categoryAxis.dim == 'y' ? 'x' : 'y'].push(value); }); } diff --git a/src/data/List.js b/src/data/List.js index e99faaa53..8cfd6a20d 100644 --- a/src/data/List.js +++ b/src/data/List.js @@ -86,10 +86,6 @@ define(function(require) { if (this.dimension > 1) { return this._value[1]; } - else { - // Value is a single number if data is 1d - return this._value; - } }, /** @@ -99,9 +95,6 @@ define(function(require) { if (this.dimension > 1) { this._value[1] = y; } - else { - this._value = y; - } }, /** @@ -126,6 +119,11 @@ define(function(require) { * @return {number} */ getValue: function () { + // PENDING + // Value is a single number if data is 1d + if (this.dimension === 1) { + return this._value; + } return this._value[this.dimension]; }, @@ -133,7 +131,12 @@ define(function(require) { * @param {number} value */ setValue: function (value) { - this._value[this.dimension] = value + if (this.dimension === 1) { + this._value = value; + } + else { + this._value[this.dimension] = value + } }, clone: function () { -- GitLab