-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix interaction on partially visible bar (#9446)
- Loading branch information
Showing
6 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module.exports = { | ||
config: { | ||
type: 'bar', | ||
data: { | ||
labels: ['a', 'b', 'c'], | ||
datasets: [ | ||
{ | ||
data: [220, 250, 225], | ||
}, | ||
], | ||
}, | ||
options: { | ||
events: ['click'], | ||
interaction: { | ||
mode: 'nearest' | ||
}, | ||
plugins: { | ||
tooltip: true, | ||
legend: false | ||
}, | ||
scales: { | ||
y: { | ||
beginAtZero: false | ||
} | ||
} | ||
} | ||
}, | ||
options: { | ||
spriteText: true, | ||
canvas: { | ||
width: 256, | ||
height: 256 | ||
}, | ||
async run(chart) { | ||
const point = { | ||
x: chart.chartArea.left + chart.chartArea.width / 2, | ||
y: chart.chartArea.top + chart.chartArea.height / 2, | ||
}; | ||
await jasmine.triggerMouseEvent(chart, 'click', point); | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions
45
test/fixtures/core.interaction/nearest-point-behind-scale.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module.exports = { | ||
config: { | ||
type: 'scatter', | ||
data: { | ||
datasets: [{ | ||
data: [{x: 1, y: 1}, {x: 48, y: 1}] | ||
}] | ||
}, | ||
options: { | ||
events: ['click'], | ||
interaction: { | ||
mode: 'nearest', | ||
intersect: false | ||
}, | ||
plugins: { | ||
tooltip: true, | ||
legend: false | ||
}, | ||
scales: { | ||
x: { | ||
min: 5, | ||
max: 50 | ||
}, | ||
y: { | ||
min: 0, | ||
max: 2 | ||
} | ||
}, | ||
layout: { | ||
padding: 50 | ||
} | ||
} | ||
}, | ||
options: { | ||
spriteText: true, | ||
canvas: { | ||
width: 256, | ||
height: 256 | ||
}, | ||
async run(chart) { | ||
const point = chart.getDatasetMeta(0).data[0]; | ||
await jasmine.triggerMouseEvent(chart, 'click', {y: point.y, x: chart.chartArea.left}); | ||
} | ||
} | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters