gifted-charts-core 0.1.60 → 0.1.62

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.
@@ -639,7 +639,8 @@ export var useBarChart = function (props) {
639
639
  customBackground: props.customBackground,
640
640
  highlightEnabled: highlightEnabled,
641
641
  lowlightOpacity: lowlightOpacity,
642
- xAxisLabelsAtBottom: xAxisLabelsAtBottom
642
+ xAxisLabelsAtBottom: xAxisLabelsAtBottom,
643
+ onScrollEndDrag: props.onScrollEndDrag
643
644
  };
644
645
  return {
645
646
  lineConfig: lineConfig,
@@ -144,6 +144,10 @@ export interface StackedBarChartPropsType {
144
144
  stackHighlightEnabled?: boolean;
145
145
  selectedStackIndex: number;
146
146
  setSelectedStackIndex: Function;
147
+ onBackgroundPress?: Function;
148
+ bounces?: boolean;
149
+ overScrollMode?: 'auto' | 'always' | 'never';
150
+ onScrollEndDrag?: (event: any, direction: any) => void;
147
151
  }
148
152
  export interface StackedBarChartPropsTypeForWeb extends StackedBarChartPropsType {
149
153
  onContextMenu?: Function;
@@ -323,6 +327,9 @@ export interface BarChartPropsType {
323
327
  endReachedOffset?: number;
324
328
  onScroll?: Function;
325
329
  onMomentumScrollEnd?: Function;
330
+ bounces?: boolean;
331
+ overScrollMode?: 'auto' | 'always' | 'never';
332
+ onScrollEndDrag?: (event: any, direction: any) => void;
326
333
  focusBarOnPress?: boolean;
327
334
  focusedBarConfig?: FocusedBarConfig;
328
335
  focusedBarIndex?: number;
@@ -334,6 +341,7 @@ export interface BarChartPropsType {
334
341
  adjustToWidth?: boolean;
335
342
  parentWidth?: number;
336
343
  secondaryXAxis?: XAxisConfig;
344
+ onBackgroundPress?: Function;
337
345
  }
338
346
  export interface FocusedBarConfig {
339
347
  color?: ColorValue;
@@ -438,7 +438,8 @@ export var useLineChartBiColor = function (props) {
438
438
  extraWidthDueToDataPoint: extraWidthDueToDataPoint,
439
439
  highlightEnabled: LineDefaults.highlightEnabled,
440
440
  lowlightOpacity: LineDefaults.lowlightOpacity,
441
- xAxisLabelsAtBottom: false
441
+ xAxisLabelsAtBottom: false,
442
+ onScrollEndDrag: props.onScrollEndDrag
442
443
  };
443
444
  return {
444
445
  toggle: toggle,
@@ -1389,7 +1389,8 @@ export var useLineChart = function (props) {
1389
1389
  onlyPositive: onlyPositive,
1390
1390
  highlightEnabled: LineDefaults.highlightEnabled,
1391
1391
  lowlightOpacity: LineDefaults.lowlightOpacity,
1392
- xAxisLabelsAtBottom: xAxisLabelsAtBottom
1392
+ xAxisLabelsAtBottom: xAxisLabelsAtBottom,
1393
+ onScrollEndDrag: props.onScrollEndDrag
1393
1394
  };
1394
1395
  var pointerItemLocal = [];
1395
1396
  if (pointerConfig) {
@@ -314,6 +314,9 @@ export interface LineChartPropsType {
314
314
  endReachedOffset?: number;
315
315
  onScroll?: Function;
316
316
  onMomentumScrollEnd?: Function;
317
+ bounces?: boolean;
318
+ overScrollMode?: 'auto' | 'always' | 'never';
319
+ onScrollEndDrag?: (event: any, direction: any) => void;
317
320
  showDataPointsForMissingValues?: boolean;
318
321
  interpolateMissingValues?: boolean;
319
322
  extrapolateMissingValues?: boolean;
@@ -580,6 +583,9 @@ export interface LineChartBicolorPropsType {
580
583
  formatYLabel?: (label: string) => string;
581
584
  onScroll?: Function;
582
585
  endReachedOffset?: number;
586
+ bounces?: boolean;
587
+ overScrollMode?: 'auto' | 'always' | 'never';
588
+ onScrollEndDrag?: (event: any, direction: any) => void;
583
589
  parentWidth?: number;
584
590
  }
585
591
  export interface LineChartPropsTypeForWeb extends LineChartPropsType {
@@ -1138,13 +1138,24 @@ export var pointsWithPaddedRepititions = function (oldPoints, newPoints) {
1138
1138
  ** Handles these cases-
1139
1139
  **
1140
1140
  ** 1. Straight line chart
1141
- ** 2. Curved Line chart
1142
- ** 3. Straight Area chart -> we need to repeatedly add the 3rd last substring from the points array which represents the last point
1143
- ** 4. Curved Area chart -> we need to repeatedly add the 3nd last substring (the 2 last substrings start with L while the 3rd last will start with C) from the points array which represents the last point
1141
+ ** 2. Curved Line chart with Cubic curve
1142
+ ** 3. Curved Line Chart with Quadratic curve
1143
+ ** 4. Straight Area chart -> we need to repeatedly add the 3rd last substring from the points array which represents the last point
1144
+ ** 5. Curved Area chart with Cubic curve -> we need to repeatedly add the 3nd last substring (the 2 last substrings start with L while the 3rd last will start with C) from the points array which represents the last point
1145
+ ** 6. Curved Area chart with Quadratic curve -> we need to repeatedly add the 3nd last substring (the 2 last substrings start with L while the 3rd last will start with Q) from the points array which represents the last point
1144
1146
  */
1145
1147
  var oldPointsCopy = oldPoints.trim();
1146
1148
  var newPointsCopy = newPoints.trim();
1147
- var char = oldPointsCopy.indexOf('C') === -1 ? 'L' : 'C';
1149
+ var char;
1150
+ if (oldPointsCopy.includes('C')) {
1151
+ char = 'C';
1152
+ }
1153
+ else if (oldPointsCopy.includes('Q ')) {
1154
+ char = 'Q ';
1155
+ }
1156
+ else {
1157
+ char = 'L';
1158
+ }
1148
1159
  var oldPointsCopyAr = oldPointsCopy.split(char);
1149
1160
  var newPointsCopyAr = newPointsCopy.split(char);
1150
1161
  var oldPointsCopyLen = oldPointsCopyAr.length - 1;
@@ -1154,7 +1165,7 @@ export var pointsWithPaddedRepititions = function (oldPoints, newPoints) {
1154
1165
  ? oldPointsCopyAr[oldPointsCopyLen].trim()
1155
1166
  : newPointsCopyAr[newPointsCopyLen].trim();
1156
1167
  var indexOfL = lastSequence.indexOf('L');
1157
- var isCurvedAreaChart = char === 'C' && indexOfL !== -1;
1168
+ var isCurvedAreaChart = (char === 'C' || char === 'Q ') && indexOfL !== -1;
1158
1169
  var isStraightAreaChart = !isCurvedAreaChart &&
1159
1170
  oldPointsCopyAr[0].substring(1).trim() ===
1160
1171
  oldPointsCopyAr[oldPointsCopyLen].trim();
@@ -1165,7 +1176,27 @@ export var pointsWithPaddedRepititions = function (oldPoints, newPoints) {
1165
1176
  ? oldPointsCopyAr[oldPointsCopyLen - 2]
1166
1177
  : newPointsCopyAr[newPointsCopyLen - 2]
1167
1178
  : lastSequence;
1168
- repeats = char + (repeats === null || repeats === void 0 ? void 0 : repeats.trim());
1179
+ if (!isCurvedAreaChart && char === 'Q ') {
1180
+ // redrawing the last curve segment is a bit complicated in case of quadratic curves as evident below-
1181
+ var repeatsAr = repeats.split('Q');
1182
+ var r1 = repeatsAr[0];
1183
+ var r2 = repeatsAr[1];
1184
+ var r1LastPoint = r1.split(' ')[1];
1185
+ var r2LastPoint = r2.split(' ')[1];
1186
+ var r2FirstPoint = r2.split(' ')[0];
1187
+ repeats =
1188
+ 'Q ' +
1189
+ r2FirstPoint +
1190
+ ' ' +
1191
+ r1LastPoint +
1192
+ ' Q' +
1193
+ r2FirstPoint +
1194
+ ' ' +
1195
+ r2LastPoint;
1196
+ }
1197
+ else {
1198
+ repeats = char + (repeats === null || repeats === void 0 ? void 0 : repeats.trim());
1199
+ }
1169
1200
  if (isCurvedAreaChart) {
1170
1201
  if (oldPointsCopyLen < newPointsCopyLen) {
1171
1202
  oldPointsCopy = oldPointsCopy
@@ -341,6 +341,7 @@ export interface BarAndLineChartsWrapperTypes {
341
341
  highlightEnabled: boolean;
342
342
  lowlightOpacity: number;
343
343
  xAxisLabelsAtBottom: boolean;
344
+ onScrollEndDrag?: (event: any, direction: any) => void;
344
345
  }
345
346
  export interface HorizontalStripConfig {
346
347
  thickness?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.1.60",
3
+ "version": "0.1.62",
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": [