Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed Issues #161 and #166 in the cumulativeLineChart
  • Loading branch information
bobmonteverde committed Aug 27, 2012
1 parent db0691c commit 3306469
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/models/cumulativeLineChart.js
Expand Up @@ -101,16 +101,21 @@ nv.models.cumulativeLineChart = function() {
// Display No Data message if there's nothing to show.

if (!data || !data.length || !data.filter(function(d) { return d.values.length }).length) {
container.append('text')
var noDataText = container.selectAll('.nv-noData').data([noData]);

noDataText.enter().append('text')
.attr('class', 'nvd3 nv-noData')
.attr('x', availableWidth / 2)
.attr('y', availableHeight / 2)
.attr('dy', '-.7em')
.style('text-anchor', 'middle')
.text(noData);
return chart;
.style('text-anchor', 'middle');

noDataText
.attr('x', margin.left + availableWidth / 2)
.attr('y', margin.top + availableHeight / 2)
.text(function(d) { return d });

return chart;
} else {
container.select('.nv-noData').remove();
container.selectAll('.nv-noData').remove();
}

//------------------------------------------------------------
Expand Down Expand Up @@ -363,7 +368,10 @@ nv.models.cumulativeLineChart = function() {

chart.margin = function(_) {
if (!arguments.length) return margin;
margin = _;
margin.top = typeof _.top != 'undefined' ? _.top : margin.top;
margin.right = typeof _.right != 'undefined' ? _.right : margin.right;
margin.bottom = typeof _.bottom != 'undefined' ? _.bottom : margin.bottom;
margin.left = typeof _.left != 'undefined' ? _.left : margin.left;
return chart;
};

Expand Down

0 comments on commit 3306469

Please sign in to comment.