gifted-charts-core 0.0.18 → 0.0.19

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gifted-charts-core",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Mathematical and logical utilities used by react-gifted-charts and react-native-gifted-charts",
5
5
  "main": "index.ts",
6
6
  "files": [
@@ -10,7 +10,6 @@ import {
10
10
  screenWidth,
11
11
  } from "../utils/constants";
12
12
  import {
13
- clone,
14
13
  computeMaxAndMinItems,
15
14
  getAllArrowProperties,
16
15
  getArrowPoints,
@@ -39,6 +38,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
39
38
  showDataPointsForMissingValues,
40
39
  interpolateMissingValues = true,
41
40
  onlyPositive,
41
+ yAxisOffset,
42
42
  } = props;
43
43
  const curvature = props.curvature ?? LineDefaults.curvature;
44
44
  const curveType = props.curveType ?? LineDefaults.curveType;
@@ -123,14 +123,14 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
123
123
  interpolateMissingValues,
124
124
  onlyPositive
125
125
  );
126
- if (props.yAxisOffset) {
126
+ if (yAxisOffset) {
127
127
  return nullishHandledData.map((item) => {
128
- item.value = item.value - (props.yAxisOffset ?? 0);
128
+ item.value = item.value - (yAxisOffset ?? 0);
129
129
  return item;
130
130
  });
131
131
  }
132
132
  return nullishHandledData;
133
- }, [props.yAxisOffset, props.data]);
133
+ }, [yAxisOffset, props.data]);
134
134
  const data2 = useMemo(() => {
135
135
  if (!props.data2) {
136
136
  return [];
@@ -141,14 +141,14 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
141
141
  interpolateMissingValues,
142
142
  onlyPositive
143
143
  );
144
- if (props.yAxisOffset) {
144
+ if (yAxisOffset) {
145
145
  return nullishHandledData.map((item) => {
146
- item.value = item.value - (props.yAxisOffset ?? 0);
146
+ item.value = item.value - (yAxisOffset ?? 0);
147
147
  return item;
148
148
  });
149
149
  }
150
150
  return nullishHandledData;
151
- }, [props.yAxisOffset, props.data2]);
151
+ }, [yAxisOffset, props.data2]);
152
152
  const data3 = useMemo(() => {
153
153
  if (!props.data3) {
154
154
  return [];
@@ -159,14 +159,14 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
159
159
  interpolateMissingValues,
160
160
  onlyPositive
161
161
  );
162
- if (props.yAxisOffset) {
162
+ if (yAxisOffset) {
163
163
  return nullishHandledData.map((item) => {
164
- item.value = item.value - (props.yAxisOffset ?? 0);
164
+ item.value = item.value - (yAxisOffset ?? 0);
165
165
  return item;
166
166
  });
167
167
  }
168
168
  return nullishHandledData;
169
- }, [props.yAxisOffset, props.data3]);
169
+ }, [yAxisOffset, props.data3]);
170
170
  const data4 = useMemo(() => {
171
171
  if (!props.data4) {
172
172
  return [];
@@ -177,14 +177,14 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
177
177
  interpolateMissingValues,
178
178
  onlyPositive
179
179
  );
180
- if (props.yAxisOffset) {
180
+ if (yAxisOffset) {
181
181
  return nullishHandledData.map((item) => {
182
- item.value = item.value - (props.yAxisOffset ?? 0);
182
+ item.value = item.value - (yAxisOffset ?? 0);
183
183
  return item;
184
184
  });
185
185
  }
186
186
  return nullishHandledData;
187
- }, [props.yAxisOffset, props.data4]);
187
+ }, [yAxisOffset, props.data4]);
188
188
  const data5 = useMemo(() => {
189
189
  if (!props.data5) {
190
190
  return [];
@@ -195,14 +195,14 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
195
195
  interpolateMissingValues,
196
196
  onlyPositive
197
197
  );
198
- if (props.yAxisOffset) {
198
+ if (yAxisOffset) {
199
199
  return nullishHandledData.map((item) => {
200
- item.value = item.value - (props.yAxisOffset ?? 0);
200
+ item.value = item.value - (yAxisOffset ?? 0);
201
201
  return item;
202
202
  });
203
203
  }
204
204
  return nullishHandledData;
205
- }, [props.yAxisOffset, props.data5]);
205
+ }, [yAxisOffset, props.data5]);
206
206
 
207
207
  const secondaryData =
208
208
  getSecondaryDataWithOffsetIncluded(
@@ -226,15 +226,15 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
226
226
  }));
227
227
  }
228
228
  const data0 = useMemo(() => {
229
- if (props.yAxisOffset) {
229
+ if (!yAxisOffset) {
230
230
  return dataSet?.[0]?.data;
231
231
  } else {
232
232
  return dataSet?.[0]?.data?.map((item) => {
233
- item.value = item.value - (props.yAxisOffset ?? 0);
233
+ item.value = item.value - (yAxisOffset ?? 0);
234
234
  return item;
235
235
  });
236
236
  }
237
- }, [props.yAxisOffset, dataSet]);
237
+ }, [yAxisOffset, dataSet]);
238
238
 
239
239
  const scrollToEnd = props.scrollToEnd || LineDefaults.scrollToEnd;
240
240
  const scrollAnimation = props.scrollAnimation ?? LineDefaults.scrollAnimation;
@@ -248,7 +248,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
248
248
  const onDataChangeAnimationDuration =
249
249
  props.onDataChangeAnimationDuration || 400;
250
250
  const animateTogether = props.animateTogether || LineDefaults.animateTogether;
251
- const animateOnDataChange = props.yAxisOffset
251
+ const animateOnDataChange = yAxisOffset
252
252
  ? false
253
253
  : props.animateOnDataChange || false;
254
254
 
@@ -808,7 +808,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
808
808
  const fillPointsArray: string[] = [];
809
809
  dataSet.map((set, index) => {
810
810
  const setData = set.data.map((item) => {
811
- item.value = item.value - (props.yAxisOffset ?? 0);
811
+ item.value = item.value - (yAxisOffset ?? 0);
812
812
  return item;
813
813
  });
814
814
  if (set.curved ?? props.curved) {
@@ -1824,7 +1824,7 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
1824
1824
  axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
1825
1825
 
1826
1826
  yAxisLabelTexts: props.yAxisLabelTexts,
1827
- yAxisOffset: props.yAxisOffset,
1827
+ yAxisOffset: yAxisOffset,
1828
1828
  rotateYAxisTexts: 0,
1829
1829
  hideAxesAndRules: props.hideAxesAndRules,
1830
1830