mirror of
https://github.com/chartjs/Chart.js.git
synced 2025-12-08 20:36:08 +00:00
Fix/scatter tooltip mode (#8354)
* scatter tooltip should be point by default * edited mode on better level and updated docs to be bit more clear
This commit is contained in:
parent
5eb3682b9f
commit
b50fba3759
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -24,6 +24,10 @@ ScatterController.defaults = {
|
||||
fill: false
|
||||
},
|
||||
|
||||
interaction: {
|
||||
mode: 'point'
|
||||
},
|
||||
|
||||
plugins: {
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user