gifted-charts-core 0.1.64 → 0.1.65

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.
@@ -139,8 +139,8 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
139
139
  rtl: boolean;
140
140
  intactTopLabel: boolean;
141
141
  showValuesAsTopLabel: boolean | undefined;
142
- topLabelContainerStyle: any;
143
- topLabelTextStyle: any;
142
+ topLabelContainerStyle: import("react-native").StyleProp<import("react-native").ViewStyle>;
143
+ topLabelTextStyle: import("react-native").StyleProp<import("react-native").TextStyle>;
144
144
  barBorderWidth: number | undefined;
145
145
  barBorderColor: import("react-native").ColorValue;
146
146
  barBorderRadius: number | undefined;
@@ -1,4 +1,4 @@
1
- import { type ColorValue, type GestureResponderEvent, type ViewStyle } from 'react-native';
1
+ import { StyleProp, TextStyle, type ColorValue, type GestureResponderEvent, type ViewStyle } from 'react-native';
2
2
  import { type yAxisSides } from '../utils/constants';
3
3
  import { XAxisConfig, type CurveType, type Pointer, type RuleType, type RulesConfig, type referenceConfigType, type secondaryYAxisType, type Linecap, CustomBackground } from '../utils/types';
4
4
  import { type Component, type ReactNode } from 'react';
@@ -13,10 +13,10 @@ export interface stackDataItem {
13
13
  labelsDistanceFromXaxis?: number;
14
14
  barWidth?: number;
15
15
  spacing?: number;
16
- labelTextStyle?: any;
16
+ labelTextStyle?: StyleProp<TextStyle>;
17
17
  topLabelComponent?: Function;
18
- topLabelContainerStyle?: any;
19
- topLabelTextStyle?: any;
18
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
19
+ topLabelTextStyle?: StyleProp<TextStyle>;
20
20
  disablePress?: any;
21
21
  color?: ColorValue;
22
22
  showGradient?: boolean;
@@ -64,11 +64,11 @@ export interface StackedBarChartPropsType {
64
64
  height?: number;
65
65
  color?: ColorValue;
66
66
  topLabelComponent?: Component;
67
- topLabelContainerStyle?: any;
68
- topLabelTextStyle?: any;
67
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
68
+ topLabelTextStyle?: StyleProp<TextStyle>;
69
69
  opacity?: number;
70
70
  label: string;
71
- labelTextStyle?: any;
71
+ labelTextStyle?: StyleProp<TextStyle>;
72
72
  autoShiftLabelsForNegativeStacks?: boolean;
73
73
  labelsDistanceFromXaxis?: number;
74
74
  xAxisLabelsAtBottom?: boolean;
@@ -186,9 +186,9 @@ export interface BarChartPropsType {
186
186
  yAxisExtraHeight?: number;
187
187
  trimYAxisAtTop?: boolean;
188
188
  xAxisType?: RuleType;
189
- yAxisLabelContainerStyle?: any;
189
+ yAxisLabelContainerStyle?: StyleProp<ViewStyle>;
190
190
  horizontalRulesStyle?: any;
191
- yAxisTextStyle?: any;
191
+ yAxisTextStyle?: StyleProp<TextStyle>;
192
192
  yAxisTextNumberOfLines?: number;
193
193
  xAxisTextNumberOfLines?: number;
194
194
  xAxisLabelsHeight?: number;
@@ -275,8 +275,8 @@ export interface BarChartPropsType {
275
275
  yAxisAtTop?: boolean;
276
276
  intactTopLabel?: boolean;
277
277
  showValuesAsTopLabel?: boolean;
278
- topLabelContainerStyle?: any;
279
- topLabelTextStyle?: any;
278
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
279
+ topLabelTextStyle?: StyleProp<TextStyle>;
280
280
  horizSections?: sectionType[];
281
281
  barBorderWidth?: number;
282
282
  barBorderColor?: ColorValue;
@@ -294,7 +294,7 @@ export interface BarChartPropsType {
294
294
  labelWidth?: number;
295
295
  yAxisLabelTexts?: string[];
296
296
  xAxisLabelTexts?: string[];
297
- xAxisLabelTextStyle?: any;
297
+ xAxisLabelTextStyle?: StyleProp<TextStyle>;
298
298
  yAxisLabelPrefix?: string;
299
299
  yAxisLabelSuffix?: string;
300
300
  autoShiftLabels?: boolean;
@@ -449,9 +449,9 @@ export interface barDataItem {
449
449
  sideWidth?: number;
450
450
  barBorderWidth?: number;
451
451
  barBorderColor?: ColorValue;
452
- labelTextStyle?: any;
452
+ labelTextStyle?: StyleProp<TextStyle>;
453
453
  topLabelComponent?: Function;
454
- topLabelContainerStyle?: any;
454
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
455
455
  disablePress?: any;
456
456
  capThickness?: number;
457
457
  capColor?: ColorValue;
@@ -467,7 +467,7 @@ export interface barDataItem {
467
467
  labelWidth?: number;
468
468
  secondaryLabel?: string;
469
469
  secondaryLabelComponent?: Function;
470
- secondaryLabelTextStyle?: any;
470
+ secondaryLabelTextStyle?: StyleProp<TextStyle>;
471
471
  barBackgroundPattern?: () => ReactNode;
472
472
  patternId?: string;
473
473
  barMarginBottom?: number;
@@ -505,8 +505,8 @@ export interface Animated2DWithGradientPropsType {
505
505
  horizontal: boolean;
506
506
  intactTopLabel: boolean;
507
507
  showValuesAsTopLabel: boolean;
508
- topLabelContainerStyle?: any;
509
- topLabelTextStyle?: any;
508
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
509
+ topLabelTextStyle?: StyleProp<TextStyle>;
510
510
  barBorderWidth?: number;
511
511
  barBorderColor: ColorValue;
512
512
  barBorderRadius?: number;
@@ -526,7 +526,7 @@ export interface Animated2DWithGradientPropsType {
526
526
  yAxisOffset: number;
527
527
  }
528
528
  export interface RenderBarsPropsType {
529
- style?: any;
529
+ style?: StyleProp<ViewStyle>;
530
530
  width?: number;
531
531
  height?: number;
532
532
  minHeight: number;
@@ -537,12 +537,12 @@ export interface RenderBarsPropsType {
537
537
  sideColor?: ColorValue;
538
538
  topColor?: ColorValue;
539
539
  topLabelComponent?: Component;
540
- topLabelContainerStyle?: any;
541
- topLabelTextStyle?: any;
540
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
541
+ topLabelTextStyle?: StyleProp<TextStyle>;
542
542
  opacity?: number;
543
543
  side?: string;
544
- labelTextStyle?: any;
545
- secondaryLabelTextStyle?: any;
544
+ labelTextStyle?: StyleProp<TextStyle>;
545
+ secondaryLabelTextStyle?: StyleProp<TextStyle>;
546
546
  item: barDataItemNullSafe;
547
547
  index: number;
548
548
  label: string;
@@ -652,8 +652,8 @@ export interface animatedBarPropTypes {
652
652
  horizontal: boolean;
653
653
  intactTopLabel: boolean;
654
654
  showValuesAsTopLabel: boolean;
655
- topLabelContainerStyle?: any;
656
- topLabelTextStyle?: any;
655
+ topLabelContainerStyle?: StyleProp<ViewStyle>;
656
+ topLabelTextStyle?: StyleProp<TextStyle>;
657
657
  barBackgroundPattern?: () => ReactNode;
658
658
  barInnerComponent?: (item?: barDataItem, index?: number) => ReactNode;
659
659
  patternId?: string;
@@ -679,8 +679,8 @@ export interface CommonPropsFor2dand3dBarsType {
679
679
  height: number;
680
680
  intactTopLabel: boolean;
681
681
  showValuesAsTopLabel: boolean;
682
- topLabelContainerStyle: any;
683
- topLabelTextStyle: any;
682
+ topLabelContainerStyle: StyleProp<ViewStyle>;
683
+ topLabelTextStyle: StyleProp<TextStyle>;
684
684
  yAxisOffset: number;
685
685
  }
686
686
  export interface BarChartPropsTypeForWeb extends BarChartPropsType {
@@ -96,5 +96,6 @@ export declare const useLineChartBiColor: (props: extendedLineChartBicolorPropsT
96
96
  value: string;
97
97
  }[];
98
98
  barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes;
99
+ yAxisExtraHeightAtTop: number;
99
100
  };
100
101
  export {};
@@ -28,11 +28,11 @@ import { AxesAndRulesDefaults, LineDefaults, chartTypes } from '../utils/constan
28
28
  import { getAxesAndRulesProps, getExtendedContainerHeightWithPadding } from '../utils';
29
29
  var initialData = null;
30
30
  export var useLineChartBiColor = function (props) {
31
- 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, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51;
32
- var _52 = __read(useState(false), 2), toggle = _52[0], setToggle = _52[1];
33
- var _53 = __read(useState([]), 2), pointsArray = _53[0], setPointsArray = _53[1];
34
- var _54 = __read(useState([]), 2), fillPointsArray = _54[0], setFillPointsArray = _54[1];
35
- var _55 = __read(useState(-1), 2), selectedIndex = _55[0], setSelectedIndex = _55[1];
31
+ 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, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52;
32
+ var _53 = __read(useState(false), 2), toggle = _53[0], setToggle = _53[1];
33
+ var _54 = __read(useState([]), 2), pointsArray = _54[0], setPointsArray = _54[1];
34
+ var _55 = __read(useState([]), 2), fillPointsArray = _55[0], setFillPointsArray = _55[1];
35
+ var _56 = __read(useState(-1), 2), selectedIndex = _56[0], setSelectedIndex = _56[1];
36
36
  var containerHeight = (_a = props.height) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.containerHeight;
37
37
  var noOfSections = (_b = props.noOfSections) !== null && _b !== void 0 ? _b : AxesAndRulesDefaults.noOfSections;
38
38
  var data = useMemo(function () {
@@ -340,34 +340,37 @@ export var useLineChartBiColor = function (props) {
340
340
  var yAxisLabelWidth = (_33 = props.yAxisLabelWidth) !== null && _33 !== void 0 ? _33 : (props.hideYAxisText
341
341
  ? AxesAndRulesDefaults.yAxisEmptyLabelWidth
342
342
  : AxesAndRulesDefaults.yAxisLabelWidth);
343
+ var yAxisExtraHeightAtTop = props.trimYAxisAtTop
344
+ ? 0
345
+ : (_34 = props.yAxisExtraHeight) !== null && _34 !== void 0 ? _34 : containerHeight / 20;
343
346
  var horizontal = false;
344
347
  var yAxisAtTop = false;
345
- var disableScroll = (_34 = props.disableScroll) !== null && _34 !== void 0 ? _34 : LineDefaults.disableScroll;
346
- var showScrollIndicator = (_35 = props.showScrollIndicator) !== null && _35 !== void 0 ? _35 : LineDefaults.showScrollIndicator;
347
- var focusEnabled = (_36 = props.focusEnabled) !== null && _36 !== void 0 ? _36 : LineDefaults.focusEnabled;
348
- var showDataPointOnFocus = (_37 = props.showDataPointOnFocus) !== null && _37 !== void 0 ? _37 : LineDefaults.showDataPointOnFocus;
349
- var showStripOnFocus = (_38 = props.showStripOnFocus) !== null && _38 !== void 0 ? _38 : LineDefaults.showStripOnFocus;
350
- var showTextOnFocus = (_39 = props.showTextOnFocus) !== null && _39 !== void 0 ? _39 : LineDefaults.showTextOnFocus;
348
+ var disableScroll = (_35 = props.disableScroll) !== null && _35 !== void 0 ? _35 : LineDefaults.disableScroll;
349
+ var showScrollIndicator = (_36 = props.showScrollIndicator) !== null && _36 !== void 0 ? _36 : LineDefaults.showScrollIndicator;
350
+ var focusEnabled = (_37 = props.focusEnabled) !== null && _37 !== void 0 ? _37 : LineDefaults.focusEnabled;
351
+ var showDataPointOnFocus = (_38 = props.showDataPointOnFocus) !== null && _38 !== void 0 ? _38 : LineDefaults.showDataPointOnFocus;
352
+ var showStripOnFocus = (_39 = props.showStripOnFocus) !== null && _39 !== void 0 ? _39 : LineDefaults.showStripOnFocus;
353
+ var showTextOnFocus = (_40 = props.showTextOnFocus) !== null && _40 !== void 0 ? _40 : LineDefaults.showTextOnFocus;
351
354
  var stripHeight = props.stripHeight;
352
- var stripWidth = (_40 = props.stripWidth) !== null && _40 !== void 0 ? _40 : LineDefaults.stripWidth;
353
- var stripColor = (_41 = props.stripColor) !== null && _41 !== void 0 ? _41 : color;
354
- var stripOpacity = (_42 = props.stripOpacity) !== null && _42 !== void 0 ? _42 : (startOpacity + endOpacity) / 2;
355
- var unFocusOnPressOut = (_43 = props.unFocusOnPressOut) !== null && _43 !== void 0 ? _43 : LineDefaults.unFocusOnPressOut;
356
- var delayBeforeUnFocus = (_44 = props.delayBeforeUnFocus) !== null && _44 !== void 0 ? _44 : LineDefaults.delayBeforeUnFocus;
355
+ var stripWidth = (_41 = props.stripWidth) !== null && _41 !== void 0 ? _41 : LineDefaults.stripWidth;
356
+ var stripColor = (_42 = props.stripColor) !== null && _42 !== void 0 ? _42 : color;
357
+ var stripOpacity = (_43 = props.stripOpacity) !== null && _43 !== void 0 ? _43 : (startOpacity + endOpacity) / 2;
358
+ var unFocusOnPressOut = (_44 = props.unFocusOnPressOut) !== null && _44 !== void 0 ? _44 : LineDefaults.unFocusOnPressOut;
359
+ var delayBeforeUnFocus = (_45 = props.delayBeforeUnFocus) !== null && _45 !== void 0 ? _45 : LineDefaults.delayBeforeUnFocus;
357
360
  horizSections.pop();
358
361
  for (var i = 0; i <= noOfSections; i++) {
359
362
  var value = maxValue - stepValue * i;
360
- if ((_45 = props.showFractionalValues) !== null && _45 !== void 0 ? _45 : props.roundToDigits) {
361
- value = parseFloat(value.toFixed((_46 = props.roundToDigits) !== null && _46 !== void 0 ? _46 : 1));
363
+ if ((_46 = props.showFractionalValues) !== null && _46 !== void 0 ? _46 : props.roundToDigits) {
364
+ value = parseFloat(value.toFixed((_47 = props.roundToDigits) !== null && _47 !== void 0 ? _47 : 1));
362
365
  }
363
366
  horizSections.push({
364
367
  value: props.yAxisLabelTexts
365
- ? (_47 = props.yAxisLabelTexts[noOfSections - i]) !== null && _47 !== void 0 ? _47 : value.toString()
368
+ ? (_48 = props.yAxisLabelTexts[noOfSections - i]) !== null && _48 !== void 0 ? _48 : value.toString()
366
369
  : value.toString()
367
370
  });
368
371
  }
369
- var dataPointsRadius = (_48 = props.dataPointsRadius) !== null && _48 !== void 0 ? _48 : LineDefaults.dataPointsRadius;
370
- var dataPointsWidth = (_49 = props.dataPointsWidth) !== null && _49 !== void 0 ? _49 : LineDefaults.dataPointsWidth;
372
+ var dataPointsRadius = (_49 = props.dataPointsRadius) !== null && _49 !== void 0 ? _49 : LineDefaults.dataPointsRadius;
373
+ var dataPointsWidth = (_50 = props.dataPointsWidth) !== null && _50 !== void 0 ? _50 : LineDefaults.dataPointsWidth;
371
374
  var extraWidthDueToDataPoint = props.hideDataPoints
372
375
  ? 0
373
376
  : dataPointsRadius !== null && dataPointsRadius !== void 0 ? dataPointsRadius : dataPointsWidth;
@@ -419,7 +422,7 @@ export var useLineChartBiColor = function (props) {
419
422
  horizontalRulesStyle: horizontalRulesStyle,
420
423
  noOfSections: noOfSections,
421
424
  showFractionalValues: showFractionalValues,
422
- axesAndRulesProps: getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, (_50 = props.roundToDigits) !== null && _50 !== void 0 ? _50 : 0, stepValue, 0, 0, false, 0),
425
+ axesAndRulesProps: getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, (_51 = props.roundToDigits) !== null && _51 !== void 0 ? _51 : 0, stepValue, 0, 0, false, 0),
423
426
  yAxisLabelTexts: props.yAxisLabelTexts,
424
427
  yAxisOffset: props.yAxisOffset,
425
428
  rotateYAxisTexts: 0,
@@ -434,7 +437,7 @@ export var useLineChartBiColor = function (props) {
434
437
  pointerIndex: 0,
435
438
  pointerX: 0,
436
439
  pointerY: 0,
437
- endReachedOffset: (_51 = props.endReachedOffset) !== null && _51 !== void 0 ? _51 : LineDefaults.endReachedOffset,
440
+ endReachedOffset: (_52 = props.endReachedOffset) !== null && _52 !== void 0 ? _52 : LineDefaults.endReachedOffset,
438
441
  extraWidthDueToDataPoint: extraWidthDueToDataPoint,
439
442
  highlightEnabled: LineDefaults.highlightEnabled,
440
443
  lowlightOpacity: LineDefaults.lowlightOpacity,
@@ -527,6 +530,7 @@ export var useLineChartBiColor = function (props) {
527
530
  unFocusOnPressOut: unFocusOnPressOut,
528
531
  delayBeforeUnFocus: delayBeforeUnFocus,
529
532
  horizSections: horizSections,
530
- barAndLineChartsWrapperProps: barAndLineChartsWrapperProps
533
+ barAndLineChartsWrapperProps: barAndLineChartsWrapperProps,
534
+ yAxisExtraHeightAtTop: yAxisExtraHeightAtTop
531
535
  };
532
536
  };
@@ -1,4 +1,4 @@
1
- import { GestureResponderEvent, type ColorValue } from 'react-native';
1
+ import { GestureResponderEvent, StyleProp, TextStyle, ViewStyle, type ColorValue } from 'react-native';
2
2
  import { type yAxisSides } from '../utils/constants';
3
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, type IntersectionAreaConfig, CustomBackground, SpreadData } from '../utils/types';
4
4
  export interface LineChartPropsType {
@@ -158,9 +158,9 @@ export interface LineChartPropsType {
158
158
  yAxisColor?: ColorValue;
159
159
  yAxisExtraHeight?: number;
160
160
  trimYAxisAtTop?: boolean;
161
- yAxisLabelContainerStyle?: any;
161
+ yAxisLabelContainerStyle?: StyleProp<ViewStyle>;
162
162
  horizontalRulesStyle?: any;
163
- yAxisTextStyle?: any;
163
+ yAxisTextStyle?: StyleProp<TextStyle>;
164
164
  yAxisTextNumberOfLines?: number;
165
165
  xAxisTextNumberOfLines?: number;
166
166
  showFractionalValues?: boolean;
@@ -265,7 +265,7 @@ export interface LineChartPropsType {
265
265
  textShiftY?: number;
266
266
  yAxisLabelTexts?: string[];
267
267
  xAxisLabelTexts?: string[];
268
- xAxisLabelTextStyle?: any;
268
+ xAxisLabelTextStyle?: StyleProp<TextStyle>;
269
269
  xAxisLabelsHeight?: number;
270
270
  xAxisLabelsVerticalShift?: number;
271
271
  xAxisLabelsAtBottom?: boolean;
@@ -343,10 +343,10 @@ export interface lineDataItem {
343
343
  value?: number;
344
344
  label?: string;
345
345
  labelComponent?: Function;
346
- labelTextStyle?: any;
346
+ labelTextStyle?: StyleProp<TextStyle>;
347
347
  secondaryLabel?: string;
348
348
  secondaryLabelComponent?: Function;
349
- secondaryLabelTextStyle?: any;
349
+ secondaryLabelTextStyle?: StyleProp<TextStyle>;
350
350
  dataPointText?: string;
351
351
  textShiftX?: number;
352
352
  textShiftY?: number;
@@ -402,7 +402,7 @@ export interface bicolorLineDataItem {
402
402
  value: number;
403
403
  label?: string;
404
404
  labelComponent?: Function;
405
- labelTextStyle?: any;
405
+ labelTextStyle?: StyleProp<TextStyle>;
406
406
  dataPointText?: string;
407
407
  textShiftX?: number;
408
408
  textShiftY?: number;
@@ -527,9 +527,9 @@ export interface LineChartBicolorPropsType {
527
527
  colorNegative?: string;
528
528
  yAxisThickness?: number;
529
529
  yAxisColor?: ColorValue;
530
- yAxisLabelContainerStyle?: any;
530
+ yAxisLabelContainerStyle?: StyleProp<ViewStyle>;
531
531
  horizontalRulesStyle?: any;
532
- yAxisTextStyle?: any;
532
+ yAxisTextStyle?: StyleProp<TextStyle>;
533
533
  yAxisTextNumberOfLines?: number;
534
534
  xAxisTextNumberOfLines?: number;
535
535
  showFractionalValues?: boolean;
@@ -571,7 +571,7 @@ export interface LineChartBicolorPropsType {
571
571
  textShiftY?: number;
572
572
  yAxisLabelTexts?: string[];
573
573
  xAxisLabelTexts?: string[];
574
- xAxisLabelTextStyle?: any;
574
+ xAxisLabelTextStyle?: StyleProp<TextStyle>;
575
575
  width?: number;
576
576
  yAxisLabelPrefix?: string;
577
577
  yAxisLabelSuffix?: string;
@@ -590,6 +590,8 @@ export interface LineChartBicolorPropsType {
590
590
  overScrollMode?: 'auto' | 'always' | 'never';
591
591
  onScrollEndDrag?: (event: any, direction: any) => void;
592
592
  parentWidth?: number;
593
+ yAxisExtraHeight?: number;
594
+ trimYAxisAtTop?: boolean;
593
595
  }
594
596
  export interface LineChartPropsTypeForWeb extends LineChartPropsType {
595
597
  onContextMenu?: Function;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "./dist/index.js",
6
6
  "files": [