Elastic (y) barchart not functioning properly
Im trying to get elastic (y) working on my barchart. I use another barchart to filter the first one works a bit like the nasdaq example except mine is not a composite chart.
When i select a range in my volumeChart. The y axis of my first barchart adapts to the selection. If i filter the barchart using my piecharts the entire barchart becomes empty. However my volumeChart sucessfully adapts to the pie charts.
If i disable elastic(y) on the first barChart then the barChart filters correctly on the selections made in the piecharts. I noticed that the yAxisMin and yAxisMax on my barChart are changing to -infinity and infinity when i filter the pie charts. So something is probably wrong in my dimension/group.
var datedimension = calls.dimension(function (d) {
return d.dd;
});
var barGroup = datedimension.group().reduce(
function (p, v) {
p.days++;
p.id = (+v[0]);
p.total += +v[19];
p.avg = p.total / p.days;
return p;
},
function (p, v) {
p.days--;
p.id = (+v[0]);
p.total -= +v[19];
p.avg = p.total / p.days;
return p;
},
function () {
return { days: 0, total: 0, avg: 0, id: 0 };
}
);
I tried the following but without success.
var barGroup = datedimension.group().reduce(
function (p, v) {
p.days++;
p.id = (+v[0]);
p.total += +v[19];
if ((p.total / p.days) != Number.POSITIVE_INFINITY || (p.total / p.days) !=
Number.NEGATIVE_INFINITY) {
p.avg = p.total / p.days;
}
return p;
},
function (p, v) {
p.days--;
p.id = (+v[0]);
p.total -= +v[19];
if ((p.total / p.days) != Number.POSITIVE_INFINITY || (p.total / p.days) !=
Number.NEGATIVE_INFINITY) {
p.avg = p.total / p.days;
}
return p;
},
function () {
return { days: 0, total: 0, avg: 0, id: 0 };
}
);
Thanks in advance !