Skip to content

Commit 3feec05

Browse files
authored
Merge pull request #442 from adobe/removePadding
feat: remove 32 padding on linear dimension scales
2 parents 1e8a97f + 5376bcf commit 3feec05

File tree

8 files changed

+18
-16
lines changed

8 files changed

+18
-16
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
"sonar-fork-pr": "node ./scripts/runSonarOnFork.js",
7171
"start": "yarn storybook",
7272
"storybook": "cross-env NODE_OPTIONS=--openssl-legacy-provider && storybook dev -p 6009",
73-
"test": "cross-env BABEL_ENV=test jest",
74-
"watch": "cross-env BABEL_ENV=test jest --watch",
73+
"test": "cross-env TZ=UTC BABEL_ENV=test jest",
74+
"watch": "cross-env TZ=UTC BABEL_ENV=test jest --watch",
7575
"skulk": "yarn watch --silent"
7676
},
7777
"devDependencies": {

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const CORNER_RADIUS = 6;
7878
// padding constants
7979
export const DISCRETE_PADDING = 0.5;
8080
export const PADDING_RATIO = 0.4;
81-
export const LINEAR_PADDING = 32;
81+
export const LINEAR_PADDING = 0;
8282
export const TRELLIS_PADDING = 0.2;
8383

8484
// donut constants

src/specBuilder/area/areaSpecBuilder.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
FILTERED_TABLE,
2525
HIGHLIGHTED_ITEM,
2626
HIGHLIGHTED_SERIES,
27+
LINEAR_PADDING,
2728
MARK_ID,
2829
SELECTED_GROUP,
2930
SELECTED_ITEM,
@@ -131,7 +132,7 @@ const defaultSpec = initializeSpec({
131132
{
132133
domain: { data: FILTERED_TABLE, fields: [DEFAULT_TRANSFORMED_TIME_DIMENSION] },
133134
name: 'xTime',
134-
padding: 32,
135+
padding: LINEAR_PADDING,
135136
range: 'width',
136137
type: 'time',
137138
},
@@ -150,7 +151,7 @@ const defaultSpec = initializeSpec({
150151
const defaultLinearScale = {
151152
domain: { data: FILTERED_TABLE, fields: [DEFAULT_TIME_DIMENSION] },
152153
name: 'xLinear',
153-
padding: 32,
154+
padding: LINEAR_PADDING,
154155
range: 'width',
155156
type: 'linear',
156157
};

src/specBuilder/line/lineSpecBuilder.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
FILTERED_TABLE,
2727
HIGHLIGHTED_ITEM,
2828
HIGHLIGHTED_SERIES,
29+
LINEAR_PADDING,
2930
MARK_ID,
3031
SERIES_ID,
3132
TABLE,
@@ -124,7 +125,7 @@ const defaultSpec = initializeSpec({
124125
{
125126
domain: { data: FILTERED_TABLE, fields: [DEFAULT_TRANSFORMED_TIME_DIMENSION] },
126127
name: 'xTime',
127-
padding: 32,
128+
padding: LINEAR_PADDING,
128129
range: 'width',
129130
type: 'time',
130131
},
@@ -143,7 +144,7 @@ const defaultSpec = initializeSpec({
143144
const defaultLinearScale = {
144145
domain: { data: FILTERED_TABLE, fields: [DEFAULT_TIME_DIMENSION] },
145146
name: 'xLinear',
146-
padding: 32,
147+
padding: LINEAR_PADDING,
147148
range: 'width',
148149
type: 'linear',
149150
};

src/specBuilder/scale/scaleSpecBuilder.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* OF ANY KIND, either express or implied. See the License for the specific language
1010
* governing permissions and limitations under the License.
1111
*/
12-
import { COLOR_SCALE, DEFAULT_COLOR } from '@constants';
12+
import { COLOR_SCALE, DEFAULT_COLOR, LINEAR_PADDING } from '@constants';
1313
import { OrdinalScale, Scale } from 'vega';
1414

1515
import {
@@ -49,12 +49,12 @@ describe('addDomainFields()', () => {
4949
describe('getPadding()', () => {
5050
test('time', () => {
5151
expect(getPadding('time')).toStrictEqual({
52-
padding: 32,
52+
padding: LINEAR_PADDING,
5353
});
5454
});
5555
test('linear', () => {
5656
expect(getPadding('time')).toStrictEqual({
57-
padding: 32,
57+
padding: LINEAR_PADDING,
5858
});
5959
});
6060
test('point', () => {

src/stories/ChartExamples/FeatureMatrix/FeatureMatrix.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('FeatureMatrix', () => {
4545
// horizontal trendline
4646
const horizontalTrendline = await findMarksByGroupName(chart, 'scatter0Trendline0', 'line');
4747
expect(horizontalTrendline).toBeInTheDocument();
48-
expect(horizontalTrendline).toHaveAttribute('x2', '452');
48+
expect(horizontalTrendline).toHaveAttribute('x2', '448');
4949
expect(horizontalTrendline).toHaveAttribute('y2', '0');
5050
expect(horizontalTrendline).toHaveAttribute('stroke', colors['gray-900']);
5151
expect(horizontalTrendline).toHaveAttribute('stroke-width', '1');

src/stories/components/Axis/Axis.story.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const AxisStory: StoryFn<typeof Axis> = (args): ReactElement => {
5555
};
5656

5757
const TimeAxisStory: StoryFn<typeof Axis> = (args): ReactElement => {
58-
const chartProps = useChartProps({ data: timeData[args.granularity ?? DEFAULT_GRANULARITY], width: 'auto' });
58+
const chartProps = useChartProps({ data: timeData[args.granularity ?? DEFAULT_GRANULARITY], width: 600 });
5959
return (
6060
<Chart {...chartProps}>
6161
<Axis {...args} />

src/stories/components/Axis/Axis.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ describe('Axis', () => {
9999
expect(chart).toBeInTheDocument();
100100

101101
// make sure labels are visible
102-
expect(screen.getByText('11')).toBeInTheDocument();
103-
expect(screen.getByText('Sep')).toBeInTheDocument();
102+
expect(await screen.findByText('18')).toBeInTheDocument();
103+
expect(await screen.findByText('Sep')).toBeInTheDocument();
104104
});
105105

106106
test('Month renders properly', async () => {
@@ -109,8 +109,8 @@ describe('Axis', () => {
109109
expect(chart).toBeInTheDocument();
110110

111111
// make sure labels are visible
112-
expect(screen.getByText('Jan')).toBeInTheDocument();
113-
expect(screen.getByText('2022')).toBeInTheDocument();
112+
expect(await screen.findByText('Feb')).toBeInTheDocument();
113+
expect(await screen.findByText('2022')).toBeInTheDocument();
114114
});
115115

116116
test('Quarter renders properly', async () => {

0 commit comments

Comments
 (0)