i have draw a line chart i want to give each line a dynamic class.
nv.addGraph(function() {
height = 450;
width = $(div).width() - 50;
chart = nv.models.lineWithFocusChart()
.width(width)
.height(height);
var svg = d3.select(div).append("svg")
.datum(chartsData)
.call(chart)
.style({
'width': width,
'height': height
})
Data:
data: {
values: formatedData,
key: key,
color: color,
class: '_class'
}
i have passed the class in the data but it doesn't pick this.. . i want a class for each line
EDITED: this is how i add the class in the line. in the nv.d3.js i have update this function to :
// Update Main (Focus)
var focusLinesWrap = g.select('.nv-focus .nv-linesWrap')
.datum(
data
.filter(function(d) {
return !d.disabled
})
.map(function(d, i) {
return {
key: d.key,
class: d.class,
circleClass: d.circleClass,
values: d.values.filter(function(d, i) {
return lines.x()(d, i) >= extent[0] && lines.x()(d, i) <= extent[1];
})
}
})
);
and process it here :
var groups = wrap.select('.nv-groups').selectAll('.nv-group')
groups
.attr('class', function(d, i) {
return d.class + ' nv-group nv-series-' + i
})