gifted-charts-core 0.1.8 → 0.1.10
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/RenderStackBars.js +2 -2
- package/src/BarChart/RenderStackBars.ts +3 -2
- package/src/BarChart/index.d.ts +3 -0
- package/src/BarChart/index.js +16 -10
- package/src/BarChart/index.ts +16 -4
- package/src/BarChart/types.d.ts +9 -0
- package/src/BarChart/types.ts +9 -0
- package/src/LineChart/LineChartBiColor.js +1 -1
- package/src/LineChart/LineChartBiColor.ts +2 -1
- package/src/LineChart/index.js +1 -1
- package/src/LineChart/index.ts +2 -1
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
17
17
|
import { useState } from 'react';
|
|
18
18
|
export var useRenderStackBars = function (props) {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f;
|
|
20
|
-
var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, propSpacing = props.propSpacing, initialSpacing = props.initialSpacing, stackData = props.stackData, isAnimated = props.isAnimated;
|
|
20
|
+
var item = props.item, index = props.index, containerHeight = props.containerHeight, maxValue = props.maxValue, propSpacing = props.propSpacing, initialSpacing = props.initialSpacing, stackData = props.stackData, isAnimated = props.isAnimated, xAxisThickness = props.xAxisThickness;
|
|
21
21
|
var cotainsNegative = item.stacks.some(function (item) { return item.value < 0; });
|
|
22
22
|
var noAnimation = cotainsNegative || !isAnimated;
|
|
23
23
|
var localBarInnerComponent = (_a = item.barInnerComponent) !== null && _a !== void 0 ? _a : props.barInnerComponent;
|
|
@@ -44,7 +44,7 @@ export var useRenderStackBars = function (props) {
|
|
|
44
44
|
var height = getBarHeight(item.stacks[index].value, item.stacks[index].marginBottom);
|
|
45
45
|
var itemValue = item.stacks[index].value;
|
|
46
46
|
var isNegative = itemValue <= 0;
|
|
47
|
-
var position = isNegative ? -(height || 0) : 0;
|
|
47
|
+
var position = isNegative ? -(height || 0) - xAxisThickness : 0;
|
|
48
48
|
for (var i = 0; i < index; i++) {
|
|
49
49
|
var valueOnIndex = item.stacks[i].value;
|
|
50
50
|
if (isNegative && valueOnIndex <= 0) {
|
|
@@ -10,7 +10,8 @@ export const useRenderStackBars = (props: StackedBarChartPropsType) => {
|
|
|
10
10
|
propSpacing,
|
|
11
11
|
initialSpacing,
|
|
12
12
|
stackData,
|
|
13
|
-
isAnimated
|
|
13
|
+
isAnimated,
|
|
14
|
+
xAxisThickness
|
|
14
15
|
} = props
|
|
15
16
|
const cotainsNegative = item.stacks.some((item) => item.value < 0)
|
|
16
17
|
const noAnimation = cotainsNegative || !isAnimated
|
|
@@ -60,7 +61,7 @@ export const useRenderStackBars = (props: StackedBarChartPropsType) => {
|
|
|
60
61
|
|
|
61
62
|
const itemValue = item.stacks[index].value
|
|
62
63
|
const isNegative = itemValue <= 0
|
|
63
|
-
let position = isNegative ? -(height || 0) : 0
|
|
64
|
+
let position = isNegative ? -(height || 0) - xAxisThickness : 0
|
|
64
65
|
|
|
65
66
|
for (let i = 0; i < index; i++) {
|
|
66
67
|
const valueOnIndex = item.stacks[i].value
|
package/src/BarChart/index.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
70
70
|
xAxisIndicesHeight: number;
|
|
71
71
|
xAxisIndicesWidth: number;
|
|
72
72
|
xAxisIndicesColor: import("react-native").ColorValue;
|
|
73
|
+
autoShiftLabelsForNegativeStacks: boolean | undefined;
|
|
73
74
|
horizontal: boolean;
|
|
74
75
|
rtl: boolean;
|
|
75
76
|
intactTopLabel: boolean;
|
|
@@ -134,6 +135,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
134
135
|
xAxisIndicesHeight: number;
|
|
135
136
|
xAxisIndicesWidth: number;
|
|
136
137
|
xAxisIndicesColor: import("react-native").ColorValue;
|
|
138
|
+
labelsDistanceFromXaxis: any;
|
|
137
139
|
horizontal: boolean;
|
|
138
140
|
rtl: boolean;
|
|
139
141
|
intactTopLabel: boolean;
|
|
@@ -174,6 +176,7 @@ export declare const useBarChart: (props: extendedBarChartPropsType) => {
|
|
|
174
176
|
pointerConfig: import("../utils/types").Pointer | undefined;
|
|
175
177
|
yAxisExtraHeightAtTop: number;
|
|
176
178
|
yAxisOffset: number;
|
|
179
|
+
focusedBarIndex: number | undefined;
|
|
177
180
|
};
|
|
178
181
|
barAndLineChartsWrapperProps: BarAndLineChartsWrapperTypes;
|
|
179
182
|
yAxisExtraHeightAtTop: number;
|
package/src/BarChart/index.js
CHANGED
|
@@ -30,12 +30,15 @@ import { getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPad
|
|
|
30
30
|
import { AxesAndRulesDefaults, BarDefaults, chartTypes, defaultLineConfig, defaultPointerConfig } from '../utils/constants';
|
|
31
31
|
export var useBarChart = function (props) {
|
|
32
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
|
-
var heightValue = props.heightValue, widthValue = props.widthValue, opacValue = props.opacValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth;
|
|
33
|
+
var heightValue = props.heightValue, widthValue = props.widthValue, opacValue = props.opacValue, yAxisOffset = props.yAxisOffset, adjustToWidth = props.adjustToWidth, parentWidth = props.parentWidth, labelsDistanceFromXaxis = props.labelsDistanceFromXaxis, autoShiftLabelsForNegativeStacks = props.autoShiftLabelsForNegativeStacks, focusedBarIndex = props.focusedBarIndex;
|
|
34
34
|
var _48 = __read(useState(''), 2), points = _48[0], setPoints = _48[1];
|
|
35
35
|
var _49 = __read(useState(''), 2), points2 = _49[0], setPoints2 = _49[1];
|
|
36
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];
|
|
37
|
+
var _51 = __read(useState(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1), 2), selectedIndex = _51[0], setSelectedIndex = _51[1];
|
|
38
38
|
var showLine = (_a = props.showLine) !== null && _a !== void 0 ? _a : BarDefaults.showLine;
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
setSelectedIndex(focusedBarIndex !== null && focusedBarIndex !== void 0 ? focusedBarIndex : -1);
|
|
41
|
+
}, [focusedBarIndex]);
|
|
39
42
|
var data = useMemo(function () {
|
|
40
43
|
if (!props.data) {
|
|
41
44
|
return [];
|
|
@@ -164,7 +167,7 @@ export var useBarChart = function (props) {
|
|
|
164
167
|
: maxValue;
|
|
165
168
|
var mostNegativeValue = (_x = props.mostNegativeValue) !== null && _x !== void 0 ? _x : maxAndMin.minItem;
|
|
166
169
|
var stepValue = (_y = props.stepValue) !== null && _y !== void 0 ? _y : maxValue / noOfSections;
|
|
167
|
-
var noOfSectionsBelowXAxis = (_z = props.noOfSectionsBelowXAxis) !== null && _z !== void 0 ? _z : -mostNegativeValue / stepValue;
|
|
170
|
+
var noOfSectionsBelowXAxis = (_z = props.noOfSectionsBelowXAxis) !== null && _z !== void 0 ? _z : Math.round(Math.ceil(-mostNegativeValue / stepValue));
|
|
168
171
|
var showScrollIndicator = (_0 = props.showScrollIndicator) !== null && _0 !== void 0 ? _0 : BarDefaults.showScrollIndicator;
|
|
169
172
|
var side = (_1 = props.side) !== null && _1 !== void 0 ? _1 : BarDefaults.side;
|
|
170
173
|
var rotateLabel = (_2 = props.rotateLabel) !== null && _2 !== void 0 ? _2 : AxesAndRulesDefaults.rotateLabel;
|
|
@@ -391,7 +394,7 @@ export var useBarChart = function (props) {
|
|
|
391
394
|
outputRange: [0, initialSpacing + totalWidth + endSpacing]
|
|
392
395
|
});
|
|
393
396
|
var getPropsCommonForBarAndStack = function (item, index) {
|
|
394
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
397
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
395
398
|
return {
|
|
396
399
|
key: index,
|
|
397
400
|
item: item,
|
|
@@ -409,6 +412,7 @@ export var useBarChart = function (props) {
|
|
|
409
412
|
xAxisIndicesHeight: xAxisIndicesHeight,
|
|
410
413
|
xAxisIndicesWidth: xAxisIndicesWidth,
|
|
411
414
|
xAxisIndicesColor: xAxisIndicesColor,
|
|
415
|
+
labelsDistanceFromXaxis: (_d = item.labelsDistanceFromXaxis) !== null && _d !== void 0 ? _d : labelsDistanceFromXaxis,
|
|
412
416
|
horizontal: horizontal,
|
|
413
417
|
rtl: rtl,
|
|
414
418
|
intactTopLabel: intactTopLabel,
|
|
@@ -437,18 +441,19 @@ export var useBarChart = function (props) {
|
|
|
437
441
|
xAxisLabelsHeight: props.xAxisLabelsHeight,
|
|
438
442
|
xAxisLabelsVerticalShift: xAxisLabelsVerticalShift,
|
|
439
443
|
renderTooltip: props.renderTooltip,
|
|
440
|
-
leftShiftForTooltip: (
|
|
444
|
+
leftShiftForTooltip: (_e = props.leftShiftForTooltip) !== null && _e !== void 0 ? _e : 0,
|
|
441
445
|
initialSpacing: initialSpacing,
|
|
442
446
|
selectedIndex: selectedIndex,
|
|
443
447
|
setSelectedIndex: setSelectedIndex,
|
|
444
|
-
activeOpacity: (
|
|
448
|
+
activeOpacity: (_f = props.activeOpacity) !== null && _f !== void 0 ? _f : 0.2,
|
|
445
449
|
noOfSectionsBelowXAxis: noOfSectionsBelowXAxis,
|
|
446
|
-
leftShiftForLastIndexTooltip: (
|
|
447
|
-
label: (
|
|
448
|
-
labelTextStyle: (
|
|
450
|
+
leftShiftForLastIndexTooltip: (_g = props.leftShiftForLastIndexTooltip) !== null && _g !== void 0 ? _g : 0,
|
|
451
|
+
label: (_h = item.label) !== null && _h !== void 0 ? _h : (((_j = props.xAxisLabelTexts) === null || _j === void 0 ? void 0 : _j[index]) ? props.xAxisLabelTexts[index] : ''),
|
|
452
|
+
labelTextStyle: (_k = item.labelTextStyle) !== null && _k !== void 0 ? _k : props.xAxisLabelTextStyle,
|
|
449
453
|
pointerConfig: pointerConfig,
|
|
450
454
|
yAxisExtraHeightAtTop: yAxisExtraHeightAtTop,
|
|
451
|
-
yAxisOffset: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0
|
|
455
|
+
yAxisOffset: yAxisOffset !== null && yAxisOffset !== void 0 ? yAxisOffset : 0,
|
|
456
|
+
focusedBarIndex: focusedBarIndex
|
|
452
457
|
};
|
|
453
458
|
};
|
|
454
459
|
var barAndLineChartsWrapperProps = {
|
|
@@ -577,6 +582,7 @@ export var useBarChart = function (props) {
|
|
|
577
582
|
xAxisIndicesHeight: xAxisIndicesHeight,
|
|
578
583
|
xAxisIndicesWidth: xAxisIndicesWidth,
|
|
579
584
|
xAxisIndicesColor: xAxisIndicesColor,
|
|
585
|
+
autoShiftLabelsForNegativeStacks: autoShiftLabelsForNegativeStacks,
|
|
580
586
|
horizontal: horizontal,
|
|
581
587
|
rtl: rtl,
|
|
582
588
|
intactTopLabel: intactTopLabel,
|
package/src/BarChart/index.ts
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
import { type Animated } from 'react-native'
|
|
33
33
|
|
|
34
34
|
export interface extendedBarChartPropsType extends BarChartPropsType {
|
|
35
|
-
parentWidth: number
|
|
35
|
+
parentWidth: number
|
|
36
36
|
heightValue?: Animated.Value
|
|
37
37
|
widthValue?: Animated.Value
|
|
38
38
|
opacValue?: Animated.Value
|
|
@@ -48,13 +48,20 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
48
48
|
yAxisOffset,
|
|
49
49
|
adjustToWidth,
|
|
50
50
|
parentWidth,
|
|
51
|
+
labelsDistanceFromXaxis,
|
|
52
|
+
autoShiftLabelsForNegativeStacks,
|
|
53
|
+
focusedBarIndex
|
|
51
54
|
} = props
|
|
52
55
|
const [points, setPoints] = useState('')
|
|
53
56
|
const [points2, setPoints2] = useState('')
|
|
54
57
|
const [arrowPoints, setArrowPoints] = useState('')
|
|
55
|
-
const [selectedIndex, setSelectedIndex] = useState(-1)
|
|
58
|
+
const [selectedIndex, setSelectedIndex] = useState(focusedBarIndex ?? -1)
|
|
56
59
|
const showLine = props.showLine ?? BarDefaults.showLine
|
|
57
60
|
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
setSelectedIndex(focusedBarIndex ?? -1)
|
|
63
|
+
}, [focusedBarIndex])
|
|
64
|
+
|
|
58
65
|
const data = useMemo(() => {
|
|
59
66
|
if (!props.data) {
|
|
60
67
|
return []
|
|
@@ -241,7 +248,8 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
241
248
|
|
|
242
249
|
const stepValue = props.stepValue ?? maxValue / noOfSections
|
|
243
250
|
const noOfSectionsBelowXAxis =
|
|
244
|
-
props.noOfSectionsBelowXAxis ??
|
|
251
|
+
props.noOfSectionsBelowXAxis ??
|
|
252
|
+
Math.round(Math.ceil(-mostNegativeValue / stepValue))
|
|
245
253
|
const showScrollIndicator =
|
|
246
254
|
props.showScrollIndicator ?? BarDefaults.showScrollIndicator
|
|
247
255
|
const side = props.side ?? BarDefaults.side
|
|
@@ -638,6 +646,8 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
638
646
|
xAxisIndicesHeight,
|
|
639
647
|
xAxisIndicesWidth,
|
|
640
648
|
xAxisIndicesColor,
|
|
649
|
+
labelsDistanceFromXaxis:
|
|
650
|
+
item.labelsDistanceFromXaxis ?? labelsDistanceFromXaxis,
|
|
641
651
|
horizontal,
|
|
642
652
|
rtl,
|
|
643
653
|
intactTopLabel,
|
|
@@ -680,7 +690,8 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
680
690
|
labelTextStyle: item.labelTextStyle ?? props.xAxisLabelTextStyle,
|
|
681
691
|
pointerConfig,
|
|
682
692
|
yAxisExtraHeightAtTop,
|
|
683
|
-
yAxisOffset: yAxisOffset ?? 0
|
|
693
|
+
yAxisOffset: yAxisOffset ?? 0,
|
|
694
|
+
focusedBarIndex
|
|
684
695
|
}
|
|
685
696
|
}
|
|
686
697
|
|
|
@@ -821,6 +832,7 @@ export const useBarChart = (props: extendedBarChartPropsType) => {
|
|
|
821
832
|
xAxisIndicesHeight,
|
|
822
833
|
xAxisIndicesWidth,
|
|
823
834
|
xAxisIndicesColor,
|
|
835
|
+
autoShiftLabelsForNegativeStacks,
|
|
824
836
|
horizontal,
|
|
825
837
|
rtl,
|
|
826
838
|
intactTopLabel,
|
package/src/BarChart/types.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface stackDataItem {
|
|
|
9
9
|
onLongPress?: any;
|
|
10
10
|
onPressOut?: any;
|
|
11
11
|
label?: string;
|
|
12
|
+
labelsDistanceFromXaxis?: number;
|
|
12
13
|
barWidth?: number;
|
|
13
14
|
spacing?: number;
|
|
14
15
|
labelTextStyle?: any;
|
|
@@ -59,6 +60,8 @@ export interface StackedBarChartPropsType {
|
|
|
59
60
|
opacity?: number;
|
|
60
61
|
label: string;
|
|
61
62
|
labelTextStyle?: any;
|
|
63
|
+
autoShiftLabelsForNegativeStacks?: boolean;
|
|
64
|
+
labelsDistanceFromXaxis?: number;
|
|
62
65
|
disablePress?: boolean;
|
|
63
66
|
item: stackDataItem;
|
|
64
67
|
index: number;
|
|
@@ -255,6 +258,8 @@ export interface BarChartPropsType {
|
|
|
255
258
|
scrollAnimation?: boolean;
|
|
256
259
|
scrollEventThrottle?: number;
|
|
257
260
|
labelsExtraHeight?: number;
|
|
261
|
+
labelsDistanceFromXaxis?: number;
|
|
262
|
+
autoShiftLabelsForNegativeStacks?: boolean;
|
|
258
263
|
barBackgroundPattern?: () => ReactNode;
|
|
259
264
|
patternId?: string;
|
|
260
265
|
barMarginBottom?: number;
|
|
@@ -278,6 +283,7 @@ export interface BarChartPropsType {
|
|
|
278
283
|
onMomentumScrollEnd?: Function;
|
|
279
284
|
focusBarOnPress?: boolean;
|
|
280
285
|
focusedBarConfig?: FocusedBarConfig;
|
|
286
|
+
focusedBarIndex?: number;
|
|
281
287
|
adjustToWidth?: boolean;
|
|
282
288
|
parentWidth?: number;
|
|
283
289
|
}
|
|
@@ -374,6 +380,7 @@ export interface barDataItem {
|
|
|
374
380
|
showGradient?: boolean;
|
|
375
381
|
gradientColor?: any;
|
|
376
382
|
label?: string;
|
|
383
|
+
labelsDistanceFromXaxis?: number;
|
|
377
384
|
barWidth?: number;
|
|
378
385
|
sideWidth?: number;
|
|
379
386
|
labelTextStyle?: any;
|
|
@@ -472,6 +479,7 @@ export interface RenderBarsPropsType {
|
|
|
472
479
|
isThreeD?: boolean;
|
|
473
480
|
isAnimated?: boolean;
|
|
474
481
|
rotateLabel?: boolean;
|
|
482
|
+
labelsDistanceFromXaxis?: number;
|
|
475
483
|
animatedHeight?: any;
|
|
476
484
|
appearingOpacity?: any;
|
|
477
485
|
animationDuration?: number;
|
|
@@ -519,6 +527,7 @@ export interface RenderBarsPropsType {
|
|
|
519
527
|
xAxisThickness?: number;
|
|
520
528
|
pointerConfig?: Pointer;
|
|
521
529
|
focusBarOnPress?: boolean;
|
|
530
|
+
focusedBarIndex?: number;
|
|
522
531
|
noOfSectionsBelowXAxis?: number;
|
|
523
532
|
yAxisOffset: number;
|
|
524
533
|
}
|
package/src/BarChart/types.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface stackDataItem {
|
|
|
21
21
|
onLongPress?: any
|
|
22
22
|
onPressOut?: any
|
|
23
23
|
label?: string
|
|
24
|
+
labelsDistanceFromXaxis?: number
|
|
24
25
|
barWidth?: number
|
|
25
26
|
spacing?: number
|
|
26
27
|
labelTextStyle?: any
|
|
@@ -72,6 +73,8 @@ export interface StackedBarChartPropsType {
|
|
|
72
73
|
opacity?: number
|
|
73
74
|
label: string
|
|
74
75
|
labelTextStyle?: any
|
|
76
|
+
autoShiftLabelsForNegativeStacks?: boolean
|
|
77
|
+
labelsDistanceFromXaxis?: number
|
|
75
78
|
disablePress?: boolean
|
|
76
79
|
|
|
77
80
|
item: stackDataItem
|
|
@@ -284,6 +287,8 @@ export interface BarChartPropsType {
|
|
|
284
287
|
scrollAnimation?: boolean
|
|
285
288
|
scrollEventThrottle?: number
|
|
286
289
|
labelsExtraHeight?: number
|
|
290
|
+
labelsDistanceFromXaxis?: number
|
|
291
|
+
autoShiftLabelsForNegativeStacks?: boolean
|
|
287
292
|
barBackgroundPattern?: () => ReactNode
|
|
288
293
|
patternId?: string
|
|
289
294
|
barMarginBottom?: number
|
|
@@ -313,6 +318,7 @@ export interface BarChartPropsType {
|
|
|
313
318
|
|
|
314
319
|
focusBarOnPress?: boolean
|
|
315
320
|
focusedBarConfig?: FocusedBarConfig
|
|
321
|
+
focusedBarIndex?: number
|
|
316
322
|
|
|
317
323
|
adjustToWidth?: boolean
|
|
318
324
|
parentWidth?: number
|
|
@@ -414,6 +420,7 @@ export interface barDataItem {
|
|
|
414
420
|
showGradient?: boolean
|
|
415
421
|
gradientColor?: any
|
|
416
422
|
label?: string
|
|
423
|
+
labelsDistanceFromXaxis?: number
|
|
417
424
|
barWidth?: number
|
|
418
425
|
sideWidth?: number
|
|
419
426
|
labelTextStyle?: any
|
|
@@ -516,6 +523,7 @@ export interface RenderBarsPropsType {
|
|
|
516
523
|
isThreeD?: boolean
|
|
517
524
|
isAnimated?: boolean
|
|
518
525
|
rotateLabel?: boolean
|
|
526
|
+
labelsDistanceFromXaxis?: number
|
|
519
527
|
animatedHeight?: any
|
|
520
528
|
appearingOpacity?: any
|
|
521
529
|
animationDuration?: number
|
|
@@ -566,6 +574,7 @@ export interface RenderBarsPropsType {
|
|
|
566
574
|
xAxisThickness?: number
|
|
567
575
|
pointerConfig?: Pointer
|
|
568
576
|
focusBarOnPress?: boolean
|
|
577
|
+
focusedBarIndex?: number
|
|
569
578
|
noOfSectionsBelowXAxis?: number
|
|
570
579
|
yAxisOffset: number
|
|
571
580
|
}
|
|
@@ -312,7 +312,7 @@ export var useLineChartBiColor = function (props) {
|
|
|
312
312
|
var horizSections = [{ value: '0' }];
|
|
313
313
|
var stepHeight = (_8 = props.stepHeight) !== null && _8 !== void 0 ? _8 : containerHeight / noOfSections;
|
|
314
314
|
var stepValue = (_9 = props.stepValue) !== null && _9 !== void 0 ? _9 : maxValue / noOfSections;
|
|
315
|
-
var noOfSectionsBelowXAxis = (_10 = props.noOfSectionsBelowXAxis) !== null && _10 !== void 0 ? _10 : -mostNegativeValue / stepValue;
|
|
315
|
+
var noOfSectionsBelowXAxis = (_10 = props.noOfSectionsBelowXAxis) !== null && _10 !== void 0 ? _10 : Math.round(Math.ceil(-mostNegativeValue / stepValue));
|
|
316
316
|
var thickness1 = (_11 = props.thickness) !== null && _11 !== void 0 ? _11 : LineDefaults.thickness;
|
|
317
317
|
var zIndex = (_12 = props.zIndex) !== null && _12 !== void 0 ? _12 : 0;
|
|
318
318
|
var strokeDashArray1 = props.strokeDashArray;
|
|
@@ -361,7 +361,8 @@ export const useLineChartBiColor = (
|
|
|
361
361
|
const stepHeight = props.stepHeight ?? containerHeight / noOfSections
|
|
362
362
|
const stepValue = props.stepValue ?? maxValue / noOfSections
|
|
363
363
|
const noOfSectionsBelowXAxis =
|
|
364
|
-
props.noOfSectionsBelowXAxis ??
|
|
364
|
+
props.noOfSectionsBelowXAxis ??
|
|
365
|
+
Math.round(Math.ceil(-mostNegativeValue / stepValue))
|
|
365
366
|
const thickness1 = props.thickness ?? LineDefaults.thickness
|
|
366
367
|
const zIndex = props.zIndex ?? 0
|
|
367
368
|
|
package/src/LineChart/index.js
CHANGED
|
@@ -901,7 +901,7 @@ export var useLineChart = function (props) {
|
|
|
901
901
|
var horizSections = [{ value: '0' }];
|
|
902
902
|
var stepHeight = (_237 = props.stepHeight) !== null && _237 !== void 0 ? _237 : containerHeight / noOfSections;
|
|
903
903
|
var stepValue = (_238 = props.stepValue) !== null && _238 !== void 0 ? _238 : maxValue / noOfSections;
|
|
904
|
-
var noOfSectionsBelowXAxis = (_239 = props.noOfSectionsBelowXAxis) !== null && _239 !== void 0 ? _239 : -mostNegativeValue /
|
|
904
|
+
var noOfSectionsBelowXAxis = (_239 = props.noOfSectionsBelowXAxis) !== null && _239 !== void 0 ? _239 : Math.round(Math.ceil(-mostNegativeValue / stepValue));
|
|
905
905
|
var showXAxisIndices = (_240 = props.showXAxisIndices) !== null && _240 !== void 0 ? _240 : AxesAndRulesDefaults.showXAxisIndices;
|
|
906
906
|
var xAxisIndicesHeight = (_241 = props.xAxisIndicesHeight) !== null && _241 !== void 0 ? _241 : AxesAndRulesDefaults.xAxisIndicesHeight;
|
|
907
907
|
var xAxisIndicesWidth = (_242 = props.xAxisIndicesWidth) !== null && _242 !== void 0 ? _242 : AxesAndRulesDefaults.xAxisIndicesWidth;
|
package/src/LineChart/index.ts
CHANGED
|
@@ -1532,7 +1532,8 @@ export const useLineChart = (props: extendedLineChartPropsType) => {
|
|
|
1532
1532
|
const stepHeight = props.stepHeight ?? containerHeight / noOfSections
|
|
1533
1533
|
const stepValue = props.stepValue ?? maxValue / noOfSections
|
|
1534
1534
|
const noOfSectionsBelowXAxis =
|
|
1535
|
-
props.noOfSectionsBelowXAxis ??
|
|
1535
|
+
props.noOfSectionsBelowXAxis ??
|
|
1536
|
+
Math.round(Math.ceil(-mostNegativeValue / stepValue))
|
|
1536
1537
|
|
|
1537
1538
|
const showXAxisIndices =
|
|
1538
1539
|
props.showXAxisIndices ?? AxesAndRulesDefaults.showXAxisIndices
|