Allow clicking on chart elements to toggle back to the full view

This commit is contained in:
Joseph Schorr 2013-12-02 18:20:42 -05:00
parent ddc4896351
commit 5778f91fbe

View file

@ -1418,8 +1418,13 @@ LogUsageChart.prototype.handleElementClicked_ = function(e) {
var kind = e.series.kind;
var disabled = [];
var enabledCount = 0;
for (var i = 0; i < this.data_.length; ++i) {
disabled.push(this.data_[i].key != key);
enabledCount += (this.chart_.multibar.disabled()[i] ? 0 : 1);
}
for (var i = 0; i < this.data_.length; ++i) {
disabled.push(enabledCount == 1 ? false : this.data_[i].key != key);
}
var allowed = {};
@ -1428,7 +1433,7 @@ LogUsageChart.prototype.handleElementClicked_ = function(e) {
this.chart_.dispatch.changeState({ 'disabled': disabled });
$(this).trigger({
'type': 'filteringChanged',
'allowed': allowed
'allowed': enabledCount == 1 ? null : allowed
});
};
@ -1437,8 +1442,6 @@ LogUsageChart.prototype.handleElementClicked_ = function(e) {
* Handler for when the state of the chart has changed.
*/
LogUsageChart.prototype.handleStateChange_ = function(e) {
window.console.log(e);
var allowed = {};
var disabled = e.disabled;
for (var i = 0; i < this.data_.length; ++i) {