diff --git a/docs/docs/charts/line.mdx b/docs/docs/charts/line.mdx index 3c58ae9d22a..c6856e3cc2d 100644 --- a/docs/docs/charts/line.mdx +++ b/docs/docs/charts/line.mdx @@ -87,7 +87,7 @@ The line chart allows a number of properties to be specified for each dataset. T | [`pointRadius`](#point-styling) | `number` | Yes | Yes | `3` | [`pointRotation`](#point-styling) | `number` | Yes | Yes | `0` | [`pointStyle`](#point-styling) | `string`\|`Image` | Yes | Yes | `'circle'` -| [`showLine`](#line-styling) | `boolean` | - | - | `undefined` +| [`showLine`](#line-styling) | `boolean` | - | - | `true` | [`spanGaps`](#line-styling) | `boolean`\|`number` | - | - | `undefined` | [`stepped`](#stepped) | `boolean`\|`string` | - | - | `false` | [`xAxisID`](#general) | `string` | - | - | first x axis diff --git a/docs/docs/charts/scatter.mdx b/docs/docs/charts/scatter.mdx index 1df75c20d6f..c23ed91f990 100644 --- a/docs/docs/charts/scatter.mdx +++ b/docs/docs/charts/scatter.mdx @@ -50,6 +50,7 @@ function example() { ## Dataset Properties The scatter chart supports all of the same properties as the [line chart](./charts/line.mdx#dataset-properties). +By default, the scatter chart will override the showLine property of the line chart to `false`. ## Data Structure diff --git a/src/controllers/controller.scatter.js b/src/controllers/controller.scatter.js index 1bf2fd5d693..e13bf50c1a4 100644 --- a/src/controllers/controller.scatter.js +++ b/src/controllers/controller.scatter.js @@ -24,6 +24,10 @@ ScatterController.defaults = { fill: false }, + interaction: { + mode: 'point' + }, + plugins: { tooltip: { callbacks: { diff --git a/test/specs/controller.scatter.tests.js b/test/specs/controller.scatter.tests.js index df516836159..b181c91c5ee 100644 --- a/test/specs/controller.scatter.tests.js +++ b/test/specs/controller.scatter.tests.js @@ -31,4 +31,44 @@ describe('Chart.controllers.scatter', function() { jasmine.triggerMouseEvent(chart, 'mousemove', point); }); + + it('should only show a single point in the tooltip on multiple datasets', function(done) { + var chart = window.acquireChart({ + type: 'scatter', + data: { + datasets: [{ + data: [{ + x: 10, + y: 15 + }, + { + x: 12, + y: 10 + }], + label: 'dataset1' + }, + { + data: [{ + x: 20, + y: 10 + }, + { + x: 4, + y: 8 + }], + label: 'dataset2' + }] + }, + options: {} + }); + var point = chart.getDatasetMeta(0).data[1]; + + afterEvent(chart, 'mousemove', function() { + expect(chart.tooltip.body.length).toEqual(1); + + done(); + }); + + jasmine.triggerMouseEvent(chart, 'mousemove', point); + }); });