-
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(tooltip): support NaN data in transpose
- Loading branch information
Showing
4 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
__tests__/integration/snapshots/tooltip/aapl-area-missing-data-transpose/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,16 @@ | ||
<div | ||
xmlns="http://www.w3.org/1999/xhtml" | ||
class="tooltip" | ||
style="pointer-events: none; position: absolute; visibility: visible; z-index: 8; transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1); background-color: rgba(255, 255, 255, 0.96); box-shadow: 0 6px 12px 0 rgba(0, 0, 0, 0.12); border-radius: 4px; color: rgba(0, 0, 0, 0.65); font-size: 12px; line-height: 20px; padding: 12px; min-width: 120px; max-width: 360px; font-family: Roboto-Regular; left: 110px; top: 98px;" | ||
> | ||
<div | ||
class="tooltip-title" | ||
style="color: rgba(0, 0, 0, 0.45); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;" | ||
> | ||
Thu Jan 10 2008 08:00:00 GMT+0800 (中国标准时间) | ||
</div> | ||
<ul | ||
class="tooltip-list" | ||
style="margin: 0px; list-style-type: none; padding: 0px;" | ||
/> | ||
</div>; |
42 changes: 42 additions & 0 deletions
42
__tests__/plots/tooltip/aapl-area-missing-data-transpose.ts
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 { G2Spec } from '../../../src'; | ||
import { seriesTooltipSteps } from './utils'; | ||
|
||
export function aaplAreaMissingDataTranspose(): G2Spec { | ||
return { | ||
width: 800, | ||
type: 'area', | ||
coordinate: { transform: [{ type: 'transpose' }] }, | ||
data: { | ||
type: 'fetch', | ||
value: 'data/aapl.csv', | ||
transform: [ | ||
{ | ||
type: 'map', | ||
callback: (d) => ({ | ||
...d, | ||
close: d.date.getUTCMonth() <= 3 ? NaN : d.close, | ||
}), | ||
}, | ||
], | ||
}, | ||
encode: { | ||
x: 'date', | ||
y: 'close', | ||
}, | ||
scale: { | ||
x: { type: 'time' }, | ||
}, | ||
style: { | ||
connect: true, | ||
connectFill: 'grey', | ||
connectFillOpacity: 0.15, | ||
}, | ||
tooltip: { | ||
// title: '', | ||
}, | ||
}; | ||
} | ||
|
||
aaplAreaMissingDataTranspose.maxError = 125; | ||
|
||
aaplAreaMissingDataTranspose.steps = seriesTooltipSteps([100, 88]); |
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