react-native-gifted-charts 1.3.7 → 1.3.8
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.tsx +33 -3
- package/src/BarChart/types.ts +3 -1
- package/src/Components/BarAndLineChartsWrapper/index.tsx +10 -6
- package/src/Components/BarAndLineChartsWrapper/renderHorizSections.tsx +3 -5
- package/src/Components/BarAndLineChartsWrapper/renderVerticalLines.tsx +79 -72
- package/src/LineChart/LineChartBicolor.tsx +2 -2
- package/src/LineChart/index.tsx +27 -2
- package/src/LineChart/types.ts +2 -1
- package/src/utils/constants.ts +2 -1
- package/src/utils/index.tsx +7 -3
- package/src/utils/types.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-gifted-charts",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "The most complete library for Bar, Line, Area, Pie, Donut and Stacked Bar charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.",
|
|
5
5
|
"main": "src/index.tsx",
|
|
6
6
|
"files": [
|
package/src/BarChart/index.tsx
CHANGED
|
@@ -149,6 +149,8 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
149
149
|
defaultLineConfig.arrowConfig?.showArrowBase,
|
|
150
150
|
},
|
|
151
151
|
customDataPoint: props.lineConfig.customDataPoint,
|
|
152
|
+
isSecondary:
|
|
153
|
+
props.lineConfig.isSecondary ?? defaultLineConfig.isSecondary,
|
|
152
154
|
}
|
|
153
155
|
: defaultLineConfig;
|
|
154
156
|
const noOfSections = props.noOfSections ?? AxesAndRulesDefaults.noOfSections;
|
|
@@ -200,6 +202,20 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
200
202
|
});
|
|
201
203
|
}
|
|
202
204
|
|
|
205
|
+
let secondaryMaxItem = 0,
|
|
206
|
+
secondaryMinItem = 0;
|
|
207
|
+
|
|
208
|
+
if (lineConfig.isSecondary) {
|
|
209
|
+
lineData.forEach((item: itemType) => {
|
|
210
|
+
if (item.value > secondaryMaxItem) {
|
|
211
|
+
secondaryMaxItem = item.value;
|
|
212
|
+
}
|
|
213
|
+
if (item.value < secondaryMinItem) {
|
|
214
|
+
secondaryMinItem = item.value;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
203
219
|
const maxAndMin = maxAndMinUtil(
|
|
204
220
|
maxItem,
|
|
205
221
|
minItem,
|
|
@@ -207,7 +223,17 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
207
223
|
props.showFractionalValues,
|
|
208
224
|
);
|
|
209
225
|
|
|
226
|
+
const secondaryMaxAndMin = maxAndMinUtil(
|
|
227
|
+
secondaryMaxItem,
|
|
228
|
+
secondaryMinItem,
|
|
229
|
+
props.roundToDigits,
|
|
230
|
+
props.showFractionalValues,
|
|
231
|
+
);
|
|
232
|
+
|
|
210
233
|
const maxValue = props.maxValue ?? maxAndMin.maxItem;
|
|
234
|
+
const secondaryMaxValue = lineConfig.isSecondary
|
|
235
|
+
? secondaryMaxAndMin.maxItem
|
|
236
|
+
: maxValue;
|
|
211
237
|
const mostNegativeValue = props.mostNegativeValue ?? maxAndMin.minItem;
|
|
212
238
|
|
|
213
239
|
const stepValue = props.stepValue ?? maxValue / noOfSections;
|
|
@@ -300,7 +326,7 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
300
326
|
currentValue,
|
|
301
327
|
lineConfig.shiftY,
|
|
302
328
|
containerHeight,
|
|
303
|
-
maxValue,
|
|
329
|
+
lineConfig.isSecondary ? secondaryMaxValue : maxValue,
|
|
304
330
|
) +
|
|
305
331
|
' ';
|
|
306
332
|
}
|
|
@@ -353,7 +379,7 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
353
379
|
currentValue,
|
|
354
380
|
lineConfig.shiftY,
|
|
355
381
|
containerHeight,
|
|
356
|
-
maxValue,
|
|
382
|
+
lineConfig.isSecondary ? secondaryMaxValue : maxValue,
|
|
357
383
|
),
|
|
358
384
|
]);
|
|
359
385
|
let xx = svgPath(p1Array, lineConfig.curveType, lineConfig.curvature);
|
|
@@ -554,7 +580,11 @@ export const BarChart = (props: BarChartPropsType) => {
|
|
|
554
580
|
noOfSections,
|
|
555
581
|
showFractionalValues,
|
|
556
582
|
|
|
557
|
-
axesAndRulesProps: getAxesAndRulesProps(
|
|
583
|
+
axesAndRulesProps: getAxesAndRulesProps(
|
|
584
|
+
props,
|
|
585
|
+
stepValue,
|
|
586
|
+
secondaryMaxValue,
|
|
587
|
+
),
|
|
558
588
|
|
|
559
589
|
yAxisLabelTexts: props.yAxisLabelTexts,
|
|
560
590
|
yAxisOffset: props.yAxisOffset,
|
package/src/BarChart/types.ts
CHANGED
|
@@ -74,7 +74,7 @@ export type BarChartPropsType = {
|
|
|
74
74
|
verticalLinesThickness?: number;
|
|
75
75
|
verticalLinesHeight?: number;
|
|
76
76
|
verticalLinesColor?: ColorValue;
|
|
77
|
-
|
|
77
|
+
verticalLinesStrokeDashArray?: Array<number>;
|
|
78
78
|
verticalLinesShift?: number;
|
|
79
79
|
verticalLinesZIndex?: number;
|
|
80
80
|
noOfVerticalLines?: number;
|
|
@@ -175,6 +175,7 @@ type lineConfigType = {
|
|
|
175
175
|
showArrow?: boolean;
|
|
176
176
|
arrowConfig?: arrowType;
|
|
177
177
|
customDataPoint?: Function;
|
|
178
|
+
isSecondary?: boolean;
|
|
178
179
|
};
|
|
179
180
|
export type defaultLineConfigType = {
|
|
180
181
|
initialSpacing: number;
|
|
@@ -203,6 +204,7 @@ export type defaultLineConfigType = {
|
|
|
203
204
|
showArrow: boolean;
|
|
204
205
|
arrowConfig: arrowType;
|
|
205
206
|
customDataPoint?: Function;
|
|
207
|
+
isSecondary: boolean;
|
|
206
208
|
};
|
|
207
209
|
type arrowType = {
|
|
208
210
|
length?: number;
|
|
@@ -145,9 +145,9 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
145
145
|
const verticalLinesColor =
|
|
146
146
|
axesAndRulesProps.verticalLinesColor ??
|
|
147
147
|
AxesAndRulesDefaults.verticalLinesColor;
|
|
148
|
-
const
|
|
149
|
-
axesAndRulesProps.
|
|
150
|
-
AxesAndRulesDefaults.
|
|
148
|
+
const verticalLinesStrokeDashArray =
|
|
149
|
+
axesAndRulesProps.verticalLinesStrokeDashArray ??
|
|
150
|
+
AxesAndRulesDefaults.verticalLinesStrokeDashArray;
|
|
151
151
|
const verticalLinesShift =
|
|
152
152
|
axesAndRulesProps.verticalLinesShift ??
|
|
153
153
|
AxesAndRulesDefaults.verticalLinesShift;
|
|
@@ -233,7 +233,7 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
233
233
|
spacing,
|
|
234
234
|
containerHeight,
|
|
235
235
|
lineConfig,
|
|
236
|
-
maxValue,
|
|
236
|
+
maxValue: secondaryYAxis?.maxValue ?? maxValue,
|
|
237
237
|
animatedWidth,
|
|
238
238
|
lineBehindBars,
|
|
239
239
|
points,
|
|
@@ -256,7 +256,7 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
256
256
|
verticalLinesHeight,
|
|
257
257
|
verticalLinesThickness,
|
|
258
258
|
verticalLinesColor,
|
|
259
|
-
|
|
259
|
+
verticalLinesStrokeDashArray,
|
|
260
260
|
verticalLinesShift,
|
|
261
261
|
verticalLinesUptoDataPoint,
|
|
262
262
|
xAxisThickness,
|
|
@@ -268,6 +268,8 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
268
268
|
maxValue,
|
|
269
269
|
chartType,
|
|
270
270
|
containerHeightIncludingBelowXAxis,
|
|
271
|
+
yAxisLabelWidth,
|
|
272
|
+
totalWidth,
|
|
271
273
|
};
|
|
272
274
|
|
|
273
275
|
const actualContainerHeight =
|
|
@@ -384,7 +386,9 @@ const BarAndLineChartsWrapper = (props: BarAndLineChartsWrapperTypes) => {
|
|
|
384
386
|
}}
|
|
385
387
|
{...remainingScrollViewProps}>
|
|
386
388
|
<Fragment>
|
|
387
|
-
{showVerticalLines
|
|
389
|
+
{showVerticalLines ? (
|
|
390
|
+
<RenderVerticalLines {...verticalLinesProps} />
|
|
391
|
+
) : null}
|
|
388
392
|
{
|
|
389
393
|
// Only For Bar Charts-
|
|
390
394
|
showLine ? <RenderLineInBarChart {...lineInBarChartProps} /> : null
|
|
@@ -800,13 +800,11 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
|
|
|
800
800
|
/***********************************************************************************************/
|
|
801
801
|
/************************* Render the secondary Y Axis *********************/
|
|
802
802
|
/***********************************************************************************************/
|
|
803
|
-
secondaryYAxis
|
|
803
|
+
secondaryYAxis ? (
|
|
804
804
|
<View
|
|
805
805
|
style={{
|
|
806
806
|
width: secondaryYAxisConfig.yAxisLabelWidth,
|
|
807
|
-
left: width
|
|
808
|
-
? yAxisLabelWidth
|
|
809
|
-
: yAxisLabelWidth - (chartType === chartTypes.BAR ? 4 : 16),
|
|
807
|
+
left: width ? yAxisLabelWidth : yAxisLabelWidth - spacing,
|
|
810
808
|
borderColor: secondaryYAxisConfig.yAxisColor,
|
|
811
809
|
borderLeftWidth: secondaryYAxisConfig.yAxisThickness,
|
|
812
810
|
}}>
|
|
@@ -817,7 +815,7 @@ export const renderHorizSections = (props: horizSectionPropTypes) => {
|
|
|
817
815
|
? renderSecondaryYaxisLabels(secondaryHorizSectionsBelow, true)
|
|
818
816
|
: null}
|
|
819
817
|
</View>
|
|
820
|
-
)
|
|
818
|
+
) : null
|
|
821
819
|
}
|
|
822
820
|
</View>
|
|
823
821
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
|
-
import {chartTypes
|
|
3
|
+
import {chartTypes} from '../../utils/constants';
|
|
4
|
+
import {Line, Svg} from 'react-native-svg';
|
|
4
5
|
|
|
5
6
|
const RenderVerticalLines = props => {
|
|
6
7
|
const {
|
|
@@ -12,7 +13,7 @@ const RenderVerticalLines = props => {
|
|
|
12
13
|
verticalLinesHeight,
|
|
13
14
|
verticalLinesThickness,
|
|
14
15
|
verticalLinesColor,
|
|
15
|
-
|
|
16
|
+
verticalLinesStrokeDashArray,
|
|
16
17
|
verticalLinesShift,
|
|
17
18
|
verticalLinesUptoDataPoint,
|
|
18
19
|
xAxisThickness,
|
|
@@ -24,6 +25,8 @@ const RenderVerticalLines = props => {
|
|
|
24
25
|
maxValue,
|
|
25
26
|
chartType,
|
|
26
27
|
containerHeightIncludingBelowXAxis,
|
|
28
|
+
yAxisLabelWidth,
|
|
29
|
+
totalWidth,
|
|
27
30
|
} = props;
|
|
28
31
|
|
|
29
32
|
const getHeightOfVerticalLine = index => {
|
|
@@ -43,82 +46,86 @@ const RenderVerticalLines = props => {
|
|
|
43
46
|
}
|
|
44
47
|
};
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
const extendedContainerHeight = containerHeight + 10 + labelsExtraHeight;
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<View
|
|
53
|
+
style={{
|
|
54
|
+
position: 'absolute',
|
|
55
|
+
height: extendedContainerHeight,
|
|
56
|
+
left: 36 - yAxisLabelWidth,
|
|
57
|
+
bottom: 60, //stepHeight * -0.5 + xAxisThickness,
|
|
58
|
+
width: totalWidth,
|
|
59
|
+
zIndex: verticalLinesZIndex || -1,
|
|
60
|
+
}}>
|
|
61
|
+
<Svg>
|
|
62
|
+
{verticalLinesAr.map((item: any, index: number) => {
|
|
63
|
+
let totalSpacing = initialSpacing;
|
|
64
|
+
if (verticalLinesSpacing) {
|
|
65
|
+
totalSpacing = verticalLinesSpacing * (index + 1);
|
|
61
66
|
} else {
|
|
62
|
-
if (stackData
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
if (stackData[i + 1].barWidth) {
|
|
66
|
-
actualSpacing += stackData[i + 1].barWidth;
|
|
67
|
+
if (stackData) {
|
|
68
|
+
totalSpacing += (stackData[0].barWidth || barWidth || 30) / 2;
|
|
67
69
|
} else {
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
if (i >= data.length - 1) {
|
|
73
|
-
actualSpacing += (barWidth || 30) / 2;
|
|
74
|
-
} else {
|
|
75
|
-
if (data[i].spacing || data[i].spacing === 0) {
|
|
76
|
-
actualSpacing = data[i].spacing;
|
|
70
|
+
totalSpacing += (data[0].barWidth || barWidth || 30) / 2;
|
|
77
71
|
}
|
|
78
|
-
|
|
79
|
-
actualSpacing
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
for (let i = 0; i < index; i++) {
|
|
73
|
+
let actualSpacing = spacing;
|
|
74
|
+
if (stackData) {
|
|
75
|
+
if (i >= stackData.length - 1) {
|
|
76
|
+
actualSpacing += (barWidth || 30) / 2;
|
|
77
|
+
} else {
|
|
78
|
+
if (stackData[i].spacing || stackData[i].spacing === 0) {
|
|
79
|
+
actualSpacing = stackData[i].spacing;
|
|
80
|
+
}
|
|
81
|
+
if (stackData[i + 1].barWidth) {
|
|
82
|
+
actualSpacing += stackData[i + 1].barWidth;
|
|
83
|
+
} else {
|
|
84
|
+
actualSpacing += barWidth || 30;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
if (i >= data.length - 1) {
|
|
89
|
+
actualSpacing += (barWidth || 30) / 2;
|
|
90
|
+
} else {
|
|
91
|
+
if (data[i].spacing || data[i].spacing === 0) {
|
|
92
|
+
actualSpacing = data[i].spacing;
|
|
93
|
+
}
|
|
94
|
+
if (data[i + 1].barWidth) {
|
|
95
|
+
actualSpacing += data[i + 1].barWidth;
|
|
96
|
+
} else {
|
|
97
|
+
actualSpacing += barWidth || 30;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
totalSpacing += actualSpacing;
|
|
82
102
|
}
|
|
83
103
|
}
|
|
84
|
-
}
|
|
85
|
-
totalSpacing += actualSpacing;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
104
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
borderColor: verticalLinesColor,
|
|
114
|
-
}
|
|
115
|
-
: {
|
|
116
|
-
backgroundColor: verticalLinesColor,
|
|
117
|
-
},
|
|
118
|
-
]}
|
|
119
|
-
/>
|
|
120
|
-
);
|
|
121
|
-
});
|
|
105
|
+
const x =
|
|
106
|
+
verticalLinesShift +
|
|
107
|
+
(chartType === chartTypes.BAR
|
|
108
|
+
? totalSpacing - 1
|
|
109
|
+
: verticalLinesSpacing
|
|
110
|
+
? verticalLinesSpacing * (index + 1)
|
|
111
|
+
: index * spacing + (initialSpacing - 2));
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Line
|
|
115
|
+
key={index}
|
|
116
|
+
x1={x}
|
|
117
|
+
y1={extendedContainerHeight - getHeightOfVerticalLine(index)}
|
|
118
|
+
x2={x}
|
|
119
|
+
y2={extendedContainerHeight}
|
|
120
|
+
stroke={verticalLinesColor || 'lightgray'}
|
|
121
|
+
strokeWidth={verticalLinesThickness || 2}
|
|
122
|
+
strokeDasharray={verticalLinesStrokeDashArray ?? ''}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
})}
|
|
126
|
+
</Svg>
|
|
127
|
+
</View>
|
|
128
|
+
);
|
|
122
129
|
};
|
|
123
130
|
|
|
124
131
|
export default RenderVerticalLines;
|
|
@@ -90,7 +90,7 @@ type propTypes = {
|
|
|
90
90
|
verticalLinesThickness?: number;
|
|
91
91
|
verticalLinesHeight?: number;
|
|
92
92
|
verticalLinesColor?: ColorValue;
|
|
93
|
-
|
|
93
|
+
verticalLinesStrokeDashArray?: Array<number>;
|
|
94
94
|
verticalLinesShift?: number;
|
|
95
95
|
verticalLinesZIndex?: number;
|
|
96
96
|
noOfVerticalLines?: number;
|
|
@@ -1361,7 +1361,7 @@ export const LineChartBicolor = (props: propTypes) => {
|
|
|
1361
1361
|
noOfSections,
|
|
1362
1362
|
showFractionalValues,
|
|
1363
1363
|
|
|
1364
|
-
axesAndRulesProps: getAxesAndRulesProps(props, stepValue),
|
|
1364
|
+
axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
|
|
1365
1365
|
|
|
1366
1366
|
yAxisLabelTexts: props.yAxisLabelTexts,
|
|
1367
1367
|
yAxisOffset: props.yAxisOffset,
|
package/src/LineChart/index.tsx
CHANGED
|
@@ -1809,6 +1809,31 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
1809
1809
|
const renderSpecificVerticalLines = (dataForRender: any) => {
|
|
1810
1810
|
return dataForRender.map((item: itemType, index: number) => {
|
|
1811
1811
|
if (item.showVerticalLine) {
|
|
1812
|
+
const x = getX(index);
|
|
1813
|
+
return (
|
|
1814
|
+
<Line
|
|
1815
|
+
key={index}
|
|
1816
|
+
x1={x}
|
|
1817
|
+
y1={extendedContainerHeight}
|
|
1818
|
+
x2={x}
|
|
1819
|
+
y2={
|
|
1820
|
+
item.verticalLineUptoDataPoint ?? props.verticalLinesUptoDataPoint
|
|
1821
|
+
? getY(item.value)
|
|
1822
|
+
: -xAxisThickness
|
|
1823
|
+
}
|
|
1824
|
+
stroke={
|
|
1825
|
+
item.verticalLineColor || props.verticalLinesColor || 'lightgray'
|
|
1826
|
+
}
|
|
1827
|
+
strokeWidth={
|
|
1828
|
+
item.verticalLineThickness || props.verticalLinesThickness || 2
|
|
1829
|
+
}
|
|
1830
|
+
strokeDasharray={
|
|
1831
|
+
item.verticalLineStrokeDashArray ??
|
|
1832
|
+
props.verticalLinesStrokeDashArray ??
|
|
1833
|
+
''
|
|
1834
|
+
}
|
|
1835
|
+
/>
|
|
1836
|
+
);
|
|
1812
1837
|
return (
|
|
1813
1838
|
<Rect
|
|
1814
1839
|
key={index}
|
|
@@ -1824,7 +1849,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
1824
1849
|
? getY(item.value)
|
|
1825
1850
|
: -xAxisThickness
|
|
1826
1851
|
}
|
|
1827
|
-
width={item.verticalLineThickness ||
|
|
1852
|
+
width={item.verticalLineThickness || 10}
|
|
1828
1853
|
height={
|
|
1829
1854
|
item.verticalLineUptoDataPoint
|
|
1830
1855
|
? (item.value * containerHeight) / maxValue - xAxisThickness
|
|
@@ -3103,7 +3128,7 @@ export const LineChart = (props: LineChartPropsType) => {
|
|
|
3103
3128
|
noOfSections,
|
|
3104
3129
|
showFractionalValues,
|
|
3105
3130
|
|
|
3106
|
-
axesAndRulesProps: getAxesAndRulesProps(props, stepValue),
|
|
3131
|
+
axesAndRulesProps: getAxesAndRulesProps(props, stepValue, undefined),
|
|
3107
3132
|
|
|
3108
3133
|
yAxisLabelTexts: props.yAxisLabelTexts,
|
|
3109
3134
|
yAxisOffset: props.yAxisOffset,
|
package/src/LineChart/types.ts
CHANGED
|
@@ -89,7 +89,7 @@ export type LineChartPropsType = {
|
|
|
89
89
|
verticalLinesThickness?: number;
|
|
90
90
|
verticalLinesHeight?: number;
|
|
91
91
|
verticalLinesColor?: ColorValue;
|
|
92
|
-
|
|
92
|
+
verticalLinesStrokeDashArray?: Array<number>;
|
|
93
93
|
verticalLinesShift?: number;
|
|
94
94
|
verticalLinesZIndex?: number;
|
|
95
95
|
noOfVerticalLines?: number;
|
|
@@ -333,6 +333,7 @@ export type itemType = {
|
|
|
333
333
|
verticalLineUptoDataPoint?: boolean;
|
|
334
334
|
verticalLineColor?: string;
|
|
335
335
|
verticalLineThickness?: number;
|
|
336
|
+
verticalLineStrokeDashArray?: Array<number>;
|
|
336
337
|
pointerShiftX?: number;
|
|
337
338
|
pointerShiftY?: number;
|
|
338
339
|
onPress?: Function;
|
package/src/utils/constants.ts
CHANGED
|
@@ -66,7 +66,7 @@ export const AxesAndRulesDefaults = {
|
|
|
66
66
|
showVerticalLines: false,
|
|
67
67
|
verticalLinesThickness: 1,
|
|
68
68
|
verticalLinesColor: 'lightgray',
|
|
69
|
-
|
|
69
|
+
verticalLinesStrokeDashArray: '',
|
|
70
70
|
verticalLinesShift: 0,
|
|
71
71
|
verticalLinesZIndex: -1,
|
|
72
72
|
verticalLinesSpacing: 0,
|
|
@@ -153,6 +153,7 @@ export const defaultLineConfig: defaultLineConfigType = {
|
|
|
153
153
|
endIndex: 0, // gets updated to lineData.length - 1
|
|
154
154
|
showArrow: false,
|
|
155
155
|
arrowConfig: defaultArrowConfig,
|
|
156
|
+
isSecondary: false,
|
|
156
157
|
};
|
|
157
158
|
|
|
158
159
|
// Line chart specific
|
package/src/utils/index.tsx
CHANGED
|
@@ -211,8 +211,8 @@ export const getArrowPoints = (
|
|
|
211
211
|
return arrowPoints;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
export const getAxesAndRulesProps = (props, stepValue) => {
|
|
215
|
-
|
|
214
|
+
export const getAxesAndRulesProps = (props, stepValue, maxValue) => {
|
|
215
|
+
const axesAndRulesProps = {
|
|
216
216
|
yAxisSide: props.yAxisSide,
|
|
217
217
|
yAxisLabelContainerStyle: props.yAxisLabelContainerStyle,
|
|
218
218
|
yAxisColor: props.yAxisColor,
|
|
@@ -255,7 +255,6 @@ export const getAxesAndRulesProps = (props, stepValue) => {
|
|
|
255
255
|
verticalLinesThickness: props.verticalLinesThickness,
|
|
256
256
|
verticalLinesHeight: props.verticalLinesHeight,
|
|
257
257
|
verticalLinesColor: props.verticalLinesColor,
|
|
258
|
-
verticalLinesType: props.verticalLinesType,
|
|
259
258
|
verticalLinesShift: props.verticalLinesShift,
|
|
260
259
|
verticalLinesZIndex: props.verticalLinesZIndex,
|
|
261
260
|
verticalLinesSpacing: props.verticalLinesSpacing,
|
|
@@ -269,6 +268,11 @@ export const getAxesAndRulesProps = (props, stepValue) => {
|
|
|
269
268
|
|
|
270
269
|
secondaryYAxis: props.secondaryYAxis,
|
|
271
270
|
};
|
|
271
|
+
if (props.secondaryYAxis && maxValue !== undefined) {
|
|
272
|
+
axesAndRulesProps.secondaryYAxis = {...props.secondaryYAxis, maxValue};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return axesAndRulesProps;
|
|
272
276
|
};
|
|
273
277
|
|
|
274
278
|
export const getExtendedContainerHeightWithPadding = (
|