From 280d7e1df46578c05cce05abde363f2c3e9fa9db Mon Sep 17 00:00:00 2001 From: xie cong Date: Fri, 30 Nov 2012 18:01:11 +0800 Subject: [PATCH] data changed --- lib/charts/chord.js | 28 ++++++++++++++-------------- lib/charts/radar.js | 27 +++++++++++++-------------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/lib/charts/chord.js b/lib/charts/chord.js index 08aa15b..64a1d9d 100644 --- a/lib/charts/chord.js +++ b/lib/charts/chord.js @@ -115,28 +115,28 @@ //底框 underBn.push(paper.rect(legendArea[0] + 10, legendArea[1] + 10 + (20 + 3) * i, 180, 20).attr({ "fill": "#ebebeb", - "stroke": "none" + "stroke": "none" //"r": 3 }).hide()); //色框 paper.rect(legendArea[0] + 10 + 3, legendArea[1] + 10 + (20 + 3) * i + 6, 16, 8).attr({ "fill": this.getColor(i), - "stroke": "none" + "stroke": "none" }); //文字 paper.text(legendArea[0] + 10 + 3 + 16 + 8, legendArea[1] + 10 + (20 + 3) * i + 10, this.groupNames[i]).attr({ "fill": "black", - "fill-opacity": 1, - "font-family": "Verdana", - "font-size": 12 + "fill-opacity": 1, + "font-family": "Verdana", + "font-size": 12 }).attr({ "text-anchor": "start" }); //选框 rectBn.push(paper.rect(legendArea[0] + 10, legendArea[1] + 10 + (20 + 3) * i, 180, 20).attr({ "fill": "white", - "fill-opacity": 0, - "stroke": "none" + "fill-opacity": 0, + "stroke": "none" //"r": 3 })).data("clicked", 0); } @@ -396,10 +396,10 @@ chordEle = that.canvas.path(belt). translate((that.defaults.width - this.xOffset) / 2 + this.xOffset, that.defaults.height / 2).attr({ "path": belt, - "fill": that.getColor(colorCalc(t)), - "fill-opacity": 0.6, - "stroke": "#d6d6d6", - "stroke-opacity": 0.1 + "fill": that.getColor(colorCalc(t)), + "fill-opacity": 0.6, + "stroke": "#d6d6d6", + "stroke-opacity": 0.1 }).hover(mouseoverChord, mouseoutChord).data("source", chords[t].source.index).data("target", chords[t].target.index); //.attr("fill", fillColor(chords[t].target.index)) chordEle.data('text', tips); @@ -427,8 +427,8 @@ donutEle = that.canvas.path(spline).translate((that.defaults.width - this.xOffset) / 2 + this.xOffset, that.defaults.height / 2).data("donutIndex", i).attr({ "path": spline, - "fill": that.getColor(i), - "stroke": that.getColor(i) + "fill": that.getColor(i), + "stroke": that.getColor(i) }).mouseover(mouseOverDonut).mouseout(mouseOutDonut); donutEle.data('text', tips); that.donutGroups.push(donutEle); @@ -468,7 +468,7 @@ tickLine = "M" + aX + "," + aY + "L" + bX + "," + bY; that.canvas.path(tickLine).attr({ 'stroke': "#929292", - "stroke-width": '1px' + "stroke-width": '1px' }); //绘制刻度 //每隔五个刻度,绘制一次文字 diff --git a/lib/charts/radar.js b/lib/charts/radar.js index e72dbd8..61e4f05 100644 --- a/lib/charts/radar.js +++ b/lib/charts/radar.js @@ -339,34 +339,33 @@ var source = this.source; - table.forEach(function(row,i){ - if(that.allDimensions.indexOf(row[map.dimName])===-1){ + table.forEach(function (row, i) { + if (that.allDimensions.indexOf(row[map.dimName]) === -1) { that.allDimensions.push(row[map.dimName]); that.dimensionType[row[map.dimName]] = "quantitative"; } - var j=0; - for(;j=source.length){ - var obj={}; + if (j >= source.length) { + var obj = {}; obj.name = row[map.label]; source.push(obj); } var d = row[map.dimValue]; - if(DataV.isNumeric(row[map.dimValue])){ + if (DataV.isNumeric(row[map.dimValue])) { source[j][row[map.dimName]] = parseFloat(row[map.dimValue]); - } - else { + } else { source[j][row[map.dimName]] = row[map.dimValue]; that.dimensionType[that.allDimensions[i]] = "ordinal"; } }); -/* + /* this.source = DataV.collectionify(table); @@ -455,7 +454,7 @@ //色框 paper.rect(legendArea[0] + 10 + 3, legendArea[1] - 6 - (20 + 3) * i - 6, 16, 8).attr({ "fill": this.getColor(i), - "stroke": "none" + "stroke": "none" }); //文字 paper.text(legendArea[0] + 10 + 3 + 16 + 8, legendArea[1] - 10 - (20 + 3) * i, this.groups[i].data('name')).attr({ @@ -521,8 +520,8 @@ } groups[i].data('clicked', false).attr({ 'stroke-width': 2, - 'fill': "", - 'fill-opacity': 0 + 'fill': "", + 'fill-opacity': 0 }); underBn[i].hide(); } else {