Add function support to the `domain` property.

This allows us to specify different domains across multiple box plots.  Thanks
Mike for the suggestion!
This commit is contained in:
Jason Davies 2011-04-13 20:35:33 +01:00
Родитель b6b39af267
Коммит 8fc521cb02
3 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -23,7 +23,7 @@ d3.chart.boxplot = function() {
// Compute the new x-scale. // Compute the new x-scale.
var x1 = d3.scale.linear() var x1 = d3.scale.linear()
.domain(domain || [min, max]) .domain(domain ? domain.call(this, d, i) : [min, max])
.range([height, 0]); .range([height, 0]);
// Retrieve the old x-scale, if this is an update. // Retrieve the old x-scale, if this is an update.
@ -151,7 +151,7 @@ d3.chart.boxplot = function() {
boxplot.domain = function(x) { boxplot.domain = function(x) {
if (!arguments.length) return domain; if (!arguments.length) return domain;
domain = x; domain = d3.functor(x);
return boxplot; return boxplot;
}; };

2
d3.chart.min.js поставляемый

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -22,7 +22,7 @@ d3.chart.boxplot = function() {
// Compute the new x-scale. // Compute the new x-scale.
var x1 = d3.scale.linear() var x1 = d3.scale.linear()
.domain(domain || [min, max]) .domain(domain ? domain.call(this, d, i) : [min, max])
.range([height, 0]); .range([height, 0]);
// Retrieve the old x-scale, if this is an update. // Retrieve the old x-scale, if this is an update.
@ -150,7 +150,7 @@ d3.chart.boxplot = function() {
boxplot.domain = function(x) { boxplot.domain = function(x) {
if (!arguments.length) return domain; if (!arguments.length) return domain;
domain = x; domain = d3.functor(x);
return boxplot; return boxplot;
}; };