mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 12:19:08 +02:00
Fix _isPointInArea for undefined point (#8678)
This commit is contained in:
parent
9a0a509385
commit
81342d6c65
@ -251,7 +251,7 @@ export function drawPoint(ctx, options, x, y) {
|
||||
export function _isPointInArea(point, area, margin) {
|
||||
margin = margin || 0.5; // margin - default is to match rounded decimals
|
||||
|
||||
return point.x > area.left - margin && point.x < area.right + margin &&
|
||||
return point && point.x > area.left - margin && point.x < area.right + margin &&
|
||||
point.y > area.top - margin && point.y < area.bottom + margin;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,23 @@ describe('Chart.controllers.line', function() {
|
||||
expect(meta.yAxisID).toBe('y');
|
||||
});
|
||||
|
||||
it('Should not throw with empty dataset when tension is non-zero', function() {
|
||||
// https://github.com/chartjs/Chart.js/issues/8676
|
||||
function createChart() {
|
||||
return window.acquireChart({
|
||||
type: 'line',
|
||||
data: {
|
||||
datasets: [{
|
||||
data: [],
|
||||
tension: 0.5
|
||||
}],
|
||||
labels: []
|
||||
},
|
||||
});
|
||||
}
|
||||
expect(createChart).not.toThrow();
|
||||
});
|
||||
|
||||
it('Should create line elements and point elements for each data item during initialization', function() {
|
||||
var chart = window.acquireChart({
|
||||
type: 'line',
|
||||
|
Loading…
Reference in New Issue
Block a user