gifted-charts-core 0.1.19 → 0.1.21
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/package.json +10 -10
- package/src/BarChart/RenderStackBars.d.ts +1 -2
- package/src/BarChart/index.d.ts +2 -3
- package/src/BarChart/types.d.ts +2 -1
- package/src/BarChart/types.ts +3 -1
- package/src/LineChart/LineChartBiColor.d.ts +0 -1
- package/src/LineChart/index.d.ts +0 -1
- package/src/LineChart/types.d.ts +2 -1
- package/src/LineChart/types.ts +4 -2
- package/src/PopulationPyramid/index.d.ts +3 -3
- package/src/PopulationPyramid/index.js +4 -3
- package/src/PopulationPyramid/index.ts +11 -4
- package/src/PopulationPyramid/types.d.ts +3 -1
- package/src/PopulationPyramid/types.ts +3 -1
- package/src/components/AnimatedThreeDBar/index.d.ts +0 -1
- package/src/components/BarAndLineChartsWrapper/index.d.ts +1 -1
- package/src/components/BarAndLineChartsWrapper/index.js +6 -4
- package/src/components/BarAndLineChartsWrapper/index.ts +4 -0
- package/src/index.d.ts +1 -1
- package/src/index.ts +2 -1
- package/src/utils/constants.d.ts +2 -0
- package/src/utils/constants.js +2 -0
- package/src/utils/constants.ts +3 -1
- package/src/utils/index.d.ts +1 -1
- package/src/utils/index.js +1 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/types.d.ts +1 -0
- package/src/utils/types.ts +16 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gifted-charts-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
"lint": "eslint src/**/*.ts"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@testing-library/jest-dom": "^
|
|
16
|
-
"@testing-library/react": "^
|
|
17
|
-
"@testing-library/user-event": "^
|
|
18
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
19
|
-
"@types/react": "^18.
|
|
20
|
-
"@types/react-dom": "^18.
|
|
21
|
-
"@types/react-native": "^0.
|
|
15
|
+
"@testing-library/jest-dom": "^6.4.8",
|
|
16
|
+
"@testing-library/react": "^16.0.0",
|
|
17
|
+
"@testing-library/user-event": "^14.5.2",
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
|
19
|
+
"@types/react": "^18.3.3",
|
|
20
|
+
"@types/react-dom": "^18.3.0",
|
|
21
|
+
"@types/react-native": "^0.73.0",
|
|
22
22
|
"eslint": "^8.56.0",
|
|
23
|
-
"eslint-config-
|
|
23
|
+
"eslint-config-love": "^62.0.0",
|
|
24
24
|
"eslint-plugin-import": "^2.29.1",
|
|
25
25
|
"eslint-plugin-n": "^16.6.2",
|
|
26
26
|
"eslint-plugin-promise": "^6.1.1",
|
|
27
27
|
"eslint-plugin-react": "^7.33.2",
|
|
28
|
-
"typescript": "^5.
|
|
28
|
+
"typescript": "^5.5.4"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "*",
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type StackedBarChartPropsType, type stackDataItem } from './types';
|
|
3
2
|
export declare const useRenderStackBars: (props: StackedBarChartPropsType) => {
|
|
4
3
|
cotainsNegative: boolean;
|
|
5
4
|
noAnimation: boolean;
|
|
6
|
-
localBarInnerComponent: ((item?: stackDataItem
|
|
5
|
+
localBarInnerComponent: ((item?: stackDataItem, index?: number) => import("react").ReactNode) | undefined;
|
|
7
6
|
borderRadius: number | undefined;
|
|
8
7
|
borderTopLeftRadius: number | undefined;
|
|
9
8
|
borderTopRightRadius: number | undefined;
|
package/src/BarChart/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type lineConfigType, type BarChartPropsType, type barDataItem, type stackDataItem } from './types';
|
|
3
2
|
import { type BarAndLineChartsWrapperTypes, type secondaryYAxisType } from '../utils/types';
|
|
4
3
|
import { type Animated } from 'react-native';
|
|
@@ -75,7 +74,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
75
74
|
rtl: boolean;
|
|
76
75
|
intactTopLabel: boolean;
|
|
77
76
|
barBorderColor: import("react-native").ColorValue;
|
|
78
|
-
barInnerComponent: ((item?:
|
|
77
|
+
barInnerComponent: ((item?: stackDataItem | barDataItem, index?: number) => import("react").ReactNode) | undefined;
|
|
79
78
|
xAxisTextNumberOfLines: number;
|
|
80
79
|
selectedIndex: number;
|
|
81
80
|
setSelectedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
@@ -148,7 +147,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
148
147
|
barBorderTopRightRadius: number | undefined;
|
|
149
148
|
barBorderBottomLeftRadius: number | undefined;
|
|
150
149
|
barBorderBottomRightRadius: number | undefined;
|
|
151
|
-
barInnerComponent: ((item?:
|
|
150
|
+
barInnerComponent: ((item?: stackDataItem | barDataItem, index?: number) => import("react").ReactNode) | undefined;
|
|
152
151
|
color: import("react-native").ColorValue | undefined;
|
|
153
152
|
showGradient: boolean | undefined;
|
|
154
153
|
gradientColor: import("react-native").ColorValue | undefined;
|
package/src/BarChart/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ColorValue, type GestureResponderEvent, type ViewStyle } from 'react-native';
|
|
2
2
|
import { type yAxisSides } from '../utils/constants';
|
|
3
|
-
import { XAxisConfig, type CurveType, type Pointer, type RuleType, type RulesConfig, type referenceConfigType, type secondaryYAxisType } from '../utils/types';
|
|
3
|
+
import { XAxisConfig, type CurveType, type Pointer, type RuleType, type RulesConfig, type referenceConfigType, type secondaryYAxisType, type Linecap } from '../utils/types';
|
|
4
4
|
import { type Component, type ReactNode } from 'react';
|
|
5
5
|
import { type lineDataItem } from '../LineChart/types';
|
|
6
6
|
export interface stackDataItem {
|
|
@@ -202,6 +202,7 @@ export interface BarChartPropsType {
|
|
|
202
202
|
verticalLinesZIndex?: number;
|
|
203
203
|
noOfVerticalLines?: number;
|
|
204
204
|
verticalLinesSpacing?: number;
|
|
205
|
+
verticalLinesStrokeLinecap?: Linecap;
|
|
205
206
|
showYAxisIndices?: boolean;
|
|
206
207
|
showXAxisIndices?: boolean;
|
|
207
208
|
yAxisIndicesHeight?: number;
|
package/src/BarChart/types.ts
CHANGED
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
type RuleType,
|
|
12
12
|
type RulesConfig,
|
|
13
13
|
type referenceConfigType,
|
|
14
|
-
type secondaryYAxisType
|
|
14
|
+
type secondaryYAxisType,
|
|
15
|
+
type Linecap
|
|
15
16
|
} from '../utils/types'
|
|
16
17
|
import { type Component, type ReactNode } from 'react'
|
|
17
18
|
import { type lineDataItem } from '../LineChart/types'
|
|
@@ -225,6 +226,7 @@ export interface BarChartPropsType {
|
|
|
225
226
|
verticalLinesZIndex?: number
|
|
226
227
|
noOfVerticalLines?: number
|
|
227
228
|
verticalLinesSpacing?: number
|
|
229
|
+
verticalLinesStrokeLinecap?: Linecap
|
|
228
230
|
|
|
229
231
|
showYAxisIndices?: boolean
|
|
230
232
|
showXAxisIndices?: boolean
|
package/src/LineChart/index.d.ts
CHANGED
package/src/LineChart/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GestureResponderEvent, type ColorValue } from 'react-native';
|
|
2
2
|
import { type yAxisSides } from '../utils/constants';
|
|
3
|
-
import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType } from '../utils/types';
|
|
3
|
+
import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap } from '../utils/types';
|
|
4
4
|
export interface LineChartPropsType {
|
|
5
5
|
height?: number;
|
|
6
6
|
overflowTop?: number;
|
|
@@ -91,6 +91,7 @@ export interface LineChartPropsType {
|
|
|
91
91
|
verticalLinesZIndex?: number;
|
|
92
92
|
noOfVerticalLines?: number;
|
|
93
93
|
verticalLinesSpacing?: number;
|
|
94
|
+
verticalLinesStrokeLinecap?: Linecap;
|
|
94
95
|
hideAxesAndRules?: boolean;
|
|
95
96
|
areaChart?: boolean;
|
|
96
97
|
areaChart1?: boolean;
|
package/src/LineChart/types.ts
CHANGED
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
type arrowConfigType,
|
|
14
14
|
type referenceConfigType,
|
|
15
15
|
type secondaryLineConfigType,
|
|
16
|
-
type secondaryYAxisType
|
|
16
|
+
type secondaryYAxisType,
|
|
17
|
+
type Linecap
|
|
17
18
|
} from '../utils/types'
|
|
18
19
|
|
|
19
20
|
export interface LineChartPropsType {
|
|
@@ -82,7 +83,7 @@ export interface LineChartPropsType {
|
|
|
82
83
|
unFocusOnPressOut?: boolean
|
|
83
84
|
delayBeforeUnFocus?: number
|
|
84
85
|
focusedDataPointIndex?: number
|
|
85
|
-
|
|
86
|
+
|
|
86
87
|
showValuesAsDataPointsText?: boolean
|
|
87
88
|
|
|
88
89
|
rulesType?: RuleType
|
|
@@ -109,6 +110,7 @@ export interface LineChartPropsType {
|
|
|
109
110
|
verticalLinesZIndex?: number
|
|
110
111
|
noOfVerticalLines?: number
|
|
111
112
|
verticalLinesSpacing?: number
|
|
113
|
+
verticalLinesStrokeLinecap?: Linecap
|
|
112
114
|
hideAxesAndRules?: boolean
|
|
113
115
|
areaChart?: boolean
|
|
114
116
|
areaChart1?: boolean
|
|
@@ -110,10 +110,10 @@ export declare const usePopulationPyramid: (props: extendedPopulationPyramidProp
|
|
|
110
110
|
leftXAfterMid: number;
|
|
111
111
|
rightXAfterMid: number;
|
|
112
112
|
yAxisLineProps: {
|
|
113
|
-
framework?: Framework.reactNative
|
|
113
|
+
framework?: Framework.reactNative;
|
|
114
114
|
} & import("./types").RulesProps;
|
|
115
115
|
midAxisLineCommonProps: {
|
|
116
|
-
framework?: Framework.reactNative
|
|
116
|
+
framework?: Framework.reactNative;
|
|
117
117
|
} & import("./types").RulesProps;
|
|
118
118
|
xAxisLabelY: number;
|
|
119
119
|
xAxisIndicesCommonProps: {
|
|
@@ -123,7 +123,7 @@ export declare const usePopulationPyramid: (props: extendedPopulationPyramidProp
|
|
|
123
123
|
strokeWidth: number;
|
|
124
124
|
};
|
|
125
125
|
verticalLinesCommonProps: {
|
|
126
|
-
framework?: Framework.reactNative
|
|
126
|
+
framework?: Framework.reactNative;
|
|
127
127
|
} & import("./types").RulesProps;
|
|
128
128
|
xAxisLabelsCommonProps: {
|
|
129
129
|
y: number;
|
|
@@ -28,8 +28,8 @@ import { AxesAndRulesDefaults, populationDefaults } from '../utils/constants';
|
|
|
28
28
|
import { Framework } from '../utils/types';
|
|
29
29
|
export var usePopulationPyramid = function (props) {
|
|
30
30
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
31
|
-
var framework = props.framework, _v = props.height, height = _v === void 0 ? populationDefaults.height : _v, _w = props.width, width = _w === void 0 ? props.screenWidth : _w, _x = props.verticalMarginBetweenBars, verticalMarginBetweenBars = _x === void 0 ? populationDefaults.verticalMarginBetweenBars : _x, _y = props.barsMapToYAxisSections, barsMapToYAxisSections = _y === void 0 ? populationDefaults.barsMapToYAxisSections : _y, data = props.data, _z = props.hideRules, hideRules = _z === void 0 ? AxesAndRulesDefaults.hideRules : _z, _0 = props.hideYAxisText, hideYAxisText = _0 === void 0 ? AxesAndRulesDefaults.hideYAxisText : _0, _1 = props.yAxisThickness, yAxisThickness = _1 === void 0 ? AxesAndRulesDefaults.yAxisThickness : _1, _2 = props.xAxisThickness, xAxisThickness = _2 === void 0 ? AxesAndRulesDefaults.xAxisThickness : _2, _3 = props.xAxisType, xAxisType = _3 === void 0 ? AxesAndRulesDefaults.xAxisType : _3, _4 = props.xAxisNoOfSections, xAxisNoOfSections = _4 === void 0 ? populationDefaults.xAxisNoOfSections : _4, _5 = props.showXAxisIndices, showXAxisIndices = _5 === void 0 ? populationDefaults.showXAxisIndices : _5, _6 = props.xAxisIndicesWidth, xAxisIndicesWidth = _6 === void 0 ? populationDefaults.xAxisIndicesWidth : _6, _7 = props.xAxisIndicesHeight, xAxisIndicesHeight = _7 === void 0 ? populationDefaults.xAxisIndicesHeight : _7, _8 = props.xAxisIndicesShiftY, xAxisIndicesShiftY = _8 === void 0 ? 0 : _8, _9 = props.showXAxisLabelTexts, showXAxisLabelTexts = _9 === void 0 ? populationDefaults.showXAxisLabelTexts : _9, _10 = props.xAxisLabelFontSize, xAxisLabelFontSize = _10 === void 0 ? populationDefaults.defaultFontSize : _10, _11 = props.xAxisLabelFontStyle, xAxisLabelFontStyle = _11 === void 0 ? populationDefaults.defaultFontStyle : _11, _12 = props.xAxisLabelFontWeight, xAxisLabelFontWeight = _12 === void 0 ? populationDefaults.defaultFontWeight : _12, _13 = props.xAxisLabelFontFamily, xAxisLabelFontFamily = _13 === void 0 ? populationDefaults.defaultFontFamily : _13, _14 = props.xAxisLabelShiftX, xAxisLabelShiftX = _14 === void 0 ? 0 : _14, _15 = props.xAxisLabelShiftY, xAxisLabelShiftY = _15 === void 0 ? 0 : _15, _16 = props.xAxisLabelPrefix, xAxisLabelPrefix = _16 === void 0 ? populationDefaults.prefix : _16, _17 = props.xAxisLabelSuffix, xAxisLabelSuffix = _17 === void 0 ? populationDefaults.suffix : _17, formatXAxisLabels = props.formatXAxisLabels, _18 = props.showVerticalLines, showVerticalLines = _18 === void 0 ? populationDefaults.showVerticalLines : _18, _19 = props.verticalLinesThickness, verticalLinesThickness = _19 === void 0 ? populationDefaults.verticalLinesThickness : _19, _20 = props.verticalLinesType, verticalLinesType = _20 === void 0 ? populationDefaults.verticalLinesType : _20, _21 = props.verticalLinesStrokeDashArray, verticalLinesStrokeDashArray = _21 === void 0 ? populationDefaults.verticalLinesStrokeDashArray : _21, _22 = props.showYAxisIndices, showYAxisIndices =
|
|
32
|
-
var
|
|
31
|
+
var framework = props.framework, _v = props.height, height = _v === void 0 ? populationDefaults.height : _v, _w = props.width, width = _w === void 0 ? props.screenWidth : _w, _x = props.verticalMarginBetweenBars, verticalMarginBetweenBars = _x === void 0 ? populationDefaults.verticalMarginBetweenBars : _x, _y = props.barsMapToYAxisSections, barsMapToYAxisSections = _y === void 0 ? populationDefaults.barsMapToYAxisSections : _y, data = props.data, _z = props.hideRules, hideRules = _z === void 0 ? AxesAndRulesDefaults.hideRules : _z, _0 = props.hideYAxisText, hideYAxisText = _0 === void 0 ? AxesAndRulesDefaults.hideYAxisText : _0, _1 = props.yAxisThickness, yAxisThickness = _1 === void 0 ? AxesAndRulesDefaults.yAxisThickness : _1, _2 = props.xAxisThickness, xAxisThickness = _2 === void 0 ? AxesAndRulesDefaults.xAxisThickness : _2, _3 = props.xAxisType, xAxisType = _3 === void 0 ? AxesAndRulesDefaults.xAxisType : _3, _4 = props.xAxisNoOfSections, xAxisNoOfSections = _4 === void 0 ? populationDefaults.xAxisNoOfSections : _4, _5 = props.showXAxisIndices, showXAxisIndices = _5 === void 0 ? populationDefaults.showXAxisIndices : _5, _6 = props.xAxisIndicesWidth, xAxisIndicesWidth = _6 === void 0 ? populationDefaults.xAxisIndicesWidth : _6, _7 = props.xAxisIndicesHeight, xAxisIndicesHeight = _7 === void 0 ? populationDefaults.xAxisIndicesHeight : _7, _8 = props.xAxisIndicesShiftY, xAxisIndicesShiftY = _8 === void 0 ? 0 : _8, _9 = props.showXAxisLabelTexts, showXAxisLabelTexts = _9 === void 0 ? populationDefaults.showXAxisLabelTexts : _9, _10 = props.xAxisLabelFontSize, xAxisLabelFontSize = _10 === void 0 ? populationDefaults.defaultFontSize : _10, _11 = props.xAxisLabelFontStyle, xAxisLabelFontStyle = _11 === void 0 ? populationDefaults.defaultFontStyle : _11, _12 = props.xAxisLabelFontWeight, xAxisLabelFontWeight = _12 === void 0 ? populationDefaults.defaultFontWeight : _12, _13 = props.xAxisLabelFontFamily, xAxisLabelFontFamily = _13 === void 0 ? populationDefaults.defaultFontFamily : _13, _14 = props.xAxisLabelShiftX, xAxisLabelShiftX = _14 === void 0 ? 0 : _14, _15 = props.xAxisLabelShiftY, xAxisLabelShiftY = _15 === void 0 ? 0 : _15, _16 = props.xAxisLabelPrefix, xAxisLabelPrefix = _16 === void 0 ? populationDefaults.prefix : _16, _17 = props.xAxisLabelSuffix, xAxisLabelSuffix = _17 === void 0 ? populationDefaults.suffix : _17, formatXAxisLabels = props.formatXAxisLabels, _18 = props.showVerticalLines, showVerticalLines = _18 === void 0 ? populationDefaults.showVerticalLines : _18, _19 = props.verticalLinesThickness, verticalLinesThickness = _19 === void 0 ? populationDefaults.verticalLinesThickness : _19, _20 = props.verticalLinesType, verticalLinesType = _20 === void 0 ? populationDefaults.verticalLinesType : _20, _21 = props.verticalLinesStrokeDashArray, verticalLinesStrokeDashArray = _21 === void 0 ? populationDefaults.verticalLinesStrokeDashArray : _21, _22 = props.verticalLinesStrokeLinecap, verticalLinesStrokeLinecap = _22 === void 0 ? populationDefaults.verticalLinesStrokeLinecap : _22, _23 = props.showYAxisIndices, showYAxisIndices = _23 === void 0 ? AxesAndRulesDefaults.showYAxisIndices : _23, _24 = props.yAxisIndicesWidth, yAxisIndicesWidth = _24 === void 0 ? AxesAndRulesDefaults.yAxisIndicesWidth : _24, _25 = props.yAxisIndicesHeight, yAxisIndicesHeight = _25 === void 0 ? AxesAndRulesDefaults.yAxisIndicesHeight : _25, _26 = props.yAxisLabelFontSize, yAxisLabelFontSize = _26 === void 0 ? populationDefaults.defaultFontSize : _26, _27 = props.yAxisLabelFontStyle, yAxisLabelFontStyle = _27 === void 0 ? populationDefaults.defaultFontStyle : _27, _28 = props.yAxisLabelFontWeight, yAxisLabelFontWeight = _28 === void 0 ? populationDefaults.defaultFontWeight : _28, _29 = props.yAxisLabelFontFamily, yAxisLabelFontFamily = _29 === void 0 ? populationDefaults.defaultFontFamily : _29, _30 = props.yAxisLabelTextMarginRight, yAxisLabelTextMarginRight = _30 === void 0 ? populationDefaults.yAxisLabelTextMarginRight : _30, _31 = props.yAxisLabelTexts, yAxisLabelTexts = _31 === void 0 ? [] : _31, _32 = props.showValuesAsBarLabels, showValuesAsBarLabels = _32 === void 0 ? populationDefaults.showValuesAsBarLabels : _32, _33 = props.rulesThickness, rulesThickness = _33 === void 0 ? AxesAndRulesDefaults.rulesThickness : _33, _34 = props.rulesType, rulesType = _34 === void 0 ? AxesAndRulesDefaults.rulesType : _34, _35 = props.dashWidth, dashWidth = _35 === void 0 ? AxesAndRulesDefaults.dashWidth : _35, _36 = props.dashGap, dashGap = _36 === void 0 ? AxesAndRulesDefaults.dashGap : _36, _37 = props.leftBarLabelWidth, leftBarLabelWidth = _37 === void 0 ? populationDefaults.leftBarLabelWidth : _37, _38 = props.leftBarLabelFontSize, leftBarLabelFontSize = _38 === void 0 ? (_a = props.barLabelFontSize) !== null && _a !== void 0 ? _a : populationDefaults.defaultFontSize : _38, _39 = props.leftBarLabelFontStyle, leftBarLabelFontStyle = _39 === void 0 ? (_b = props.barLabelFontStyle) !== null && _b !== void 0 ? _b : populationDefaults.defaultFontStyle : _39, _40 = props.leftBarLabelFontWeight, leftBarLabelFontWeight = _40 === void 0 ? (_c = props.barLabelFontWeight) !== null && _c !== void 0 ? _c : populationDefaults.defaultFontWeight : _40, _41 = props.leftBarLabelFontFamily, leftBarLabelFontFamily = _41 === void 0 ? (_d = props.barLabelFontFamily) !== null && _d !== void 0 ? _d : populationDefaults.defaultFontFamily : _41, _42 = props.leftBarLabelPrefix, leftBarLabelPrefix = _42 === void 0 ? populationDefaults.prefix : _42, _43 = props.leftBarLabelSuffix, leftBarLabelSuffix = _43 === void 0 ? populationDefaults.suffix : _43, _44 = props.rightBarLabelWidth, rightBarLabelWidth = _44 === void 0 ? populationDefaults.rightBarLabelWidth : _44, _45 = props.rightBarLabelFontSize, rightBarLabelFontSize = _45 === void 0 ? (_e = props.barLabelFontSize) !== null && _e !== void 0 ? _e : populationDefaults.defaultFontSize : _45, _46 = props.rightBarLabelFontStyle, rightBarLabelFontStyle = _46 === void 0 ? (_f = props.barLabelFontStyle) !== null && _f !== void 0 ? _f : populationDefaults.defaultFontStyle : _46, _47 = props.rightBarLabelFontWeight, rightBarLabelFontWeight = _47 === void 0 ? (_g = props.barLabelFontWeight) !== null && _g !== void 0 ? _g : populationDefaults.defaultFontWeight : _47, _48 = props.rightBarLabelFontFamily, rightBarLabelFontFamily = _48 === void 0 ? (_h = props.barLabelFontFamily) !== null && _h !== void 0 ? _h : populationDefaults.defaultFontFamily : _48, _49 = props.rightBarLabelPrefix, rightBarLabelPrefix = _49 === void 0 ? populationDefaults.prefix : _49, _50 = props.rightBarLabelSuffix, rightBarLabelSuffix = _50 === void 0 ? populationDefaults.suffix : _50, formatBarLabels = props.formatBarLabels, _51 = props.showMidAxis, showMidAxis = _51 === void 0 ? populationDefaults.showMidAxis : _51, _52 = props.midAxisLabelWidth, midAxisLabelWidth = _52 === void 0 ? populationDefaults.midAxisLabelWidth : _52, _53 = props.midAxisLabelFontSize, midAxisLabelFontSize = _53 === void 0 ? populationDefaults.defaultFontSize : _53, _54 = props.midAxisLabelFontStyle, midAxisLabelFontStyle = _54 === void 0 ? populationDefaults.defaultFontStyle : _54, _55 = props.midAxisLabelFontWeight, midAxisLabelFontWeight = _55 === void 0 ? populationDefaults.defaultFontWeight : _55, _56 = props.midAxisLabelFontFamily, midAxisLabelFontFamily = _56 === void 0 ? populationDefaults.defaultFontFamily : _56, _57 = props.leftBarBorderWidth, leftBarBorderWidth = _57 === void 0 ? (_j = props.barBorderWidth) !== null && _j !== void 0 ? _j : populationDefaults.leftBarBorderWidth : _57, _58 = props.rightBarBorderWidth, rightBarBorderWidth = _58 === void 0 ? (_k = props.barBorderWidth) !== null && _k !== void 0 ? _k : populationDefaults.rightBarBorderWidth : _58, _59 = props.leftBarBorderRadius, leftBarBorderRadius = _59 === void 0 ? (_l = props.barBorderRadius) !== null && _l !== void 0 ? _l : populationDefaults.leftBarBorderRadius : _59, _60 = props.rightBarBorderRadius, rightBarBorderRadius = _60 === void 0 ? (_m = props.barBorderRadius) !== null && _m !== void 0 ? _m : populationDefaults.rightBarBorderRadius : _60, _61 = props.allCornersRounded, allCornersRounded = _61 === void 0 ? populationDefaults.allCornersRounded : _61, _62 = props.showSurplus, showSurplus = _62 === void 0 ? populationDefaults.showSurplus : _62, _63 = props.showSurplusLeft, showSurplusLeft = _63 === void 0 ? populationDefaults.showSurplusLeft : _63, _64 = props.showSurplusRight, showSurplusRight = _64 === void 0 ? populationDefaults.showSurplusRight : _64, _65 = props.leftSurplusBorderWidth, leftSurplusBorderWidth = _65 === void 0 ? populationDefaults.leftSurplusBorderWidth : _65, _66 = props.rightSurplusBorderWidth, rightSurplusBorderWidth = _66 === void 0 ? populationDefaults.rightSurplusBorderWidth : _66;
|
|
32
|
+
var _67 = props.yAxisColor, yAxisColor = _67 === void 0 ? AxesAndRulesDefaults.yAxisColor : _67, _68 = props.xAxisColor, xAxisColor = _68 === void 0 ? AxesAndRulesDefaults.xAxisColor : _68, _69 = props.xAxisIndicesColor, xAxisIndicesColor = _69 === void 0 ? populationDefaults.xAxisIndicesColor : _69, _70 = props.xAxisLabelColor, xAxisLabelColor = _70 === void 0 ? populationDefaults.defaultFontColor : _70, _71 = props.verticalLinesColor, verticalLinesColor = _71 === void 0 ? populationDefaults.verticalLinesColor : _71, _72 = props.yAxisIndicesColor, yAxisIndicesColor = _72 === void 0 ? AxesAndRulesDefaults.yAxisIndicesColor : _72, _73 = props.yAxisLabelColor, yAxisLabelColor = _73 === void 0 ? populationDefaults.defaultFontColor : _73, _74 = props.rulesColor, rulesColor = _74 === void 0 ? AxesAndRulesDefaults.rulesColor : _74, _75 = props.leftBarLabelColor, leftBarLabelColor = _75 === void 0 ? (_o = props.barLabelColor) !== null && _o !== void 0 ? _o : populationDefaults.defaultFontColor : _75, _76 = props.rightBarLabelColor, rightBarLabelColor = _76 === void 0 ? (_p = props.barLabelColor) !== null && _p !== void 0 ? _p : populationDefaults.defaultFontColor : _76, _77 = props.midAxisLabelColor, midAxisLabelColor = _77 === void 0 ? populationDefaults.defaultFontColor : _77, _78 = props.leftBarColor, leftBarColor = _78 === void 0 ? populationDefaults.leftBarColor : _78, _79 = props.rightBarColor, rightBarColor = _79 === void 0 ? populationDefaults.rightBarColor : _79, _80 = props.leftBarBorderColor, leftBarBorderColor = _80 === void 0 ? populationDefaults.leftBarBorderColor : _80, _81 = props.rightBarBorderColor, rightBarBorderColor = _81 === void 0 ? populationDefaults.rightBarBorderColor : _81, _82 = props.leftSurplusColor, leftSurplusColor = _82 === void 0 ? populationDefaults.leftSurplusColor : _82, _83 = props.leftSurplusBorderColor, leftSurplusBorderColor = _83 === void 0 ? populationDefaults.leftSurplusBorderColor : _83, _84 = props.rightSurplusColor, rightSurplusColor = _84 === void 0 ? populationDefaults.rightSurplusColor : _84, _85 = props.rightSurplusBorderColor, rightSurplusBorderColor = _85 === void 0 ? populationDefaults.rightSurplusBorderColor : _85;
|
|
33
33
|
if (framework === Framework.reactJS) {
|
|
34
34
|
yAxisColor = yAxisColor.toString();
|
|
35
35
|
xAxisColor = xAxisColor.toString();
|
|
@@ -97,7 +97,8 @@ export var usePopulationPyramid = function (props) {
|
|
|
97
97
|
y1: 0,
|
|
98
98
|
y2: containerHeight,
|
|
99
99
|
stroke: verticalLinesColor,
|
|
100
|
-
strokeWidth: verticalLinesThickness
|
|
100
|
+
strokeWidth: verticalLinesThickness,
|
|
101
|
+
strokeLinecap: verticalLinesStrokeLinecap
|
|
101
102
|
};
|
|
102
103
|
verticalLinesCommonProps.strokeDasharray = getStrokeDashArray(verticalLinesStrokeDashArray);
|
|
103
104
|
var xAxisLabelsCommonProps = {
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { getStrokeDashArray } from '../utils'
|
|
2
2
|
import { AxesAndRulesDefaults, populationDefaults } from '../utils/constants'
|
|
3
|
-
import { Framework } from '../utils/types'
|
|
4
|
-
import {
|
|
3
|
+
import { Framework, type Linecap } from '../utils/types'
|
|
4
|
+
import {
|
|
5
|
+
type extendedPopulationPyramidPropsType,
|
|
6
|
+
type RulesPropsType
|
|
7
|
+
} from './types'
|
|
5
8
|
|
|
6
|
-
export const usePopulationPyramid = (
|
|
9
|
+
export const usePopulationPyramid = (
|
|
10
|
+
props: extendedPopulationPyramidPropsType
|
|
11
|
+
) => {
|
|
7
12
|
const {
|
|
8
13
|
framework,
|
|
9
14
|
height = populationDefaults.height,
|
|
@@ -37,6 +42,7 @@ export const usePopulationPyramid = (props: extendedPopulationPyramidPropsType)
|
|
|
37
42
|
verticalLinesThickness = populationDefaults.verticalLinesThickness,
|
|
38
43
|
verticalLinesType = populationDefaults.verticalLinesType,
|
|
39
44
|
verticalLinesStrokeDashArray = populationDefaults.verticalLinesStrokeDashArray,
|
|
45
|
+
verticalLinesStrokeLinecap = populationDefaults.verticalLinesStrokeLinecap,
|
|
40
46
|
|
|
41
47
|
showYAxisIndices = AxesAndRulesDefaults.showYAxisIndices,
|
|
42
48
|
yAxisIndicesWidth = AxesAndRulesDefaults.yAxisIndicesWidth,
|
|
@@ -218,7 +224,8 @@ export const usePopulationPyramid = (props: extendedPopulationPyramidPropsType)
|
|
|
218
224
|
y1: 0,
|
|
219
225
|
y2: containerHeight,
|
|
220
226
|
stroke: verticalLinesColor,
|
|
221
|
-
strokeWidth: verticalLinesThickness
|
|
227
|
+
strokeWidth: verticalLinesThickness,
|
|
228
|
+
strokeLinecap: verticalLinesStrokeLinecap as Linecap
|
|
222
229
|
}
|
|
223
230
|
verticalLinesCommonProps.strokeDasharray = getStrokeDashArray(
|
|
224
231
|
verticalLinesStrokeDashArray
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ColorValue } from 'react-native';
|
|
2
|
-
import { type Framework, type RuleTypes } from '../utils/types';
|
|
2
|
+
import { type Linecap, type Framework, type RuleTypes } from '../utils/types';
|
|
3
3
|
import { type FontStyle, type FontWeight } from 'react-native-svg';
|
|
4
4
|
export interface popnPyramidDataItem {
|
|
5
5
|
left: number;
|
|
@@ -75,6 +75,7 @@ export interface RulesProps {
|
|
|
75
75
|
stroke?: ColorValue;
|
|
76
76
|
strokeWidth?: number;
|
|
77
77
|
strokeDasharray?: number[] | string;
|
|
78
|
+
strokeLinecap?: Linecap;
|
|
78
79
|
}
|
|
79
80
|
export type RulesPropsReactJS = RulesProps & {
|
|
80
81
|
stroke?: string;
|
|
@@ -117,6 +118,7 @@ export interface PopulationPyramidPropsType {
|
|
|
117
118
|
verticalLinesThickness?: number;
|
|
118
119
|
verticalLinesType?: RuleTypes;
|
|
119
120
|
verticalLinesStrokeDashArray?: number[] | string;
|
|
121
|
+
verticalLinesStrokeLinecap?: Linecap;
|
|
120
122
|
noOfSections?: number;
|
|
121
123
|
barsMapToYAxisSections?: boolean;
|
|
122
124
|
showYAxisIndices?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ColorValue } from 'react-native'
|
|
2
|
-
import { type Framework, type RuleTypes } from '../utils/types'
|
|
2
|
+
import { type Linecap, type Framework, type RuleTypes } from '../utils/types'
|
|
3
3
|
import { type FontStyle, type FontWeight } from 'react-native-svg'
|
|
4
4
|
|
|
5
5
|
export interface popnPyramidDataItem {
|
|
@@ -83,6 +83,7 @@ export interface RulesProps {
|
|
|
83
83
|
stroke?: ColorValue
|
|
84
84
|
strokeWidth?: number
|
|
85
85
|
strokeDasharray?: number[] | string
|
|
86
|
+
strokeLinecap?: Linecap
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
export type RulesPropsReactJS = RulesProps & {
|
|
@@ -128,6 +129,7 @@ export interface PopulationPyramidPropsType {
|
|
|
128
129
|
verticalLinesThickness?: number
|
|
129
130
|
verticalLinesType?: RuleTypes
|
|
130
131
|
verticalLinesStrokeDashArray?: number[] | string
|
|
132
|
+
verticalLinesStrokeLinecap?: Linecap
|
|
131
133
|
|
|
132
134
|
noOfSections?: number
|
|
133
135
|
barsMapToYAxisSections?: boolean
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { LineInBarChartPropsType, type BarAndLineChartsWrapperTypes, type horizSectionPropTypes } from '../../utils/types';
|
|
3
2
|
import { type NativeScrollEvent } from 'react-native';
|
|
4
3
|
export declare const useBarAndLineChartsWrapper: (props: BarAndLineChartsWrapperTypes) => {
|
|
@@ -46,6 +45,7 @@ export declare const useBarAndLineChartsWrapper: (props: BarAndLineChartsWrapper
|
|
|
46
45
|
verticalLinesStrokeDashArray: any;
|
|
47
46
|
verticalLinesShift: any;
|
|
48
47
|
verticalLinesUptoDataPoint: any;
|
|
48
|
+
verticalLinesStrokeLinecap: any;
|
|
49
49
|
xAxisThickness: number;
|
|
50
50
|
labelsExtraHeight: number;
|
|
51
51
|
containerHeight: number;
|
|
@@ -37,7 +37,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
37
37
|
import { useEffect, useState } from 'react';
|
|
38
38
|
import { AxesAndRulesDefaults, BarDefaults } from '../../utils/constants';
|
|
39
39
|
export var useBarAndLineChartsWrapper = function (props) {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
40
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
|
|
41
41
|
var chartType = props.chartType, containerHeight = props.containerHeight, noOfSectionsBelowXAxis = props.noOfSectionsBelowXAxis, sectionColors = props.sectionColors, stepHeight = props.stepHeight, negativeStepHeight = props.negativeStepHeight, labelsExtraHeight = props.labelsExtraHeight, yAxisLabelWidth = props.yAxisLabelWidth, horizontal = props.horizontal, rtl = props.rtl, shiftX = props.shiftX, shiftY = props.shiftY, initialSpacing = props.initialSpacing, data = props.data, stackData = props.stackData, secondaryData = props.secondaryData, barWidth = props.barWidth, xAxisThickness = props.xAxisThickness, totalWidth = props.totalWidth, spacing = props.spacing, lineConfig = props.lineConfig, lineConfig2 = props.lineConfig2, maxValue = props.maxValue, lineData = props.lineData, lineData2 = props.lineData2, animatedWidth = props.animatedWidth, lineBehindBars = props.lineBehindBars, points = props.points, points2 = props.points2, arrowPoints = props.arrowPoints, width = props.width, horizSections = props.horizSections, endSpacing = props.endSpacing, horizontalRulesStyle = props.horizontalRulesStyle, noOfSections = props.noOfSections, showFractionalValues = props.showFractionalValues, axesAndRulesProps = props.axesAndRulesProps, yAxisLabelTexts = props.yAxisLabelTexts, yAxisOffset = props.yAxisOffset, rotateYAxisTexts = props.rotateYAxisTexts, pointerConfig = props.pointerConfig, getPointerProps = props.getPointerProps, pointerIndex = props.pointerIndex, pointerX = props.pointerX, pointerY = props.pointerY, scrollEventThrottle = props.scrollEventThrottle, endReachedOffset = props.endReachedOffset, isRTL = props.isRTL, selectedIndex = props.selectedIndex;
|
|
42
42
|
var yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
|
|
43
43
|
var hideOrigin = (_a = axesAndRulesProps.hideOrigin) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.hideOrigin;
|
|
@@ -87,6 +87,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
87
87
|
var verticalLinesZIndex = (_7 = axesAndRulesProps.verticalLinesZIndex) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.verticalLinesZIndex;
|
|
88
88
|
var verticalLinesSpacing = (_8 = axesAndRulesProps.verticalLinesSpacing) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.verticalLinesSpacing;
|
|
89
89
|
var verticalLinesUptoDataPoint = (_9 = axesAndRulesProps.verticalLinesUptoDataPoint) !== null && _9 !== void 0 ? _9 : AxesAndRulesDefaults.verticalLinesUptoDataPoint;
|
|
90
|
+
var verticalLinesStrokeLinecap = (_10 = axesAndRulesProps.verticalLinesStrokeLinecap) !== null && _10 !== void 0 ? _10 : AxesAndRulesDefaults.verticalLinesStrokeLinecap;
|
|
90
91
|
var noOfVerticalLines = axesAndRulesProps.noOfVerticalLines;
|
|
91
92
|
var secondaryXAxis = axesAndRulesProps.secondaryXAxis;
|
|
92
93
|
var verticalLinesAr = noOfVerticalLines
|
|
@@ -159,7 +160,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
159
160
|
spacing: spacing,
|
|
160
161
|
containerHeight: containerHeight,
|
|
161
162
|
lineConfig: lineConfig,
|
|
162
|
-
maxValue: (
|
|
163
|
+
maxValue: (_11 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _11 !== void 0 ? _11 : maxValue,
|
|
163
164
|
animatedWidth: animatedWidth,
|
|
164
165
|
lineBehindBars: lineBehindBars,
|
|
165
166
|
points: points,
|
|
@@ -178,7 +179,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
178
179
|
var verticalLinesProps = {
|
|
179
180
|
verticalLinesAr: verticalLinesAr,
|
|
180
181
|
verticalLinesSpacing: verticalLinesSpacing,
|
|
181
|
-
spacing: (
|
|
182
|
+
spacing: (_12 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.spacing) !== null && _12 !== void 0 ? _12 : spacing,
|
|
182
183
|
initialSpacing: initialSpacing,
|
|
183
184
|
verticalLinesZIndex: verticalLinesZIndex,
|
|
184
185
|
verticalLinesHeight: verticalLinesHeight,
|
|
@@ -187,6 +188,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
187
188
|
verticalLinesStrokeDashArray: verticalLinesStrokeDashArray,
|
|
188
189
|
verticalLinesShift: verticalLinesShift,
|
|
189
190
|
verticalLinesUptoDataPoint: verticalLinesUptoDataPoint,
|
|
191
|
+
verticalLinesStrokeLinecap: verticalLinesStrokeLinecap,
|
|
190
192
|
xAxisThickness: xAxisThickness,
|
|
191
193
|
labelsExtraHeight: labelsExtraHeight,
|
|
192
194
|
containerHeight: containerHeight,
|
|
@@ -232,7 +234,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
232
234
|
: difBwWidthHeight - 40) /
|
|
233
235
|
2 +
|
|
234
236
|
(yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52), ")");
|
|
235
|
-
var
|
|
237
|
+
var _13 = __read(useState(false), 2), canMomentum = _13[0], setCanMomentum = _13[1];
|
|
236
238
|
var isCloseToEnd = function (_a) {
|
|
237
239
|
var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
|
|
238
240
|
return isRTL
|
|
@@ -162,6 +162,9 @@ export const useBarAndLineChartsWrapper = (
|
|
|
162
162
|
const verticalLinesUptoDataPoint =
|
|
163
163
|
axesAndRulesProps.verticalLinesUptoDataPoint ??
|
|
164
164
|
AxesAndRulesDefaults.verticalLinesUptoDataPoint
|
|
165
|
+
const verticalLinesStrokeLinecap =
|
|
166
|
+
axesAndRulesProps.verticalLinesStrokeLinecap ??
|
|
167
|
+
AxesAndRulesDefaults.verticalLinesStrokeLinecap
|
|
165
168
|
const noOfVerticalLines = axesAndRulesProps.noOfVerticalLines
|
|
166
169
|
const secondaryXAxis = axesAndRulesProps.secondaryXAxis
|
|
167
170
|
|
|
@@ -279,6 +282,7 @@ export const useBarAndLineChartsWrapper = (
|
|
|
279
282
|
verticalLinesStrokeDashArray,
|
|
280
283
|
verticalLinesShift,
|
|
281
284
|
verticalLinesUptoDataPoint,
|
|
285
|
+
verticalLinesStrokeLinecap,
|
|
282
286
|
xAxisThickness,
|
|
283
287
|
labelsExtraHeight,
|
|
284
288
|
containerHeight,
|
package/src/index.d.ts
CHANGED
|
@@ -35,4 +35,4 @@ export { getTopAndLeftForStripAndLabel } from './components/common/StripAndLabel
|
|
|
35
35
|
/***********************************************************************************************************************/
|
|
36
36
|
export { getCumulativeWidth, getLighterColor, svgQuadraticCurvePath, svgPath, bezierCommand, getSegmentString, getCurvePathWithSegments, getPreviousSegmentsLastPoint, getPathWithHighlight, getRegionPathObjects, getSegmentedPathObjects, getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getSecondaryDataWithOffsetIncluded, getArrowProperty, getAllArrowProperties, maxAndMinUtil, computeMaxAndMinItems, getLabelTextUtil, getXForLineInBar, getYForLineInBar, clone, getLineConfigForBarChart, adjustToOffset } from './utils';
|
|
37
37
|
export { chartTypes, yAxisSides, loc, SEGMENT_START, SEGMENT_END, RANGE_ENTER, RANGE_EXIT, STOP, ruleTypes, AxesAndRulesDefaults, defaultArrowConfig, BarDefaults, defaultLineConfig, LineDefaults, defaultPointerConfig, pieColors, populationDefaults, defaultAnimationDuration } from './utils/constants';
|
|
38
|
-
export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps } from './utils/types';
|
|
38
|
+
export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap } from './utils/types';
|
package/src/index.ts
CHANGED
package/src/utils/constants.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare const AxesAndRulesDefaults: {
|
|
|
64
64
|
verticalLinesZIndex: number;
|
|
65
65
|
verticalLinesSpacing: number;
|
|
66
66
|
verticalLinesUptoDataPoint: boolean;
|
|
67
|
+
verticalLinesStrokeLinecap: string;
|
|
67
68
|
noOfSections: number;
|
|
68
69
|
containerHeight: number;
|
|
69
70
|
width: number;
|
|
@@ -217,6 +218,7 @@ export declare const populationDefaults: {
|
|
|
217
218
|
verticalLinesThickness: number;
|
|
218
219
|
verticalLinesType: string;
|
|
219
220
|
verticalLinesStrokeDashArray: number[];
|
|
221
|
+
verticalLinesStrokeLinecap: string;
|
|
220
222
|
defaultFontSize: number;
|
|
221
223
|
defaultFontColor: string;
|
|
222
224
|
defaultFontStyle: FontStyle;
|
package/src/utils/constants.js
CHANGED
|
@@ -74,6 +74,7 @@ export var AxesAndRulesDefaults = {
|
|
|
74
74
|
verticalLinesZIndex: -1,
|
|
75
75
|
verticalLinesSpacing: 0,
|
|
76
76
|
verticalLinesUptoDataPoint: false,
|
|
77
|
+
verticalLinesStrokeLinecap: 'butt',
|
|
77
78
|
noOfSections: 10,
|
|
78
79
|
containerHeight: 200,
|
|
79
80
|
width: 200,
|
|
@@ -270,6 +271,7 @@ export var populationDefaults = {
|
|
|
270
271
|
verticalLinesThickness: 1,
|
|
271
272
|
verticalLinesType: ruleTypes.DASHED,
|
|
272
273
|
verticalLinesStrokeDashArray: [4, 8],
|
|
274
|
+
verticalLinesStrokeLinecap: 'butt',
|
|
273
275
|
defaultFontSize: 12,
|
|
274
276
|
defaultFontColor: 'black',
|
|
275
277
|
defaultFontStyle: 'normal',
|
package/src/utils/constants.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type defaultLineConfigType } from '../BarChart/types'
|
|
2
|
-
import { CurveType, EdgePosition, type RuleTypes } from './types'
|
|
2
|
+
import { CurveType, EdgePosition, Linecap, type RuleTypes } from './types'
|
|
3
3
|
import { type FontStyle } from 'react-native-svg'
|
|
4
4
|
|
|
5
5
|
// Global
|
|
@@ -88,6 +88,7 @@ export const AxesAndRulesDefaults = {
|
|
|
88
88
|
verticalLinesZIndex: -1,
|
|
89
89
|
verticalLinesSpacing: 0,
|
|
90
90
|
verticalLinesUptoDataPoint: false,
|
|
91
|
+
verticalLinesStrokeLinecap: 'butt',
|
|
91
92
|
|
|
92
93
|
noOfSections: 10,
|
|
93
94
|
containerHeight: 200,
|
|
@@ -308,6 +309,7 @@ export const populationDefaults = {
|
|
|
308
309
|
verticalLinesThickness: 1,
|
|
309
310
|
verticalLinesType: ruleTypes.DASHED,
|
|
310
311
|
verticalLinesStrokeDashArray: [4, 8],
|
|
312
|
+
verticalLinesStrokeLinecap: 'butt',
|
|
311
313
|
|
|
312
314
|
defaultFontSize: 12,
|
|
313
315
|
defaultFontColor: 'black',
|
package/src/utils/index.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ interface MaxAndMin {
|
|
|
81
81
|
}
|
|
82
82
|
export declare const maxAndMinUtil: (maxItem: number, minItem: number, roundToDigits?: number, showFractionalValues?: boolean) => MaxAndMin;
|
|
83
83
|
export declare const computeMaxAndMinItems: (data: any[] | undefined, roundToDigits?: number, showFractionalValues?: boolean) => MaxAndMin;
|
|
84
|
-
export declare const getLabelTextUtil: (val: string, index: number, showFractionalValues?: boolean, yAxisLabelTexts?: string[], yAxisOffset?: number, yAxisLabelPrefix?: string, yAxisLabelSuffix?: string, roundToDigits?: number, formatYLabel?: (
|
|
84
|
+
export declare const getLabelTextUtil: (val: string, index: number, showFractionalValues?: boolean, yAxisLabelTexts?: string[], yAxisOffset?: number, yAxisLabelPrefix?: string, yAxisLabelSuffix?: string, roundToDigits?: number, formatYLabel?: (label: string) => string) => string;
|
|
85
85
|
export declare const getXForLineInBar: (index: number, firstBarWidth: number, currentBarWidth: number, yAxisLabelWidth: number, lineConfig: any, spacing: number) => number;
|
|
86
86
|
export declare const getYForLineInBar: (value: number | undefined, shiftY: number | undefined, containerHeight: number, maxValue: number) => number;
|
|
87
87
|
export declare const clone: (obj: any) => any;
|
package/src/utils/index.js
CHANGED
|
@@ -537,6 +537,7 @@ export var getAxesAndRulesProps = function (props, stepValue, negativeStepValue,
|
|
|
537
537
|
verticalLinesZIndex: props.verticalLinesZIndex,
|
|
538
538
|
verticalLinesSpacing: props.verticalLinesSpacing,
|
|
539
539
|
noOfVerticalLines: props.noOfVerticalLines,
|
|
540
|
+
verticalLinesStrokeLinecap: props.verticalLinesStrokeLinecap,
|
|
540
541
|
// specific to Line charts-
|
|
541
542
|
verticalLinesUptoDataPoint: props.verticalLinesUptoDataPoint,
|
|
542
543
|
roundToDigits: props.roundToDigits,
|
package/src/utils/index.ts
CHANGED
|
@@ -733,6 +733,7 @@ export const getAxesAndRulesProps = (
|
|
|
733
733
|
verticalLinesZIndex: props.verticalLinesZIndex,
|
|
734
734
|
verticalLinesSpacing: props.verticalLinesSpacing,
|
|
735
735
|
noOfVerticalLines: props.noOfVerticalLines,
|
|
736
|
+
verticalLinesStrokeLinecap: props.verticalLinesStrokeLinecap,
|
|
736
737
|
|
|
737
738
|
// specific to Line charts-
|
|
738
739
|
verticalLinesUptoDataPoint: props.verticalLinesUptoDataPoint,
|
package/src/utils/types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare enum Framework {
|
|
|
8
8
|
}
|
|
9
9
|
export type RuleType = 'solid' | 'dashed' | 'dotted' | string;
|
|
10
10
|
export type LabelsPosition = 'onBorder' | 'outward' | 'inward' | 'mid';
|
|
11
|
+
export type Linecap = 'butt' | 'square' | 'round';
|
|
11
12
|
export interface RuleTypes {
|
|
12
13
|
SOLID: RuleType;
|
|
13
14
|
DASHED: RuleType;
|
package/src/utils/types.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type ColorValue } from 'react-native'
|
|
2
2
|
import { type chartTypes, type yAxisSides } from './constants'
|
|
3
3
|
import { type lineDataItem } from '../LineChart/types'
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
lineConfigType,
|
|
6
|
+
type barDataItem,
|
|
7
|
+
type stackDataItem
|
|
8
|
+
} from '../BarChart/types'
|
|
5
9
|
|
|
6
10
|
export enum Framework {
|
|
7
11
|
reactJS,
|
|
@@ -12,6 +16,8 @@ export type RuleType = 'solid' | 'dashed' | 'dotted' | string
|
|
|
12
16
|
|
|
13
17
|
export type LabelsPosition = 'onBorder' | 'outward' | 'inward' | 'mid'
|
|
14
18
|
|
|
19
|
+
export type Linecap = 'butt' | 'square' | 'round'
|
|
20
|
+
|
|
15
21
|
export interface RuleTypes {
|
|
16
22
|
SOLID: RuleType
|
|
17
23
|
DASHED: RuleType
|
|
@@ -139,15 +145,15 @@ export interface LineInBarChartPropsType {
|
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
export interface DataPointProps {
|
|
142
|
-
data: any[]
|
|
143
|
-
lineConfig: ExtendedLineConfigType
|
|
144
|
-
barWidth?: number
|
|
145
|
-
containerHeight: number
|
|
146
|
-
maxValue: number
|
|
147
|
-
firstBarWidth: number
|
|
148
|
-
yAxisLabelWidth: number
|
|
149
|
-
spacing: number
|
|
150
|
-
selectedIndex: number
|
|
148
|
+
data: any[]
|
|
149
|
+
lineConfig: ExtendedLineConfigType
|
|
150
|
+
barWidth?: number
|
|
151
|
+
containerHeight: number
|
|
152
|
+
maxValue: number
|
|
153
|
+
firstBarWidth: number
|
|
154
|
+
yAxisLabelWidth: number
|
|
155
|
+
spacing: number
|
|
156
|
+
selectedIndex: number
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
export interface referenceConfigType {
|