|
|
@ -1039,12 +1039,12 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
height = null,
|
|
|
|
height = null,
|
|
|
|
showLegend = true,
|
|
|
|
showLegend = true,
|
|
|
|
tooltips = true,
|
|
|
|
tooltips = true,
|
|
|
|
|
|
|
|
showRescaleToggle = false, //TODO: get rescale y functionality back (need to calculate exten of y for ALL possible re-zero points
|
|
|
|
|
|
|
|
rescaleY = true;
|
|
|
|
tooltip = function(key, x, y, e, graph) {
|
|
|
|
tooltip = function(key, x, y, e, graph) {
|
|
|
|
return '<h3>' + key + '</h3>' +
|
|
|
|
return '<h3>' + key + '</h3>' +
|
|
|
|
'<p>' + y + ' at ' + x + '</p>'
|
|
|
|
'<p>' + y + ' at ' + x + '</p>'
|
|
|
|
},
|
|
|
|
};
|
|
|
|
showRescaleToggle = false,
|
|
|
|
|
|
|
|
rescaleY = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lines = nv.models.line(),
|
|
|
|
var lines = nv.models.line(),
|
|
|
|
x = lines.xScale(),
|
|
|
|
x = lines.xScale(),
|
|
|
@ -1091,7 +1091,7 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
d.i = Math.round(dx.invert(d.x));
|
|
|
|
d.i = Math.round(dx.invert(d.x));
|
|
|
|
|
|
|
|
|
|
|
|
//d3.transition(d3.select('.chart-' + id)).call(chart);
|
|
|
|
//d3.transition(d3.select('.chart-' + id)).call(chart);
|
|
|
|
d3.select(this).attr("transform", "translate(" + dx(d.i) + ",0)");
|
|
|
|
d3.select(this).attr('transform', 'translate(' + dx(d.i) + ',0)');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function dragEnd(d,i) {
|
|
|
|
function dragEnd(d,i) {
|
|
|
@ -1112,7 +1112,7 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
- margin.top - margin.bottom;
|
|
|
|
- margin.top - margin.bottom;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = indexify(index.i, data);
|
|
|
|
var data = indexify(index.i, data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length
|
|
|
|
dx .domain([0, data[0].values.length - 1]) //Assumes all series have same length
|
|
|
@ -1121,7 +1121,7 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var wrap = container.selectAll('g.wrap.cumulativeLine').data([series]);
|
|
|
|
var wrap = container.selectAll('g.wrap.cumulativeLine').data([data]);
|
|
|
|
var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 cumulativeLine').append('g');
|
|
|
|
var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 cumulativeLine').append('g');
|
|
|
|
|
|
|
|
|
|
|
|
gEnter.append('g').attr('class', 'x axis');
|
|
|
|
gEnter.append('g').attr('class', 'x axis');
|
|
|
@ -1165,9 +1165,11 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lines
|
|
|
|
lines
|
|
|
|
|
|
|
|
//.x(function(d) { return d.x })
|
|
|
|
|
|
|
|
.y(function(d) { return d.display.y })
|
|
|
|
.width(availableWidth)
|
|
|
|
.width(availableWidth)
|
|
|
|
.height(availableHeight)
|
|
|
|
.height(availableHeight)
|
|
|
|
.color(series.map(function(d,i) {
|
|
|
|
.color(data.map(function(d,i) {
|
|
|
|
return d.color || color[i % color.length];
|
|
|
|
return d.color || color[i % color.length];
|
|
|
|
}).filter(function(d,i) { return !data[i].disabled }));
|
|
|
|
}).filter(function(d,i) { return !data[i].disabled }));
|
|
|
|
|
|
|
|
|
|
|
@ -1177,7 +1179,7 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var linesWrap = g.select('.linesWrap')
|
|
|
|
var linesWrap = g.select('.linesWrap')
|
|
|
|
.datum(series.filter(function(d) { return !d.disabled }))
|
|
|
|
.datum(data.filter(function(d) { return !d.disabled }))
|
|
|
|
|
|
|
|
|
|
|
|
d3.transition(linesWrap).call(lines);
|
|
|
|
d3.transition(linesWrap).call(lines);
|
|
|
|
|
|
|
|
|
|
|
@ -1192,13 +1194,12 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
.call(indexDrag)
|
|
|
|
.call(indexDrag)
|
|
|
|
|
|
|
|
|
|
|
|
indexLine
|
|
|
|
indexLine
|
|
|
|
.attr("transform", function(d) { return "translate(" + dx(d.i) + ",0)" })
|
|
|
|
.attr('transform', function(d) { return 'translate(' + dx(d.i) + ',0)' })
|
|
|
|
.attr('height', availableHeight)
|
|
|
|
.attr('height', availableHeight)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
xAxis
|
|
|
|
xAxis
|
|
|
|
.scale(x)
|
|
|
|
|
|
|
|
.ticks( availableWidth / 100 )
|
|
|
|
.ticks( availableWidth / 100 )
|
|
|
|
.tickSize(-availableHeight, 0);
|
|
|
|
.tickSize(-availableHeight, 0);
|
|
|
|
|
|
|
|
|
|
|
@ -1209,7 +1210,6 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
yAxis
|
|
|
|
yAxis
|
|
|
|
.scale(y)
|
|
|
|
|
|
|
|
.ticks( availableHeight / 36 )
|
|
|
|
.ticks( availableHeight / 36 )
|
|
|
|
.tickSize( -availableWidth, 0);
|
|
|
|
.tickSize( -availableWidth, 0);
|
|
|
|
|
|
|
|
|
|
|
@ -1337,23 +1337,18 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
return data.map(function(line, i) {
|
|
|
|
return data.map(function(line, i) {
|
|
|
|
var v = lines.y()(line.values[idx], idx);
|
|
|
|
var v = lines.y()(line.values[idx], idx);
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
line.values = line.values.map(function(point, pointIndex) {
|
|
|
|
key: line.key,
|
|
|
|
point.display = {'y': (lines.y()(point, pointIndex) - v) / (1 + v) };
|
|
|
|
values: line.values.map(function(point, pointIndex) {
|
|
|
|
return point;
|
|
|
|
return {'x': lines.x()(point, pointIndex), 'y': (lines.y()(point, pointIndex) - v) / (1 + v) };
|
|
|
|
})
|
|
|
|
}),
|
|
|
|
/*
|
|
|
|
disabled: line.disabled,
|
|
|
|
if (v < -.9) {
|
|
|
|
hover: line.hover
|
|
|
|
//if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically currect till it hits 100)
|
|
|
|
/*
|
|
|
|
}
|
|
|
|
if (v < -.9) {
|
|
|
|
*/
|
|
|
|
//if a series loses more than 100%, calculations fail.. anything close can cause major distortion (but is mathematically currect till it hits 100)
|
|
|
|
return line;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|