Hi,
I am developing a d3 chart plotting some biological data to it, but I am having some problems while trying to implement a simple line chart into my svg.
I have:
my variable max_[0] is the one with all necessary data:
console:
max_[0]
Object {key: "MOT_10", values: Array[256]}
- key: "MOT_10"
- values: Array[256]
- [0 … 99]
- 0: Object
- MAX: 0.833333
- MOTIF_NAME: "MOT_10"
- POSITION: 26773
- __proto__: Object
- 1: Object
...
My simple code:
var line = d3.svg.line()
.interpolate("basis")
.x(function(d) { console.log(d.POSITION); return x(d.POSITION); })
.y(function(d) { console.log(d.MAX); return ySeqLogo(d.MAX); });
and then I try to draw the line chart like this:
var lll = svg.selectAll(".line")
.data(max_[0]);
lll
.enter().append("svg:path")
//lll.exit().remove();
//lll
.attr("class", "line")
.attr("d", function(d) {debugger ; return line(d.values);});
Nothing happens !
Looking for my var lll on console, I have:
lll
[- 0: undefined
- length: 1
- parentNode: svg.[object SVGAnimatedString]
- __proto__: Array[0]
0:indefined ? it should be [object SVGAnimatedString] right ?
What am I doing wrong ?
Any insight is appreciated.
P.S.: if I use: svg.append("svg:path").attr("d", line(max_[0].values));
"it works", but I need to redraw it whenever the user moves the pan/zoom, so I am not able to exit().remove().