gifted-charts-core 0.1.52 → 0.1.54
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/RenderStackBars.js +0 -1
- package/dist/LineChart/index.d.ts +1 -1
- package/dist/LineChart/index.js +217 -209
- package/dist/RadarChart/index.d.ts +82 -0
- package/dist/RadarChart/index.js +257 -0
- package/dist/RadarChart/types.d.ts +56 -0
- package/dist/RadarChart/types.js +1 -0
- package/dist/components/BarAndLineChartsWrapper/index.js +3 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/utils/constants.d.ts +37 -0
- package/dist/utils/constants.js +37 -0
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +12 -5
- package/dist/utils/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { GridConfig, RadarChartProps } from './types';
|
|
2
|
+
export declare const useRadarChart: (props: RadarChartProps) => {
|
|
3
|
+
data: number[];
|
|
4
|
+
dataSet: number[][] | undefined;
|
|
5
|
+
center: number;
|
|
6
|
+
radius: number;
|
|
7
|
+
chartSize: number;
|
|
8
|
+
noOfSections: number;
|
|
9
|
+
polarToCartesian: (angle: number, value: number) => {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
labels: string[];
|
|
14
|
+
labelConfigArray: import("./types").LabelConfig[] | undefined;
|
|
15
|
+
labelsPositionOffset: number;
|
|
16
|
+
dataLabelsConfigArray: any[];
|
|
17
|
+
maxValue: number;
|
|
18
|
+
dataLabels: string[] | null;
|
|
19
|
+
dataLabelsArray: (string[] | null)[] | undefined;
|
|
20
|
+
dataLabelsConfigSet: any[] | null;
|
|
21
|
+
gridSections: any[];
|
|
22
|
+
gridStroke: string;
|
|
23
|
+
gridStrokeWidth: number;
|
|
24
|
+
gridStrokeDashArray: number[];
|
|
25
|
+
gridFill: string;
|
|
26
|
+
gridGradientColor: string;
|
|
27
|
+
gridShowGradient: boolean;
|
|
28
|
+
gridOpacity: number;
|
|
29
|
+
gridGradientOpacity: number;
|
|
30
|
+
fontSize: number;
|
|
31
|
+
fontWeight: string;
|
|
32
|
+
fontFamily: string;
|
|
33
|
+
stroke: string;
|
|
34
|
+
textAnchor: string;
|
|
35
|
+
alignmentBaseline: string;
|
|
36
|
+
dataLabelsFontSize: number;
|
|
37
|
+
dataLabelsColor: string;
|
|
38
|
+
dataLabelsTextAnchor: string;
|
|
39
|
+
dataLabelsAlignmentBaseline: string;
|
|
40
|
+
dataLabelsPositionOffset: number;
|
|
41
|
+
dataLabelsFontWeight: string;
|
|
42
|
+
dataLabelsFontFamily: string;
|
|
43
|
+
polygonStroke: string;
|
|
44
|
+
polygonStrokeWidth: number;
|
|
45
|
+
polygonStrokeDashArray: number[];
|
|
46
|
+
polygonFill: string;
|
|
47
|
+
polygonGradientColor: string;
|
|
48
|
+
polygonShowGradient: boolean;
|
|
49
|
+
polygonOpacity: number;
|
|
50
|
+
polygonGradientOpacity: number;
|
|
51
|
+
polygonConfigArray: any[] | null;
|
|
52
|
+
asterLinesStroke: string;
|
|
53
|
+
asterLinesStrokeWidth: number;
|
|
54
|
+
asterLinesStrokeDashArray: number[];
|
|
55
|
+
points: {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
}[];
|
|
59
|
+
polygonPoints: string;
|
|
60
|
+
polygonPointsArray: string[];
|
|
61
|
+
angleStep: number;
|
|
62
|
+
circular: boolean;
|
|
63
|
+
hideGrid: boolean;
|
|
64
|
+
hideAsterLines: boolean;
|
|
65
|
+
getGridLevelProps: (gridItem: GridConfig, ind: number) => {
|
|
66
|
+
level: number;
|
|
67
|
+
gridGradientColorLocal: string;
|
|
68
|
+
gridFillColorLocal: string;
|
|
69
|
+
gridOpacityLocal: number;
|
|
70
|
+
gridGradientOpacityLocal: number;
|
|
71
|
+
gridStrokeLocal: string;
|
|
72
|
+
gridStrokeWidthLocal: number;
|
|
73
|
+
gridShowGradientLocal: boolean;
|
|
74
|
+
gridStrokeDashArrayLocal: number[];
|
|
75
|
+
levelPoints: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
}[];
|
|
79
|
+
levelPolygonPoints: string;
|
|
80
|
+
r: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
37
|
+
import { radarChartDefaults } from '../utils/constants';
|
|
38
|
+
export var useRadarChart = function (props) {
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
40
|
+
var _t = props.circular, circular = _t === void 0 ? false : _t, _u = props.gridConfig, gridConfig = _u === void 0 ? {} : _u, _v = props.polygonConfig, polygonConfig = _v === void 0 ? {} : _v, _w = props.data, data = _w === void 0 ? [] : _w, dataSet = props.dataSet, _x = props.noOfSections, noOfSections = _x === void 0 ? radarChartDefaults.noOfSections : _x, _y = props.chartSize, chartSize = _y === void 0 ? radarChartDefaults.chartSize : _y, _z = props.labelConfig, labelConfig = _z === void 0 ? {} : _z, labelConfigArray = props.labelConfigArray, _0 = props.asterLinesConfig, asterLinesConfig = _0 === void 0 ? {} : _0, _1 = props.hideGrid, hideGrid = _1 === void 0 ? radarChartDefaults.hideGrid : _1, _2 = props.hideAsterLines, hideAsterLines = _2 === void 0 ? (_a = props.hideGrid) !== null && _a !== void 0 ? _a : radarChartDefaults.hideAsterLines : _2, _3 = props.dataLabelsConfig, dataLabelsConfig = _3 === void 0 ? {} : _3, _4 = props.labelsPositionOffset, labelsPositionOffset = _4 === void 0 ? radarChartDefaults.labelsPositionOffset : _4, _5 = props.dataLabelsPositionOffset, dataLabelsPositionOffset = _5 === void 0 ? radarChartDefaults.dataLabelsPositionOffset : _5;
|
|
41
|
+
var labels = (_e = (_b = props.labels) !== null && _b !== void 0 ? _b : (_d = ((_c = dataSet === null || dataSet === void 0 ? void 0 : dataSet[0]) !== null && _c !== void 0 ? _c : data)) === null || _d === void 0 ? void 0 : _d.map(function (_, index) { return "Label".concat(index + 1); })) !== null && _e !== void 0 ? _e : [];
|
|
42
|
+
var getMax = function (dataSet) {
|
|
43
|
+
return dataSet.reduce(function (acc, set) {
|
|
44
|
+
var max = Math.max.apply(Math, __spreadArray([], __read(set), false));
|
|
45
|
+
return max > acc ? max : acc;
|
|
46
|
+
}, 0);
|
|
47
|
+
};
|
|
48
|
+
var maxValue = (_f = props.maxValue) !== null && _f !== void 0 ? _f : (dataSet ? Math.max(getMax(dataSet !== null && dataSet !== void 0 ? dataSet : [])) : Math.max.apply(Math, __spreadArray([], __read((data !== null && data !== void 0 ? data : [])), false)));
|
|
49
|
+
var dataLabels = (_g = props.dataLabels) !== null && _g !== void 0 ? _g : (polygonConfig.showDataValuesAsLabels
|
|
50
|
+
? data.map(function (d) { return d.toString(); })
|
|
51
|
+
: null);
|
|
52
|
+
var polarToCartesian = function (angle, value) {
|
|
53
|
+
var radians = (Math.PI / 180) * angle;
|
|
54
|
+
return {
|
|
55
|
+
x: center + radius * (value / maxValue) * Math.cos(radians),
|
|
56
|
+
y: center - radius * (value / maxValue) * Math.sin(radians)
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
var center = chartSize / 2;
|
|
60
|
+
var radius = center * 0.8;
|
|
61
|
+
var _6 = gridConfig.stroke, gridStroke = _6 === void 0 ? radarChartDefaults.gridSection.stroke : _6, _7 = gridConfig.strokeWidth, gridStrokeWidth = _7 === void 0 ? radarChartDefaults.gridSection.strokeWidth : _7, _8 = gridConfig.strokeDashArray, gridStrokeDashArray = _8 === void 0 ? radarChartDefaults.gridSection
|
|
62
|
+
.strokeDashArray : _8, _9 = gridConfig.fill, gridFill = _9 === void 0 ? radarChartDefaults.gridSection.fill : _9, _10 = gridConfig.gradientColor, gridGradientColor = _10 === void 0 ? radarChartDefaults.gridSection
|
|
63
|
+
.gradientColor : _10, _11 = gridConfig.showGradient, gridShowGradient = _11 === void 0 ? radarChartDefaults.gridSection
|
|
64
|
+
.showGradient : _11, _12 = gridConfig.opacity, gridOpacity = _12 === void 0 ? radarChartDefaults.gridSection.opacity : _12, _13 = gridConfig.gradientOpacity, gridGradientOpacity = _13 === void 0 ? radarChartDefaults.gridSection
|
|
65
|
+
.gradientOpacity : _13;
|
|
66
|
+
var gridSections = (_j = (_h = gridConfig.gridSections) === null || _h === void 0 ? void 0 : _h.map(function (i) { return (__assign(__assign({}, radarChartDefaults.gridSection), i)); })) !== null && _j !== void 0 ? _j : Array(noOfSections).fill({});
|
|
67
|
+
var _14 = labelConfig.fontSize, fontSize = _14 === void 0 ? radarChartDefaults.labelConfig.fontSize : _14, _15 = labelConfig.stroke, stroke = _15 === void 0 ? radarChartDefaults.labelConfig.stroke : _15, _16 = labelConfig.textAnchor, textAnchor = _16 === void 0 ? radarChartDefaults.labelConfig.textAnchor : _16, _17 = labelConfig.alignmentBaseline, alignmentBaseline = _17 === void 0 ? radarChartDefaults.labelConfig.alignmentBaseline : _17, _18 = labelConfig.fontWeight, fontWeight = _18 === void 0 ? radarChartDefaults.labelConfig.fontWeight : _18, _19 = labelConfig.fontFamily, fontFamily = _19 === void 0 ? radarChartDefaults.labelConfig.fontFamily : _19;
|
|
68
|
+
var _20 = dataLabelsConfig.fontSize, dataLabelsFontSize = _20 === void 0 ? fontSize : _20, // defaults to labelConfig (from above)
|
|
69
|
+
_21 = dataLabelsConfig.stroke, // defaults to labelConfig (from above)
|
|
70
|
+
dataLabelsColor = _21 === void 0 ? stroke : _21, // defaults to labelConfig (from above)
|
|
71
|
+
_22 = dataLabelsConfig.textAnchor, // defaults to labelConfig (from above)
|
|
72
|
+
dataLabelsTextAnchor = _22 === void 0 ? textAnchor : _22, // defaults to labelConfig (from above)
|
|
73
|
+
_23 = dataLabelsConfig.alignmentBaseline, // defaults to labelConfig (from above)
|
|
74
|
+
dataLabelsAlignmentBaseline = _23 === void 0 ? alignmentBaseline : _23, // defaults to labelConfig (from above)
|
|
75
|
+
_24 = dataLabelsConfig.fontWeight, // defaults to labelConfig (from above)
|
|
76
|
+
dataLabelsFontWeight = _24 === void 0 ? fontWeight : _24, // defaults to labelConfig (from above)
|
|
77
|
+
_25 = dataLabelsConfig.fontFamily // defaults to labelConfig (from above)
|
|
78
|
+
, // defaults to labelConfig (from above)
|
|
79
|
+
dataLabelsFontFamily = _25 === void 0 ? fontFamily : _25 // defaults to labelConfig (from above)
|
|
80
|
+
;
|
|
81
|
+
var _26 = polygonConfig.stroke, polygonStroke = _26 === void 0 ? radarChartDefaults.polygonConfig.stroke : _26, _27 = polygonConfig.strokeWidth, polygonStrokeWidth = _27 === void 0 ? radarChartDefaults.polygonConfig
|
|
82
|
+
.strokeWidth : _27, _28 = polygonConfig.strokeDashArray, polygonStrokeDashArray = _28 === void 0 ? radarChartDefaults.polygonConfig
|
|
83
|
+
.strokeDashArray : _28, _29 = polygonConfig.fill, polygonFill = _29 === void 0 ? radarChartDefaults.polygonConfig.fill : _29, _30 = polygonConfig.gradientColor, polygonGradientColor = _30 === void 0 ? radarChartDefaults.polygonConfig
|
|
84
|
+
.gradientColor : _30, _31 = polygonConfig.showGradient, polygonShowGradient = _31 === void 0 ? radarChartDefaults.polygonConfig
|
|
85
|
+
.showGradient : _31, _32 = polygonConfig.opacity, polygonOpacity = _32 === void 0 ? radarChartDefaults.polygonConfig.opacity : _32, _33 = polygonConfig.gradientOpacity, polygonGradientOpacity = _33 === void 0 ? polygonOpacity : _33, showDataValuesAsLabels = polygonConfig.showDataValuesAsLabels;
|
|
86
|
+
var polygonConfigArray = (_l = (_k = props.polygonConfigArray) === null || _k === void 0 ? void 0 : _k.map(function (set) {
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
88
|
+
return ({
|
|
89
|
+
stroke: (_a = set.stroke) !== null && _a !== void 0 ? _a : polygonStroke,
|
|
90
|
+
strokeWidth: (_b = set.strokeWidth) !== null && _b !== void 0 ? _b : polygonStrokeWidth,
|
|
91
|
+
strokeDashArray: (_c = set.strokeDashArray) !== null && _c !== void 0 ? _c : polygonStrokeDashArray,
|
|
92
|
+
fill: (_d = set.fill) !== null && _d !== void 0 ? _d : polygonFill,
|
|
93
|
+
gradientColor: (_e = set.gradientColor) !== null && _e !== void 0 ? _e : polygonGradientColor,
|
|
94
|
+
showGradient: (_f = set.showGradient) !== null && _f !== void 0 ? _f : polygonShowGradient,
|
|
95
|
+
opacity: (_g = set.opacity) !== null && _g !== void 0 ? _g : polygonOpacity,
|
|
96
|
+
gradientOpacity: (_h = set.gradientOpacity) !== null && _h !== void 0 ? _h : polygonGradientOpacity,
|
|
97
|
+
showDataValuesAsLabels: (_j = set.showDataValuesAsLabels) !== null && _j !== void 0 ? _j : showDataValuesAsLabels
|
|
98
|
+
});
|
|
99
|
+
})) !== null && _l !== void 0 ? _l : (dataSet
|
|
100
|
+
? Array(dataSet.length).fill({
|
|
101
|
+
stroke: polygonStroke,
|
|
102
|
+
strokeWidth: polygonStrokeWidth,
|
|
103
|
+
strokeDashArray: polygonStrokeDashArray,
|
|
104
|
+
fill: polygonFill,
|
|
105
|
+
gradientColor: polygonGradientColor,
|
|
106
|
+
showGradient: polygonShowGradient,
|
|
107
|
+
opacity: polygonOpacity,
|
|
108
|
+
gradientOpacity: polygonGradientOpacity,
|
|
109
|
+
showDataValuesAsLabels: showDataValuesAsLabels
|
|
110
|
+
})
|
|
111
|
+
: null);
|
|
112
|
+
var dataLabelsArray = (_m = props.dataLabelsArray) !== null && _m !== void 0 ? _m : polygonConfigArray === null || polygonConfigArray === void 0 ? void 0 : polygonConfigArray.map(function (polygonItem, index) {
|
|
113
|
+
return polygonItem.showDataValuesAsLabels ? data.map(function (d) { return d.toString(); }) : null;
|
|
114
|
+
});
|
|
115
|
+
var dataLabelsConfigArray = (_p = (_o = props.dataLabelsConfigArray) === null || _o === void 0 ? void 0 : _o.map(function (dataLabelsConfigItem) {
|
|
116
|
+
var _a, _b, _c, _d, _e, _f;
|
|
117
|
+
return ({
|
|
118
|
+
fontSize: (_a = dataLabelsConfigItem.fontSize) !== null && _a !== void 0 ? _a : dataLabelsFontSize,
|
|
119
|
+
stroke: (_b = dataLabelsConfigItem.stroke) !== null && _b !== void 0 ? _b : dataLabelsColor,
|
|
120
|
+
textAnchor: (_c = dataLabelsConfigItem.textAnchor) !== null && _c !== void 0 ? _c : dataLabelsTextAnchor,
|
|
121
|
+
alignmentBaseline: (_d = dataLabelsConfigItem.alignmentBaseline) !== null && _d !== void 0 ? _d : dataLabelsAlignmentBaseline,
|
|
122
|
+
fontWeight: (_e = dataLabelsConfigItem.fontWeight) !== null && _e !== void 0 ? _e : dataLabelsFontWeight,
|
|
123
|
+
fontFamily: (_f = dataLabelsConfigItem.fontFamily) !== null && _f !== void 0 ? _f : dataLabelsFontFamily
|
|
124
|
+
});
|
|
125
|
+
})) !== null && _p !== void 0 ? _p : Array(data.length).fill({
|
|
126
|
+
fontSize: dataLabelsFontSize,
|
|
127
|
+
stroke: dataLabelsColor,
|
|
128
|
+
textAnchor: dataLabelsTextAnchor,
|
|
129
|
+
alignmentBaseline: dataLabelsAlignmentBaseline,
|
|
130
|
+
fontWeight: dataLabelsFontWeight,
|
|
131
|
+
fontFamily: dataLabelsFontFamily
|
|
132
|
+
});
|
|
133
|
+
var dataLabelsConfigSet = (_r = (_q = props.dataLabelsConfigSet) === null || _q === void 0 ? void 0 : _q.map(function (dataLabelConfigSetItem) {
|
|
134
|
+
return dataLabelConfigSetItem.map(function (dataLabelConfigItem) {
|
|
135
|
+
var _a, _b, _c, _d, _e, _f;
|
|
136
|
+
return ({
|
|
137
|
+
fontSize: (_a = dataLabelConfigItem.fontSize) !== null && _a !== void 0 ? _a : dataLabelsFontSize,
|
|
138
|
+
stroke: (_b = dataLabelConfigItem.stroke) !== null && _b !== void 0 ? _b : dataLabelsColor,
|
|
139
|
+
textAnchor: (_c = dataLabelConfigItem.textAnchor) !== null && _c !== void 0 ? _c : dataLabelsTextAnchor,
|
|
140
|
+
alignmentBaseline: (_d = dataLabelConfigItem.alignmentBaseline) !== null && _d !== void 0 ? _d : dataLabelsAlignmentBaseline,
|
|
141
|
+
fontWeight: (_e = dataLabelConfigItem.fontWeight) !== null && _e !== void 0 ? _e : dataLabelsFontWeight,
|
|
142
|
+
fontFamily: (_f = dataLabelConfigItem.fontFamily) !== null && _f !== void 0 ? _f : dataLabelsFontFamily
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
})) !== null && _r !== void 0 ? _r : (dataSet ? Array(dataSet.length).fill(dataLabelsConfigArray) : null);
|
|
146
|
+
var _34 = asterLinesConfig.stroke, asterLinesStroke = _34 === void 0 ? gridStroke : _34, _35 = asterLinesConfig.strokeWidth, asterLinesStrokeWidth = _35 === void 0 ? gridStrokeWidth : _35, _36 = asterLinesConfig.strokeDashArray, asterLinesStrokeDashArray = _36 === void 0 ? radarChartDefaults.asterLineStrokeDashArray : _36;
|
|
147
|
+
// Calculate angles for each category
|
|
148
|
+
var angleStep = 360 / labels.length;
|
|
149
|
+
// Generate coordinates for the data points
|
|
150
|
+
var points = data.map(function (value, index) {
|
|
151
|
+
var angle = index * angleStep;
|
|
152
|
+
return polarToCartesian(angle, value);
|
|
153
|
+
});
|
|
154
|
+
var pointsArray = (_s = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
|
|
155
|
+
return set.map(function (value, index) {
|
|
156
|
+
var angle = index * angleStep;
|
|
157
|
+
return polarToCartesian(angle, value);
|
|
158
|
+
});
|
|
159
|
+
})) !== null && _s !== void 0 ? _s : [];
|
|
160
|
+
// Generate the polygon points for the radar chart (in SVG "x,y" format)
|
|
161
|
+
var polygonPoints = points.map(function (point) { return "".concat(point.x, ",").concat(point.y); }).join(' ');
|
|
162
|
+
var polygonPointsArray = pointsArray.map(function (set) {
|
|
163
|
+
return set.map(function (point) { return "".concat(point.x, ",").concat(point.y); }).join(' ');
|
|
164
|
+
});
|
|
165
|
+
var getGridLevelProps = function (gridItem, ind) {
|
|
166
|
+
var level = noOfSections - ind;
|
|
167
|
+
var gridGradientColorLocal = gridItem.gradientColor || gridGradientColor;
|
|
168
|
+
var gridFillColorLocal = gridItem.fill || gridFill;
|
|
169
|
+
var gridOpacityLocal = gridItem.opacity || gridOpacity;
|
|
170
|
+
var gridGradientOpacityLocal = gridItem.gradientOpacity || gridGradientOpacity;
|
|
171
|
+
var gridStrokeLocal = gridItem.stroke || gridStroke;
|
|
172
|
+
var gridStrokeWidthLocal = gridItem.strokeWidth || gridStrokeWidth;
|
|
173
|
+
var gridShowGradientLocal = gridItem.showGradient || gridShowGradient;
|
|
174
|
+
var gridStrokeDashArrayLocal = gridItem.strokeDashArray || gridStrokeDashArray;
|
|
175
|
+
var levelPoints = labels.map(function (_, index) {
|
|
176
|
+
var angle = index * angleStep;
|
|
177
|
+
return polarToCartesian(angle, (level / noOfSections) * maxValue);
|
|
178
|
+
});
|
|
179
|
+
var levelPolygonPoints = levelPoints
|
|
180
|
+
.map(function (point) { return "".concat(point.x, ",").concat(point.y); })
|
|
181
|
+
.join(' ');
|
|
182
|
+
var r = radius * (level / noOfSections);
|
|
183
|
+
return {
|
|
184
|
+
level: level,
|
|
185
|
+
gridGradientColorLocal: gridGradientColorLocal,
|
|
186
|
+
gridFillColorLocal: gridFillColorLocal,
|
|
187
|
+
gridOpacityLocal: gridOpacityLocal,
|
|
188
|
+
gridGradientOpacityLocal: gridGradientOpacityLocal,
|
|
189
|
+
gridStrokeLocal: gridStrokeLocal,
|
|
190
|
+
gridStrokeWidthLocal: gridStrokeWidthLocal,
|
|
191
|
+
gridShowGradientLocal: gridShowGradientLocal,
|
|
192
|
+
gridStrokeDashArrayLocal: gridStrokeDashArrayLocal,
|
|
193
|
+
levelPoints: levelPoints,
|
|
194
|
+
levelPolygonPoints: levelPolygonPoints,
|
|
195
|
+
r: r
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
data: data,
|
|
200
|
+
dataSet: dataSet,
|
|
201
|
+
center: center,
|
|
202
|
+
radius: radius,
|
|
203
|
+
chartSize: chartSize,
|
|
204
|
+
noOfSections: noOfSections,
|
|
205
|
+
polarToCartesian: polarToCartesian,
|
|
206
|
+
labels: labels,
|
|
207
|
+
labelConfigArray: labelConfigArray,
|
|
208
|
+
labelsPositionOffset: labelsPositionOffset,
|
|
209
|
+
dataLabelsConfigArray: dataLabelsConfigArray,
|
|
210
|
+
maxValue: maxValue,
|
|
211
|
+
dataLabels: dataLabels,
|
|
212
|
+
dataLabelsArray: dataLabelsArray,
|
|
213
|
+
dataLabelsConfigSet: dataLabelsConfigSet,
|
|
214
|
+
gridSections: gridSections,
|
|
215
|
+
gridStroke: gridStroke,
|
|
216
|
+
gridStrokeWidth: gridStrokeWidth,
|
|
217
|
+
gridStrokeDashArray: gridStrokeDashArray,
|
|
218
|
+
gridFill: gridFill,
|
|
219
|
+
gridGradientColor: gridGradientColor,
|
|
220
|
+
gridShowGradient: gridShowGradient,
|
|
221
|
+
gridOpacity: gridOpacity,
|
|
222
|
+
gridGradientOpacity: gridGradientOpacity,
|
|
223
|
+
fontSize: fontSize,
|
|
224
|
+
fontWeight: fontWeight,
|
|
225
|
+
fontFamily: fontFamily,
|
|
226
|
+
stroke: stroke,
|
|
227
|
+
textAnchor: textAnchor,
|
|
228
|
+
alignmentBaseline: alignmentBaseline,
|
|
229
|
+
dataLabelsFontSize: dataLabelsFontSize,
|
|
230
|
+
dataLabelsColor: dataLabelsColor,
|
|
231
|
+
dataLabelsTextAnchor: dataLabelsTextAnchor,
|
|
232
|
+
dataLabelsAlignmentBaseline: dataLabelsAlignmentBaseline,
|
|
233
|
+
dataLabelsPositionOffset: dataLabelsPositionOffset,
|
|
234
|
+
dataLabelsFontWeight: dataLabelsFontWeight,
|
|
235
|
+
dataLabelsFontFamily: dataLabelsFontFamily,
|
|
236
|
+
polygonStroke: polygonStroke,
|
|
237
|
+
polygonStrokeWidth: polygonStrokeWidth,
|
|
238
|
+
polygonStrokeDashArray: polygonStrokeDashArray,
|
|
239
|
+
polygonFill: polygonFill,
|
|
240
|
+
polygonGradientColor: polygonGradientColor,
|
|
241
|
+
polygonShowGradient: polygonShowGradient,
|
|
242
|
+
polygonOpacity: polygonOpacity,
|
|
243
|
+
polygonGradientOpacity: polygonGradientOpacity,
|
|
244
|
+
polygonConfigArray: polygonConfigArray,
|
|
245
|
+
asterLinesStroke: asterLinesStroke,
|
|
246
|
+
asterLinesStrokeWidth: asterLinesStrokeWidth,
|
|
247
|
+
asterLinesStrokeDashArray: asterLinesStrokeDashArray,
|
|
248
|
+
points: points,
|
|
249
|
+
polygonPoints: polygonPoints,
|
|
250
|
+
polygonPointsArray: polygonPointsArray,
|
|
251
|
+
angleStep: angleStep,
|
|
252
|
+
circular: circular,
|
|
253
|
+
hideGrid: hideGrid,
|
|
254
|
+
hideAsterLines: hideAsterLines,
|
|
255
|
+
getGridLevelProps: getGridLevelProps
|
|
256
|
+
};
|
|
257
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface GridConfig extends StrokeFillAndGradient {
|
|
2
|
+
gridSections?: GridSectionConfig[];
|
|
3
|
+
}
|
|
4
|
+
export interface LabelConfig {
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
textAnchor?: string;
|
|
8
|
+
alignmentBaseline?: string;
|
|
9
|
+
fontWeight?: string;
|
|
10
|
+
fontFamily?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface RadarChartProps {
|
|
13
|
+
circular?: boolean;
|
|
14
|
+
gridConfig?: GridConfig;
|
|
15
|
+
data?: number[];
|
|
16
|
+
dataSet?: number[][];
|
|
17
|
+
maxValue?: number;
|
|
18
|
+
noOfSections?: number;
|
|
19
|
+
chartSize?: number;
|
|
20
|
+
labelConfig?: LabelConfig;
|
|
21
|
+
labelConfigArray?: LabelConfig[];
|
|
22
|
+
labels?: string[];
|
|
23
|
+
dataLabels?: string[];
|
|
24
|
+
dataLabelsArray?: string[][];
|
|
25
|
+
dataLabelConfig?: LabelConfig;
|
|
26
|
+
dataLabelsConfigArray?: LabelConfig[];
|
|
27
|
+
polygonConfig?: PolygonConfig;
|
|
28
|
+
polygonConfigArray?: PolygonConfig[];
|
|
29
|
+
asterLinesConfig?: AsterLinesConfig;
|
|
30
|
+
hideAsterLines?: boolean;
|
|
31
|
+
hideGrid?: boolean;
|
|
32
|
+
hideLabels?: boolean;
|
|
33
|
+
dataLabelsConfig?: LabelConfig;
|
|
34
|
+
dataLabelsConfigSet?: LabelConfig[][];
|
|
35
|
+
labelsPositionOffset?: number;
|
|
36
|
+
dataLabelsPositionOffset?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface StrokeConfig {
|
|
39
|
+
stroke?: string;
|
|
40
|
+
strokeWidth?: number;
|
|
41
|
+
strokeDashArray?: number[];
|
|
42
|
+
}
|
|
43
|
+
export interface StrokeFillAndGradient extends StrokeConfig {
|
|
44
|
+
fill?: string;
|
|
45
|
+
gradientColor?: string;
|
|
46
|
+
showGradient?: boolean;
|
|
47
|
+
opacity?: number;
|
|
48
|
+
gradientOpacity?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface PolygonConfig extends StrokeFillAndGradient {
|
|
51
|
+
showDataValuesAsLabels?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface GridSectionConfig extends StrokeFillAndGradient {
|
|
54
|
+
}
|
|
55
|
+
export interface AsterLinesConfig extends StrokeConfig {
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -39,7 +39,7 @@ import { AxesAndRulesDefaults, BarDefaults } from '../../utils/constants';
|
|
|
39
39
|
import { computeMaxAndMinItems } from '../../utils';
|
|
40
40
|
export var useBarAndLineChartsWrapper = function (props) {
|
|
41
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, _19;
|
|
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;
|
|
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, onlyPositive = props.onlyPositive;
|
|
43
43
|
var yAxisAtTop = rtl ? !props.yAxisAtTop : props.yAxisAtTop;
|
|
44
44
|
var hideOrigin = (_a = axesAndRulesProps.hideOrigin) !== null && _a !== void 0 ? _a : AxesAndRulesDefaults.hideOrigin;
|
|
45
45
|
var yAxisSide = (_b = axesAndRulesProps.yAxisSide) !== null && _b !== void 0 ? _b : AxesAndRulesDefaults.yAxisSide;
|
|
@@ -179,7 +179,8 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
179
179
|
secondaryRoundToDigits: secondaryRoundToDigits,
|
|
180
180
|
secondaryStepHeight: secondaryStepHeight,
|
|
181
181
|
secondaryNegativeStepHeight: secondaryNegativeStepHeight,
|
|
182
|
-
customBackground: props.customBackground
|
|
182
|
+
customBackground: props.customBackground,
|
|
183
|
+
onlyPositive: onlyPositive,
|
|
183
184
|
};
|
|
184
185
|
var lineInBarChartProps = {
|
|
185
186
|
yAxisLabelWidth: yAxisLabelWidth,
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export { type PieChartPropsType, type pieDataItem, type PieChartMainProps } from
|
|
|
25
25
|
export { usePopulationPyramid } from './PopulationPyramid';
|
|
26
26
|
export { type popnPyramidDataItem, type popnPyramidDataItemReactJS, type RulesProps, type RulesPropsReactJS, type RulesPropsType, type PopulationPyramidPropsType, type PopulationPyramidPropsTypeReactJS, type TPopulationPyramidPropsType, type extendedPopulationPyramidPropsType } from './PopulationPyramid/types';
|
|
27
27
|
/***********************************************************************************************************************
|
|
28
|
+
/************************************ Radar Chart ************************************
|
|
29
|
+
/***********************************************************************************************************************/
|
|
30
|
+
export { useRadarChart } from './RadarChart';
|
|
31
|
+
export { type RadarChartProps, type PolygonConfig, type GridConfig, type GridSectionConfig, type AsterLinesConfig } from './RadarChart/types';
|
|
32
|
+
/***********************************************************************************************************************
|
|
28
33
|
/************************************ Common Components ************************************
|
|
29
34
|
/***********************************************************************************************************************/
|
|
30
35
|
export { useAnimatedThreeDBar } from './components/AnimatedThreeDBar';
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,10 @@ export { getPieChartMainProps } from './PieChart/main';
|
|
|
21
21
|
/***********************************************************************************************************************/
|
|
22
22
|
export { usePopulationPyramid } from './PopulationPyramid';
|
|
23
23
|
/***********************************************************************************************************************
|
|
24
|
+
/************************************ Radar Chart ************************************
|
|
25
|
+
/***********************************************************************************************************************/
|
|
26
|
+
export { useRadarChart } from './RadarChart';
|
|
27
|
+
/***********************************************************************************************************************
|
|
24
28
|
/************************************ Common Components ************************************
|
|
25
29
|
/***********************************************************************************************************************/
|
|
26
30
|
export { useAnimatedThreeDBar } from './components/AnimatedThreeDBar';
|
|
@@ -265,3 +265,40 @@ export declare const PieTooltipDefaults: {
|
|
|
265
265
|
tooltipBackgroundColor: string;
|
|
266
266
|
tooltipBorderRadius: number;
|
|
267
267
|
};
|
|
268
|
+
export declare const radarChartDefaults: {
|
|
269
|
+
data: never[];
|
|
270
|
+
noOfSections: number;
|
|
271
|
+
chartSize: number;
|
|
272
|
+
hideAsterLines: boolean;
|
|
273
|
+
hideGrid: boolean;
|
|
274
|
+
labelsPositionOffset: number;
|
|
275
|
+
dataLabelsPositionOffset: number;
|
|
276
|
+
gridSection: {
|
|
277
|
+
stroke: string;
|
|
278
|
+
strokeWidth: number;
|
|
279
|
+
fill: string;
|
|
280
|
+
gradientColor: string;
|
|
281
|
+
showGradient: boolean;
|
|
282
|
+
strokeDashArray: number[];
|
|
283
|
+
opacity: number;
|
|
284
|
+
gradientOpacity: number;
|
|
285
|
+
};
|
|
286
|
+
labelConfig: {
|
|
287
|
+
fontSize: number;
|
|
288
|
+
stroke: string;
|
|
289
|
+
textAnchor: string;
|
|
290
|
+
alignmentBaseline: string;
|
|
291
|
+
fontWeight: string;
|
|
292
|
+
fontFamily: string;
|
|
293
|
+
};
|
|
294
|
+
polygonConfig: {
|
|
295
|
+
stroke: string;
|
|
296
|
+
strokeWidth: number;
|
|
297
|
+
strokeDashArray: number[];
|
|
298
|
+
fill: string;
|
|
299
|
+
gradientColor: string;
|
|
300
|
+
showGradient: boolean;
|
|
301
|
+
opacity: number;
|
|
302
|
+
};
|
|
303
|
+
asterLineStrokeDashArray: number[];
|
|
304
|
+
};
|
package/dist/utils/constants.js
CHANGED
|
@@ -318,3 +318,40 @@ export var PieTooltipDefaults = {
|
|
|
318
318
|
tooltipBackgroundColor: 'rgba(20,20,20,0.8)',
|
|
319
319
|
tooltipBorderRadius: 4
|
|
320
320
|
};
|
|
321
|
+
export var radarChartDefaults = {
|
|
322
|
+
data: [],
|
|
323
|
+
noOfSections: 4,
|
|
324
|
+
chartSize: 300,
|
|
325
|
+
hideAsterLines: false,
|
|
326
|
+
hideGrid: false,
|
|
327
|
+
labelsPositionOffset: 5,
|
|
328
|
+
dataLabelsPositionOffset: 5,
|
|
329
|
+
gridSection: {
|
|
330
|
+
stroke: 'lightgray',
|
|
331
|
+
strokeWidth: 1,
|
|
332
|
+
fill: '#bbb',
|
|
333
|
+
gradientColor: 'white',
|
|
334
|
+
showGradient: true,
|
|
335
|
+
strokeDashArray: [0, 0],
|
|
336
|
+
opacity: 1,
|
|
337
|
+
gradientOpacity: 1
|
|
338
|
+
},
|
|
339
|
+
labelConfig: {
|
|
340
|
+
fontSize: 12,
|
|
341
|
+
stroke: 'black',
|
|
342
|
+
textAnchor: 'middle',
|
|
343
|
+
alignmentBaseline: 'middle',
|
|
344
|
+
fontWeight: 'normal',
|
|
345
|
+
fontFamily: 'Arial'
|
|
346
|
+
},
|
|
347
|
+
polygonConfig: {
|
|
348
|
+
stroke: '#027bff',
|
|
349
|
+
strokeWidth: 2,
|
|
350
|
+
strokeDashArray: [0, 0],
|
|
351
|
+
fill: 'skyblue',
|
|
352
|
+
gradientColor: 'lightgray',
|
|
353
|
+
showGradient: false,
|
|
354
|
+
opacity: 0.7,
|
|
355
|
+
},
|
|
356
|
+
asterLineStrokeDashArray: [4, 4]
|
|
357
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const getLighterColor: (color: string) => string;
|
|
|
9
9
|
export declare const svgQuadraticCurvePath: (points: number[][]) => string;
|
|
10
10
|
export declare const svgPath: (points: number[][], curveType?: CurveType, curvature?: number) => string;
|
|
11
11
|
export declare const bezierCommand: (point: number[], i: number, a: number[][], curvature: number) => string;
|
|
12
|
-
export declare const getSegmentString: (lineSegment: LineSegment[] | undefined, index: number, startDelimeter: string, endDelimeter: string) => string;
|
|
12
|
+
export declare const getSegmentString: (lineSegment: LineSegment[] | undefined, index: number, startDelimeter: string, endDelimeter: string, stepChart?: boolean) => string;
|
|
13
13
|
export declare const getCurvePathWithSegments: (path: string, lineSegment: LineSegment[] | undefined, startDelimeter: string, endDelimeter: string, curveType: CurveType) => string;
|
|
14
14
|
export declare const getPreviousSegmentsLastPoint: (isCurved: boolean, previousSegment: string) => string;
|
|
15
15
|
export declare const getPathWithHighlight: (data: lineDataItemNullSafe[], i: number, highlightedRange: HighlightedRange, startIndex: number, endIndex: number, spacingArray: number[], getX: (spacingArray: number[], i: number) => number, getY: (value: number) => number) => string;
|
|
@@ -88,7 +88,7 @@ interface MaxAndMin {
|
|
|
88
88
|
}
|
|
89
89
|
export declare const indexOfFirstNonZeroDigit: (num: number) => number;
|
|
90
90
|
export declare const maxAndMinUtil: (maxItem: number, minItem: number, roundToDigits?: number, showFractionalValues?: boolean) => MaxAndMin;
|
|
91
|
-
export declare const computeMaxAndMinItems: (data: any[] | undefined, roundToDigits?: number, showFractionalValues?: boolean) => MaxAndMin;
|
|
91
|
+
export declare const computeMaxAndMinItems: (data: any[] | undefined, roundToDigits?: number, showFractionalValues?: boolean, propsData?: any[]) => 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
94
|
export declare const getYForLineInBar: (value: number | undefined, shiftY: number | undefined, containerHeight: number, maxValue: number, yAxisOffset: number) => number;
|
package/dist/utils/index.js
CHANGED
|
@@ -153,9 +153,16 @@ export var bezierCommand = function (point, i, a, curvature) {
|
|
|
153
153
|
var _b = __read(controlPoint(curvature, point, a[i - 1], a[i + 1], true), 2), cpeX = _b[0], cpeY = _b[1];
|
|
154
154
|
return "C".concat(cpsX, ",").concat(cpsY, " ").concat(cpeX, ",").concat(cpeY, " ").concat(point[0], ",").concat(point[1]);
|
|
155
155
|
};
|
|
156
|
-
export var getSegmentString = function (lineSegment, index, startDelimeter, endDelimeter) {
|
|
156
|
+
export var getSegmentString = function (lineSegment, index, startDelimeter, endDelimeter, stepChart) {
|
|
157
|
+
var _a;
|
|
157
158
|
var segment = lineSegment === null || lineSegment === void 0 ? void 0 : lineSegment.find(function (segment) { return segment.startIndex === index; });
|
|
158
|
-
|
|
159
|
+
if (segment) {
|
|
160
|
+
if (stepChart) {
|
|
161
|
+
segment = __assign(__assign({}, segment), { endIndex: ((_a = segment === null || segment === void 0 ? void 0 : segment.endIndex) !== null && _a !== void 0 ? _a : 0) * 2 });
|
|
162
|
+
}
|
|
163
|
+
return startDelimeter + JSON.stringify(segment) + endDelimeter;
|
|
164
|
+
}
|
|
165
|
+
return '';
|
|
159
166
|
};
|
|
160
167
|
export var getCurvePathWithSegments = function (path, lineSegment, startDelimeter, endDelimeter, curveType) {
|
|
161
168
|
if (!(lineSegment === null || lineSegment === void 0 ? void 0 : lineSegment.length))
|
|
@@ -710,17 +717,17 @@ export var maxAndMinUtil = function (maxItem, minItem, roundToDigits, showFracti
|
|
|
710
717
|
}
|
|
711
718
|
return { maxItem: maxItem, minItem: minItem };
|
|
712
719
|
};
|
|
713
|
-
export var computeMaxAndMinItems = function (data, roundToDigits, showFractionalValues) {
|
|
720
|
+
export var computeMaxAndMinItems = function (data, roundToDigits, showFractionalValues, propsData) {
|
|
714
721
|
if (!(data === null || data === void 0 ? void 0 : data.length)) {
|
|
715
722
|
return { maxItem: 0, minItem: 0 };
|
|
716
723
|
}
|
|
717
724
|
var maxItem = 0;
|
|
718
725
|
var minItem = 0;
|
|
719
|
-
data.forEach(function (item) {
|
|
726
|
+
data.forEach(function (item, index) {
|
|
720
727
|
if (item.value > maxItem) {
|
|
721
728
|
maxItem = item.value;
|
|
722
729
|
}
|
|
723
|
-
if (item.value < minItem) {
|
|
730
|
+
if (item.value < minItem && !(propsData === null || propsData === void 0 ? void 0 : propsData[index].value)) {
|
|
724
731
|
minItem = item.value;
|
|
725
732
|
}
|
|
726
733
|
});
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -253,6 +253,7 @@ export interface horizSectionPropTypes {
|
|
|
253
253
|
secondaryStepHeight: number;
|
|
254
254
|
secondaryNegativeStepHeight: number;
|
|
255
255
|
customBackground?: CustomBackground;
|
|
256
|
+
onlyPositive?: boolean;
|
|
256
257
|
}
|
|
257
258
|
interface HorizSectionObject {
|
|
258
259
|
value: string;
|
|
@@ -332,6 +333,7 @@ export interface BarAndLineChartsWrapperTypes {
|
|
|
332
333
|
nestedScrollEnabled?: boolean;
|
|
333
334
|
dataSet?: DataSetNullSafe[];
|
|
334
335
|
customBackground?: CustomBackground;
|
|
336
|
+
onlyPositive?: boolean;
|
|
335
337
|
}
|
|
336
338
|
export interface HorizontalStripConfig {
|
|
337
339
|
thickness?: number;
|