-
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: add style.minHeight to interval (#5715)
* fix: 为interval添加最小高度配置 * fix: fix the inverted rect display * fix: fit horizontal direction minHeight, and change code style * fix: add minHeight test * fix: add snapshot * fix: cancel the maxHeight type and format the code style --------- Co-authored-by: Runtus <[email protected]>
- Loading branch information
Showing
9 changed files
with
101 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.4 KB
__tests__/integration/snapshots/static/alphabetIntervalMinHeightTransposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions
29
__tests__/plots/static/alphanbet-interval-min-height-transposed.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,29 @@ | ||
import { G2Spec } from '../../../src'; | ||
|
||
export function alphabetIntervalMinHeightTransposed(): G2Spec { | ||
return { | ||
type: 'interval', | ||
coordinate: { transform: [{ type: 'transpose' }] }, | ||
data: [ | ||
{ genre: 'Sports', sold: 0 }, | ||
{ genre: 'Strategy', sold: 115 }, | ||
{ genre: 'Action', sold: 120 }, | ||
{ genre: 'Shooter', sold: 350 }, | ||
{ genre: 'Other', sold: 150 }, | ||
], | ||
encode: { | ||
x: 'genre', | ||
y: 'sold', | ||
color: 'genre', | ||
}, | ||
axis: { | ||
x: { animate: false }, | ||
y: { animate: false }, | ||
}, | ||
style: { | ||
draggable: true, | ||
droppable: true, | ||
minHeight: 50, | ||
}, | ||
}; | ||
} |
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,28 @@ | ||
import { G2Spec } from '../../../src'; | ||
|
||
export function alphabetIntervalMinHeight(): G2Spec { | ||
return { | ||
type: 'interval', | ||
data: [ | ||
{ genre: 'Sports', sold: 0 }, | ||
{ genre: 'Strategy', sold: 115 }, | ||
{ genre: 'Action', sold: 120 }, | ||
{ genre: 'Shooter', sold: 350 }, | ||
{ genre: 'Other', sold: 150 }, | ||
], | ||
encode: { | ||
x: 'genre', | ||
y: 'sold', | ||
color: 'genre', | ||
}, | ||
axis: { | ||
x: { animate: false }, | ||
y: { animate: false }, | ||
}, | ||
style: { | ||
draggable: true, | ||
droppable: true, | ||
minHeight: 50, | ||
}, | ||
}; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Chart } from '@antv/g2'; | ||
|
||
const chart = new Chart({ container: 'container' }); | ||
chart.data([ | ||
{ genre: 'Sports', sold: 0 }, | ||
{ genre: 'Strategy', sold: 115 }, | ||
{ genre: 'Action', sold: 120 }, | ||
{ genre: 'Shooter', sold: 350 }, | ||
{ genre: 'Other', sold: 150 }, | ||
]); | ||
|
||
chart | ||
.interval() | ||
.encode('x', 'genre') | ||
.encode('y', 'sold') | ||
.encode('color', 'genre') | ||
.axis({ x: { animate: false }, y: { animate: false } }) | ||
.style('draggable', true) | ||
.style('droppable', true) | ||
.style('minHeight', 50); |
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