gifted-charts-core 0.1.67 → 0.1.69
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/RenderBars.js +2 -1
- package/dist/BarChart/RenderStackBars.js +2 -1
- package/dist/BarChart/index.js +2 -1
- package/dist/LineChart/index.d.ts +1 -0
- package/dist/LineChart/index.js +301 -299
- package/dist/LineChart/types.d.ts +2 -1
- package/dist/PopulationPyramid/index.js +1 -1
- package/dist/RadarChart/index.d.ts +1 -0
- package/dist/RadarChart/index.js +32 -31
- package/dist/RadarChart/types.d.ts +2 -0
- package/dist/components/BarAndLineChartsWrapper/index.js +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/utils/constants.d.ts +2 -0
- package/dist/utils/constants.js +3 -1
- package/dist/utils/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GestureResponderEvent, StyleProp, TextStyle, ViewStyle, type ColorValue } from 'react-native';
|
|
2
2
|
import { type yAxisSides } from '../utils/constants';
|
|
3
|
-
import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap, type IntersectionAreaConfig, CustomBackground, SpreadData } from '../utils/types';
|
|
3
|
+
import { XAxisConfig, type CurveType, type DataSet, type EdgePosition, type HighlightedRange, type LineSegment, type Pointer, type RuleType, type RulesConfig, type arrowConfigType, type referenceConfigType, type secondaryLineConfigType, type secondaryYAxisType, type Linecap, type IntersectionAreaConfig, CustomBackground, SpreadData, ColorFromToY } from '../utils/types';
|
|
4
4
|
export interface LineChartPropsType {
|
|
5
5
|
height?: number;
|
|
6
6
|
overflowTop?: number;
|
|
@@ -154,6 +154,7 @@ export interface LineChartPropsType {
|
|
|
154
154
|
color3?: string;
|
|
155
155
|
color4?: string;
|
|
156
156
|
color5?: string;
|
|
157
|
+
colors?: ColorFromToY[];
|
|
157
158
|
yAxisThickness?: number;
|
|
158
159
|
yAxisColor?: ColorValue;
|
|
159
160
|
yAxisExtraHeight?: number;
|
|
@@ -60,7 +60,7 @@ export var usePopulationPyramid = function (props) {
|
|
|
60
60
|
: height;
|
|
61
61
|
var stepHeight = (_s = props.stepHeight) !== null && _s !== void 0 ? _s : containerHeight / noOfSections;
|
|
62
62
|
var xAxisLabelsHeight = 30;
|
|
63
|
-
var containerHeightWithXaxisLabels = containerHeight + xAxisLabelsHeight;
|
|
63
|
+
var containerHeightWithXaxisLabels = containerHeight + xAxisLabelsHeight + Math.max(0, xAxisLabelShiftY);
|
|
64
64
|
var mid = (width + yAxisLabelWidth) / 2;
|
|
65
65
|
var leftMax = Math.max.apply(Math, __spreadArray([], __read(data.map(function (item) { return item.left; })), false));
|
|
66
66
|
var rightMax = Math.max.apply(Math, __spreadArray([], __read(data.map(function (item) { return item.right; })), false));
|
package/dist/RadarChart/index.js
CHANGED
|
@@ -37,7 +37,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
37
37
|
import { radarChartDefaults } from '../utils/constants';
|
|
38
38
|
export var useRadarChart = function (props) {
|
|
39
39
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
40
|
-
var _u = props.circular, circular = _u === void 0 ? false : _u, _v = props.gridConfig, gridConfig = _v === void 0 ? {} : _v, _w = props.polygonConfig, polygonConfig = _w === void 0 ? {} : _w, _x = props.data, data = _x === void 0 ? [] : _x, dataSet = props.dataSet, _y = props.noOfSections, noOfSections = _y === void 0 ? radarChartDefaults.noOfSections : _y, _z = props.chartSize, chartSize = _z === void 0 ? radarChartDefaults.chartSize : _z, _0 = props.labelConfig, labelConfig = _0 === void 0 ? {} : _0, labelConfigArray = props.labelConfigArray, _1 = props.asterLinesConfig, asterLinesConfig = _1 === void 0 ? {} : _1, _2 = props.hideGrid, hideGrid = _2 === void 0 ? radarChartDefaults.hideGrid : _2, _3 = props.hideLabels, hideLabels = _3 === void 0 ? radarChartDefaults.hideLabels : _3, _4 = props.hideAsterLines, hideAsterLines = _4 === void 0 ? (_a = props.hideGrid) !== null && _a !== void 0 ? _a : radarChartDefaults.hideAsterLines : _4, _5 = props.dataLabelsConfig, dataLabelsConfig = _5 === void 0 ? {} : _5, _6 = props.labelsPositionOffset, labelsPositionOffset = _6 === void 0 ? radarChartDefaults.labelsPositionOffset : _6, _7 = props.dataLabelsPositionOffset, dataLabelsPositionOffset = _7 === void 0 ? radarChartDefaults.dataLabelsPositionOffset : _7, _8 = props.isAnimated, isAnimated = _8 === void 0 ? radarChartDefaults.isAnimated : _8, _9 = props.animationDuration, animationDuration = _9 === void 0 ? radarChartDefaults.animationDuration : _9, _10 = props.animateTogether, animateTogether = _10 === void 0 ? radarChartDefaults.animateTogether : _10;
|
|
40
|
+
var _u = props.circular, circular = _u === void 0 ? false : _u, _v = props.gridConfig, gridConfig = _v === void 0 ? {} : _v, _w = props.polygonConfig, polygonConfig = _w === void 0 ? {} : _w, _x = props.data, data = _x === void 0 ? [] : _x, dataSet = props.dataSet, _y = props.noOfSections, noOfSections = _y === void 0 ? radarChartDefaults.noOfSections : _y, _z = props.chartSize, chartSize = _z === void 0 ? radarChartDefaults.chartSize : _z, _0 = props.labelConfig, labelConfig = _0 === void 0 ? {} : _0, labelConfigArray = props.labelConfigArray, _1 = props.asterLinesConfig, asterLinesConfig = _1 === void 0 ? {} : _1, _2 = props.hideGrid, hideGrid = _2 === void 0 ? radarChartDefaults.hideGrid : _2, _3 = props.hideLabels, hideLabels = _3 === void 0 ? radarChartDefaults.hideLabels : _3, _4 = props.hideAsterLines, hideAsterLines = _4 === void 0 ? (_a = props.hideGrid) !== null && _a !== void 0 ? _a : radarChartDefaults.hideAsterLines : _4, _5 = props.dataLabelsConfig, dataLabelsConfig = _5 === void 0 ? {} : _5, _6 = props.labelsPositionOffset, labelsPositionOffset = _6 === void 0 ? radarChartDefaults.labelsPositionOffset : _6, _7 = props.dataLabelsPositionOffset, dataLabelsPositionOffset = _7 === void 0 ? radarChartDefaults.dataLabelsPositionOffset : _7, _8 = props.isAnimated, isAnimated = _8 === void 0 ? radarChartDefaults.isAnimated : _8, _9 = props.animationDuration, animationDuration = _9 === void 0 ? radarChartDefaults.animationDuration : _9, _10 = props.animateTogether, animateTogether = _10 === void 0 ? radarChartDefaults.animateTogether : _10, _11 = props.startAngle, startAngle = _11 === void 0 ? radarChartDefaults.startAngle : _11, _12 = props.isClockWise, isClockWise = _12 === void 0 ? radarChartDefaults.isClockWise : _12;
|
|
41
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
42
|
var getMax = function (dataSet) {
|
|
43
43
|
return dataSet.reduce(function (acc, set) {
|
|
@@ -58,31 +58,31 @@ export var useRadarChart = function (props) {
|
|
|
58
58
|
};
|
|
59
59
|
var center = chartSize / 2;
|
|
60
60
|
var radius = center * 0.8;
|
|
61
|
-
var
|
|
62
|
-
.strokeDashArray :
|
|
63
|
-
.gradientColor :
|
|
64
|
-
.showGradient :
|
|
65
|
-
.gradientOpacity :
|
|
61
|
+
var _13 = gridConfig.stroke, gridStroke = _13 === void 0 ? radarChartDefaults.gridSection.stroke : _13, _14 = gridConfig.strokeWidth, gridStrokeWidth = _14 === void 0 ? radarChartDefaults.gridSection.strokeWidth : _14, _15 = gridConfig.strokeDashArray, gridStrokeDashArray = _15 === void 0 ? radarChartDefaults.gridSection
|
|
62
|
+
.strokeDashArray : _15, _16 = gridConfig.fill, gridFill = _16 === void 0 ? radarChartDefaults.gridSection.fill : _16, _17 = gridConfig.gradientColor, gridGradientColor = _17 === void 0 ? radarChartDefaults.gridSection
|
|
63
|
+
.gradientColor : _17, _18 = gridConfig.showGradient, gridShowGradient = _18 === void 0 ? radarChartDefaults.gridSection
|
|
64
|
+
.showGradient : _18, _19 = gridConfig.opacity, gridOpacity = _19 === void 0 ? radarChartDefaults.gridSection.opacity : _19, _20 = gridConfig.gradientOpacity, gridGradientOpacity = _20 === void 0 ? radarChartDefaults.gridSection
|
|
65
|
+
.gradientOpacity : _20;
|
|
66
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
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
dataLabelsColor =
|
|
71
|
-
|
|
72
|
-
dataLabelsTextAnchor =
|
|
73
|
-
|
|
74
|
-
dataLabelsAlignmentBaseline =
|
|
75
|
-
|
|
76
|
-
dataLabelsFontWeight =
|
|
77
|
-
|
|
67
|
+
var _21 = labelConfig.fontSize, fontSize = _21 === void 0 ? radarChartDefaults.labelConfig.fontSize : _21, _22 = labelConfig.stroke, stroke = _22 === void 0 ? radarChartDefaults.labelConfig.stroke : _22, _23 = labelConfig.textAnchor, textAnchor = _23 === void 0 ? radarChartDefaults.labelConfig.textAnchor : _23, _24 = labelConfig.alignmentBaseline, alignmentBaseline = _24 === void 0 ? radarChartDefaults.labelConfig.alignmentBaseline : _24, _25 = labelConfig.fontWeight, fontWeight = _25 === void 0 ? radarChartDefaults.labelConfig.fontWeight : _25, _26 = labelConfig.fontFamily, fontFamily = _26 === void 0 ? radarChartDefaults.labelConfig.fontFamily : _26;
|
|
68
|
+
var _27 = dataLabelsConfig.fontSize, dataLabelsFontSize = _27 === void 0 ? fontSize : _27, // defaults to labelConfig (from above)
|
|
69
|
+
_28 = dataLabelsConfig.stroke, // defaults to labelConfig (from above)
|
|
70
|
+
dataLabelsColor = _28 === void 0 ? stroke : _28, // defaults to labelConfig (from above)
|
|
71
|
+
_29 = dataLabelsConfig.textAnchor, // defaults to labelConfig (from above)
|
|
72
|
+
dataLabelsTextAnchor = _29 === void 0 ? textAnchor : _29, // defaults to labelConfig (from above)
|
|
73
|
+
_30 = dataLabelsConfig.alignmentBaseline, // defaults to labelConfig (from above)
|
|
74
|
+
dataLabelsAlignmentBaseline = _30 === void 0 ? alignmentBaseline : _30, // defaults to labelConfig (from above)
|
|
75
|
+
_31 = dataLabelsConfig.fontWeight, // defaults to labelConfig (from above)
|
|
76
|
+
dataLabelsFontWeight = _31 === void 0 ? fontWeight : _31, // defaults to labelConfig (from above)
|
|
77
|
+
_32 = dataLabelsConfig.fontFamily // defaults to labelConfig (from above)
|
|
78
78
|
, // defaults to labelConfig (from above)
|
|
79
|
-
dataLabelsFontFamily =
|
|
79
|
+
dataLabelsFontFamily = _32 === void 0 ? fontFamily : _32 // defaults to labelConfig (from above)
|
|
80
80
|
;
|
|
81
|
-
var
|
|
82
|
-
.strokeWidth :
|
|
83
|
-
.strokeDashArray :
|
|
84
|
-
.gradientColor :
|
|
85
|
-
.showGradient :
|
|
81
|
+
var _33 = polygonConfig.stroke, polygonStroke = _33 === void 0 ? radarChartDefaults.polygonConfig.stroke : _33, _34 = polygonConfig.strokeWidth, polygonStrokeWidth = _34 === void 0 ? radarChartDefaults.polygonConfig
|
|
82
|
+
.strokeWidth : _34, _35 = polygonConfig.strokeDashArray, polygonStrokeDashArray = _35 === void 0 ? radarChartDefaults.polygonConfig
|
|
83
|
+
.strokeDashArray : _35, _36 = polygonConfig.fill, polygonFill = _36 === void 0 ? radarChartDefaults.polygonConfig.fill : _36, _37 = polygonConfig.gradientColor, polygonGradientColor = _37 === void 0 ? radarChartDefaults.polygonConfig
|
|
84
|
+
.gradientColor : _37, _38 = polygonConfig.showGradient, polygonShowGradient = _38 === void 0 ? radarChartDefaults.polygonConfig
|
|
85
|
+
.showGradient : _38, _39 = polygonConfig.opacity, polygonOpacity = _39 === void 0 ? radarChartDefaults.polygonConfig.opacity : _39, _40 = polygonConfig.gradientOpacity, polygonGradientOpacity = _40 === void 0 ? polygonOpacity : _40, showDataValuesAsLabels = polygonConfig.showDataValuesAsLabels, _41 = polygonConfig.isAnimated, polygonIsAnimated = _41 === void 0 ? isAnimated : _41, _42 = polygonConfig.animationDuration, polygonAnimationDuration = _42 === void 0 ? animationDuration : _42;
|
|
86
86
|
var polygonConfigArray = (_l = (_k = props.polygonConfigArray) === null || _k === void 0 ? void 0 : _k.map(function (set) {
|
|
87
87
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
88
88
|
return ({
|
|
@@ -147,27 +147,27 @@ export var useRadarChart = function (props) {
|
|
|
147
147
|
});
|
|
148
148
|
});
|
|
149
149
|
})) !== null && _r !== void 0 ? _r : (dataSet ? Array(dataSet.length).fill(dataLabelsConfigArray) : null);
|
|
150
|
-
var
|
|
150
|
+
var _43 = asterLinesConfig.stroke, asterLinesStroke = _43 === void 0 ? gridStroke : _43, _44 = asterLinesConfig.strokeWidth, asterLinesStrokeWidth = _44 === void 0 ? gridStrokeWidth : _44, _45 = asterLinesConfig.strokeDashArray, asterLinesStrokeDashArray = _45 === void 0 ? radarChartDefaults.asterLineStrokeDashArray : _45;
|
|
151
151
|
// Calculate angles for each category
|
|
152
|
-
var angleStep = 360 / labels.length;
|
|
152
|
+
var angleStep = (360 / labels.length) * (isClockWise ? -1 : 1);
|
|
153
153
|
// Generate coordinates for the data points
|
|
154
154
|
var points = data.map(function (value, index) {
|
|
155
|
-
var angle = index * angleStep;
|
|
155
|
+
var angle = index * angleStep + startAngle;
|
|
156
156
|
return polarToCartesian(angle, value);
|
|
157
157
|
});
|
|
158
158
|
var initialPoints = data.map(function (value, index) {
|
|
159
|
-
var angle = index * angleStep;
|
|
159
|
+
var angle = index * angleStep + startAngle;
|
|
160
160
|
return polarToCartesian(angle, 0);
|
|
161
161
|
});
|
|
162
162
|
var pointsArray = (_s = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
|
|
163
163
|
return set.map(function (value, index) {
|
|
164
|
-
var angle = index * angleStep;
|
|
164
|
+
var angle = index * angleStep + startAngle;
|
|
165
165
|
return polarToCartesian(angle, value);
|
|
166
166
|
});
|
|
167
167
|
})) !== null && _s !== void 0 ? _s : [];
|
|
168
168
|
var initialPointsArray = (_t = dataSet === null || dataSet === void 0 ? void 0 : dataSet.map(function (set) {
|
|
169
169
|
return set.map(function (value, index) {
|
|
170
|
-
var angle = index * angleStep;
|
|
170
|
+
var angle = index * angleStep + startAngle;
|
|
171
171
|
return polarToCartesian(angle, 0);
|
|
172
172
|
});
|
|
173
173
|
})) !== null && _t !== void 0 ? _t : [];
|
|
@@ -193,7 +193,7 @@ export var useRadarChart = function (props) {
|
|
|
193
193
|
var gridShowGradientLocal = gridItem.showGradient || gridShowGradient;
|
|
194
194
|
var gridStrokeDashArrayLocal = gridItem.strokeDashArray || gridStrokeDashArray;
|
|
195
195
|
var levelPoints = labels.map(function (_, index) {
|
|
196
|
-
var angle = index * angleStep;
|
|
196
|
+
var angle = index * angleStep + startAngle;
|
|
197
197
|
return polarToCartesian(angle, (level / noOfSections) * maxValue);
|
|
198
198
|
});
|
|
199
199
|
var levelPolygonPoints = levelPoints
|
|
@@ -279,6 +279,7 @@ export var useRadarChart = function (props) {
|
|
|
279
279
|
hideLabels: hideLabels,
|
|
280
280
|
hideAsterLines: hideAsterLines,
|
|
281
281
|
getGridLevelProps: getGridLevelProps,
|
|
282
|
-
animateTogether: animateTogether
|
|
282
|
+
animateTogether: animateTogether,
|
|
283
|
+
startAngle: startAngle
|
|
283
284
|
};
|
|
284
285
|
};
|
|
@@ -193,7 +193,9 @@ export var useBarAndLineChartsWrapper = function (props) {
|
|
|
193
193
|
containerHeight: containerHeight,
|
|
194
194
|
containerHeightIncludingBelowXAxis: containerHeightIncludingBelowXAxis,
|
|
195
195
|
lineConfig: lineConfig,
|
|
196
|
-
maxValue: (
|
|
196
|
+
maxValue: (lineConfig === null || lineConfig === void 0 ? void 0 : lineConfig.isSecondary)
|
|
197
|
+
? (_15 = secondaryYAxis === null || secondaryYAxis === void 0 ? void 0 : secondaryYAxis.maxValue) !== null && _15 !== void 0 ? _15 : maxValue
|
|
198
|
+
: maxValue,
|
|
197
199
|
animatedWidth: animatedWidth,
|
|
198
200
|
lineBehindBars: lineBehindBars,
|
|
199
201
|
points: points,
|
package/dist/index.d.ts
CHANGED
|
@@ -42,4 +42,4 @@ export { type StripAndLabelProps } from './components/common/types';
|
|
|
42
42
|
/***********************************************************************************************************************/
|
|
43
43
|
export { getCumulativeWidth, getLighterColor, svgQuadraticCurvePath, svgPath, bezierCommand, getSegmentString, getCurvePathWithSegments, getPreviousSegmentsLastPoint, getPathWithHighlight, getRegionPathObjects, getSegmentedPathObjects, getArrowPoints, getAxesAndRulesProps, getExtendedContainerHeightWithPadding, getSecondaryDataWithOffsetIncluded, getArrowProperty, getAllArrowProperties, maxAndMinUtil, computeMaxAndMinItems, getLabelTextUtil, getXForLineInBar, getYForLineInBar, clone, getLineConfigForBarChart, adjustToOffset, pointsWithPaddedRepititions } from './utils';
|
|
44
44
|
export { chartTypes, yAxisSides, loc, SEGMENT_START, SEGMENT_END, RANGE_ENTER, RANGE_EXIT, STOP, ruleTypes, AxesAndRulesDefaults, defaultArrowConfig, BarDefaults, defaultLineConfig, LineDefaults, defaultPointerConfig, pieColors, populationDefaults, defaultAnimationDuration } from './utils/constants';
|
|
45
|
-
export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, type DataSetNullSafe, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap, type IntersectionAreaConfig, type LabelLineConfig, type TooltipProps, type SpreadData } from './utils/types';
|
|
45
|
+
export { type RuleType, type RuleTypes, type RulesConfig, CurveType, EdgePosition, type LabelsPosition, type PointerEvents, type secondaryYAxisType, type secondaryLineConfigType, type referenceConfigType, type arrowConfigType, type horizSectionPropTypes, type HorizSectionsType, type BarAndLineChartsWrapperTypes, type Pointer, type HighlightedRange, type LineSegment, type LineSvgProps, type LineProperties, type DataSet, type DataSetNullSafe, Framework, type XAxisConfig, type LineInBarChartPropsType, type DataPointProps, type Linecap, type IntersectionAreaConfig, type LabelLineConfig, type TooltipProps, type SpreadData, type ColorFromToY } from './utils/types';
|
package/dist/utils/constants.js
CHANGED
package/dist/utils/types.d.ts
CHANGED