Skip to content

Commit 15c78c1

Browse files
feat: add domain padding (#707)
This commit adds the margin to the domain, allows unconstrained padded domains, creates specific y domain type, deprecates the `yScaleToDataExtent` fix #706 Co-authored-by: Marco Vettorello <vettorello.marco@gmail.com>
1 parent 2504bbe commit 15c78c1

61 files changed

Lines changed: 398 additions & 547 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/charts.api.md

Lines changed: 16 additions & 108 deletions
Large diffs are not rendered by default.
Loading

integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-scale-to-extents-scaley-scale-to-data-extent-is-false-should-show-correct-extents-banded-1-snap.png renamed to integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-scale-to-extents-domain-fit-is-false-should-show-correct-extents-banded-1-snap.png

File renamed without changes.

integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-scale-to-extents-scaley-scale-to-data-extent-is-false-should-show-correct-extents-stacked-1-snap.png renamed to integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-scale-to-extents-domain-fit-is-false-should-show-correct-extents-stacked-1-snap.png

File renamed without changes.

integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-scale-to-extents-scaley-scale-to-data-extent-is-true-should-show-correct-extents-banded-1-snap.png renamed to integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-scale-to-extents-domain-fit-is-true-should-show-correct-extents-banded-1-snap.png

File renamed without changes.

integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-scale-to-extents-scaley-scale-to-data-extent-is-true-should-show-correct-extents-stacked-1-snap.png renamed to integration/tests/__image_snapshots__/area-stories-test-ts-area-series-stories-scale-to-extents-domain-fit-is-true-should-show-correct-extents-stacked-1-snap.png

File renamed without changes.

integration/tests/area_stories.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,36 @@ describe('Area series stories', () => {
2525
'http://localhost:9001/?path=/story/area-chart--stacked-percentage&knob-stacked as percentage=',
2626
);
2727
});
28+
2829
describe('accessorFormats', () => {
2930
it('should show custom format', async() => {
3031
await common.expectChartAtUrlToMatchScreenshot(
3132
'http://localhost:9001/?path=/story/area-chart--band-area&knob-scale to extent=&knob-y0AccessorFormat= [min]&knob-y1AccessorFormat= [max]',
3233
);
3334
});
3435
});
36+
3537
describe('scale to extents', () => {
36-
describe('scaleyScaleToDataExtent is true', () => {
38+
describe('domain.fit is true', () => {
39+
const trueUrl = 'http://localhost:9001/?path=/story/area-chart--stacked-band&knob-fit Y domain=true';
3740
it('should show correct extents - Banded', async() => {
38-
await common.expectChartAtUrlToMatchScreenshot(
39-
'http://localhost:9001/?path=/story/area-chart--stacked-band&knob-scale to extent=true',
40-
);
41+
await common.expectChartAtUrlToMatchScreenshot(trueUrl);
4142
});
43+
4244
it('should show correct extents - stacked', async() => {
43-
await common.expectChartAtUrlToMatchScreenshot(
44-
'http://localhost:9001/?path=/story/area-chart--stacked-band&knob-scale to extent=true',
45-
);
45+
await common.expectChartAtUrlToMatchScreenshot(trueUrl);
4646
});
4747
});
48-
describe('scaleyScaleToDataExtent is false', () => {
48+
49+
describe('domain.fit is false', () => {
50+
const falseUrl = 'http://localhost:9001/?path=/story/area-chart--stacked-band&knob-fit Y domain=false';
51+
4952
it('should show correct extents - Banded', async() => {
50-
await common.expectChartAtUrlToMatchScreenshot(
51-
'http://localhost:9001/?path=/story/area-chart--stacked-band&knob-scale to extent=false',
52-
);
53+
await common.expectChartAtUrlToMatchScreenshot(falseUrl);
5354
});
55+
5456
it('should show correct extents - stacked', async() => {
55-
await common.expectChartAtUrlToMatchScreenshot(
56-
'http://localhost:9001/?path=/story/area-chart--stacked-band&knob-scale to extent=false',
57-
);
57+
await common.expectChartAtUrlToMatchScreenshot(falseUrl);
5858
});
5959
});
6060
});

src/chart_types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ export const ChartTypes = Object.freeze({
2626
XYAxis: 'xy_axis' as const,
2727
});
2828

29+
/** @public */
2930
export type ChartTypes = $Values<typeof ChartTypes>;

src/chart_types/partition_chart/layout/types/config_types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const PartitionLayout = Object.freeze({
2929
treemap: 'treemap' as const,
3030
});
3131

32+
/** @public */
3233
export type PartitionLayout = Values<typeof PartitionLayout>; // could use ValuesType<typeof HierarchicalChartTypes>
3334

3435
export type PerSidePadding = PerSideDistance;
@@ -47,6 +48,7 @@ interface LabelConfig extends Font {
4748
padding: Padding;
4849
}
4950

51+
/** @public */
5052
export type FillLabelConfig = LabelConfig;
5153

5254
export interface LinkLabelConfig extends LabelConfig {

src/chart_types/xy_chart/annotations/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { AnnotationType } from '../utils/specs';
2222
import { AnnotationLineProps } from './line/types';
2323
import { AnnotationRectProps } from './rect/types';
2424

25+
/** @public */
2526
export type AnnotationTooltipFormatter = (details?: string) => JSX.Element | null;
2627

2728
/**

0 commit comments

Comments
 (0)