Skip to content

Commit

Permalink
Merge pull request #430 from stormpython/feature/visualize_events_off
Browse files Browse the repository at this point in the history
turning off events in visualize
  • Loading branch information
spenceralger committed Oct 2, 2014
2 parents 5fc6a7b + 99c0d85 commit e17a04c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/kibana/apps/discover/controllers/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ define(function (require) {
type: 'histogram',
vislibParams: {
addLegend: false,
addEvents: true,
addBrushing: true,
},
listeners: {
Expand Down
2 changes: 0 additions & 2 deletions src/kibana/components/vis_types/histogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ define(function (require) {
shareYAxis: true,
addTooltip: true,
addLegend: true,
addEvents: true,
addBrushing: true
},
schemas: new Schemas([
{
Expand Down
29 changes: 16 additions & 13 deletions src/kibana/components/vislib/visualizations/column_chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ define(function (require) {
ColumnChart.prototype.addBarEvents = function (svg, bars, brush) {
var events = this.events;
var dispatch = this.events._attr.dispatch;
var addBrush = this._attr.addBrushing;
var xScale = this.handler.xAxis.xScale;
var startXInv;

Expand All @@ -131,19 +132,21 @@ define(function (require) {
d3.event.stopPropagation();
})
.on('mousedown.bar', function () {
var bar = d3.select(this);
var startX = d3.mouse(svg.node());
startXInv = xScale.invert(startX[0]);

// Reset the brush value
brush.extent([startXInv, startXInv]);

// Magic!
// Need to call brush on svg to see brush when brushing
// while on top of bars.
// Need to call brush on bar to allow the click event to be registered
svg.call(brush);
bar.call(brush);
if (addBrush) {
var bar = d3.select(this);
var startX = d3.mouse(svg.node());
startXInv = xScale.invert(startX[0]);

// Reset the brush value
brush.extent([startXInv, startXInv]);

// Magic!
// Need to call brush on svg to see brush when brushing
// while on top of bars.
// Need to call brush on bar to allow the click event to be registered
svg.call(brush);
bar.call(brush);
}
})
.on('click.bar', function (d, i) {
dispatch.click(events.eventResponse(d, i));
Expand Down

0 comments on commit e17a04c

Please sign in to comment.