gifted-charts-core 0.1.36 → 0.1.37
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/dist/BarChart/index.js
CHANGED
|
@@ -29,12 +29,12 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
29
29
|
import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getLineConfigForBarChart, getMaxValue, getMostNegativeValue, getNoOfSections, getXForLineInBar, getYForLineInBar, indexOfFirstNonZeroDigit, 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, _47, _48, _49, _50, _51, _52, _53, _54;
|
|
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, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58;
|
|
33
33
|
var heightValue = props.heightValue, widthValue = props.widthValue, opacityValue = props.opacityValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex, negativeStepValue = props.negativeStepValue, autoCenterTooltip = props.autoCenterTooltip;
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
34
|
+
var _59 = __read(useState(''), 2), points = _59[0], setPoints = _59[1];
|
|
35
|
+
var _60 = __read(useState(''), 2), points2 = _60[0], setPoints2 = _60[1];
|
|
36
|
+
var _61 = __read(useState(''), 2), arrowPoints = _61[0], setArrowPoints = _61[1];
|
|
37
|
+
var _62 = __read(useState(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1), 2), selectedIndex = _62[0], setSelectedIndex = _62[1];
|
|
38
38
|
var showLine = (_a = props.showLine) !== null && _a !== void 0 ? _a : BarDefaults.showLine;
|
|
39
39
|
useEffect(function () {
|
|
40
40
|
setSelectedIndex(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1);
|
|
@@ -225,17 +225,17 @@ export var useBarChart = function (props) {
|
|
|
225
225
|
var barBorderColor = (_18 = props.barBorderColor) !== null && _18 !== void 0 ? _18 : BarDefaults.barBorderColor;
|
|
226
226
|
var extendedContainerHeight = getExtendedContainerHeightWithPadding(containerHeight, 0);
|
|
227
227
|
var axesAndRulesProps = getAxesAndRulesProps(props, containerHeight, stepHeight, stepValue, noOfSections, roundToDigits, negativeStepValue !== null && negativeStepValue !== void 0 ? negativeStepValue : stepValue, secondaryMaxValue, secondaryMinItem, showSecondaryFractionalValues, secondaryRoundToDigits);
|
|
228
|
-
var
|
|
228
|
+
var _63 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepHeight = _63.stepHeight, secondaryStepValue = _63.stepValue, secondaryNegativeStepHeight = _63.negativeStepHeight, secondaryNegativeStepValue = _63.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _63.noOfSectionsBelowXAxis;
|
|
229
229
|
var primary4thQuadrantHeight = noOfSectionsBelowXAxis * ((_19 = props.negativeStepHeight) !== null && _19 !== void 0 ? _19 : stepHeight);
|
|
230
230
|
var secondary4thQuadrantHeight = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
|
|
231
231
|
var containerHeightIncludingBelowXAxis = extendedContainerHeight +
|
|
232
232
|
Math.max(primary4thQuadrantHeight, secondary4thQuadrantHeight);
|
|
233
|
-
var
|
|
234
|
-
var
|
|
235
|
-
var
|
|
236
|
-
var
|
|
237
|
-
var
|
|
238
|
-
var
|
|
233
|
+
var _64 = __read(useState(-1), 2), pointerIndex = _64[0], setPointerIndex = _64[1];
|
|
234
|
+
var _65 = __read(useState(0), 2), pointerX = _65[0], setPointerX = _65[1];
|
|
235
|
+
var _66 = __read(useState(0), 2), pointerY = _66[0], setPointerY = _66[1];
|
|
236
|
+
var _67 = __read(useState(), 2), pointerItem = _67[0], setPointerItem = _67[1];
|
|
237
|
+
var _68 = __read(useState(0), 2), responderStartTime = _68[0], setResponderStartTime = _68[1];
|
|
238
|
+
var _69 = __read(useState(false), 2), responderActive = _69[0], setResponderActive = _69[1];
|
|
239
239
|
var pointerConfig = props.pointerConfig;
|
|
240
240
|
var getPointerProps = (_20 = props.getPointerProps) !== null && _20 !== void 0 ? _20 : null;
|
|
241
241
|
var pointerHeight = (_21 = pointerConfig === null || pointerConfig === void 0 ? void 0 : pointerConfig.height) !== null && _21 !== void 0 ? _21 : defaultPointerConfig.height;
|
|
@@ -277,6 +277,12 @@ export var useBarChart = function (props) {
|
|
|
277
277
|
? 0
|
|
278
278
|
: (_46 = props.yAxisExtraHeight) !== null && _46 !== void 0 ? _46 : containerHeight / 20;
|
|
279
279
|
var barInnerComponent = props.barInnerComponent;
|
|
280
|
+
var localYAxisOffset1 = lineConfig.isSecondary
|
|
281
|
+
? (_48 = (_47 = props.secondaryYAxis) === null || _47 === void 0 ? void 0 : _47.yAxisOffset) !== null && _48 !== void 0 ? _48 : 0
|
|
282
|
+
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
|
|
283
|
+
var localYAxisOffset2 = lineConfig2.isSecondary
|
|
284
|
+
? (_50 = (_49 = props.secondaryYAxis) === null || _49 === void 0 ? void 0 : _49.yAxisOffset) !== null && _50 !== void 0 ? _50 : 0
|
|
285
|
+
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0;
|
|
280
286
|
useEffect(function () {
|
|
281
287
|
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;
|
|
282
288
|
if (showLine) {
|
|
@@ -299,7 +305,7 @@ export var useBarChart = function (props) {
|
|
|
299
305
|
'L' +
|
|
300
306
|
getXForLineInBar(i, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing) +
|
|
301
307
|
' ' +
|
|
302
|
-
getYForLineInBar(currentValue, lineConfig.shiftY, containerHeight, lineConfig.isSecondary ? secondaryMaxValue : maxValue) +
|
|
308
|
+
getYForLineInBar(currentValue, lineConfig.shiftY, containerHeight, lineConfig.isSecondary ? secondaryMaxValue : maxValue, localYAxisOffset1) +
|
|
303
309
|
' ';
|
|
304
310
|
}
|
|
305
311
|
setPoints(pp.replace('L', 'M'));
|
|
@@ -328,7 +334,7 @@ export var useBarChart = function (props) {
|
|
|
328
334
|
: data[i].value;
|
|
329
335
|
p1Array.push([
|
|
330
336
|
getXForLineInBar(i, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig, spacing),
|
|
331
|
-
getYForLineInBar(currentValue, lineConfig.shiftY, containerHeight, lineConfig.isSecondary ? secondaryMaxValue : maxValue)
|
|
337
|
+
getYForLineInBar(currentValue, lineConfig.shiftY, containerHeight, lineConfig.isSecondary ? secondaryMaxValue : maxValue, localYAxisOffset1)
|
|
332
338
|
]);
|
|
333
339
|
var xx = svgPath(p1Array, lineConfig.curveType, lineConfig.curvature);
|
|
334
340
|
setPoints(xx);
|
|
@@ -347,7 +353,7 @@ export var useBarChart = function (props) {
|
|
|
347
353
|
'L' +
|
|
348
354
|
getXForLineInBar(i, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig2, spacing) +
|
|
349
355
|
' ' +
|
|
350
|
-
getYForLineInBar(currentValue, lineConfig2.shiftY, containerHeight, lineConfig2.isSecondary ? secondaryMaxValue : maxValue) +
|
|
356
|
+
getYForLineInBar(currentValue, lineConfig2.shiftY, containerHeight, lineConfig2.isSecondary ? secondaryMaxValue : maxValue, localYAxisOffset2) +
|
|
351
357
|
' ';
|
|
352
358
|
}
|
|
353
359
|
setPoints2(pp2.replace('L', 'M'));
|
|
@@ -363,7 +369,7 @@ export var useBarChart = function (props) {
|
|
|
363
369
|
var currentValue = lineData2[i].value;
|
|
364
370
|
p2Array.push([
|
|
365
371
|
getXForLineInBar(i, firstBarWidth, currentBarWidth, yAxisLabelWidth, lineConfig2, spacing),
|
|
366
|
-
getYForLineInBar(currentValue, lineConfig2.shiftY, containerHeight, lineConfig2.isSecondary ? secondaryMaxValue : maxValue)
|
|
372
|
+
getYForLineInBar(currentValue, lineConfig2.shiftY, containerHeight, lineConfig2.isSecondary ? secondaryMaxValue : maxValue, localYAxisOffset2)
|
|
367
373
|
]);
|
|
368
374
|
var xx = svgPath(p2Array, lineConfig2.curveType, lineConfig2.curvature);
|
|
369
375
|
setPoints2(xx);
|
|
@@ -391,9 +397,9 @@ export var useBarChart = function (props) {
|
|
|
391
397
|
spacing,
|
|
392
398
|
yAxisLabelWidth,
|
|
393
399
|
lineConfig.showArrow,
|
|
394
|
-
(
|
|
395
|
-
(
|
|
396
|
-
(
|
|
400
|
+
(_51 = lineConfig.arrowConfig) === null || _51 === void 0 ? void 0 : _51.length,
|
|
401
|
+
(_52 = lineConfig.arrowConfig) === null || _52 === void 0 ? void 0 : _52.width,
|
|
402
|
+
(_53 = lineConfig.arrowConfig) === null || _53 === void 0 ? void 0 : _53.showArrowBase
|
|
397
403
|
]);
|
|
398
404
|
useEffect(function () {
|
|
399
405
|
var _a, _b, _c, _d;
|
|
@@ -522,19 +528,19 @@ export var useBarChart = function (props) {
|
|
|
522
528
|
containerHeight: containerHeight,
|
|
523
529
|
noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
|
|
524
530
|
stepHeight: stepHeight,
|
|
525
|
-
negativeStepHeight: (
|
|
531
|
+
negativeStepHeight: (_54 = props.negativeStepHeight) !== null && _54 !== void 0 ? _54 : stepHeight,
|
|
526
532
|
labelsExtraHeight: labelsExtraHeight,
|
|
527
533
|
yAxisLabelWidth: yAxisLabelWidth,
|
|
528
534
|
horizontal: horizontal,
|
|
529
535
|
rtl: rtl,
|
|
530
|
-
shiftX: (
|
|
531
|
-
shiftY: (
|
|
536
|
+
shiftX: (_55 = props.shiftX) !== null && _55 !== void 0 ? _55 : 0,
|
|
537
|
+
shiftY: (_56 = props.shiftY) !== null && _56 !== void 0 ? _56 : 0,
|
|
532
538
|
yAxisAtTop: yAxisAtTop,
|
|
533
539
|
initialSpacing: initialSpacing,
|
|
534
540
|
data: data,
|
|
535
541
|
stackData: props.stackData,
|
|
536
542
|
// secondaryData,
|
|
537
|
-
barWidth: (
|
|
543
|
+
barWidth: (_57 = props.barWidth) !== null && _57 !== void 0 ? _57 : defaultBarWidth,
|
|
538
544
|
xAxisThickness: xAxisThickness,
|
|
539
545
|
totalWidth: totalWidth,
|
|
540
546
|
disableScroll: disableScroll,
|
|
@@ -583,7 +589,7 @@ export var useBarChart = function (props) {
|
|
|
583
589
|
pointerY: pointerY,
|
|
584
590
|
onEndReached: props.onEndReached,
|
|
585
591
|
onStartReached: props.onStartReached,
|
|
586
|
-
endReachedOffset: (
|
|
592
|
+
endReachedOffset: (_58 = props.endReachedOffset) !== null && _58 !== void 0 ? _58 : BarDefaults.endReachedOffset,
|
|
587
593
|
onMomentumScrollEnd: props.onMomentumScrollEnd
|
|
588
594
|
};
|
|
589
595
|
return {
|
|
@@ -38,7 +38,7 @@ import { useEffect, useState } from 'react';
|
|
|
38
38
|
import { AxesAndRulesDefaults, BarDefaults } from '../../utils/constants';
|
|
39
39
|
import { computeMaxAndMinItems } from '../../utils';
|
|
40
40
|
export var useBarAndLineChartsWrapper = function (props) {
|
|
41
|
-
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;
|
|
41
|
+
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;
|
|
42
42
|
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, dataSet = props.dataSet, 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;
|
|
43
43
|
var yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
|
|
44
44
|
var hideOrigin = (_a = axesAndRulesProps.hideOrigin) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.hideOrigin;
|
|
@@ -104,8 +104,8 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
104
104
|
var secondaryDataArrayWithMinValue = (secondaryData === null || secondaryData === void 0 ? void 0 : secondaryData.length)
|
|
105
105
|
? secondaryData
|
|
106
106
|
: setWithMinValueInDataset === null || setWithMinValueInDataset === void 0 ? void 0 : setWithMinValueInDataset.data;
|
|
107
|
-
var
|
|
108
|
-
var
|
|
107
|
+
var _19 = computeMaxAndMinItems(secondaryDataArrayWithMinValue, (_13 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.roundToDigits) !== null && _13 !== void 0 ? _13 : roundToDigits, (_14 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.showFractionalValues) !== null && _14 !== void 0 ? _14 : showFractionalValues), secondaryMaxItem = _19.maxItem, secondaryMinItem = _19.minItem;
|
|
108
|
+
var _20 = axesAndRulesProps.secondaryYAxisConfig, secondaryStepValue = _20.stepValue, secondaryNegativeStepValue = _20.negativeStepValue, secondaryNoOfSectionsBelowXAxis = _20.noOfSectionsBelowXAxis, showSecondaryFractionalValues = _20.showFractionalValues, secondaryRoundToDigits = _20.roundToDigits, secondaryStepHeight = _20.stepHeight, secondaryNegativeStepHeight = _20.negativeStepHeight;
|
|
109
109
|
var primaryYAxisHeightBelowOrigin = noOfSectionsBelowXAxis * negativeStepHeight;
|
|
110
110
|
var secondaryYAxisHeightBelowOrigin = secondaryNoOfSectionsBelowXAxis * secondaryNegativeStepHeight;
|
|
111
111
|
var biggerNegativeYAxisHeight = Math.max(primaryYAxisHeightBelowOrigin, secondaryYAxisHeightBelowOrigin);
|
|
@@ -198,13 +198,18 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
198
198
|
labelsExtraHeight: labelsExtraHeight,
|
|
199
199
|
scrollEventThrottle: scrollEventThrottle,
|
|
200
200
|
xAxisLabelsVerticalShift: xAxisLabelsVerticalShift,
|
|
201
|
-
selectedIndex: selectedIndex
|
|
201
|
+
selectedIndex: selectedIndex,
|
|
202
|
+
yAxisOffset: lineConfig.isSecondary
|
|
203
|
+
? (_16 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset) !== null && _16 !== void 0 ? _16 : 0
|
|
204
|
+
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0
|
|
202
205
|
};
|
|
203
|
-
var lineInBarChartProps2 = __assign(__assign({}, lineInBarChartProps), { lineConfig: lineConfig2, points: points2, data: lineData2 !== null && lineData2 !== void 0 ? lineData2 : []
|
|
206
|
+
var lineInBarChartProps2 = __assign(__assign({}, lineInBarChartProps), { lineConfig: lineConfig2, points: points2, data: lineData2 !== null && lineData2 !== void 0 ? lineData2 : [], yAxisOffset: lineConfig2.isSecondary
|
|
207
|
+
? (_17 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.yAxisOffset) !== null && _17 !== void 0 ? _17 : 0
|
|
208
|
+
: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0 });
|
|
204
209
|
var verticalLinesProps = {
|
|
205
210
|
verticalLinesAr: verticalLinesAr,
|
|
206
211
|
verticalLinesSpacing: verticalLinesSpacing,
|
|
207
|
-
spacing: (
|
|
212
|
+
spacing: (_18 = lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.spacing) !== null && _18 !== void 0 ? _18 : spacing,
|
|
208
213
|
initialSpacing: initialSpacing,
|
|
209
214
|
verticalLinesZIndex: verticalLinesZIndex,
|
|
210
215
|
verticalLinesHeight: verticalLinesHeight,
|
|
@@ -259,7 +264,7 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
259
264
|
: difBwWidthHeight - 40) /
|
|
260
265
|
2 +
|
|
261
266
|
(yAxisAtTop ? (rtl ? (props.width ? 12 : 40) : 12) : 52), ")");
|
|
262
|
-
var
|
|
267
|
+
var _21 = __read(useState(false), 2), canMomentum = _21[0], setCanMomentum = _21[1];
|
|
263
268
|
var isCloseToEnd = function (_a) {
|
|
264
269
|
var layoutMeasurement = _a.layoutMeasurement, contentOffset = _a.contentOffset, contentSize = _a.contentSize;
|
|
265
270
|
return isRTL
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export declare const maxAndMinUtil: (maxItem: number, minItem: number, roundToDi
|
|
|
91
91
|
export declare const computeMaxAndMinItems: (data: any[] | undefined, roundToDigits?: number, showFractionalValues?: boolean) => MaxAndMin;
|
|
92
92
|
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;
|
|
93
93
|
export declare const getXForLineInBar: (index: number, firstBarWidth: number, currentBarWidth: number, yAxisLabelWidth: number, lineConfig: any, spacing: number) => number;
|
|
94
|
-
export declare const getYForLineInBar: (value: number | undefined, shiftY: number | undefined, containerHeight: number, maxValue: number) => number;
|
|
94
|
+
export declare const getYForLineInBar: (value: number | undefined, shiftY: number | undefined, containerHeight: number, maxValue: number, yAxisOffset: number) => number;
|
|
95
95
|
export declare const clone: (obj: any) => any;
|
|
96
96
|
export declare const getLineConfigForBarChart: (lineConfig: lineConfigType, barInitialSpacing: number) => lineConfigType;
|
|
97
97
|
export declare const getNoOfSections: (noOfSections: number | undefined, maxValue: number | undefined, stepValue: number | undefined) => number;
|
package/dist/utils/index.js
CHANGED
|
@@ -764,8 +764,10 @@ export var getXForLineInBar = function (index, firstBarWidth, currentBarWidth, y
|
|
|
764
764
|
lineConfig.dataPointsWidth / 2 -
|
|
765
765
|
4;
|
|
766
766
|
};
|
|
767
|
-
export var getYForLineInBar = function (value, shiftY, containerHeight, maxValue) {
|
|
768
|
-
return containerHeight -
|
|
767
|
+
export var getYForLineInBar = function (value, shiftY, containerHeight, maxValue, yAxisOffset) {
|
|
768
|
+
return containerHeight -
|
|
769
|
+
(shiftY !== null && shiftY !== void 0 ? shiftY : 0) -
|
|
770
|
+
(((value !== null && value !== void 0 ? value : 0) - yAxisOffset) * containerHeight) / maxValue;
|
|
769
771
|
};
|
|
770
772
|
export var clone = function (obj) {
|
|
771
773
|
if (obj === null || typeof obj !== 'object' || 'isActiveClone' in obj) {
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -123,6 +123,7 @@ export interface LineInBarChartPropsType {
|
|
|
123
123
|
scrollEventThrottle: number;
|
|
124
124
|
xAxisLabelsVerticalShift: number;
|
|
125
125
|
selectedIndex: number;
|
|
126
|
+
yAxisOffset: number;
|
|
126
127
|
}
|
|
127
128
|
export interface DataPointProps {
|
|
128
129
|
data: any[];
|
|
@@ -134,6 +135,7 @@ export interface DataPointProps {
|
|
|
134
135
|
yAxisLabelWidth: number;
|
|
135
136
|
spacing: number;
|
|
136
137
|
selectedIndex: number;
|
|
138
|
+
yAxisOffset: number;
|
|
137
139
|
}
|
|
138
140
|
export interface referenceConfigType {
|
|
139
141
|
thickness?: number;
|