@ledgerhq/lumen-ui-rnative-visualization 0.1.1 → 0.1.3
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/dist/module/lib/Components/Axis/Axis.types.js +2 -0
- package/dist/module/lib/Components/Axis/Axis.types.js.map +1 -0
- package/dist/module/lib/Components/Axis/XAxis/XAxis.js +81 -0
- package/dist/module/lib/Components/Axis/XAxis/XAxis.js.map +1 -0
- package/dist/module/lib/Components/Axis/XAxis/XAxis.test.js +121 -0
- package/dist/module/lib/Components/Axis/XAxis/XAxis.test.js.map +1 -0
- package/dist/module/lib/Components/Axis/XAxis/index.js +4 -0
- package/dist/module/lib/Components/Axis/XAxis/index.js.map +1 -0
- package/dist/module/lib/Components/Axis/XAxis/types.js +4 -0
- package/dist/module/lib/Components/Axis/XAxis/types.js.map +1 -0
- package/dist/module/lib/Components/Axis/YAxis/YAxis.js +81 -0
- package/dist/module/lib/Components/Axis/YAxis/YAxis.js.map +1 -0
- package/dist/module/lib/Components/Axis/YAxis/YAxis.test.js +121 -0
- package/dist/module/lib/Components/Axis/YAxis/YAxis.test.js.map +1 -0
- package/dist/module/lib/Components/Axis/YAxis/index.js +4 -0
- package/dist/module/lib/Components/Axis/YAxis/index.js.map +1 -0
- package/dist/module/lib/Components/Axis/YAxis/types.js +4 -0
- package/dist/module/lib/Components/Axis/YAxis/types.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/CartesianChart.js +123 -0
- package/dist/module/lib/Components/CartesianChart/CartesianChart.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/context/cartesianChartContext.js +10 -0
- package/dist/module/lib/Components/CartesianChart/context/cartesianChartContext.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/context/index.js +5 -0
- package/dist/module/lib/Components/CartesianChart/context/index.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/context/useBuildChartContext.js +75 -0
- package/dist/module/lib/Components/CartesianChart/context/useBuildChartContext.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/context/useBuildChartContext.test.js +279 -0
- package/dist/module/lib/Components/CartesianChart/context/useBuildChartContext.test.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/index.js +5 -0
- package/dist/module/lib/Components/CartesianChart/index.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/types.js +4 -0
- package/dist/module/lib/Components/CartesianChart/types.js.map +1 -0
- package/dist/module/lib/Components/Line/Line.js +72 -0
- package/dist/module/lib/Components/Line/Line.js.map +1 -0
- package/dist/module/lib/Components/Line/index.js +4 -0
- package/dist/module/lib/Components/Line/index.js.map +1 -0
- package/dist/module/lib/Components/Line/types.js +2 -0
- package/dist/module/lib/Components/Line/types.js.map +1 -0
- package/dist/module/lib/Components/Line/utils.js +38 -0
- package/dist/module/lib/Components/Line/utils.js.map +1 -0
- package/dist/module/lib/Components/LineChart/LineChart.js +70 -31
- package/dist/module/lib/Components/LineChart/LineChart.js.map +1 -1
- package/dist/module/lib/Components/LineChart/LineChart.stories.js +271 -2
- package/dist/module/lib/Components/LineChart/LineChart.stories.js.map +1 -1
- package/dist/module/lib/Components/LineChart/LineChart.test.js +84 -3
- package/dist/module/lib/Components/LineChart/LineChart.test.js.map +1 -1
- package/dist/module/lib/Components/LineChart/types.js +4 -0
- package/dist/module/lib/Components/LineChart/types.js.map +1 -0
- package/dist/module/lib/utils/domain/domain.js +93 -0
- package/dist/module/lib/utils/domain/domain.js.map +1 -0
- package/dist/module/lib/utils/domain/domain.test.js +152 -0
- package/dist/module/lib/utils/domain/domain.test.js.map +1 -0
- package/dist/module/lib/utils/index.js +0 -2
- package/dist/module/lib/utils/index.js.map +1 -1
- package/dist/module/lib/utils/scales/scales.js +41 -0
- package/dist/module/lib/utils/scales/scales.js.map +1 -0
- package/dist/module/lib/utils/scales/scales.test.js +173 -0
- package/dist/module/lib/utils/scales/scales.test.js.map +1 -0
- package/dist/module/lib/utils/ticks/ticks.js +55 -0
- package/dist/module/lib/utils/ticks/ticks.js.map +1 -0
- package/dist/module/lib/utils/ticks/ticks.test.js +121 -0
- package/dist/module/lib/utils/ticks/ticks.test.js.map +1 -0
- package/dist/module/lib/utils/types.js +2 -0
- package/dist/typescript/src/lib/Components/Axis/Axis.types.d.ts +33 -0
- package/dist/typescript/src/lib/Components/Axis/Axis.types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Axis/XAxis/XAxis.d.ts +4 -0
- package/dist/typescript/src/lib/Components/Axis/XAxis/XAxis.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Axis/XAxis/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/Axis/XAxis/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Axis/XAxis/types.d.ts +9 -0
- package/dist/typescript/src/lib/Components/Axis/XAxis/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Axis/YAxis/YAxis.d.ts +4 -0
- package/dist/typescript/src/lib/Components/Axis/YAxis/YAxis.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Axis/YAxis/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/Axis/YAxis/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Axis/YAxis/types.d.ts +14 -0
- package/dist/typescript/src/lib/Components/Axis/YAxis/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/CartesianChart.d.ts +3 -0
- package/dist/typescript/src/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/context/cartesianChartContext.d.ts +8 -0
- package/dist/typescript/src/lib/Components/CartesianChart/context/cartesianChartContext.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/context/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/CartesianChart/context/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/context/useBuildChartContext.d.ts +23 -0
- package/dist/typescript/src/lib/Components/CartesianChart/context/useBuildChartContext.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/index.d.ts +4 -0
- package/dist/typescript/src/lib/Components/CartesianChart/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/types.d.ts +46 -0
- package/dist/typescript/src/lib/Components/CartesianChart/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Line/Line.d.ts +3 -0
- package/dist/typescript/src/lib/Components/Line/Line.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Line/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/Line/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Line/types.d.ts +24 -0
- package/dist/typescript/src/lib/Components/Line/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Line/utils.d.ts +19 -0
- package/dist/typescript/src/lib/Components/Line/utils.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts +2 -8
- package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/LineChart/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/LineChart/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/LineChart/types.d.ts +62 -0
- package/dist/typescript/src/lib/Components/LineChart/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/utils/domain/domain.d.ts +17 -0
- package/dist/typescript/src/lib/utils/domain/domain.d.ts.map +1 -0
- package/dist/typescript/src/lib/utils/index.d.ts +1 -1
- package/dist/typescript/src/lib/utils/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/utils/scales/scales.d.ts +24 -0
- package/dist/typescript/src/lib/utils/scales/scales.d.ts.map +1 -0
- package/dist/typescript/src/lib/utils/ticks/ticks.d.ts +27 -0
- package/dist/typescript/src/lib/utils/ticks/ticks.d.ts.map +1 -0
- package/dist/typescript/src/lib/utils/types.d.ts +90 -6
- package/dist/typescript/src/lib/utils/types.d.ts.map +1 -1
- package/package.json +12 -2
- package/src/lib/Components/Axis/Axis.types.ts +32 -0
- package/src/lib/Components/Axis/XAxis/XAxis.test.tsx +89 -0
- package/src/lib/Components/Axis/XAxis/XAxis.tsx +111 -0
- package/src/lib/Components/Axis/XAxis/index.ts +2 -0
- package/src/lib/Components/Axis/XAxis/types.ts +9 -0
- package/src/lib/Components/Axis/YAxis/YAxis.test.tsx +89 -0
- package/src/lib/Components/Axis/YAxis/YAxis.tsx +110 -0
- package/src/lib/Components/Axis/YAxis/index.ts +2 -0
- package/src/lib/Components/Axis/YAxis/types.ts +14 -0
- package/src/lib/Components/CartesianChart/CartesianChart.tsx +153 -0
- package/src/lib/Components/CartesianChart/context/cartesianChartContext.ts +14 -0
- package/src/lib/Components/CartesianChart/context/index.ts +10 -0
- package/src/lib/Components/CartesianChart/context/useBuildChartContext.test.ts +224 -0
- package/src/lib/Components/CartesianChart/context/useBuildChartContext.ts +115 -0
- package/src/lib/Components/CartesianChart/index.ts +3 -0
- package/src/lib/Components/CartesianChart/types.ts +47 -0
- package/src/lib/Components/Line/Line.tsx +88 -0
- package/src/lib/Components/Line/index.ts +2 -0
- package/src/lib/Components/Line/types.ts +23 -0
- package/src/lib/Components/Line/utils.ts +72 -0
- package/src/lib/Components/LineChart/LineChart.stories.tsx +287 -4
- package/src/lib/Components/LineChart/LineChart.test.tsx +71 -2
- package/src/lib/Components/LineChart/LineChart.tsx +90 -34
- package/src/lib/Components/LineChart/index.ts +1 -0
- package/src/lib/Components/LineChart/types.ts +63 -0
- package/src/lib/utils/domain/domain.test.ts +129 -0
- package/src/lib/utils/domain/domain.ts +101 -0
- package/src/lib/utils/index.ts +11 -1
- package/src/lib/utils/scales/scales.test.ts +133 -0
- package/src/lib/utils/scales/scales.ts +67 -0
- package/src/lib/utils/ticks/ticks.test.ts +136 -0
- package/src/lib/utils/ticks/ticks.ts +82 -0
- package/src/lib/utils/types.ts +97 -6
- package/dist/module/lib/utils/math/index.js +0 -4
- package/dist/module/lib/utils/math/index.js.map +0 -1
- package/dist/typescript/src/lib/utils/math/index.d.ts +0 -1
- package/dist/typescript/src/lib/utils/math/index.d.ts.map +0 -1
- package/src/lib/utils/math/index.ts +0 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BaseAxisProps } from '../Axis.types';
|
|
2
|
+
export type XAxisProps = BaseAxisProps & {
|
|
3
|
+
/**
|
|
4
|
+
* Where the x-axis is rendered relative to the drawing area.
|
|
5
|
+
* @default 'bottom'
|
|
6
|
+
*/
|
|
7
|
+
position?: 'top' | 'bottom';
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Axis/XAxis/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CAC7B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { YAxisProps } from './types';
|
|
2
|
+
export declare const DEFAULT_AXIS_WIDTH = 40;
|
|
3
|
+
export declare const YAxis: ({ position, showGrid, showLine, showTickMark, gridLineStyle, ticks: ticksProp, tickLabelFormatter, }: YAxisProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
//# sourceMappingURL=YAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Axis/YAxis/YAxis.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAK1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,KAAK,GAAI,sGAQnB,UAAU,mDAuFZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Axis/YAxis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BaseAxisProps } from '../Axis.types';
|
|
2
|
+
export type YAxisProps = BaseAxisProps & {
|
|
3
|
+
/**
|
|
4
|
+
* Where the y-axis is rendered relative to the drawing area.
|
|
5
|
+
* @default 'start'
|
|
6
|
+
*/
|
|
7
|
+
position?: 'start' | 'end';
|
|
8
|
+
/**
|
|
9
|
+
* Width of the axis in pixels.
|
|
10
|
+
* @default 40
|
|
11
|
+
*/
|
|
12
|
+
width?: number;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Axis/YAxis/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CartesianChartProps } from './types';
|
|
2
|
+
export declare const CartesianChart: ({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, children, }: CartesianChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=CartesianChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/CartesianChart/CartesianChart.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AA0DnD,eAAO,MAAM,cAAc,GAAI,mFAU5B,mBAAmB,4CA6ErB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CartesianChartContextValue } from '../../../utils/types';
|
|
2
|
+
declare const CartesianChartProvider: import("react").FC<{
|
|
3
|
+
children: import("react").ReactNode;
|
|
4
|
+
value: CartesianChartContextValue;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useCartesianChartContext: () => CartesianChartContextValue;
|
|
7
|
+
export { CartesianChartProvider };
|
|
8
|
+
//# sourceMappingURL=cartesianChartContext.d.ts.map
|
package/dist/typescript/src/lib/Components/CartesianChart/context/cartesianChartContext.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cartesianChartContext.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/CartesianChart/context/cartesianChartContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAEvE,QAAA,MAAO,sBAAsB;;;EACoC,CAAC;AAElE,eAAO,MAAM,wBAAwB,kCAIjC,CAAC;AAEL,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/CartesianChart/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AxisBounds, AxisConfigProps, CartesianChartContextValue, ChartInset, ChartScaleFunction, DrawingArea, Series } from '../../../utils/types';
|
|
2
|
+
type UseBuildChartContextParams = {
|
|
3
|
+
series: Series[];
|
|
4
|
+
xAxis?: Partial<AxisConfigProps>;
|
|
5
|
+
yAxis?: Partial<AxisConfigProps>;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
inset: ChartInset;
|
|
9
|
+
axisPadding: ChartInset;
|
|
10
|
+
};
|
|
11
|
+
type AxisRange = {
|
|
12
|
+
min: number;
|
|
13
|
+
max: number;
|
|
14
|
+
};
|
|
15
|
+
export declare const computeAxisRange: (drawingArea: DrawingArea) => {
|
|
16
|
+
xRange: AxisRange;
|
|
17
|
+
yRange: AxisRange;
|
|
18
|
+
};
|
|
19
|
+
export declare const buildScale: (domain: AxisBounds, range: AxisRange, scaleType?: AxisConfigProps["scaleType"]) => ChartScaleFunction;
|
|
20
|
+
export declare const computeDrawingArea: (width: number, height: number, inset: ChartInset, axisPadding: ChartInset) => DrawingArea;
|
|
21
|
+
export declare const useBuildChartContext: ({ series, xAxis, yAxis, width, height, inset, axisPadding, }: UseBuildChartContextParams) => CartesianChartContextValue;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=useBuildChartContext.d.ts.map
|
package/dist/typescript/src/lib/Components/CartesianChart/context/useBuildChartContext.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBuildChartContext.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/CartesianChart/context/useBuildChartContext.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,0BAA0B,EAC1B,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,MAAM,EACP,MAAM,sBAAsB,CAAC;AAE9B,KAAK,0BAA0B,GAAG;IAChC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C,eAAO,MAAM,gBAAgB,GAC3B,aAAa,WAAW,KACvB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAMvC,CAAC;AAEH,eAAO,MAAM,UAAU,GACrB,QAAQ,UAAU,EAClB,OAAO,SAAS,EAChB,YAAW,eAAe,CAAC,WAAW,CAAY,KACjD,kBAGgD,CAAC;AAEpD,eAAO,MAAM,kBAAkB,GAC7B,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,OAAO,UAAU,EACjB,aAAa,UAAU,KACtB,WAaF,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,8DAQlC,0BAA0B,KAAG,0BAiC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/CartesianChart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AxisConfigProps, ChartInset, Series } from '../../utils/types';
|
|
3
|
+
export type CartesianChartProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Data series provided to child components via context.
|
|
6
|
+
*/
|
|
7
|
+
series: Series[];
|
|
8
|
+
/**
|
|
9
|
+
* Scale and domain configuration for the x-axis.
|
|
10
|
+
*/
|
|
11
|
+
xAxis?: Partial<AxisConfigProps>;
|
|
12
|
+
/**
|
|
13
|
+
* Scale and domain configuration for the y-axis.
|
|
14
|
+
*/
|
|
15
|
+
yAxis?: Partial<AxisConfigProps>;
|
|
16
|
+
/**
|
|
17
|
+
* Width of the chart in pixels.
|
|
18
|
+
* When omitted, the component auto-measures via `onLayout`.
|
|
19
|
+
*/
|
|
20
|
+
width?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Height of the chart in pixels.
|
|
23
|
+
* @default 160
|
|
24
|
+
*/
|
|
25
|
+
height?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Padding between the SVG edge and the drawing area.
|
|
28
|
+
* A number applies uniformly; a partial object overrides individual sides.
|
|
29
|
+
*/
|
|
30
|
+
inset?: number | Partial<ChartInset>;
|
|
31
|
+
/**
|
|
32
|
+
* Space reserved for axes around the drawing area.
|
|
33
|
+
* Shrinks the drawing area by the specified amount on each side.
|
|
34
|
+
*/
|
|
35
|
+
axisPadding?: Partial<ChartInset>;
|
|
36
|
+
/**
|
|
37
|
+
* Accessible label for the chart.
|
|
38
|
+
* @default 'Chart'
|
|
39
|
+
*/
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
/**
|
|
42
|
+
* SVG content rendered inside the chart's context provider.
|
|
43
|
+
*/
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/CartesianChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Line/Line.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC,eAAO,MAAM,IAAI,GAAI,sDAKlB,SAAS,mDAsEX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Line/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type LineProps = {
|
|
2
|
+
/**
|
|
3
|
+
* The ID of the series to render.
|
|
4
|
+
* Must match a `Series.id` provided to the parent chart.
|
|
5
|
+
*/
|
|
6
|
+
seriesId: string;
|
|
7
|
+
/**
|
|
8
|
+
* Override color for the line stroke.
|
|
9
|
+
* When omitted, falls back to the `stroke` defined on the series.
|
|
10
|
+
*/
|
|
11
|
+
stroke?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to show a filled area under the line.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
showArea?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Area fill style.
|
|
19
|
+
* When `'gradient'`, renders a vertical gradient from the stroke color to transparent.
|
|
20
|
+
* @default 'gradient'
|
|
21
|
+
*/
|
|
22
|
+
areaType?: 'gradient';
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Line/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChartScaleFunction, DrawingArea, NumericScale } from '../../utils/types';
|
|
2
|
+
type Point = [x: number, y: number];
|
|
3
|
+
/**
|
|
4
|
+
* Project series data into scaled [x, y] pixel coordinates, skipping nulls.
|
|
5
|
+
*
|
|
6
|
+
* When `xData` contains numeric values, those values are fed into the scale
|
|
7
|
+
* instead of the array index so the points honour a numeric X domain.
|
|
8
|
+
*/
|
|
9
|
+
export declare const toScaledPoints: (data: Array<number | null>, xScale: ChartScaleFunction, yScale: NumericScale, xData?: ReadonlyArray<string | number>) => Point[] | null;
|
|
10
|
+
/**
|
|
11
|
+
* Build the SVG `d` attribute for the line stroke.
|
|
12
|
+
*/
|
|
13
|
+
export declare const buildLinePath: (points: Point[]) => string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Build the SVG `d` attribute for the filled area beneath the line.
|
|
16
|
+
*/
|
|
17
|
+
export declare const buildAreaPath: (points: Point[], drawingArea: DrawingArea) => string | null;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Line/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,KAAK,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,EAC1B,QAAQ,kBAAkB,EAC1B,QAAQ,YAAY,EACpB,QAAQ,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,KACrC,KAAK,EAAE,GAAG,IAmBZ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,KAAK,EAAE,KAAG,MAAM,GAAG,IAOxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,KAAK,EAAE,EACf,aAAa,WAAW,KACvB,MAAM,GAAG,IAUX,CAAC"}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
series: Series[];
|
|
4
|
-
width?: number;
|
|
5
|
-
height?: number;
|
|
6
|
-
};
|
|
7
|
-
export declare function LineChart({ series: _series, width, height, }: LineChartProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
1
|
+
import type { LineChartProps } from './types';
|
|
2
|
+
export declare const LineChart: ({ series, showArea, areaType, showXAxis, showYAxis, xAxis, yAxis, width, height, inset, children, }: LineChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
3
|
//# sourceMappingURL=LineChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,SAAS,GAAI,qGAYvB,cAAc,4CAuEhB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AxisConfigProps, ChartInset, Series } from '../../utils/types';
|
|
3
|
+
import type { XAxisProps } from '../Axis/XAxis';
|
|
4
|
+
import type { YAxisProps } from '../Axis/YAxis';
|
|
5
|
+
export type LineChartProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Data series to render as lines.
|
|
8
|
+
* Each series produces one `<Line>` element.
|
|
9
|
+
*/
|
|
10
|
+
series?: Series[];
|
|
11
|
+
/**
|
|
12
|
+
* Whether to show area fill under all lines.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
showArea?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Area fill style applied to all lines.
|
|
18
|
+
* When `'gradient'`, renders a vertical gradient from the stroke color to transparent.
|
|
19
|
+
* @default 'gradient'
|
|
20
|
+
*/
|
|
21
|
+
areaType?: 'gradient';
|
|
22
|
+
/**
|
|
23
|
+
* Whether to render an x-axis.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
showXAxis?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to render a y-axis.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
showYAxis?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Combined axis configuration and visual props for the x-axis.
|
|
34
|
+
* Includes scale/domain settings as well as visual options like `showGrid` and `showLine`.
|
|
35
|
+
*/
|
|
36
|
+
xAxis?: Partial<AxisConfigProps> & XAxisProps;
|
|
37
|
+
/**
|
|
38
|
+
* Combined axis configuration and visual props for the y-axis.
|
|
39
|
+
* Includes scale/domain settings as well as visual options like `showGrid` and `showLine`.
|
|
40
|
+
*/
|
|
41
|
+
yAxis?: Partial<AxisConfigProps> & YAxisProps;
|
|
42
|
+
/**
|
|
43
|
+
* Width of the chart in pixels.
|
|
44
|
+
* When omitted, the component auto-measures via `onLayout`.
|
|
45
|
+
*/
|
|
46
|
+
width?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Height of the chart in pixels.
|
|
49
|
+
* @default 160
|
|
50
|
+
*/
|
|
51
|
+
height?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Padding between the SVG edge and the drawing area.
|
|
54
|
+
* A number applies uniformly; a partial object overrides individual sides.
|
|
55
|
+
*/
|
|
56
|
+
inset?: number | Partial<ChartInset>;
|
|
57
|
+
/**
|
|
58
|
+
* Additional SVG content rendered inside the chart after lines and axes.
|
|
59
|
+
*/
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AxisBounds, AxisConfigProps, Series } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Compute the X domain (index-based) from series data and axis config.
|
|
4
|
+
* For the X axis the domain is typically 0..N-1 where N = longest series length,
|
|
5
|
+
* unless explicit `data` is provided on the axis config.
|
|
6
|
+
*/
|
|
7
|
+
export declare const computeXDomain: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => AxisBounds;
|
|
8
|
+
/**
|
|
9
|
+
* Compute the Y domain (value-based) from series data and axis config.
|
|
10
|
+
* Scans all non-null values across all series to find min/max.
|
|
11
|
+
*/
|
|
12
|
+
export declare const computeYDomain: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => AxisBounds;
|
|
13
|
+
/**
|
|
14
|
+
* Compute the data length (number of discrete positions on the index axis).
|
|
15
|
+
*/
|
|
16
|
+
export declare const computeDataLength: (series: Series[], axisConfig?: Partial<AxisConfigProps>) => number;
|
|
17
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/domain/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,UA4BF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,UAwBF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,EAAE,EAChB,aAAa,OAAO,CAAC,eAAe,CAAC,KACpC,MAKF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type { AxisBounds, AxisConfigProps, CartesianChartContextValue, CategoricalScale, ChartInset, ChartScaleFunction, DrawingArea, NumericScale, Series, } from './types';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,MAAM,GACP,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AxisBounds, AxisConfigProps, CategoricalScale, ChartScaleFunction, NumericScale } from '../types';
|
|
2
|
+
export declare const getNumericScale: ({ scaleType, domain, range, }: {
|
|
3
|
+
scaleType: "linear" | "log";
|
|
4
|
+
domain: AxisBounds;
|
|
5
|
+
range: AxisBounds;
|
|
6
|
+
}) => NumericScale;
|
|
7
|
+
export declare const getCategoricalScale: ({ domain, range, padding, }: {
|
|
8
|
+
domain: AxisBounds;
|
|
9
|
+
range: AxisBounds;
|
|
10
|
+
padding?: number;
|
|
11
|
+
}) => CategoricalScale;
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a scale type config value refers to a band (categorical) scale.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isBandScaleType: (scaleType: AxisConfigProps["scaleType"]) => scaleType is "band";
|
|
16
|
+
/**
|
|
17
|
+
* Checks if a scale is a categorical scale.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isCategoricalScale: (scale: ChartScaleFunction) => scale is CategoricalScale;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if a scale is a numeric scale.
|
|
22
|
+
*/
|
|
23
|
+
export declare const isNumericScale: (scale: ChartScaleFunction) => scale is NumericScale;
|
|
24
|
+
//# sourceMappingURL=scales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/scales/scales.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,YAGH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6BAIjC;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,gBAUH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,eAAe,CAAC,WAAW,CAAC,KACtC,SAAS,IAAI,MAA8B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,kBAAkB,KACxB,KAAK,IAAI,gBAEX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,KACxB,KAAK,IAAI,YAEX,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AxisConfigProps, ChartScaleFunction } from '../types';
|
|
2
|
+
export declare const APPROXIMATE_TICK_COUNT = 5;
|
|
3
|
+
export type TickData = {
|
|
4
|
+
position: number;
|
|
5
|
+
value: number;
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Resolves which numeric tick values should appear on the axis.
|
|
10
|
+
* Explicit ticks take priority, then scale-specific defaults.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getTickValues: (scale: ChartScaleFunction, explicitTicks?: number[]) => number[];
|
|
13
|
+
/**
|
|
14
|
+
* Converts a tick value to its pixel position on the axis.
|
|
15
|
+
* Band scales are centered within the band.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getTickPosition: (scale: ChartScaleFunction, tick: number) => number;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the display label for a tick value.
|
|
20
|
+
* Priority: formatter > string label lookup > raw value.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getTickLabel: (tick: number, axisData: AxisConfigProps["data"], formatter?: (value: number | string) => string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Builds the complete tick data array from a scale and axis configuration.
|
|
25
|
+
*/
|
|
26
|
+
export declare const buildTicksData: (scale: ChartScaleFunction, axisConfig?: AxisConfigProps, explicitTicks?: number[], formatter?: (value: number | string) => string) => TickData[];
|
|
27
|
+
//# sourceMappingURL=ticks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/ticks/ticks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEpE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,kBAAkB,EACzB,gBAAgB,MAAM,EAAE,KACvB,MAAM,EAKR,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,kBAAkB,EACzB,MAAM,MAAM,KACX,MAKF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,MAAM,MAAM,EACZ,UAAU,eAAe,CAAC,MAAM,CAAC,EACjC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,KAC7C,MAeF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,EACzB,aAAa,eAAe,EAC5B,gBAAgB,MAAM,EAAE,EACxB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,KAC7C,QAAQ,EASV,CAAC"}
|
|
@@ -1,11 +1,95 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ScaleBand, ScaleLinear, ScaleLogarithmic } from 'd3-scale';
|
|
2
|
+
export type AxisBounds = {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
};
|
|
6
|
+
export type ChartInset = {
|
|
7
|
+
top: number;
|
|
8
|
+
right: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
left: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Pixel bounds of the drawable region.
|
|
14
|
+
*/
|
|
15
|
+
export type DrawingArea = {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
4
20
|
};
|
|
5
21
|
export type Series = {
|
|
22
|
+
/**
|
|
23
|
+
* Unique identifier for the series.
|
|
24
|
+
*/
|
|
6
25
|
id: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Numeric data points; `null` entries represent gaps.
|
|
28
|
+
*/
|
|
29
|
+
data?: Array<number | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Human-readable label used in legends and tooltips.
|
|
32
|
+
*/
|
|
33
|
+
label?: string;
|
|
34
|
+
/**
|
|
35
|
+
* CSS color applied to the series line/mark.
|
|
36
|
+
*/
|
|
37
|
+
stroke: string;
|
|
38
|
+
};
|
|
39
|
+
export type AxisConfigProps = {
|
|
40
|
+
/**
|
|
41
|
+
* Scale algorithm used by this axis.
|
|
42
|
+
* @default 'linear'
|
|
43
|
+
*/
|
|
44
|
+
scaleType?: 'linear' | 'log' | 'band';
|
|
45
|
+
/**
|
|
46
|
+
* Explicit data values for band scales or category labels.
|
|
47
|
+
* For band scales, provides the discrete domain. For numeric scales, string values
|
|
48
|
+
* are used as tick labels at corresponding indices.
|
|
49
|
+
*/
|
|
50
|
+
data?: string[] | number[];
|
|
51
|
+
/**
|
|
52
|
+
* Fixed domain bounds or a function that adjusts the computed bounds.
|
|
53
|
+
* A partial object overrides only the specified bound(s).
|
|
54
|
+
* A function receives the auto-computed bounds and returns adjusted ones.
|
|
55
|
+
*/
|
|
56
|
+
domain?: Partial<AxisBounds> | ((bounds: AxisBounds) => AxisBounds);
|
|
57
|
+
};
|
|
58
|
+
export type NumericScale = ScaleLinear<number, number> | ScaleLogarithmic<number, number>;
|
|
59
|
+
export type CategoricalScale = ScaleBand<number>;
|
|
60
|
+
export type ChartScaleFunction = NumericScale | CategoricalScale;
|
|
61
|
+
export type CartesianChartContextValue = {
|
|
62
|
+
/**
|
|
63
|
+
* All data series registered in the chart.
|
|
64
|
+
*/
|
|
65
|
+
series: Series[];
|
|
66
|
+
/**
|
|
67
|
+
* Lookup map for series by ID. Stable reference when series identity is unchanged.
|
|
68
|
+
*/
|
|
69
|
+
seriesMap: Map<string, Series>;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the x-axis scale. Accepts an optional axis ID for future multi-axis support.
|
|
72
|
+
*/
|
|
73
|
+
getXScale: (id?: string) => ChartScaleFunction | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the y-axis scale. Accepts an optional axis ID for future multi-axis support.
|
|
76
|
+
*/
|
|
77
|
+
getYScale: (id?: string) => ChartScaleFunction | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the x-axis config. Accepts an optional axis ID for future multi-axis support.
|
|
80
|
+
*/
|
|
81
|
+
getXAxisConfig: (id?: string) => AxisConfigProps | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the y-axis config. Accepts an optional axis ID for future multi-axis support.
|
|
84
|
+
*/
|
|
85
|
+
getYAxisConfig: (id?: string) => AxisConfigProps | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Pixel bounds of the drawable region.
|
|
88
|
+
*/
|
|
89
|
+
drawingArea: DrawingArea;
|
|
90
|
+
/**
|
|
91
|
+
* Number of data points along the x-axis.
|
|
92
|
+
*/
|
|
93
|
+
dataLength: number;
|
|
10
94
|
};
|
|
11
95
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEzE,MAAM,MAAM,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACtC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,CAAC,CAAC;CACrE,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAErC,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEjE,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B;;OAEG;IACH,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;IAC3D;;OAEG;IACH,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;IAC3D;;OAEG;IACH,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IAC7D;;OAEG;IACH,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IAC7D;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-rnative-visualization",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"keywords": [
|
|
@@ -30,12 +30,22 @@
|
|
|
30
30
|
"src",
|
|
31
31
|
"!**/*.tsbuildinfo"
|
|
32
32
|
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@ledgerhq/lumen-utils-shared": "0.1.3",
|
|
35
|
+
"d3-array": "^3.2.4",
|
|
36
|
+
"d3-scale": "^4.0.2",
|
|
37
|
+
"d3-shape": "^3.2.0"
|
|
38
|
+
},
|
|
33
39
|
"devDependencies": {
|
|
40
|
+
"@types/d3-array": "^3.2.2",
|
|
41
|
+
"@types/d3-scale": "^4.0.9",
|
|
42
|
+
"@types/d3-shape": "^3.1.8",
|
|
34
43
|
"@types/react": "^19.0.0"
|
|
35
44
|
},
|
|
36
45
|
"peerDependencies": {
|
|
37
46
|
"@types/react": "^19.0.0",
|
|
38
|
-
"@ledgerhq/lumen-design-core": "0.1.
|
|
47
|
+
"@ledgerhq/lumen-design-core": "0.1.11",
|
|
48
|
+
"@ledgerhq/lumen-ui-rnative": "0.1.26",
|
|
39
49
|
"react": "^19.0.0",
|
|
40
50
|
"react-native": "~0.79.7",
|
|
41
51
|
"react-native-svg": "^15.0.0"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type BaseAxisProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Whether to render grid lines at each tick.
|
|
4
|
+
* @default false
|
|
5
|
+
*/
|
|
6
|
+
showGrid?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Appearance of the grid lines.
|
|
9
|
+
* @default 'dashed'
|
|
10
|
+
*/
|
|
11
|
+
gridLineStyle?: 'solid' | 'dashed';
|
|
12
|
+
/**
|
|
13
|
+
* Whether to render the axis baseline.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
showLine?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to render tick marks at each tick position.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
showTickMark?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Explicit tick positions along the axis.
|
|
24
|
+
* When omitted, ticks are computed automatically from the scale.
|
|
25
|
+
*/
|
|
26
|
+
ticks?: number[];
|
|
27
|
+
/**
|
|
28
|
+
* Formats a tick value into its display label.
|
|
29
|
+
* Receives the raw tick value (number or string label) and must return a string.
|
|
30
|
+
*/
|
|
31
|
+
tickLabelFormatter?: (value: number | string) => string;
|
|
32
|
+
};
|