gifted-charts-core 0.1.2 → 0.1.4
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 +1 -1
- package/src/BarChart/index.js +68 -65
- package/src/BarChart/index.ts +6 -2
- package/src/BarChart/types.d.ts +1 -0
- package/src/BarChart/types.ts +1 -0
- package/src/LineChart/index.d.ts +1 -1
- package/src/LineChart/index.js +11 -5
- package/src/LineChart/index.ts +13 -5
- package/src/LineChart/types.d.ts +1 -0
- package/src/LineChart/types.ts +1 -0
- package/src/PieChart/pro.js +3 -3
- package/src/PieChart/pro.ts +4 -4
- package/src/utils/types.d.ts +2 -0
- package/src/utils/types.ts +2 -0
package/package.json
CHANGED
package/src/BarChart/index.js
CHANGED
|
@@ -29,12 +29,12 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
29
29
|
import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getLineConfigForBarChart, getMaxValue, getNoOfSections, getSecondaryDataWithOffsetIncluded, getXForLineInBar, getYForLineInBar, maxAndMinUtil, svgPath } from '../utils';
|
|
30
30
|
import { AxesAndRulesDefaults, BarDefaults, chartTypes, defaultLineConfig, defaultPointerConfig } from '../utils/constants';
|
|
31
31
|
export var useBarChart = function (props) {
|
|
32
|
-
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;
|
|
32
|
+
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;
|
|
33
33
|
var heightValue = props.heightValue, widthValue = props.widthValue, opacValue = props.opacValue, yAxisOffset = props.yAxisOffset;
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
34
|
+
var _48 = __read(useState(''), 2), points = _48[0], setPoints = _48[1];
|
|
35
|
+
var _49 = __read(useState(''), 2), points2 = _49[0], setPoints2 = _49[1];
|
|
36
|
+
var _50 = __read(useState(''), 2), arrowPoints = _50[0], setArrowPoints = _50[1];
|
|
37
|
+
var _51 = __read(useState(-1), 2), selectedIndex = _51[0], setSelectedIndex = _51[1];
|
|
38
38
|
var showLine = (_a = props.showLine) !== null && _a !== void 0 ? _a : BarDefaults.showLine;
|
|
39
39
|
var spacing = (_b = props.spacing) !== null && _b !== void 0 ? _b : BarDefaults.spacing;
|
|
40
40
|
var initialSpacing = (_c = props.initialSpacing) !== null && _c !== void 0 ? _c : spacing;
|
|
@@ -145,78 +145,80 @@ export var useBarChart = function (props) {
|
|
|
145
145
|
var secondaryMaxAndMin = maxAndMinUtil(secondaryMaxItem, secondaryMinItem, props.roundToDigits, props.showFractionalValues);
|
|
146
146
|
var maxValue = getMaxValue(props.maxValue, props.stepValue, noOfSections, maxAndMin.maxItem);
|
|
147
147
|
var secondaryMaxValue = lineConfig.isSecondary
|
|
148
|
-
?
|
|
148
|
+
? typeof props.secondaryYAxis !== 'boolean'
|
|
149
|
+
? (_u = props.secondaryYAxis.maxValue) !== null && _u !== void 0 ? _u : secondaryMaxAndMin.maxItem
|
|
150
|
+
: secondaryMaxAndMin.maxItem
|
|
149
151
|
: maxValue;
|
|
150
|
-
var mostNegativeValue = (
|
|
151
|
-
var stepValue = (
|
|
152
|
-
var noOfSectionsBelowXAxis = (
|
|
153
|
-
var showScrollIndicator = (
|
|
154
|
-
var side = (
|
|
155
|
-
var rotateLabel = (
|
|
156
|
-
var opacity = (
|
|
157
|
-
var isThreeD = (
|
|
158
|
-
var showXAxisIndices = (
|
|
159
|
-
var xAxisIndicesHeight = (
|
|
160
|
-
var xAxisIndicesWidth = (
|
|
161
|
-
var xAxisIndicesColor = (
|
|
162
|
-
var xAxisThickness = (
|
|
163
|
-
var xAxisTextNumberOfLines = (
|
|
164
|
-
var xAxisLabelsVerticalShift = (
|
|
152
|
+
var mostNegativeValue = (_v = props.mostNegativeValue) !== null && _v !== void 0 ? _v : maxAndMin.minItem;
|
|
153
|
+
var stepValue = (_w = props.stepValue) !== null && _w !== void 0 ? _w : maxValue / noOfSections;
|
|
154
|
+
var noOfSectionsBelowXAxis = (_x = props.noOfSectionsBelowXAxis) !== null && _x !== void 0 ? _x : -mostNegativeValue / stepValue;
|
|
155
|
+
var showScrollIndicator = (_y = props.showScrollIndicator) !== null && _y !== void 0 ? _y : BarDefaults.showScrollIndicator;
|
|
156
|
+
var side = (_z = props.side) !== null && _z !== void 0 ? _z : BarDefaults.side;
|
|
157
|
+
var rotateLabel = (_0 = props.rotateLabel) !== null && _0 !== void 0 ? _0 : AxesAndRulesDefaults.rotateLabel;
|
|
158
|
+
var opacity = (_1 = props.opacity) !== null && _1 !== void 0 ? _1 : BarDefaults.opacity;
|
|
159
|
+
var isThreeD = (_2 = props.isThreeD) !== null && _2 !== void 0 ? _2 : BarDefaults.isThreeD;
|
|
160
|
+
var showXAxisIndices = (_3 = props.showXAxisIndices) !== null && _3 !== void 0 ? _3 : AxesAndRulesDefaults.showXAxisIndices;
|
|
161
|
+
var xAxisIndicesHeight = (_4 = props.xAxisIndicesHeight) !== null && _4 !== void 0 ? _4 : AxesAndRulesDefaults.xAxisIndicesHeight;
|
|
162
|
+
var xAxisIndicesWidth = (_5 = props.xAxisIndicesWidth) !== null && _5 !== void 0 ? _5 : AxesAndRulesDefaults.xAxisIndicesWidth;
|
|
163
|
+
var xAxisIndicesColor = (_6 = props.xAxisIndicesColor) !== null && _6 !== void 0 ? _6 : AxesAndRulesDefaults.xAxisIndicesColor;
|
|
164
|
+
var xAxisThickness = (_7 = props.xAxisThickness) !== null && _7 !== void 0 ? _7 : AxesAndRulesDefaults.xAxisThickness;
|
|
165
|
+
var xAxisTextNumberOfLines = (_8 = props.xAxisTextNumberOfLines) !== null && _8 !== void 0 ? _8 : AxesAndRulesDefaults.xAxisTextNumberOfLines;
|
|
166
|
+
var xAxisLabelsVerticalShift = (_9 = props.xAxisLabelsVerticalShift) !== null && _9 !== void 0 ? _9 : AxesAndRulesDefaults.xAxisLabelsVerticalShift;
|
|
165
167
|
var horizontalRulesStyle = props.horizontalRulesStyle;
|
|
166
|
-
var yAxisLabelWidth = (
|
|
168
|
+
var yAxisLabelWidth = (_10 = props.yAxisLabelWidth) !== null && _10 !== void 0 ? _10 : (props.hideYAxisText
|
|
167
169
|
? AxesAndRulesDefaults.yAxisEmptyLabelWidth
|
|
168
170
|
: AxesAndRulesDefaults.yAxisLabelWidth);
|
|
169
|
-
var autoShiftLabels = (
|
|
170
|
-
var barWidth = (
|
|
171
|
-
var barBorderColor = (
|
|
171
|
+
var autoShiftLabels = (_11 = props.autoShiftLabels) !== null && _11 !== void 0 ? _11 : false;
|
|
172
|
+
var barWidth = (_12 = props.barWidth) !== null && _12 !== void 0 ? _12 : BarDefaults.barWidth;
|
|
173
|
+
var barBorderColor = (_13 = props.barBorderColor) !== null && _13 !== void 0 ? _13 : BarDefaults.barBorderColor;
|
|
172
174
|
var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
|
|
173
175
|
var containerHeightIncludingBelowXAxis = extendedContainerHeight + noOfSectionsBelowXAxis * stepHeight;
|
|
174
|
-
var
|
|
175
|
-
var
|
|
176
|
-
var
|
|
177
|
-
var
|
|
178
|
-
var
|
|
179
|
-
var
|
|
176
|
+
var _52 = __read(useState(-1), 2), pointerIndex = _52[0], setPointerIndex = _52[1];
|
|
177
|
+
var _53 = __read(useState(0), 2), pointerX = _53[0], setPointerX = _53[1];
|
|
178
|
+
var _54 = __read(useState(0), 2), pointerY = _54[0], setPointerY = _54[1];
|
|
179
|
+
var _55 = __read(useState(), 2), pointerItem = _55[0], setPointerItem = _55[1];
|
|
180
|
+
var _56 = __read(useState(0), 2), responderStartTime = _56[0], setResponderStartTime = _56[1];
|
|
181
|
+
var _57 = __read(useState(false), 2), responderActive = _57[0], setResponderActive = _57[1];
|
|
180
182
|
var pointerConfig = props.pointerConfig;
|
|
181
|
-
var getPointerProps = (
|
|
182
|
-
var pointerHeight = (
|
|
183
|
-
var pointerWidth = (
|
|
184
|
-
var pointerRadius = (
|
|
185
|
-
var pointerColor = (
|
|
186
|
-
var pointerComponent = (
|
|
183
|
+
var getPointerProps = (_14 = props.getPointerProps) !== null && _14 !== void 0 ? _14 : null;
|
|
184
|
+
var pointerHeight = (_15 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _15 !== void 0 ? _15 : defaultPointerConfig.height;
|
|
185
|
+
var pointerWidth = (_16 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.width) !== null && _16 !== void 0 ? _16 : defaultPointerConfig.width;
|
|
186
|
+
var pointerRadius = (_17 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.radius) !== null && _17 !== void 0 ? _17 : defaultPointerConfig.radius;
|
|
187
|
+
var pointerColor = (_18 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerColor) !== null && _18 !== void 0 ? _18 : defaultPointerConfig.pointerColor;
|
|
188
|
+
var pointerComponent = (_19 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerComponent) !== null && _19 !== void 0 ? _19 : defaultPointerConfig.pointerComponent;
|
|
187
189
|
var showPointerStrip = (pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.showPointerStrip) === false
|
|
188
190
|
? false
|
|
189
191
|
: defaultPointerConfig.showPointerStrip;
|
|
190
|
-
var pointerStripHeight = (
|
|
191
|
-
var pointerStripWidth = (
|
|
192
|
-
var pointerStripColor = (
|
|
193
|
-
var pointerStripUptoDataPoint = (
|
|
194
|
-
var pointerLabelComponent = (
|
|
195
|
-
var stripOverPointer = (
|
|
196
|
-
var shiftPointerLabelX = (
|
|
197
|
-
var shiftPointerLabelY = (
|
|
198
|
-
var pointerLabelWidth = (
|
|
199
|
-
var pointerLabelHeight = (
|
|
200
|
-
var autoAdjustPointerLabelPosition = (
|
|
201
|
-
var pointerVanishDelay = (
|
|
202
|
-
var activatePointersOnLongPress = (
|
|
203
|
-
var activatePointersDelay = (
|
|
204
|
-
var initialPointerIndex = (
|
|
205
|
-
var initialPointerAppearDelay = (
|
|
192
|
+
var pointerStripHeight = (_20 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripHeight) !== null && _20 !== void 0 ? _20 : defaultPointerConfig.pointerStripHeight;
|
|
193
|
+
var pointerStripWidth = (_21 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripWidth) !== null && _21 !== void 0 ? _21 : defaultPointerConfig.pointerStripWidth;
|
|
194
|
+
var pointerStripColor = (_22 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripColor) !== null && _22 !== void 0 ? _22 : defaultPointerConfig.pointerStripColor;
|
|
195
|
+
var pointerStripUptoDataPoint = (_23 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerStripUptoDataPoint) !== null && _23 !== void 0 ? _23 : defaultPointerConfig.pointerStripUptoDataPoint;
|
|
196
|
+
var pointerLabelComponent = (_24 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelComponent) !== null && _24 !== void 0 ? _24 : defaultPointerConfig.pointerLabelComponent;
|
|
197
|
+
var stripOverPointer = (_25 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripOverPointer) !== null && _25 !== void 0 ? _25 : defaultPointerConfig.stripOverPointer;
|
|
198
|
+
var shiftPointerLabelX = (_26 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelX) !== null && _26 !== void 0 ? _26 : defaultPointerConfig.shiftPointerLabelX;
|
|
199
|
+
var shiftPointerLabelY = (_27 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.shiftPointerLabelY) !== null && _27 !== void 0 ? _27 : defaultPointerConfig.shiftPointerLabelY;
|
|
200
|
+
var pointerLabelWidth = (_28 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelWidth) !== null && _28 !== void 0 ? _28 : defaultPointerConfig.pointerLabelWidth;
|
|
201
|
+
var pointerLabelHeight = (_29 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerLabelHeight) !== null && _29 !== void 0 ? _29 : defaultPointerConfig.pointerLabelHeight;
|
|
202
|
+
var autoAdjustPointerLabelPosition = (_30 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.autoAdjustPointerLabelPosition) !== null && _30 !== void 0 ? _30 : defaultPointerConfig.autoAdjustPointerLabelPosition;
|
|
203
|
+
var pointerVanishDelay = (_31 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerVanishDelay) !== null && _31 !== void 0 ? _31 : defaultPointerConfig.pointerVanishDelay;
|
|
204
|
+
var activatePointersOnLongPress = (_32 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersOnLongPress) !== null && _32 !== void 0 ? _32 : defaultPointerConfig.activatePointersOnLongPress;
|
|
205
|
+
var activatePointersDelay = (_33 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.activatePointersDelay) !== null && _33 !== void 0 ? _33 : defaultPointerConfig.activatePointersDelay;
|
|
206
|
+
var initialPointerIndex = (_34 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerIndex) !== null && _34 !== void 0 ? _34 : defaultPointerConfig.initialPointerIndex;
|
|
207
|
+
var initialPointerAppearDelay = (_35 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.initialPointerAppearDelay) !== null && _35 !== void 0 ? _35 : (isAnimated
|
|
206
208
|
? animationDuration
|
|
207
209
|
: defaultPointerConfig.initialPointerAppearDelay);
|
|
208
|
-
var persistPointer = (
|
|
209
|
-
var hidePointer1 = (
|
|
210
|
+
var persistPointer = (_36 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.persistPointer) !== null && _36 !== void 0 ? _36 : defaultPointerConfig.persistPointer;
|
|
211
|
+
var hidePointer1 = (_37 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.hidePointer1) !== null && _37 !== void 0 ? _37 : defaultPointerConfig.hidePointer1;
|
|
210
212
|
var pointerEvents = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.pointerEvents;
|
|
211
|
-
var stripBehindBars = (
|
|
212
|
-
var disableScroll = (
|
|
213
|
+
var stripBehindBars = (_38 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.stripBehindBars) !== null && _38 !== void 0 ? _38 : defaultPointerConfig.stripBehindBars;
|
|
214
|
+
var disableScroll = (_39 = props.disableScroll) !== null && _39 !== void 0 ? _39 : (pointerConfig
|
|
213
215
|
? activatePointersOnLongPress
|
|
214
216
|
? !!responderActive
|
|
215
217
|
: true
|
|
216
218
|
: false);
|
|
217
219
|
var yAxisExtraHeightAtTop = props.trimYAxisAtTop
|
|
218
220
|
? 0
|
|
219
|
-
: (
|
|
221
|
+
: (_40 = props.yAxisExtraHeight) !== null && _40 !== void 0 ? _40 : containerHeight / 20;
|
|
220
222
|
var barInnerComponent = props.barInnerComponent;
|
|
221
223
|
useEffect(function () {
|
|
222
224
|
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;
|
|
@@ -332,9 +334,9 @@ export var useBarChart = function (props) {
|
|
|
332
334
|
spacing,
|
|
333
335
|
yAxisLabelWidth,
|
|
334
336
|
lineConfig.showArrow,
|
|
335
|
-
(
|
|
336
|
-
(
|
|
337
|
-
(
|
|
337
|
+
(_41 = lineConfig.arrowConfig) === null || _41 === void 0 ? void 0 : _41.length,
|
|
338
|
+
(_42 = lineConfig.arrowConfig) === null || _42 === void 0 ? void 0 : _42.width,
|
|
339
|
+
(_43 = lineConfig.arrowConfig) === null || _43 === void 0 ? void 0 : _43.showArrowBase
|
|
338
340
|
]);
|
|
339
341
|
useEffect(function () {
|
|
340
342
|
var _a, _b, _c, _d;
|
|
@@ -449,14 +451,14 @@ export var useBarChart = function (props) {
|
|
|
449
451
|
yAxisLabelWidth: yAxisLabelWidth,
|
|
450
452
|
horizontal: horizontal,
|
|
451
453
|
rtl: rtl,
|
|
452
|
-
shiftX: (
|
|
453
|
-
shiftY: (
|
|
454
|
+
shiftX: (_44 = props.shiftX) !== null && _44 !== void 0 ? _44 : 0,
|
|
455
|
+
shiftY: (_45 = props.shiftY) !== null && _45 !== void 0 ? _45 : 0,
|
|
454
456
|
yAxisAtTop: yAxisAtTop,
|
|
455
457
|
initialSpacing: initialSpacing,
|
|
456
458
|
data: data,
|
|
457
459
|
stackData: props.stackData,
|
|
458
460
|
secondaryData: secondaryData,
|
|
459
|
-
barWidth: (
|
|
461
|
+
barWidth: (_46 = props.barWidth) !== null && _46 !== void 0 ? _46 : BarDefaults.barWidth,
|
|
460
462
|
xAxisThickness: xAxisThickness,
|
|
461
463
|
totalWidth: totalWidth,
|
|
462
464
|
disableScroll: disableScroll,
|
|
@@ -503,7 +505,8 @@ export var useBarChart = function (props) {
|
|
|
503
505
|
pointerY: pointerY,
|
|
504
506
|
onEndReached: props.onEndReached,
|
|
505
507
|
onStartReached: props.onStartReached,
|
|
506
|
-
endReachedOffset: (
|
|
508
|
+
endReachedOffset: (_47 = props.endReachedOffset) !== null && _47 !== void 0 ? _47 : BarDefaults.endReachedOffset,
|
|
509
|
+
onMomentumScrollEnd: props.onMomentumScrollEnd
|
|
507
510
|
};
|
|
508
511
|
return {
|
|
509
512
|
lineConfig: lineConfig,
|
package/src/BarChart/index.ts
CHANGED
|
@@ -204,7 +204,10 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
204
204
|
maxAndMin.maxItem
|
|
205
205
|
)
|
|
206
206
|
const secondaryMaxValue = lineConfig.isSecondary
|
|
207
|
-
?
|
|
207
|
+
? typeof props.secondaryYAxis !== 'boolean'
|
|
208
|
+
? (props.secondaryYAxis as secondaryYAxisType).maxValue ??
|
|
209
|
+
secondaryMaxAndMin.maxItem
|
|
210
|
+
: secondaryMaxAndMin.maxItem
|
|
208
211
|
: maxValue
|
|
209
212
|
const mostNegativeValue = props.mostNegativeValue ?? maxAndMin.minItem
|
|
210
213
|
|
|
@@ -733,7 +736,8 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
733
736
|
|
|
734
737
|
onEndReached: props.onEndReached,
|
|
735
738
|
onStartReached: props.onStartReached,
|
|
736
|
-
endReachedOffset: props.endReachedOffset ?? BarDefaults.endReachedOffset
|
|
739
|
+
endReachedOffset: props.endReachedOffset ?? BarDefaults.endReachedOffset,
|
|
740
|
+
onMomentumScrollEnd: props.onMomentumScrollEnd
|
|
737
741
|
}
|
|
738
742
|
|
|
739
743
|
return {
|
package/src/BarChart/types.d.ts
CHANGED
package/src/BarChart/types.ts
CHANGED
package/src/LineChart/index.d.ts
CHANGED
|
@@ -306,7 +306,7 @@ export declare const useLineChart: (props: extendedLineChartPropsType) => {
|
|
|
306
306
|
addLeadingAndTrailingPathForAreaFill: (initialPath: string, value: number, dataLength: number) => string;
|
|
307
307
|
getNextPoint: (data: lineDataItem[], index: number, around: boolean, before: boolean) => string;
|
|
308
308
|
getStepPath: (data: lineDataItem[], i: number) => string;
|
|
309
|
-
getSegmentPath: (data: lineDataItem[], i: number, lineSegment: LineSegment[] | undefined, startIndex: number, endIndex: number) => string;
|
|
309
|
+
getSegmentPath: (data: lineDataItem[], i: number, lineSegment: LineSegment[] | undefined, startIndex: number, endIndex: number, isSecondary?: boolean) => string;
|
|
310
310
|
gradientDirection: string;
|
|
311
311
|
horizSections: {
|
|
312
312
|
value: string;
|
package/src/LineChart/index.js
CHANGED
|
@@ -414,11 +414,11 @@ export var useLineChart = function (props) {
|
|
|
414
414
|
getY(data[i].value) +
|
|
415
415
|
getNextPoint(data, i, around, before));
|
|
416
416
|
};
|
|
417
|
-
var getSegmentPath = function (data, i, lineSegment, startIndex, endIndex) {
|
|
417
|
+
var getSegmentPath = function (data, i, lineSegment, startIndex, endIndex, isSecondary) {
|
|
418
418
|
var path = 'L' +
|
|
419
419
|
getX(i) +
|
|
420
420
|
' ' +
|
|
421
|
-
getY(data[i].value) +
|
|
421
|
+
(isSecondary ? getSecondaryY(data[i].value) : getY(data[i].value)) +
|
|
422
422
|
' ' +
|
|
423
423
|
getSegmentString(lineSegment, i, SEGMENT_START, SEGMENT_END);
|
|
424
424
|
if (highlightedRange) {
|
|
@@ -439,7 +439,12 @@ export var useLineChart = function (props) {
|
|
|
439
439
|
for (var i = 0; i < set.data.length; i++) {
|
|
440
440
|
if (i >= ((_b = set.startIndex) !== null && _b !== void 0 ? _b : 0) &&
|
|
441
441
|
i <= ((_c = set.endIndex) !== null && _c !== void 0 ? _c : set.data.length - 1)) {
|
|
442
|
-
pArray.push([
|
|
442
|
+
pArray.push([
|
|
443
|
+
getX(i),
|
|
444
|
+
set.isSecondary
|
|
445
|
+
? getSecondaryY(set.data[i].value)
|
|
446
|
+
: getY(set.data[i].value)
|
|
447
|
+
]);
|
|
443
448
|
}
|
|
444
449
|
}
|
|
445
450
|
var xx = svgPath(pArray, (_d = set.curveType) !== null && _d !== void 0 ? _d : curveType, (_e = set.curvature) !== null && _e !== void 0 ? _e : curvature);
|
|
@@ -468,7 +473,7 @@ export var useLineChart = function (props) {
|
|
|
468
473
|
pp += getStepPath(set.data, i);
|
|
469
474
|
}
|
|
470
475
|
else {
|
|
471
|
-
pp += getSegmentPath(set.data, i, set.lineSegments, (_l = set.startIndex) !== null && _l !== void 0 ? _l : 0, (_m = set.endIndex) !== null && _m !== void 0 ? _m : set.data.length - 1);
|
|
476
|
+
pp += getSegmentPath(set.data, i, set.lineSegments, (_l = set.startIndex) !== null && _l !== void 0 ? _l : 0, (_m = set.endIndex) !== null && _m !== void 0 ? _m : set.data.length - 1, set.isSecondary);
|
|
472
477
|
}
|
|
473
478
|
}
|
|
474
479
|
}
|
|
@@ -1071,7 +1076,8 @@ export var useLineChart = function (props) {
|
|
|
1071
1076
|
pointerY: pointerY,
|
|
1072
1077
|
onEndReached: props.onEndReached,
|
|
1073
1078
|
onStartReached: props.onStartReached,
|
|
1074
|
-
endReachedOffset: (_291 = props.endReachedOffset) !== null && _291 !== void 0 ? _291 : LineDefaults.endReachedOffset
|
|
1079
|
+
endReachedOffset: (_291 = props.endReachedOffset) !== null && _291 !== void 0 ? _291 : LineDefaults.endReachedOffset,
|
|
1080
|
+
onMomentumScrollEnd: props.onMomentumScrollEnd
|
|
1075
1081
|
};
|
|
1076
1082
|
return {
|
|
1077
1083
|
curvature: curvature,
|
package/src/LineChart/index.ts
CHANGED
|
@@ -727,13 +727,14 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
727
727
|
i: number,
|
|
728
728
|
lineSegment: LineSegment[] | undefined,
|
|
729
729
|
startIndex: number,
|
|
730
|
-
endIndex: number
|
|
730
|
+
endIndex: number,
|
|
731
|
+
isSecondary?: boolean
|
|
731
732
|
): string => {
|
|
732
733
|
let path =
|
|
733
734
|
'L' +
|
|
734
735
|
getX(i) +
|
|
735
736
|
' ' +
|
|
736
|
-
getY(data[i].value) +
|
|
737
|
+
(isSecondary ? getSecondaryY(data[i].value) : getY(data[i].value)) +
|
|
737
738
|
' ' +
|
|
738
739
|
getSegmentString(lineSegment, i, SEGMENT_START, SEGMENT_END)
|
|
739
740
|
|
|
@@ -764,7 +765,12 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
764
765
|
i >= (set.startIndex ?? 0) &&
|
|
765
766
|
i <= (set.endIndex ?? set.data.length - 1)
|
|
766
767
|
) {
|
|
767
|
-
pArray.push([
|
|
768
|
+
pArray.push([
|
|
769
|
+
getX(i),
|
|
770
|
+
set.isSecondary
|
|
771
|
+
? getSecondaryY(set.data[i].value)
|
|
772
|
+
: getY(set.data[i].value)
|
|
773
|
+
])
|
|
768
774
|
}
|
|
769
775
|
}
|
|
770
776
|
let xx = svgPath(
|
|
@@ -825,7 +831,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
825
831
|
i,
|
|
826
832
|
set.lineSegments,
|
|
827
833
|
set.startIndex ?? 0,
|
|
828
|
-
set.endIndex ?? set.data.length - 1
|
|
834
|
+
set.endIndex ?? set.data.length - 1,
|
|
835
|
+
set.isSecondary
|
|
829
836
|
)
|
|
830
837
|
}
|
|
831
838
|
}
|
|
@@ -1780,7 +1787,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
1780
1787
|
|
|
1781
1788
|
onEndReached: props.onEndReached,
|
|
1782
1789
|
onStartReached: props.onStartReached,
|
|
1783
|
-
endReachedOffset: props.endReachedOffset ?? LineDefaults.endReachedOffset
|
|
1790
|
+
endReachedOffset: props.endReachedOffset ?? LineDefaults.endReachedOffset,
|
|
1791
|
+
onMomentumScrollEnd: props.onMomentumScrollEnd
|
|
1784
1792
|
}
|
|
1785
1793
|
|
|
1786
1794
|
return {
|
package/src/LineChart/types.d.ts
CHANGED
|
@@ -288,6 +288,7 @@ export interface LineChartPropsType {
|
|
|
288
288
|
onStartReached?: () => void;
|
|
289
289
|
endReachedOffset?: number;
|
|
290
290
|
onScroll?: Function;
|
|
291
|
+
onMomentumScrollEnd?: Function;
|
|
291
292
|
showDataPointsForMissingValues?: boolean;
|
|
292
293
|
interpolateMissingValues?: boolean;
|
|
293
294
|
onlyPositive?: boolean;
|
package/src/LineChart/types.ts
CHANGED
package/src/PieChart/pro.js
CHANGED
|
@@ -34,9 +34,9 @@ export var usePiePro = function (props) {
|
|
|
34
34
|
var heightFactor = semiCircle ? 1 : 2;
|
|
35
35
|
var height = radius + maxStrokeWidth;
|
|
36
36
|
var svgProps = {
|
|
37
|
-
height:
|
|
38
|
-
width:
|
|
39
|
-
viewBox: "".concat(-maxStrokeWidth, " ").concat(-maxStrokeWidth - (semiCircle ? height / 2 : 0), " ").concat(
|
|
37
|
+
height: height * 2,
|
|
38
|
+
width: height * 2,
|
|
39
|
+
viewBox: "".concat(-maxStrokeWidth * 1.5, " ").concat(-maxStrokeWidth - (semiCircle ? height / 2 : 0), " ").concat(height * 2, " ").concat(height * 2)
|
|
40
40
|
};
|
|
41
41
|
// let endAngleLocal = 0
|
|
42
42
|
var addValues = function (index) {
|
package/src/PieChart/pro.ts
CHANGED
|
@@ -57,11 +57,11 @@ export const usePiePro = (props: PieChartPropsType): IusePiePro => {
|
|
|
57
57
|
const height = radius + maxStrokeWidth
|
|
58
58
|
|
|
59
59
|
const svgProps = {
|
|
60
|
-
height:
|
|
61
|
-
width:
|
|
62
|
-
viewBox: `${-maxStrokeWidth} ${
|
|
60
|
+
height: height * 2,
|
|
61
|
+
width: height * 2,
|
|
62
|
+
viewBox: `${-maxStrokeWidth * 1.5} ${
|
|
63
63
|
-maxStrokeWidth - (semiCircle ? height / 2 : 0)
|
|
64
|
-
} ${
|
|
64
|
+
} ${height * 2} ${height * 2}`
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// let endAngleLocal = 0
|
package/src/utils/types.d.ts
CHANGED
|
@@ -234,6 +234,7 @@ export interface BarAndLineChartsWrapperTypes {
|
|
|
234
234
|
scrollEventThrottle: number;
|
|
235
235
|
onEndReached?: () => void;
|
|
236
236
|
onStartReached?: () => void;
|
|
237
|
+
onMomentumScrollEnd?: Function;
|
|
237
238
|
endReachedOffset: number;
|
|
238
239
|
isRTL?: boolean;
|
|
239
240
|
}
|
|
@@ -334,5 +335,6 @@ export interface DataSet {
|
|
|
334
335
|
curvature?: number;
|
|
335
336
|
curveType?: CurveType;
|
|
336
337
|
lineSegments?: LineSegment[];
|
|
338
|
+
isSecondary?: boolean;
|
|
337
339
|
}
|
|
338
340
|
export {};
|
package/src/utils/types.ts
CHANGED
|
@@ -265,6 +265,7 @@ export interface BarAndLineChartsWrapperTypes {
|
|
|
265
265
|
|
|
266
266
|
onEndReached?: () => void
|
|
267
267
|
onStartReached?: () => void
|
|
268
|
+
onMomentumScrollEnd?: Function
|
|
268
269
|
endReachedOffset: number
|
|
269
270
|
isRTL?: boolean
|
|
270
271
|
}
|
|
@@ -371,4 +372,5 @@ export interface DataSet {
|
|
|
371
372
|
curvature?: number
|
|
372
373
|
curveType?: CurveType
|
|
373
374
|
lineSegments?: LineSegment[]
|
|
375
|
+
isSecondary?: boolean
|
|
374
376
|
}
|