Merging in Pull Request #43 fixiing Issue #42 MultibarChart set to stacked, the controls default value is wrong

master-patched
Bob Monteverde 12 years ago
commit 53401adab5

@ -4047,7 +4047,7 @@ nv.models.multiBarChart = function() {
showControls = true, showControls = true,
showLegend = true, showLegend = true,
tooltips = true, tooltips = 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 + ' on ' + x + '</p>' '<p>' + y + ' on ' + x + '</p>'
}; };
@ -4076,8 +4076,8 @@ nv.models.multiBarChart = function() {
//TODO: let user select default //TODO: let user select default
var controlsData = [ var controlsData = [
{ key: 'Grouped' }, { key: 'Grouped', disabled: multibar.stacked },
{ key: 'Stacked', disabled: true } { key: 'Stacked', disabled: !multibar.stacked }
]; ];
function chart(selection) { function chart(selection) {
@ -4103,7 +4103,7 @@ nv.models.multiBarChart = function() {
}, []); }, []);
} else { } else {
seriesData = data.filter(function(d) { return !d.disabled }) seriesData = data.filter(function(d) { return !d.disabled })
.map(function(d) { .map(function(d) {
return d.values.map(function(d,i) { return d.values.map(function(d,i) {
return { x: multibar.x()(d,i), y: multibar.y()(d,i) } return { x: multibar.x()(d,i), y: multibar.y()(d,i) }
}) })
@ -4228,7 +4228,7 @@ nv.models.multiBarChart = function() {
selection.transition().call(chart); selection.transition().call(chart);
}); });
controls.dispatch.on('legendClick', function(d,i) { controls.dispatch.on('legendClick', function(d,i) {
if (!d.disabled) return; if (!d.disabled) return;
controlsData = controlsData.map(function(s) { controlsData = controlsData.map(function(s) {
s.disabled = true; s.disabled = true;

6
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -7,7 +7,7 @@ nv.models.multiBarChart = function() {
showControls = true, showControls = true,
showLegend = true, showLegend = true,
tooltips = true, tooltips = 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 + ' on ' + x + '</p>' '<p>' + y + ' on ' + x + '</p>'
}; };
@ -36,8 +36,8 @@ nv.models.multiBarChart = function() {
//TODO: let user select default //TODO: let user select default
var controlsData = [ var controlsData = [
{ key: 'Grouped' }, { key: 'Grouped', disabled: multibar.stacked },
{ key: 'Stacked', disabled: true } { key: 'Stacked', disabled: !multibar.stacked }
]; ];
function chart(selection) { function chart(selection) {
@ -63,7 +63,7 @@ nv.models.multiBarChart = function() {
}, []); }, []);
} else { } else {
seriesData = data.filter(function(d) { return !d.disabled }) seriesData = data.filter(function(d) { return !d.disabled })
.map(function(d) { .map(function(d) {
return d.values.map(function(d,i) { return d.values.map(function(d,i) {
return { x: multibar.x()(d,i), y: multibar.y()(d,i) } return { x: multibar.x()(d,i), y: multibar.y()(d,i) }
}) })
@ -188,7 +188,7 @@ nv.models.multiBarChart = function() {
selection.transition().call(chart); selection.transition().call(chart);
}); });
controls.dispatch.on('legendClick', function(d,i) { controls.dispatch.on('legendClick', function(d,i) {
if (!d.disabled) return; if (!d.disabled) return;
controlsData = controlsData.map(function(s) { controlsData = controlsData.map(function(s) {
s.disabled = true; s.disabled = true;

Loading…
Cancel
Save