Skip to content

Commit

Permalink
test: add integration for data.sort
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcc committed Dec 9, 2022
1 parent e66c5fd commit 6e6d5d6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions __tests__/integration/charts/alphabet-interval-data-sort.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { G2Spec } from '../../../src';

export function alphabetIntervalDataSort(): G2Spec {
return {
type: 'interval',
data: {
type: 'fetch',
value: 'data/alphabet.csv',
transform: [
{
type: 'sort',
callback: (a, b) => a.frequency - b.frequency,
},
],
},
axis: {
y: { labelFormatter: '.0%' },
},
encode: {
x: 'letter',
y: 'frequency',
color: 'steelblue',
},
};
}
1 change: 1 addition & 0 deletions __tests__/integration/charts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { alphabetInterval } from './alphabet-interval';
export { alphabetIntervalDataSort } from './alphabet-interval-data-sort';
export { gammaRandomLineSortXQuantitative } from './gamma-random-line-sortx-quantitative';
export { alphabetIntervalTransposed } from './alphabet-interval-transposed';
export { stateAgesIntervalStacked } from './stateages-interval-stacked';
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6e6d5d6

Please sign in to comment.