@cloudscape-design/components 3.0.22 → 3.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alert/styles.scoped.css +0 -34
- package/annotation-context/annotation/annotation-popover.d.ts.map +1 -1
- package/annotation-context/annotation/annotation-popover.js +12 -16
- package/annotation-context/annotation/annotation-popover.js.map +1 -1
- package/annotation-context/annotation/styles.scoped.css +0 -18
- package/app-layout/content-wrapper/styles.scoped.css +0 -4
- package/app-layout/index.d.ts.map +1 -1
- package/app-layout/index.js +6 -4
- package/app-layout/index.js.map +1 -1
- package/app-layout/mobile-toolbar/styles.scoped.css +0 -9
- package/app-layout/styles.scoped.css +0 -20
- package/app-layout/toggles/styles.scoped.css +0 -16
- package/app-layout/visual-refresh/styles.scoped.css +0 -71
- package/area-chart/styles.scoped.css +0 -13
- package/attribute-editor/styles.scoped.css +0 -23
- package/badge/styles.scoped.css +0 -15
- package/bar-chart/interfaces.d.ts +1 -1
- package/bar-chart/interfaces.d.ts.map +1 -1
- package/bar-chart/interfaces.js.map +1 -1
- package/box/styles.scoped.css +0 -171
- package/breadcrumb-group/item/styles.scoped.css +0 -11
- package/breadcrumb-group/styles.scoped.css +0 -10
- package/button/styles.scoped.css +0 -264
- package/button-dropdown/category-elements/styles.scoped.css +0 -26
- package/button-dropdown/item-element/styles.scoped.css +0 -22
- package/button-dropdown/mobile-expandable-group/styles.scoped.css +0 -5
- package/button-dropdown/styles.scoped.css +0 -7
- package/cards/styles.scoped.css +0 -45
- package/checkbox/styles.scoped.css +0 -11
- package/code-editor/styles.scoped.css +0 -87
- package/collection-preferences/styles.scoped.css +0 -12
- package/column-layout/styles.scoped.css +0 -12
- package/container/styles.scoped.css +0 -27
- package/date-picker/calendar/index.d.ts.map +1 -1
- package/date-picker/calendar/index.js +2 -2
- package/date-picker/calendar/index.js.map +1 -1
- package/date-picker/calendar/utils/locales.d.ts +2 -0
- package/date-picker/calendar/utils/locales.d.ts.map +1 -1
- package/date-picker/calendar/utils/locales.js +4 -0
- package/date-picker/calendar/utils/locales.js.map +1 -1
- package/date-picker/styles.scoped.css +0 -45
- package/date-range-picker/calendar/grids/day/styles.scoped.css +0 -45
- package/date-range-picker/calendar/index.js +2 -2
- package/date-range-picker/calendar/index.js.map +1 -1
- package/date-range-picker/index.d.ts.map +1 -1
- package/date-range-picker/index.js +13 -15
- package/date-range-picker/index.js.map +1 -1
- package/date-range-picker/relative-range/styles.scoped.css +0 -3
- package/date-range-picker/styles.css.js +41 -42
- package/date-range-picker/styles.scoped.css +49 -92
- package/date-range-picker/styles.selectors.js +41 -42
- package/expandable-section/styles.scoped.css +0 -33
- package/flashbar/styles.scoped.css +0 -36
- package/form/styles.scoped.css +0 -12
- package/form-field/styles.scoped.css +0 -26
- package/grid/styles.scoped.css +0 -6
- package/header/styles.scoped.css +0 -51
- package/help-panel/styles.scoped.css +0 -73
- package/hotspot/styles.scoped.css +0 -3
- package/icon/styles.scoped.css +0 -33
- package/input/styles.scoped.css +0 -49
- package/internal/base-component/styles.scoped.css +0 -1
- package/internal/components/abstract-switch/styles.scoped.css +0 -7
- package/internal/components/button-trigger/styles.scoped.css +0 -42
- package/internal/components/cartesian-chart/styles.scoped.css +0 -10
- package/internal/components/chart-filter/styles.scoped.css +0 -4
- package/internal/components/chart-legend/styles.scoped.css +0 -8
- package/internal/components/chart-plot/styles.scoped.css +0 -1
- package/internal/components/chart-popover/styles.scoped.css +0 -4
- package/internal/components/chart-series-details/styles.scoped.css +0 -12
- package/internal/components/chart-series-marker/styles.scoped.css +0 -7
- package/internal/components/chart-status-container/styles.scoped.css +0 -1
- package/internal/components/checkbox-icon/styles.scoped.css +0 -10
- package/internal/components/content-layout/styles.scoped.css +0 -5
- package/internal/components/dark-ribbon/styles.scoped.css +0 -1
- package/internal/components/dropdown/styles.scoped.css +0 -17
- package/internal/components/dropdown-footer/styles.scoped.css +0 -6
- package/internal/components/dropdown-status/styles.scoped.css +0 -6
- package/internal/components/filtering-token/styles.scoped.css +0 -21
- package/internal/components/menu-dropdown/styles.scoped.css +0 -17
- package/internal/components/option/index.js +3 -3
- package/internal/components/option/index.js.map +1 -1
- package/internal/components/option/option-parts.js +3 -3
- package/internal/components/option/option-parts.js.map +1 -1
- package/internal/components/option/styles.scoped.css +0 -16
- package/internal/components/options-list/styles.scoped.css +0 -5
- package/internal/components/selectable-item/styles.scoped.css +0 -44
- package/internal/environment.js +1 -1
- package/line-chart/interfaces.d.ts +1 -1
- package/line-chart/interfaces.d.ts.map +1 -1
- package/line-chart/interfaces.js.map +1 -1
- package/link/styles.scoped.css +0 -77
- package/mixed-line-bar-chart/bar-series.d.ts +1 -1
- package/mixed-line-bar-chart/bar-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/bar-series.js.map +1 -1
- package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
- package/mixed-line-bar-chart/chart-container.js +9 -10
- package/mixed-line-bar-chart/chart-container.js.map +1 -1
- package/mixed-line-bar-chart/chart-filters.d.ts +2 -2
- package/mixed-line-bar-chart/chart-filters.d.ts.map +1 -1
- package/mixed-line-bar-chart/chart-filters.js +1 -2
- package/mixed-line-bar-chart/chart-filters.js.map +1 -1
- package/mixed-line-bar-chart/chart-legend.d.ts +2 -2
- package/mixed-line-bar-chart/chart-legend.d.ts.map +1 -1
- package/mixed-line-bar-chart/chart-legend.js +1 -2
- package/mixed-line-bar-chart/chart-legend.js.map +1 -1
- package/mixed-line-bar-chart/domain.d.ts +4 -0
- package/mixed-line-bar-chart/domain.d.ts.map +1 -0
- package/mixed-line-bar-chart/domain.js +138 -0
- package/mixed-line-bar-chart/domain.js.map +1 -0
- package/mixed-line-bar-chart/format-highlighted.d.ts +2 -4
- package/mixed-line-bar-chart/format-highlighted.d.ts.map +1 -1
- package/mixed-line-bar-chart/format-highlighted.js +26 -15
- package/mixed-line-bar-chart/format-highlighted.js.map +1 -1
- package/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts.map +1 -1
- package/mixed-line-bar-chart/hooks/use-mouse-hover.js +3 -2
- package/mixed-line-bar-chart/hooks/use-mouse-hover.js.map +1 -1
- package/mixed-line-bar-chart/hooks/use-navigation.d.ts.map +1 -1
- package/mixed-line-bar-chart/hooks/use-navigation.js +23 -35
- package/mixed-line-bar-chart/hooks/use-navigation.js.map +1 -1
- package/mixed-line-bar-chart/interfaces.d.ts +12 -2
- package/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
- package/mixed-line-bar-chart/interfaces.js.map +1 -1
- package/mixed-line-bar-chart/internal.d.ts.map +1 -1
- package/mixed-line-bar-chart/internal.js +14 -6
- package/mixed-line-bar-chart/internal.js.map +1 -1
- package/mixed-line-bar-chart/line-series.d.ts +2 -2
- package/mixed-line-bar-chart/line-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/line-series.js +21 -9
- package/mixed-line-bar-chart/line-series.js.map +1 -1
- package/mixed-line-bar-chart/make-scaled-bar-groups.d.ts.map +1 -1
- package/mixed-line-bar-chart/make-scaled-bar-groups.js +11 -4
- package/mixed-line-bar-chart/make-scaled-bar-groups.js.map +1 -1
- package/mixed-line-bar-chart/make-scaled-series.d.ts +2 -4
- package/mixed-line-bar-chart/make-scaled-series.d.ts.map +1 -1
- package/mixed-line-bar-chart/make-scaled-series.js +89 -25
- package/mixed-line-bar-chart/make-scaled-series.js.map +1 -1
- package/mixed-line-bar-chart/styles.scoped.css +0 -13
- package/mixed-line-bar-chart/utils.d.ts +5 -6
- package/mixed-line-bar-chart/utils.d.ts.map +1 -1
- package/mixed-line-bar-chart/utils.js +11 -112
- package/mixed-line-bar-chart/utils.js.map +1 -1
- package/modal/styles.scoped.css +0 -31
- package/multiselect/styles.scoped.css +0 -4
- package/package.json +1 -1
- package/pagination/styles.scoped.css +0 -22
- package/pie-chart/styles.scoped.css +0 -25
- package/popover/styles.scoped.css +0 -35
- package/progress-bar/internal.d.ts.map +1 -1
- package/progress-bar/internal.js +1 -1
- package/progress-bar/internal.js.map +1 -1
- package/progress-bar/styles.scoped.css +0 -25
- package/property-filter/controller.d.ts +3 -3
- package/property-filter/controller.d.ts.map +1 -1
- package/property-filter/interfaces.d.ts +7 -20
- package/property-filter/interfaces.d.ts.map +1 -1
- package/property-filter/interfaces.js.map +1 -1
- package/property-filter/styles.scoped.css +0 -22
- package/property-filter/use-load-items.d.ts +1 -1
- package/radio-group/styles.scoped.css +0 -22
- package/s3-resource-selector/s3-in-context/styles.scoped.css +0 -6
- package/segmented-control/styles.scoped.css +0 -36
- package/select/parts/styles.scoped.css +0 -6
- package/select/styles.scoped.css +0 -4
- package/side-navigation/styles.scoped.css +0 -38
- package/space-between/styles.scoped.css +0 -40
- package/spinner/styles.scoped.css +0 -17
- package/split-panel/styles.scoped.css +0 -65
- package/status-indicator/styles.scoped.css +0 -20
- package/table/body-cell/styles.scoped.css +0 -29
- package/table/header-cell/styles.scoped.css +0 -32
- package/table/resizer/styles.scoped.css +0 -6
- package/table/selection-control/styles.scoped.css +0 -3
- package/table/styles.scoped.css +0 -39
- package/tabs/styles.scoped.css +0 -41
- package/tabs/tab-header-bar.d.ts.map +1 -1
- package/tabs/tab-header-bar.js +3 -1
- package/tabs/tab-header-bar.js.map +1 -1
- package/tag-editor/styles.scoped.css +0 -12
- package/test-utils/dom/split-panel/index.d.ts +1 -0
- package/test-utils/dom/split-panel/index.js +3 -0
- package/test-utils/dom/split-panel/index.js.map +1 -1
- package/test-utils/selectors/split-panel/index.d.ts +1 -0
- package/test-utils/selectors/split-panel/index.js +3 -0
- package/test-utils/selectors/split-panel/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +1 -1
- package/text-content/styles.scoped.css +0 -54
- package/text-filter/styles.scoped.css +0 -7
- package/textarea/styles.scoped.css +0 -30
- package/tiles/styles.scoped.css +0 -55
- package/toggle/styles.scoped.css +0 -14
- package/token-group/styles.scoped.css +0 -35
- package/top-navigation/1.0-beta/styles.scoped.css +0 -40
- package/top-navigation/styles.scoped.css +0 -75
- package/tutorial-panel/components/tutorial-detail-view/styles.scoped.css +0 -22
- package/tutorial-panel/components/tutorial-list/styles.scoped.css +0 -24
- package/tutorial-panel/styles.scoped.css +0 -5
- package/wizard/styles.scoped.css +0 -54
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-scaled-bar-groups.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-bar-groups.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"make-scaled-bar-groups.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-bar-groups.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAc7E;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,MAA6C,EAC7C,MAAkB,EAClB,SAAiB,EACjB,UAAkB,EAClB,IAAe;IAEf,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE;QAC3B,OAAO,EAAE,CAAC;KACX;IAED,OAAQ,MAAM,CAAC,MAA2B,CAAC,GAAG,CAAC,UAAA,CAAC;QAC9C,IAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAClC,IAAM,OAAO,GAAG,OAAO,OAAO,KAAK,WAAW,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEpE,OAAO;YACL,CAAC,GAAA;YACD,OAAO,SAAA;YACP,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAC,EAAU;oBAAR,MAAM,YAAA;gBAC5B,4EAA4E;gBAC5E,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;oBACxB,OAAO,IAAI,CAAC;iBACb;gBACD,6CAA6C;gBAC7C,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;oBACxB,OAAO,KAAK,CAAC;iBACd;gBACD,IAAI,YAAY,CAAC,MAAM,CAAC,EAAE;oBACxB,OAAQ,MAAM,CAAC,IAAuD,CAAC,IAAI,CAAC,UAAA,KAAK,IAAI,OAAA,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAApB,CAAoB,CAAC,CAAC;iBAC5G;gBACD,OAAO,KAAK,CAAC;YACf,CAAC,CAAC;YACF,QAAQ,EACN,IAAI,KAAK,GAAG;gBACV,CAAC,CAAC;oBACE,CAAC,EAAE,CAAC;oBACJ,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC7B,KAAK,EAAE,SAAS;oBAChB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE;iBACnC;gBACH,CAAC,CAAC;oBACE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC7B,CAAC,EAAE,CAAC;oBACJ,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE;oBACjC,MAAM,EAAE,UAAU;iBACnB;SACR,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps } from './interfaces';\nimport { ChartScale } from '../internal/components/cartesian-chart/scales';\nimport { isDataSeries, isXThreshold, isYThreshold, matchesX } from './utils';\n\nexport interface ScaledBarGroup<T> {\n x: T;\n hasData: boolean;\n isValid: boolean;\n position: {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n}\n\n/**\n * Creates a list of all bar (and mixed) groups in the series with their scaled positions.\n */\nexport default function makeScaledBarGroups<T extends ChartDataTypes>(\n series: ReadonlyArray<InternalChartSeries<T>>,\n xScale: ChartScale,\n plotWidth: number,\n plotHeight: number,\n axis: 'x' | 'y'\n): ScaledBarGroup<T>[] {\n if (!xScale.isCategorical()) {\n return [];\n }\n\n return (xScale.domain as ReadonlyArray<T>).map(x => {\n const scaledX = xScale.d3Scale(x);\n const isValid = typeof scaledX !== 'undefined' && isFinite(scaledX);\n\n return {\n x,\n isValid,\n hasData: series.some(({ series }) => {\n // If there is a threshold series, every valid group will have a data point.\n if (isYThreshold(series)) {\n return true;\n }\n // X-thresholds do not have associated value.\n if (isXThreshold(series)) {\n return false;\n }\n if (isDataSeries(series)) {\n return (series.data as ReadonlyArray<MixedLineBarChartProps.Datum<T>>).some(datum => matchesX(datum.x, x));\n }\n return false;\n }),\n position:\n axis === 'x'\n ? {\n x: 0,\n y: isValid ? scaledX || 0 : 0,\n width: plotWidth,\n height: xScale.d3Scale.bandwidth(),\n }\n : {\n x: isValid ? scaledX || 0 : 0,\n y: 0,\n width: xScale.d3Scale.bandwidth(),\n height: plotHeight,\n },\n };\n });\n}\n"]}
|
|
@@ -7,8 +7,6 @@ export interface ScaledPoint<T> {
|
|
|
7
7
|
datum?: MixedLineBarChartProps.Datum<T> | undefined;
|
|
8
8
|
series: MixedLineBarChartProps.ChartSeries<T>;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
*/
|
|
13
|
-
export default function makeScaledSeries<T extends ChartDataTypes>(series: ReadonlyArray<InternalChartSeries<T>>, xScale: ChartScale, yScale: NumericChartScale): readonly ScaledPoint<T>[];
|
|
10
|
+
/** Combine all line series into an array of scaled data points with the given scales. */
|
|
11
|
+
export default function makeScaledSeries<T extends ChartDataTypes>(allSeries: ReadonlyArray<InternalChartSeries<T>>, xScale: ChartScale, yScale: NumericChartScale): readonly ScaledPoint<T>[];
|
|
14
12
|
//# sourceMappingURL=make-scaled-series.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-scaled-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-series.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"make-scaled-series.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-series.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAG9F,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IACpD,MAAM,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAC/C;AAED,yFAAyF;AACzF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,SAAS,cAAc,EAC/D,SAAS,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAChD,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,iBAAiB,GACxB,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,CA6E3B"}
|
|
@@ -1,48 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export default function makeScaledSeries(series, xScale, yScale) {
|
|
1
|
+
import { isXThreshold, isYThreshold } from './utils';
|
|
2
|
+
/** Combine all line series into an array of scaled data points with the given scales. */
|
|
3
|
+
export default function makeScaledSeries(allSeries, xScale, yScale) {
|
|
5
4
|
var xOffset = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;
|
|
6
5
|
var scaleX = function (x) { return (xScale.d3Scale(x) || 0) + xOffset; };
|
|
7
6
|
var scaleY = function (y) { return yScale.d3Scale(y) || 0; };
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
var allX = getAllX(allSeries);
|
|
8
|
+
function mergeLineSeriesPointsWithXThresholds(scaledPoints, xThresholdSeries, xThresholdSeriesColor) {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
var x = scaleX(xThresholdSeries.x);
|
|
11
|
+
// Locate a point the x-threshold can be inserted after (if such exists).
|
|
12
|
+
var bisectIndex = -1;
|
|
13
|
+
for (var i = 0; i < scaledPoints.length - 1; i++) {
|
|
14
|
+
if (scaledPoints[i].x < x && x < scaledPoints[i + 1].x) {
|
|
15
|
+
bisectIndex = i;
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Insert x-threshold point into the given series using extrapolated Y value.
|
|
20
|
+
// The extrapolated value is only used to render highlighted point on the chart plot.
|
|
21
|
+
if (bisectIndex !== -1) {
|
|
22
|
+
var prevY = ((_a = scaledPoints[bisectIndex].datum) === null || _a === void 0 ? void 0 : _a.y) || 0;
|
|
23
|
+
var nextY = ((_b = scaledPoints[bisectIndex + 1].datum) === null || _b === void 0 ? void 0 : _b.y) || 0;
|
|
24
|
+
var averageY = (prevY + nextY) / 2;
|
|
25
|
+
scaledPoints.push({
|
|
26
|
+
x: x,
|
|
27
|
+
y: scaleY(averageY),
|
|
28
|
+
datum: { x: xThresholdSeries.x, y: NaN },
|
|
29
|
+
series: scaledPoints[bisectIndex].series,
|
|
30
|
+
color: xThresholdSeriesColor
|
|
31
|
+
});
|
|
32
|
+
}
|
|
12
33
|
}
|
|
13
|
-
|
|
34
|
+
var scaledSeriesX = allSeries.map(function (_a) {
|
|
14
35
|
var series = _a.series, color = _a.color;
|
|
36
|
+
var scaledPoints = [];
|
|
37
|
+
// Scale and add all line series data points.
|
|
15
38
|
if (series.type === 'line') {
|
|
16
39
|
for (var _i = 0, _b = series.data; _i < _b.length; _i++) {
|
|
17
40
|
var datum = _b[_i];
|
|
18
|
-
|
|
41
|
+
scaledPoints.push({ x: scaleX(datum.x), y: scaleY(datum.y), datum: datum, series: series, color: color });
|
|
42
|
+
}
|
|
43
|
+
// Sort scaled points to ensure correct x-thresholds insertion.
|
|
44
|
+
scaledPoints.sort(function (s1, s2) { return s1.x - s2.x; });
|
|
45
|
+
// Merge x-thresholds into series if they don't have a shared coordinate.
|
|
46
|
+
for (var _c = 0, allSeries_1 = allSeries; _c < allSeries_1.length; _c++) {
|
|
47
|
+
var otherSeries = allSeries_1[_c];
|
|
48
|
+
if (isXThreshold(otherSeries.series)) {
|
|
49
|
+
mergeLineSeriesPointsWithXThresholds(scaledPoints, otherSeries.series, otherSeries.color);
|
|
50
|
+
}
|
|
19
51
|
}
|
|
20
52
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
53
|
+
// Y-thresholds only have Y. To make thresholds navigable they are mapped to all defined X values.
|
|
54
|
+
else if (isYThreshold(series)) {
|
|
55
|
+
for (var _d = 0, allX_1 = allX; _d < allX_1.length; _d++) {
|
|
56
|
+
var x = allX_1[_d];
|
|
57
|
+
scaledPoints.push({ x: scaleX(x), y: scaleY(series.y), datum: { x: x, y: series.y }, series: series, color: color });
|
|
58
|
+
}
|
|
59
|
+
// Support threshold-only setup.
|
|
60
|
+
if (allX.length === 0) {
|
|
61
|
+
scaledPoints.push({ x: NaN, y: scaleY(series.y), series: series, color: color });
|
|
25
62
|
}
|
|
26
63
|
}
|
|
27
|
-
|
|
28
|
-
|
|
64
|
+
// X-thresholds only have X. The y value is taken as NaN which means there is no associated point - only vertical marker.
|
|
65
|
+
else if (isXThreshold(series)) {
|
|
66
|
+
scaledPoints.push({ x: scaleX(series.x), y: NaN, datum: { x: series.x, y: NaN }, series: series, color: color });
|
|
67
|
+
}
|
|
68
|
+
// Bar series are handled separately.
|
|
69
|
+
return scaledPoints;
|
|
70
|
+
});
|
|
71
|
+
// Sort scaled points by x to ensure their order matches visual order in the chart to support navigation.
|
|
72
|
+
return flatten(scaledSeriesX).sort(function (s1, s2) { return s1.x - s2.x; });
|
|
29
73
|
}
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
function getAllScaledX(series, scaleX) {
|
|
74
|
+
/** Collect unique x values from all data series. */
|
|
75
|
+
function getAllX(series) {
|
|
34
76
|
var addDataXSet = new Set();
|
|
35
77
|
for (var _i = 0, series_1 = series; _i < series_1.length; _i++) {
|
|
36
78
|
var s = series_1[_i].series;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
79
|
+
switch (s.type) {
|
|
80
|
+
// Add all X values from data series.
|
|
81
|
+
case 'bar':
|
|
82
|
+
case 'line':
|
|
83
|
+
for (var _a = 0, _b = s.data; _a < _b.length; _a++) {
|
|
84
|
+
var d = _b[_a];
|
|
85
|
+
addDataXSet.add(d.x);
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
case 'threshold':
|
|
89
|
+
// X-thresholds have a single X value.
|
|
90
|
+
if (isXThreshold(s)) {
|
|
91
|
+
addDataXSet.add(s.x);
|
|
92
|
+
}
|
|
93
|
+
// Thresholds don't have X values.
|
|
94
|
+
break;
|
|
42
95
|
}
|
|
43
96
|
}
|
|
44
97
|
var allDataX = [];
|
|
45
98
|
addDataXSet.forEach(function (x) { return allDataX.push(x); });
|
|
46
99
|
return allDataX;
|
|
47
100
|
}
|
|
101
|
+
function flatten(arrays) {
|
|
102
|
+
var merged = [];
|
|
103
|
+
for (var _i = 0, arrays_1 = arrays; _i < arrays_1.length; _i++) {
|
|
104
|
+
var array = arrays_1[_i];
|
|
105
|
+
for (var _a = 0, array_1 = array; _a < array_1.length; _a++) {
|
|
106
|
+
var item = array_1[_a];
|
|
107
|
+
merged.push(item);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return merged;
|
|
111
|
+
}
|
|
48
112
|
//# sourceMappingURL=make-scaled-series.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-scaled-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-series.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"make-scaled-series.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/make-scaled-series.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUrD,yFAAyF;AACzF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,SAAgD,EAChD,MAAkB,EAClB,MAAyB;IAEzB,IAAM,OAAO,GAAG,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,IAAM,MAAM,GAAG,UAAC,CAAI,IAAK,OAAA,CAAC,MAAM,CAAC,OAAO,CAAC,CAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,EAAzC,CAAyC,CAAC;IACnE,IAAM,MAAM,GAAG,UAAC,CAAS,IAAK,OAAA,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAtB,CAAsB,CAAC;IACrD,IAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,SAAS,oCAAoC,CAC3C,YAA8B,EAC9B,gBAAsE,EACtE,qBAA6B;;QAE7B,IAAM,CAAC,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAErC,yEAAyE;QACzE,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;YAChD,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,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AAA,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAhB,CAAgB,CAAC,CAAC;IAE3C,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CAAI,MAAa;IAC/B,IAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,KAAoB,UAAM,EAAN,iBAAM,EAAN,oBAAM,EAAN,IAAM,EAAE;QAAvB,IAAM,KAAK,eAAA;QACd,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK,EAAE;YAArB,IAAM,IAAI,cAAA;YACb,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACnB;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps } from './interfaces';\nimport { ChartScale, NumericChartScale } from '../internal/components/cartesian-chart/scales';\nimport { isXThreshold, isYThreshold } from './utils';\n\nexport interface ScaledPoint<T> {\n x: number;\n y: number;\n color: string;\n datum?: MixedLineBarChartProps.Datum<T> | undefined;\n series: MixedLineBarChartProps.ChartSeries<T>;\n}\n\n/** Combine all line series into an array of scaled data points with the given scales. */\nexport default function makeScaledSeries<T extends ChartDataTypes>(\n allSeries: ReadonlyArray<InternalChartSeries<T>>,\n xScale: ChartScale,\n yScale: NumericChartScale\n): readonly ScaledPoint<T>[] {\n const xOffset = xScale.isCategorical() ? Math.max(0, xScale.d3Scale.bandwidth() - 1) / 2 : 0;\n const scaleX = (x: T) => (xScale.d3Scale(x as any) || 0) + xOffset;\n const scaleY = (y: number) => yScale.d3Scale(y) || 0;\n const allX = getAllX(allSeries);\n\n function mergeLineSeriesPointsWithXThresholds(\n scaledPoints: ScaledPoint<T>[],\n xThresholdSeries: MixedLineBarChartProps.ThresholdSeries<T> & { x: T },\n xThresholdSeriesColor: string\n ) {\n const x = scaleX(xThresholdSeries.x);\n\n // Locate a point the x-threshold can be inserted after (if such exists).\n let bisectIndex = -1;\n for (let i = 0; i < scaledPoints.length - 1; i++) {\n if (scaledPoints[i].x < x && x < scaledPoints[i + 1].x) {\n bisectIndex = i;\n break;\n }\n }\n\n // Insert x-threshold point into the given series using extrapolated Y value.\n // The extrapolated value is only used to render highlighted point on the chart plot.\n if (bisectIndex !== -1) {\n const prevY = scaledPoints[bisectIndex].datum?.y || 0;\n const nextY = scaledPoints[bisectIndex + 1].datum?.y || 0;\n const averageY = (prevY + nextY) / 2;\n scaledPoints.push({\n x: x,\n y: scaleY(averageY),\n datum: { x: xThresholdSeries.x, y: NaN },\n series: scaledPoints[bisectIndex].series,\n color: xThresholdSeriesColor,\n });\n }\n }\n\n const scaledSeriesX = allSeries.map(({ series, color }) => {\n const scaledPoints: ScaledPoint<T>[] = [];\n\n // Scale and add all line series data points.\n if (series.type === 'line') {\n for (const datum of series.data as MixedLineBarChartProps.Datum<T>[]) {\n scaledPoints.push({ x: scaleX(datum.x), y: scaleY(datum.y), datum, series, color });\n }\n\n // Sort scaled points to ensure correct x-thresholds insertion.\n scaledPoints.sort((s1, s2) => s1.x - s2.x);\n\n // Merge x-thresholds into series if they don't have a shared coordinate.\n for (const otherSeries of allSeries) {\n if (isXThreshold(otherSeries.series)) {\n mergeLineSeriesPointsWithXThresholds(scaledPoints, otherSeries.series, otherSeries.color);\n }\n }\n }\n // Y-thresholds only have Y. To make thresholds navigable they are mapped to all defined X values.\n else if (isYThreshold(series)) {\n for (const x of allX) {\n scaledPoints.push({ x: scaleX(x), y: scaleY(series.y), datum: { x, y: series.y }, series, color });\n }\n // Support threshold-only setup.\n if (allX.length === 0) {\n scaledPoints.push({ x: NaN, y: scaleY(series.y), series, color });\n }\n }\n // X-thresholds only have X. The y value is taken as NaN which means there is no associated point - only vertical marker.\n else if (isXThreshold(series)) {\n scaledPoints.push({ x: scaleX(series.x), y: NaN, datum: { x: series.x, y: NaN }, series, color });\n }\n // Bar series are handled separately.\n return scaledPoints;\n });\n\n // Sort scaled points by x to ensure their order matches visual order in the chart to support navigation.\n return flatten(scaledSeriesX).sort((s1, s2) => s1.x - s2.x);\n}\n\n/** Collect unique x values from all data series. */\nfunction getAllX<T>(series: ReadonlyArray<InternalChartSeries<T>>) {\n const addDataXSet = new Set<T>();\n for (const { series: s } of series) {\n switch (s.type) {\n // Add all X values from data series.\n case 'bar':\n case 'line':\n for (const d of s.data) {\n addDataXSet.add(d.x);\n }\n break;\n\n case 'threshold':\n // X-thresholds have a single X value.\n if (isXThreshold(s)) {\n addDataXSet.add(s.x);\n }\n // Thresholds don't have X values.\n break;\n }\n }\n const allDataX: T[] = [];\n addDataXSet.forEach(x => allDataX.push(x));\n\n return allDataX;\n}\n\nfunction flatten<T>(arrays: T[][]): T[] {\n const merged: T[] = [];\n for (const array of arrays) {\n for (const item of array) {\n merged.push(item);\n }\n }\n return merged;\n}\n"]}
|
|
@@ -92,7 +92,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
92
92
|
*/
|
|
93
93
|
.awsui_series_1yz9c_13bfe_93:not(#\9),
|
|
94
94
|
.awsui_series--bar_1yz9c_13bfe_94 > .awsui_series__rect_1yz9c_13bfe_94:not(#\9) {
|
|
95
|
-
transition: opacity 90ms linear;
|
|
96
95
|
transition: opacity var(--motion-duration-transition-quick-x85tae, 90ms) var(--motion-easing-transition-quick-lukbd8, linear);
|
|
97
96
|
}
|
|
98
97
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -108,7 +107,6 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
.awsui_exiting_1yz9c_13bfe_111:not(#\9) {
|
|
111
|
-
animation: awsui_awsui-motion-fade-out-0_1yz9c_13bfe_1 115ms cubic-bezier(1, 0, 0.83, 1);
|
|
112
110
|
animation: awsui_awsui-motion-fade-out-0_1yz9c_13bfe_1 var(--motion-duration-refresh-only-fast-addxjd, 115ms) var(--motion-easing-refresh-only-b-nspng9, cubic-bezier(1, 0, 0.83, 1));
|
|
113
111
|
}
|
|
114
112
|
@keyframes awsui_awsui-motion-fade-out-0_1yz9c_13bfe_1 {
|
|
@@ -164,14 +162,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
164
162
|
widows: 2;
|
|
165
163
|
word-spacing: normal;
|
|
166
164
|
box-sizing: border-box;
|
|
167
|
-
font-size: 14px;
|
|
168
165
|
font-size: var(--font-body-m-size-sregvd, 14px);
|
|
169
|
-
line-height: 22px;
|
|
170
166
|
line-height: var(--font-body-m-line-height-i7xxvv, 22px);
|
|
171
|
-
color: #000716;
|
|
172
167
|
color: var(--color-text-body-default-ajf1h5, #000716);
|
|
173
168
|
font-weight: 400;
|
|
174
|
-
font-family: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;
|
|
175
169
|
font-family: var(--font-family-base-qnistn, "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif);
|
|
176
170
|
position: relative;
|
|
177
171
|
display: block;
|
|
@@ -209,22 +203,18 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
209
203
|
}
|
|
210
204
|
|
|
211
205
|
.awsui_content--reserve-filter_1yz9c_13bfe_181:not(#\9) {
|
|
212
|
-
margin-top: calc(2 * 22px);
|
|
213
206
|
margin-top: calc(2 * var(--font-body-m-line-height-i7xxvv, 22px));
|
|
214
207
|
}
|
|
215
208
|
|
|
216
209
|
.awsui_content--reserve-legend_1yz9c_13bfe_185:not(#\9) {
|
|
217
|
-
margin-bottom: calc(2 * 22px);
|
|
218
210
|
margin-bottom: calc(2 * var(--font-body-m-line-height-i7xxvv, 22px));
|
|
219
211
|
}
|
|
220
212
|
|
|
221
213
|
.awsui_series_1yz9c_13bfe_93:not(#\9) {
|
|
222
214
|
display: block;
|
|
223
|
-
stroke-width: 2px;
|
|
224
215
|
stroke-width: var(--border-line-chart-width-nj0hc5, 2px);
|
|
225
216
|
fill: none;
|
|
226
217
|
stroke-linecap: round;
|
|
227
|
-
stroke-linejoin: round;
|
|
228
218
|
stroke-linejoin: var(--border-line-chart-line-join-nan7pn, round);
|
|
229
219
|
pointer-events: none;
|
|
230
220
|
}
|
|
@@ -239,15 +229,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
239
229
|
}
|
|
240
230
|
|
|
241
231
|
.awsui_series--bar_1yz9c_13bfe_94 > .awsui_series__rect_1yz9c_13bfe_94:not(#\9) {
|
|
242
|
-
stroke: #ffffff;
|
|
243
232
|
stroke: var(--color-background-container-content-i8i4a0, #ffffff);
|
|
244
233
|
stroke-width: 2px;
|
|
245
234
|
}
|
|
246
235
|
|
|
247
236
|
.awsui_series--threshold_1yz9c_13bfe_212:not(#\9) {
|
|
248
|
-
stroke-dasharray: 3 5;
|
|
249
237
|
stroke-dasharray: var(--border-line-chart-dash-array-4wa4ab, 3 5);
|
|
250
|
-
stroke-width: 2px;
|
|
251
238
|
stroke-width: var(--border-line-chart-width-nj0hc5, 2px);
|
|
252
239
|
}
|
|
253
240
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ChartSeriesMarkerType } from '../internal/components/chart-series-marker';
|
|
2
|
-
import { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps
|
|
2
|
+
import { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps } from './interfaces';
|
|
3
3
|
import { ScaledBarGroup } from './make-scaled-bar-groups';
|
|
4
4
|
export declare const chartLegendMap: Record<string, ChartSeriesMarkerType>;
|
|
5
|
-
export declare function computeDomainX<T>(series: readonly InternalChartSeries<T>[], xScaleType: ScaleType): T[];
|
|
6
|
-
export declare function computeDomainY<T>(series: readonly InternalChartSeries<T>[], scaleType: 'linear' | 'log', stackedBars: boolean): number[];
|
|
7
5
|
export declare const nextValidDomainIndex: <T>(nextGroupIndex: number, barGroups: ScaledBarGroup<T>[], direction?: number) => number;
|
|
8
6
|
/**
|
|
9
7
|
* Find the subset of series that are individually navigable with keyboard.
|
|
@@ -27,8 +25,9 @@ export interface StackedOffsets {
|
|
|
27
25
|
* Calculates list of offset maps from all data by accumulating each value
|
|
28
26
|
*/
|
|
29
27
|
export declare function calculateOffsetMaps(data: Array<readonly MixedLineBarChartProps.Datum<ChartDataTypes>[]>): StackedOffsets[];
|
|
30
|
-
/**
|
|
31
|
-
* Returns string or number value for ChartDataTypes key
|
|
32
|
-
*/
|
|
28
|
+
/** Returns string or number value for ChartDataTypes key */
|
|
33
29
|
export declare const getKeyValue: (key: ChartDataTypes) => string | number;
|
|
30
|
+
export declare function isYThreshold<T>(series: MixedLineBarChartProps.ChartSeries<T>): series is MixedLineBarChartProps.YThresholdSeries;
|
|
31
|
+
export declare function isXThreshold<T>(series: MixedLineBarChartProps.ChartSeries<T>): series is MixedLineBarChartProps.XThresholdSeries<T>;
|
|
32
|
+
export declare function isDataSeries<T>(series: MixedLineBarChartProps.ChartSeries<T>): series is MixedLineBarChartProps.DataSeries<T>;
|
|
34
33
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,eAAO,MA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LegendMap = {
|
|
3
3
|
line: 'line',
|
|
4
4
|
bar: 'rectangle',
|
|
5
5
|
threshold: 'dashed'
|
|
6
6
|
};
|
|
7
|
-
export function computeDomainX(series, xScaleType) {
|
|
8
|
-
if (xScaleType === 'categorical') {
|
|
9
|
-
return series.reduce(function (acc, s) {
|
|
10
|
-
if (s.series.type !== 'threshold') {
|
|
11
|
-
s.series.data.forEach(function (_a) {
|
|
12
|
-
var x = _a.x;
|
|
13
|
-
if (acc.indexOf(x) === -1) {
|
|
14
|
-
acc.push(x);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return acc;
|
|
19
|
-
}, []);
|
|
20
|
-
}
|
|
21
|
-
return series.reduce(function (acc, curr) {
|
|
22
|
-
if (curr.series.type === 'threshold') {
|
|
23
|
-
return acc;
|
|
24
|
-
}
|
|
25
|
-
return curr.series.data.reduce(function (_a, _b) {
|
|
26
|
-
var min = _a[0], max = _a[1];
|
|
27
|
-
var x = _b.x;
|
|
28
|
-
var newMin = min === undefined || x < min ? x : min;
|
|
29
|
-
var newMax = max === undefined || max < x ? x : max;
|
|
30
|
-
return [newMin, newMax];
|
|
31
|
-
}, acc);
|
|
32
|
-
}, []);
|
|
33
|
-
}
|
|
34
|
-
function find(arr, func) {
|
|
35
|
-
for (var i = 0; i < arr.length; i++) {
|
|
36
|
-
var found = func(arr[i]);
|
|
37
|
-
if (found) {
|
|
38
|
-
return arr[i];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
export function computeDomainY(series, scaleType, stackedBars) {
|
|
44
|
-
var _series = series;
|
|
45
|
-
// For stacked bars, we need to accumulate all the bar series into a positive and a negative series
|
|
46
|
-
if (stackedBars) {
|
|
47
|
-
var _a = series.reduce(function (acc, curr) {
|
|
48
|
-
if (curr.series.type === 'bar') {
|
|
49
|
-
curr.series.data.forEach(function (_a) {
|
|
50
|
-
var x = _a.x, y = _a.y;
|
|
51
|
-
var data = y < 0 ? acc.negativeData : acc.positiveData;
|
|
52
|
-
var stackedDatum = find(data, function (el) { return matchesX(el.x, x); });
|
|
53
|
-
if (stackedDatum) {
|
|
54
|
-
stackedDatum.y += y;
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
data.push({ x: x, y: y });
|
|
58
|
-
}
|
|
59
|
-
return acc;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return acc;
|
|
63
|
-
}, {
|
|
64
|
-
positiveData: [],
|
|
65
|
-
negativeData: []
|
|
66
|
-
}), positiveData = _a.positiveData, negativeData = _a.negativeData;
|
|
67
|
-
// Artificial series with the sum of all bars when stacked
|
|
68
|
-
var stackedSeries = [
|
|
69
|
-
{
|
|
70
|
-
color: '',
|
|
71
|
-
index: NaN,
|
|
72
|
-
series: {
|
|
73
|
-
type: 'bar',
|
|
74
|
-
title: 'positive',
|
|
75
|
-
data: positiveData
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
color: '',
|
|
80
|
-
index: NaN,
|
|
81
|
-
series: {
|
|
82
|
-
type: 'bar',
|
|
83
|
-
title: 'negative',
|
|
84
|
-
data: negativeData
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
];
|
|
88
|
-
// MixedLineBarChart can also contain other non-bar series,
|
|
89
|
-
// so we replace all bars with the artificial bar series
|
|
90
|
-
// Then proceed to compute range with it and the remaining (non-bar) series
|
|
91
|
-
_series = __spreadArray(__spreadArray([], stackedSeries, true), _series.filter(function (s) { return s.series.type !== 'bar'; }), true);
|
|
92
|
-
}
|
|
93
|
-
var domain = _series.reduce(function (acc, curr) {
|
|
94
|
-
if (curr.series.type === 'threshold') {
|
|
95
|
-
var min = acc[0], max = acc[1];
|
|
96
|
-
var y = curr.series.y;
|
|
97
|
-
var newMin = min === undefined || y < min ? y : min;
|
|
98
|
-
var newMax = max === undefined || max < y ? y : max;
|
|
99
|
-
return [newMin, newMax];
|
|
100
|
-
}
|
|
101
|
-
return curr.series.data.reduce(function (_a, _b) {
|
|
102
|
-
var min = _a[0], max = _a[1];
|
|
103
|
-
var y = _b.y;
|
|
104
|
-
var newMin = min === undefined || y < min ? y : min;
|
|
105
|
-
var newMax = max === undefined || max < y ? y : max;
|
|
106
|
-
return [newMin, newMax];
|
|
107
|
-
}, acc);
|
|
108
|
-
}, [0, 0]);
|
|
109
|
-
// Log scales can't start from 0, so if possible, start from 1.
|
|
110
|
-
if (scaleType === 'log' && domain[0] === 0 && domain[1] > 1) {
|
|
111
|
-
return [1, domain[1]];
|
|
112
|
-
}
|
|
113
|
-
return domain;
|
|
114
|
-
}
|
|
115
7
|
// Starting from the given index, find the first x value in the x domain that has bar data attached to it.
|
|
116
8
|
export var nextValidDomainIndex = function (nextGroupIndex, barGroups, direction) {
|
|
117
9
|
if (direction === void 0) { direction = 1; }
|
|
@@ -197,8 +89,15 @@ export function calculateOffsetMaps(data) {
|
|
|
197
89
|
return acc;
|
|
198
90
|
}, []);
|
|
199
91
|
}
|
|
200
|
-
/**
|
|
201
|
-
* Returns string or number value for ChartDataTypes key
|
|
202
|
-
*/
|
|
92
|
+
/** Returns string or number value for ChartDataTypes key */
|
|
203
93
|
export var getKeyValue = function (key) { return (key instanceof Date ? key.getTime() : key); };
|
|
94
|
+
export function isYThreshold(series) {
|
|
95
|
+
return series.type === 'threshold' && 'y' in series;
|
|
96
|
+
}
|
|
97
|
+
export function isXThreshold(series) {
|
|
98
|
+
return series.type === 'threshold' && 'x' in series;
|
|
99
|
+
}
|
|
100
|
+
export function isDataSeries(series) {
|
|
101
|
+
return series.type === 'line' || series.type === 'bar';
|
|
102
|
+
}
|
|
204
103
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/utils.ts"],"names":[],"mappings":";AAMA,MAAM,CAAC,IAAM,cAAc,GAA0C;IACnE,IAAI,EAAE,MAAM;IACZ,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H,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,GAAmB,IAAK,OAAA,CAAC,GAAG,YAAY,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAA3C,CAA2C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartSeriesMarkerType } from '../internal/components/chart-series-marker';\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps, ScaleType } from './interfaces';\nimport { ScaledBarGroup } from './make-scaled-bar-groups';\n\nexport const chartLegendMap: Record<string, ChartSeriesMarkerType> = {\n line: 'line',\n bar: 'rectangle',\n threshold: 'dashed',\n};\n\nexport function computeDomainX<T>(series: readonly InternalChartSeries<T>[], xScaleType: ScaleType) {\n if (xScaleType === 'categorical') {\n return series.reduce((acc, s) => {\n if (s.series.type !== 'threshold') {\n s.series.data.forEach(({ x }) => {\n if (acc.indexOf(x) === -1) {\n acc.push(x);\n }\n });\n }\n return acc;\n }, [] as T[]);\n }\n\n return series.reduce((acc, curr) => {\n if (curr.series.type === 'threshold') {\n return acc;\n }\n\n return curr.series.data.reduce(([min, max], { x }) => {\n const newMin = min === undefined || x < min ? x : min;\n const newMax = max === undefined || max < x ? x : max;\n return [newMin, newMax] as T[];\n }, acc);\n }, [] as T[]);\n}\n\nfunction find<Q>(arr: readonly Q[], func: (el: Q) => boolean) {\n for (let i = 0; i < arr.length; i++) {\n const found = func(arr[i]);\n if (found) {\n return arr[i];\n }\n }\n return null;\n}\n\nexport function computeDomainY<T>(\n series: readonly InternalChartSeries<T>[],\n scaleType: 'linear' | 'log',\n stackedBars: boolean\n) {\n let _series = series;\n\n // For stacked bars, we need to accumulate all the bar series into a positive and a negative series\n if (stackedBars) {\n const { positiveData, negativeData } = series.reduce(\n (acc, curr) => {\n if (curr.series.type === 'bar') {\n curr.series.data.forEach(({ x, y }) => {\n const data = y < 0 ? acc.negativeData : acc.positiveData;\n const stackedDatum = find(data, el => matchesX(el.x, x));\n if (stackedDatum) {\n stackedDatum.y += y;\n } else {\n data.push({ x, y });\n }\n return acc;\n });\n }\n return acc;\n },\n {\n positiveData: [] as MixedLineBarChartProps.Datum<T>[],\n negativeData: [] as MixedLineBarChartProps.Datum<T>[],\n }\n );\n\n // Artificial series with the sum of all bars when stacked\n const stackedSeries: InternalChartSeries<T>[] = [\n {\n color: '',\n index: NaN,\n series: {\n type: 'bar',\n title: 'positive',\n data: positiveData as any,\n },\n },\n {\n color: '',\n index: NaN,\n series: {\n type: 'bar',\n title: 'negative',\n data: negativeData as any,\n },\n },\n ];\n\n // MixedLineBarChart can also contain other non-bar series,\n // so we replace all bars with the artificial bar series\n // Then proceed to compute range with it and the remaining (non-bar) series\n _series = [...stackedSeries, ..._series.filter(s => s.series.type !== 'bar')];\n }\n\n const domain = _series.reduce(\n (acc, curr) => {\n if (curr.series.type === 'threshold') {\n const [min, max] = acc;\n const y = curr.series.y;\n const newMin = min === undefined || y < min ? y : min;\n const newMax = max === undefined || max < y ? y : max;\n return [newMin, newMax];\n }\n\n return curr.series.data.reduce(([min, max], { y }) => {\n const newMin = min === undefined || y < min ? y : min;\n const newMax = max === undefined || max < y ? y : max;\n return [newMin, newMax];\n }, acc);\n },\n [0, 0]\n );\n\n // Log scales can't start from 0, so if possible, start from 1.\n if (scaleType === 'log' && domain[0] === 0 && domain[1] > 1) {\n return [1, domain[1]];\n }\n return domain;\n}\n\n// Starting from the given index, find the first x value in the x domain that has bar data attached to it.\nexport const nextValidDomainIndex = <T>(nextGroupIndex: number, barGroups: ScaledBarGroup<T>[], direction = 1) => {\n let index = nextGroupIndex;\n\n if (index < 0 || index >= barGroups.length) {\n index = 0;\n }\n\n do {\n if (barGroups[index].isValid && barGroups[index].hasData) {\n return index;\n }\n index += direction;\n\n // Loop back to the beginning if necessary\n if (index >= barGroups.length) {\n index = 0;\n } else if (index < 0) {\n index = barGroups.length - 1;\n }\n } while (index !== nextGroupIndex);\n return 0;\n};\n\n/**\n * Find the subset of series that are individually navigable with keyboard.\n * Lines and thresholds are navigated individually, while bar series are grouped as one.\n */\nexport function findNavigableSeries<T extends ChartDataTypes>(series: ReadonlyArray<InternalChartSeries<T>>) {\n const navigableSeries: Array<MixedLineBarChartProps.ChartSeries<T>> = [];\n let navigableBarSeriesIndex = -1;\n\n series.forEach(internalSeries => {\n if (internalSeries.series.type === 'bar') {\n // Only include the first bar series because all bar series are handled as one\n if (navigableBarSeriesIndex === -1) {\n navigableBarSeriesIndex = navigableSeries.length;\n navigableSeries.push(internalSeries.series);\n }\n } else {\n navigableSeries.push(internalSeries.series);\n }\n });\n return { navigableSeries, navigableBarSeriesIndex };\n}\n\n/**\n * Checks if two x values are equal.\n * With a special treat for Date values which need to be converted to numbers first.\n */\nexport const matchesX = <T>(x1: T, x2: T) => {\n if (x1 instanceof Date && x2 instanceof Date) {\n return x1.getTime() === x2.getTime();\n }\n return x1 === x2;\n};\n\nexport type OffsetMap = Record<string | number, number>;\n\nexport interface StackedOffsets {\n positiveOffsets: OffsetMap;\n negativeOffsets: OffsetMap;\n}\n\n/**\n * Calculates list of offset maps from all data by accumulating each value\n */\nexport function calculateOffsetMaps(\n data: Array<readonly MixedLineBarChartProps.Datum<ChartDataTypes>[]>\n): StackedOffsets[] {\n return data.reduce((acc, curr, idx) => {\n // First series receives empty offsets map\n if (idx === 0) {\n acc.push({ positiveOffsets: {}, negativeOffsets: {} });\n }\n const lastMap = acc[idx];\n const map: StackedOffsets = lastMap\n ? { positiveOffsets: { ...lastMap.positiveOffsets }, negativeOffsets: { ...lastMap.negativeOffsets } }\n : { positiveOffsets: {}, negativeOffsets: {} };\n\n curr.forEach(({ x, y }) => {\n const key = getKeyValue(x);\n if (y < 0) {\n const lastValue = lastMap?.negativeOffsets[key] || 0;\n map.negativeOffsets[key] = lastValue + y;\n } else {\n const lastValue = lastMap?.positiveOffsets[key] || 0;\n map.positiveOffsets[key] = lastValue + y;\n }\n });\n\n // Ignore last value for map but still run it for logging\n if (idx < data.length - 1) {\n acc.push(map);\n }\n\n return acc;\n }, [] as StackedOffsets[]);\n}\n\n/**\n * Returns string or number value for ChartDataTypes key\n */\nexport const getKeyValue = (key: ChartDataTypes) => (key instanceof Date ? key.getTime() : key);\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/mixed-line-bar-chart/utils.ts"],"names":[],"mappings":";AAMA,MAAM,CAAC,IAAM,cAAc,GAA0C;IACnE,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,WAAW;IAChB,SAAS,EAAE,QAAQ;CACpB,CAAC;AAEF,0GAA0G;AAC1G,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAI,cAAsB,EAAE,SAA8B,EAAE,SAAa;IAAb,0BAAA,EAAA,aAAa;IAC3G,IAAI,KAAK,GAAG,cAAc,CAAC;IAE3B,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE;QAC1C,KAAK,GAAG,CAAC,CAAC;KACX;IAED,GAAG;QACD,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;YACxD,OAAO,KAAK,CAAC;SACd;QACD,KAAK,IAAI,SAAS,CAAC;QAEnB,0CAA0C;QAC1C,IAAI,KAAK,IAAI,SAAS,CAAC,MAAM,EAAE;YAC7B,KAAK,GAAG,CAAC,CAAC;SACX;aAAM,IAAI,KAAK,GAAG,CAAC,EAAE;YACpB,KAAK,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;SAC9B;KACF,QAAQ,KAAK,KAAK,cAAc,EAAE;IACnC,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAA2B,MAA6C;IACzG,IAAM,eAAe,GAAiD,EAAE,CAAC;IACzE,IAAI,uBAAuB,GAAG,CAAC,CAAC,CA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,IAAI,MAAM,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,YAAY,CAC1B,MAA6C;IAE7C,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;AACzD,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ChartSeriesMarkerType } from '../internal/components/chart-series-marker';\nimport { ChartDataTypes, InternalChartSeries, MixedLineBarChartProps } from './interfaces';\nimport { ScaledBarGroup } from './make-scaled-bar-groups';\n\nexport const chartLegendMap: Record<string, ChartSeriesMarkerType> = {\n line: 'line',\n bar: 'rectangle',\n threshold: 'dashed',\n};\n\n// Starting from the given index, find the first x value in the x domain that has bar data attached to it.\nexport const nextValidDomainIndex = <T>(nextGroupIndex: number, barGroups: ScaledBarGroup<T>[], direction = 1) => {\n let index = nextGroupIndex;\n\n if (index < 0 || index >= barGroups.length) {\n index = 0;\n }\n\n do {\n if (barGroups[index].isValid && barGroups[index].hasData) {\n return index;\n }\n index += direction;\n\n // Loop back to the beginning if necessary\n if (index >= barGroups.length) {\n index = 0;\n } else if (index < 0) {\n index = barGroups.length - 1;\n }\n } while (index !== nextGroupIndex);\n return 0;\n};\n\n/**\n * Find the subset of series that are individually navigable with keyboard.\n * Lines and thresholds are navigated individually, while bar series are grouped as one.\n */\nexport function findNavigableSeries<T extends ChartDataTypes>(series: ReadonlyArray<InternalChartSeries<T>>) {\n const navigableSeries: Array<MixedLineBarChartProps.ChartSeries<T>> = [];\n let navigableBarSeriesIndex = -1;\n\n series.forEach(internalSeries => {\n if (internalSeries.series.type === 'bar') {\n // Only include the first bar series because all bar series are handled as one\n if (navigableBarSeriesIndex === -1) {\n navigableBarSeriesIndex = navigableSeries.length;\n navigableSeries.push(internalSeries.series);\n }\n } else {\n navigableSeries.push(internalSeries.series);\n }\n });\n return { navigableSeries, navigableBarSeriesIndex };\n}\n\n/**\n * Checks if two x values are equal.\n * With a special treat for Date values which need to be converted to numbers first.\n */\nexport const matchesX = <T>(x1: T, x2: T) => {\n if (x1 instanceof Date && x2 instanceof Date) {\n return x1.getTime() === x2.getTime();\n }\n return x1 === x2;\n};\n\nexport type OffsetMap = Record<string | number, number>;\n\nexport interface StackedOffsets {\n positiveOffsets: OffsetMap;\n negativeOffsets: OffsetMap;\n}\n\n/**\n * Calculates list of offset maps from all data by accumulating each value\n */\nexport function calculateOffsetMaps(\n data: Array<readonly MixedLineBarChartProps.Datum<ChartDataTypes>[]>\n): StackedOffsets[] {\n return data.reduce((acc, curr, idx) => {\n // First series receives empty offsets map\n if (idx === 0) {\n acc.push({ positiveOffsets: {}, negativeOffsets: {} });\n }\n const lastMap = acc[idx];\n const map: StackedOffsets = lastMap\n ? { positiveOffsets: { ...lastMap.positiveOffsets }, negativeOffsets: { ...lastMap.negativeOffsets } }\n : { positiveOffsets: {}, negativeOffsets: {} };\n\n curr.forEach(({ x, y }) => {\n const key = getKeyValue(x);\n if (y < 0) {\n const lastValue = lastMap?.negativeOffsets[key] || 0;\n map.negativeOffsets[key] = lastValue + y;\n } else {\n const lastValue = lastMap?.positiveOffsets[key] || 0;\n map.positiveOffsets[key] = lastValue + y;\n }\n });\n\n // Ignore last value for map but still run it for logging\n if (idx < data.length - 1) {\n acc.push(map);\n }\n\n return acc;\n }, [] as StackedOffsets[]);\n}\n\n/** Returns string or number value for ChartDataTypes key */\nexport const getKeyValue = (key: ChartDataTypes) => (key instanceof Date ? key.getTime() : key);\n\nexport function isYThreshold<T>(\n series: MixedLineBarChartProps.ChartSeries<T>\n): series is MixedLineBarChartProps.YThresholdSeries {\n return series.type === 'threshold' && 'y' in series;\n}\n\nexport function isXThreshold<T>(\n series: MixedLineBarChartProps.ChartSeries<T>\n): series is MixedLineBarChartProps.XThresholdSeries<T> {\n return series.type === 'threshold' && 'x' in series;\n}\n\nexport function isDataSeries<T>(\n series: MixedLineBarChartProps.ChartSeries<T>\n): series is MixedLineBarChartProps.DataSeries<T> {\n return series.type === 'line' || series.type === 'bar';\n}\n"]}
|