-
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.
feat(transform): add pack padding and direction (#5964)
* fix: fix the tooltip shown on one element line chart * fix: change test examples * feat: rebase v5 * fix: code style
- Loading branch information
Showing
8 changed files
with
33,220 additions
and
45 deletions.
There are no files selected for viewing
16,538 changes: 16,538 additions & 0 deletions
16,538
__tests__/integration/snapshots/static/titanicPointPackSharedDataPadding.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16,538 changes: 16,538 additions & 0 deletions
16,538
__tests__/integration/snapshots/static/titanicPointPackSharedRowData.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
41 changes: 41 additions & 0 deletions
41
__tests__/plots/static/titanic-point-pack-shared-data-padding.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,41 @@ | ||
import { G2Spec } from '../../../src'; | ||
|
||
export function titanicPointPackSharedDataPadding(): G2Spec { | ||
return { | ||
type: 'facetRect', | ||
data: { | ||
type: 'fetch', | ||
value: 'data/titanic.csv', | ||
transform: [ | ||
{ | ||
type: 'sortBy', | ||
fields: ['survived'], | ||
}, | ||
{ | ||
type: 'map', | ||
callback: ({ survived, ...d }) => ({ | ||
...d, | ||
survived: survived + '', | ||
}), | ||
}, | ||
], | ||
}, | ||
shareData: true, | ||
encode: { | ||
x: 'pclass', | ||
}, | ||
children: [ | ||
{ | ||
type: 'point', | ||
transform: [{ type: 'pack', padding: 2 }], | ||
legend: { | ||
color: { labelFormatter: (d) => (d === '1' ? 'Yes' : 'No') }, | ||
}, | ||
encode: { | ||
color: 'survived', | ||
shape: 'point', | ||
}, | ||
}, | ||
], | ||
}; | ||
} |
41 changes: 41 additions & 0 deletions
41
__tests__/plots/static/titanic-point-pack-shared-row-data.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,41 @@ | ||
import { G2Spec } from '../../../src'; | ||
|
||
export function titanicPointPackSharedRowData(): G2Spec { | ||
return { | ||
type: 'facetRect', | ||
data: { | ||
type: 'fetch', | ||
value: 'data/titanic.csv', | ||
transform: [ | ||
{ | ||
type: 'sortBy', | ||
fields: ['survived'], | ||
}, | ||
{ | ||
type: 'map', | ||
callback: ({ survived, ...d }) => ({ | ||
...d, | ||
survived: survived + '', | ||
}), | ||
}, | ||
], | ||
}, | ||
shareData: true, | ||
encode: { | ||
x: 'pclass', | ||
}, | ||
children: [ | ||
{ | ||
type: 'point', | ||
transform: [{ type: 'pack', direction: 'row' }], | ||
legend: { | ||
color: { labelFormatter: (d) => (d === '1' ? 'Yes' : 'No') }, | ||
}, | ||
encode: { | ||
color: 'survived', | ||
shape: 'point', | ||
}, | ||
}, | ||
], | ||
}; | ||
} |
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
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