-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(demo): disable series tooltip for regression (#4912)
* fix(demo): disable series tooltip for regression * fix(tooltip): series tooltip need defiend series element
- Loading branch information
Showing
9 changed files
with
60 additions
and
8 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
__tests__/integration/snapshots/tooltip/points-point-regression-quad/step0.html
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 @@ | ||
null |
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 @@ | ||
import { regressionQuad } from 'd3-regression'; | ||
import { G2Spec } from '../../../src'; | ||
import { points } from '../../data/points'; | ||
import { seriesTooltipSteps } from './utils'; | ||
|
||
const regression = regressionQuad() | ||
.x((d) => d.x) | ||
// @ts-ignore | ||
.y((d) => d.y) | ||
.domain([-4, 4]); | ||
|
||
export function pointsPointRegressionQuad(): G2Spec { | ||
return { | ||
type: 'view', | ||
data: points, | ||
scale: { x: { domain: [-4, 4] }, y: { domain: [-2, 14] } }, | ||
axis: { x: { title: false }, y: { title: false } }, | ||
children: [ | ||
{ | ||
type: 'point', | ||
encode: { x: 'x', y: 'y', shape: 'point' }, | ||
}, | ||
{ | ||
type: 'line', | ||
data: { transform: [{ type: 'custom', callback: regression }] }, | ||
encode: { | ||
x: (d) => d[0], | ||
y: (d) => d[1], | ||
}, | ||
style: { | ||
stroke: '#30BF78', | ||
lineWidth: 2, | ||
}, | ||
tooltip: false, | ||
}, | ||
{ type: 'lineX', data: [0] }, | ||
{ type: 'lineY', data: [0] }, | ||
], | ||
}; | ||
} | ||
|
||
pointsPointRegressionQuad.steps = seriesTooltipSteps([100, 300]); |
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 |
---|---|---|
|
@@ -46,6 +46,7 @@ chart | |
style: { | ||
textAlign: 'end', | ||
}, | ||
}); | ||
}) | ||
.tooltip(false); | ||
|
||
chart.render(); |
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 |
---|---|---|
|
@@ -49,6 +49,4 @@ chart | |
}) | ||
.tooltip(false); | ||
|
||
chart.interaction('tooltip', { series: false }); | ||
|
||
chart.render(); |
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 |
---|---|---|
|
@@ -48,6 +48,7 @@ chart | |
style: { | ||
textAlign: 'end', | ||
}, | ||
}); | ||
}) | ||
.tooltip(false); | ||
|
||
chart.render(); |
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 |
---|---|---|
|
@@ -56,6 +56,7 @@ chart | |
textAlign: 'end', | ||
dx: -8, | ||
}, | ||
}); | ||
}) | ||
.tooltip(null); | ||
|
||
chart.render(); |
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