@redsift/charts 10.0.0 → 10.1.0-alpha.0
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/index.d.ts +16 -8
- package/index.js +322 -48
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -130,19 +130,24 @@ type EmptyDatum<T> = {
|
|
|
130
130
|
percent?: number;
|
|
131
131
|
};
|
|
132
132
|
type CategoryDim = string;
|
|
133
|
-
type
|
|
134
|
-
type
|
|
133
|
+
type LinearDim = number | Date | string;
|
|
134
|
+
type CategoricalOrLinearDim = CategoryDim | LinearDim;
|
|
135
|
+
type TwoCategoryDim = [CategoricalOrLinearDim, CategoryDim | undefined | null];
|
|
136
|
+
type CoordinatesCategoryDim = [number, number, CategoryDim | undefined | null];
|
|
135
137
|
type CategoryDatum = Datum<CategoryDim>;
|
|
138
|
+
type LinearDatum = Datum<LinearDim>;
|
|
136
139
|
type TwoCategoryDatum = EmptyDatum<TwoCategoryDim>;
|
|
137
140
|
type CoordinatesCategoryDatum = Datum<CoordinatesCategoryDim>;
|
|
138
141
|
type CategoryData = CategoryDatum[];
|
|
142
|
+
type LinearData = LinearDatum[];
|
|
139
143
|
type TwoCategoryData = TwoCategoryDatum[];
|
|
140
144
|
type CoordinatesCategoryData = CoordinatesCategoryDatum[];
|
|
141
145
|
type ArcDatum = PieArcDatum<CategoryDatum>;
|
|
142
146
|
type BarDatum = {
|
|
143
|
-
data: CategoryDatum
|
|
147
|
+
data: CategoryDatum | LinearDatum | Datum<TwoCategoryDim>;
|
|
144
148
|
height?: number;
|
|
145
149
|
width?: number;
|
|
150
|
+
category?: string | null;
|
|
146
151
|
};
|
|
147
152
|
type DotDatum = {
|
|
148
153
|
data: EmptyDatum<CoordinatesCategoryDim | TwoCategoryDim>;
|
|
@@ -297,6 +302,7 @@ declare const useColor: ({ data, colorTheme, category, theme }: UseColorProps) =
|
|
|
297
302
|
|
|
298
303
|
type SortingMethod = 'none' | 'asc-key' | 'desc-key' | 'asc-value' | 'desc-value' | string[] | ((a: CategoryDatum, b: CategoryDatum) => 1 | -1);
|
|
299
304
|
declare const getSortingMethod: (sortingMethod: SortingMethod) => (a: CategoryDatum, b: CategoryDatum) => 1 | -1;
|
|
305
|
+
declare const isValidDate: (value: string) => boolean;
|
|
300
306
|
|
|
301
307
|
interface UseFormatCategoricalDataProps {
|
|
302
308
|
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
@@ -484,10 +490,12 @@ interface BarProps extends DataPointProps<BarDatum> {
|
|
|
484
490
|
orientation?: BarOrientation;
|
|
485
491
|
/** A linear continuous scale defined over a numeric domain used to determine the width or height of the bar (depending on the orientation). */
|
|
486
492
|
scale: ScaleLinear$1<number, number, never>;
|
|
493
|
+
/** A scale defined over a numeric/time/ordinal domain used to determine the position of the bar. */
|
|
494
|
+
scalePosition: ScaleLinear$1<number, number, never> | ScaleTime$2<number, number, never> | ScalePoint$2<string>;
|
|
487
495
|
/** Width of the bar in vertical orientation. */
|
|
488
496
|
width?: number;
|
|
489
497
|
}
|
|
490
|
-
type StyledBarProps = StyledDataPointProps & Omit<BarProps, 'scale'> & {
|
|
498
|
+
type StyledBarProps = StyledDataPointProps & Omit<BarProps, 'scale' | 'scalePosition'> & {
|
|
491
499
|
$theme: Theme;
|
|
492
500
|
};
|
|
493
501
|
|
|
@@ -498,7 +506,7 @@ declare const Bar: Comp<BarProps, SVGGElement>;
|
|
|
498
506
|
*/
|
|
499
507
|
declare const StyledBar: styled_components.StyledComponent<_redsift_design_system.Comp<DataPointProps<any>, SVGGElement>, any, Omit<DataPointProps<any>, "data"> & {
|
|
500
508
|
$clickable: boolean;
|
|
501
|
-
} & Omit<BarProps, "scale"> & {
|
|
509
|
+
} & Omit<BarProps, "scale" | "scalePosition"> & {
|
|
502
510
|
$theme: Theme;
|
|
503
511
|
}, never>;
|
|
504
512
|
|
|
@@ -557,7 +565,7 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
557
565
|
/** Number of categories to use, the rest being put into a new category called "Others". */
|
|
558
566
|
caping?: number;
|
|
559
567
|
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
560
|
-
data?: CategoryData;
|
|
568
|
+
data?: CategoryData | LinearData | TwoCategoryData;
|
|
561
569
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
562
570
|
emptyComponent?: ReactNode;
|
|
563
571
|
/** Method to determine whether a slice is selected or not. */
|
|
@@ -623,7 +631,7 @@ type DotVariant = ValueOf<typeof DotVariant>;
|
|
|
623
631
|
* Component props.
|
|
624
632
|
*/
|
|
625
633
|
interface DotProps extends DataPointProps<DotDatum> {
|
|
626
|
-
/** A
|
|
634
|
+
/** A scale defined over a numeric/time/ordinal domain used to determine the x position based on the coordinates. */
|
|
627
635
|
scaleX: ScaleLinear$1<number, number, never> | ScaleTime$2<number, number, never> | ScalePoint$2<string>;
|
|
628
636
|
/** A linear continuous scale defined over a numeric domain used to determine the y position based on the coordinates. */
|
|
629
637
|
scaleY: ScaleLinear$1<number, number, never>;
|
|
@@ -1025,4 +1033,4 @@ declare const StyledScatterPlotEmptyText: styled_components.StyledComponent<"div
|
|
|
1025
1033
|
$theme: Theme;
|
|
1026
1034
|
}, never>;
|
|
1027
1035
|
|
|
1028
|
-
export { AnyScale, Arc, ArcDatum, ArcProps, Arcs, ArcsProps, Axis, AxisPosition, AxisProps, AxisVariant, Bar, BarChart, BarChartDimensions, BarChartProps, BarDatum, BarOrientation, BarProps, CategoryData, CategoryDatum, CategoryDim, ChartAxesProps, ChartContainer, ChartContainerProps, ChartDimensions, ChartSize, ChartTheme, ColorTheme, Coordinates, CoordinatesCategoryData, CoordinatesCategoryDatum, CoordinatesCategoryDim, CustomColorTheme, DataPoint, DataPointProps, Datum, Dot, DotDatum, DotProps, DotVariant, EmptyDatum, JSONArray, JSONObject, JSONValue, LabelVariant, Legend, LegendItemDatum, LegendProps, LegendVariant, Line, LineChart, LineChartDimensions, LineChartLegendVariant, LineChartProps, LinePointDatum, LineProps, MarginProps, NumericValue, PieChart, PieChartDimensions, PieChartLegendVariant, PieChartProps, PieChartVariant, Scale, ScaleBand, ScaleLinear, ScaleLog, ScalePoint, ScaleSymlog, ScaleTime, ScaleTypeToScale, ScaleValue, ScaleWithBandwidth, ScatterPlot, ScatterPlotDimensions, ScatterPlotLegendVariant, ScatterPlotProps, ScatterPlotVariant, SortingMethod, Statistic, Statistics, StringValue, StyledArc, StyledArcProps, StyledArcs, StyledArcsProps, StyledAxis, StyledAxisProps, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledBarChartProps, StyledBarProps, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerProps, StyledChartContainerTitle, StyledDataPoint, StyledDataPointProps, StyledDot, StyledDotProps, StyledLegend, StyledLegendProps, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledLineChartProps, StyledLineProps, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartProps, StyledScatterPlot, StyledScatterPlotEmptyText, StyledScatterPlotProps, SuccessDangerColorTheme, TicksSpec, TooltipVariant, TwoCategoryData, TwoCategoryDatum, TwoCategoryDim, UseBrushProps, UseColorProps, UseFormatCategoricalDataProps, UseZoomProps, empty, getColorScale, getSortingMethod, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|
|
1036
|
+
export { AnyScale, Arc, ArcDatum, ArcProps, Arcs, ArcsProps, Axis, AxisPosition, AxisProps, AxisVariant, Bar, BarChart, BarChartDimensions, BarChartProps, BarDatum, BarOrientation, BarProps, CategoricalOrLinearDim, CategoryData, CategoryDatum, CategoryDim, ChartAxesProps, ChartContainer, ChartContainerProps, ChartDimensions, ChartSize, ChartTheme, ColorTheme, Coordinates, CoordinatesCategoryData, CoordinatesCategoryDatum, CoordinatesCategoryDim, CustomColorTheme, DataPoint, DataPointProps, Datum, Dot, DotDatum, DotProps, DotVariant, EmptyDatum, JSONArray, JSONObject, JSONValue, LabelVariant, Legend, LegendItemDatum, LegendProps, LegendVariant, Line, LineChart, LineChartDimensions, LineChartLegendVariant, LineChartProps, LinePointDatum, LineProps, LinearData, LinearDatum, LinearDim, MarginProps, NumericValue, PieChart, PieChartDimensions, PieChartLegendVariant, PieChartProps, PieChartVariant, Scale, ScaleBand, ScaleLinear, ScaleLog, ScalePoint, ScaleSymlog, ScaleTime, ScaleTypeToScale, ScaleValue, ScaleWithBandwidth, ScatterPlot, ScatterPlotDimensions, ScatterPlotLegendVariant, ScatterPlotProps, ScatterPlotVariant, SortingMethod, Statistic, Statistics, StringValue, StyledArc, StyledArcProps, StyledArcs, StyledArcsProps, StyledAxis, StyledAxisProps, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledBarChartProps, StyledBarProps, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerProps, StyledChartContainerTitle, StyledDataPoint, StyledDataPointProps, StyledDot, StyledDotProps, StyledLegend, StyledLegendProps, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledLineChartProps, StyledLineProps, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartProps, StyledScatterPlot, StyledScatterPlotEmptyText, StyledScatterPlotProps, SuccessDangerColorTheme, TicksSpec, TooltipVariant, TwoCategoryData, TwoCategoryDatum, TwoCategoryDim, UseBrushProps, UseColorProps, UseFormatCategoricalDataProps, UseZoomProps, empty, getColorScale, getSortingMethod, isValidDate, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|
package/index.js
CHANGED
|
@@ -223,6 +223,10 @@ const getSortingMethod = sortingMethod => {
|
|
|
223
223
|
}
|
|
224
224
|
return () => -1;
|
|
225
225
|
};
|
|
226
|
+
const isValidDate = value => {
|
|
227
|
+
const date = new Date(value);
|
|
228
|
+
return date instanceof Date && !isNaN(date) && !isNaN(Date.parse(value));
|
|
229
|
+
};
|
|
226
230
|
|
|
227
231
|
const useFormatCategoricalData = _ref => {
|
|
228
232
|
let {
|
|
@@ -359,7 +363,7 @@ var k=/^--/;function I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeo
|
|
|
359
363
|
*/
|
|
360
364
|
const StyledDataPoint = styled(it.g)``;
|
|
361
365
|
|
|
362
|
-
const _excluded$
|
|
366
|
+
const _excluded$q = ["children", "className", "data", "id", "index", "isSelected", "labelDecorator", "onClick", "role", "tooltipDecorator", "tooltipVariant", "theme"];
|
|
363
367
|
const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
|
|
364
368
|
const {
|
|
365
369
|
children,
|
|
@@ -375,7 +379,7 @@ const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
375
379
|
tooltipVariant,
|
|
376
380
|
theme: propsTheme
|
|
377
381
|
} = props,
|
|
378
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
382
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$q);
|
|
379
383
|
const [_id] = useId();
|
|
380
384
|
const id = propsId !== null && propsId !== void 0 ? propsId : _id;
|
|
381
385
|
const theme = useTheme(propsTheme);
|
|
@@ -493,7 +497,7 @@ const config = (() => ({
|
|
|
493
497
|
immediate: false
|
|
494
498
|
}))();
|
|
495
499
|
|
|
496
|
-
const _excluded$
|
|
500
|
+
const _excluded$p = ["className", "createArc", "hasStroke", "previousData"];
|
|
497
501
|
const COMPONENT_NAME$c = 'Arc';
|
|
498
502
|
const CLASSNAME$c = 'redsift-arc';
|
|
499
503
|
const DEFAULT_PROPS$c = {
|
|
@@ -525,7 +529,7 @@ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
525
529
|
hasStroke,
|
|
526
530
|
previousData
|
|
527
531
|
} = props,
|
|
528
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
532
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$p);
|
|
529
533
|
const theme = useTheme();
|
|
530
534
|
const interpolator = interpolate(previousData, data);
|
|
531
535
|
const isSelectable = role === 'option';
|
|
@@ -560,7 +564,7 @@ Arc.displayName = COMPONENT_NAME$c;
|
|
|
560
564
|
*/
|
|
561
565
|
const StyledArcs = styled.g``;
|
|
562
566
|
|
|
563
|
-
const _excluded$
|
|
567
|
+
const _excluded$o = ["arcs", "className", "color", "hasLabels", "hasStroke", "id", "labelDecorator", "onClick", "role", "sliceProps", "tooltipVariant"];
|
|
564
568
|
const COMPONENT_NAME$b = 'Arcs';
|
|
565
569
|
const CLASSNAME$b = 'redsift-arcs';
|
|
566
570
|
const DEFAULT_PROPS$b = {};
|
|
@@ -578,7 +582,7 @@ const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
578
582
|
sliceProps,
|
|
579
583
|
tooltipVariant
|
|
580
584
|
} = props,
|
|
581
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
585
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$o);
|
|
582
586
|
const [_id] = useId();
|
|
583
587
|
const id = propsId !== null && propsId !== void 0 ? propsId : _id;
|
|
584
588
|
const animatedProps = J(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
@@ -804,7 +808,7 @@ const computeTicks = _ref => {
|
|
|
804
808
|
};
|
|
805
809
|
};
|
|
806
810
|
|
|
807
|
-
const _excluded$
|
|
811
|
+
const _excluded$n = ["className", "length", "legend", "legendOffset", "legendPosition", "position", "scale", "tickPadding", "tickRotation", "tickSize", "tickValues", "tickFormat", "variant", "x", "y"];
|
|
808
812
|
const COMPONENT_NAME$a = 'Axis';
|
|
809
813
|
const CLASSNAME$a = 'redsift-axis';
|
|
810
814
|
const DEFAULT_PROPS$a = {
|
|
@@ -837,7 +841,7 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
837
841
|
x,
|
|
838
842
|
y
|
|
839
843
|
} = props,
|
|
840
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
844
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$n);
|
|
841
845
|
const theme = useTheme();
|
|
842
846
|
const axis = getAxisType(position);
|
|
843
847
|
const axisRef = ref || useRef();
|
|
@@ -1044,7 +1048,7 @@ const StyledBar = styled(DataPoint)`
|
|
|
1044
1048
|
}}}
|
|
1045
1049
|
`;
|
|
1046
1050
|
|
|
1047
|
-
const _excluded$
|
|
1051
|
+
const _excluded$m = ["className", "gap", "height", "maxHeight", "orientation", "previousData", "scale", "scalePosition", "width"];
|
|
1048
1052
|
const COMPONENT_NAME$9 = 'Bar';
|
|
1049
1053
|
const CLASSNAME$9 = 'redsift-bar';
|
|
1050
1054
|
const DEFAULT_PROPS$9 = {
|
|
@@ -1081,9 +1085,10 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1081
1085
|
orientation,
|
|
1082
1086
|
previousData,
|
|
1083
1087
|
scale,
|
|
1088
|
+
scalePosition,
|
|
1084
1089
|
width
|
|
1085
1090
|
} = props,
|
|
1086
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
1091
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$m);
|
|
1087
1092
|
const theme = useTheme();
|
|
1088
1093
|
const interpolator = interpolate(((_data = previousData.data) === null || _data === void 0 ? void 0 : _data.value) || 0, data.data.value);
|
|
1089
1094
|
const text = labelDecorator ? labelDecorator(data, {
|
|
@@ -1094,6 +1099,7 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1094
1099
|
const isSelectable = role === 'option';
|
|
1095
1100
|
const isDeselected = isSelectable && propsIsSelected === false;
|
|
1096
1101
|
const isHorizontal = orientation === BarOrientation.horizontal;
|
|
1102
|
+
const isOrdinal = typeof scalePosition.domain()[0] === 'string';
|
|
1097
1103
|
const animatedProps = J(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
1098
1104
|
to: async next => {
|
|
1099
1105
|
await next({
|
|
@@ -1107,7 +1113,7 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1107
1113
|
return /*#__PURE__*/React__default.createElement(StyledBar, _extends({}, forwardedProps, {
|
|
1108
1114
|
ref: ref,
|
|
1109
1115
|
className: classNames(Bar.className, className),
|
|
1110
|
-
transform: isHorizontal ? `translate(0, ${
|
|
1116
|
+
transform: isHorizontal ? `translate(0, ${scalePosition(data.data.key) + gap / 2})` : `translate(${scalePosition(data.data.key) + (isOrdinal ? width + gap / 2 : width / 2)}, ${maxHeight}), rotate(180)`,
|
|
1111
1117
|
$clickable: Boolean(onClick),
|
|
1112
1118
|
$theme: theme
|
|
1113
1119
|
}), isHorizontal ? /*#__PURE__*/React__default.createElement(it.rect, {
|
|
@@ -1188,7 +1194,7 @@ const StyledChartContainerCaption = styled.p`
|
|
|
1188
1194
|
margin: 8px;
|
|
1189
1195
|
`;
|
|
1190
1196
|
|
|
1191
|
-
const _excluded$
|
|
1197
|
+
const _excluded$l = ["aria-label", "aria-labelledby", "description", "chartProps", "chartRef", "children", "className", "id", "title", "onReset", "theme"];
|
|
1192
1198
|
const COMPONENT_NAME$8 = 'ChartContainer';
|
|
1193
1199
|
const CLASSNAME$8 = 'redsift-chart-container';
|
|
1194
1200
|
const DEFAULT_PROPS$8 = {};
|
|
@@ -1206,7 +1212,7 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1206
1212
|
onReset,
|
|
1207
1213
|
theme: propsTheme
|
|
1208
1214
|
} = props,
|
|
1209
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
1215
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$l);
|
|
1210
1216
|
const [_id] = useId();
|
|
1211
1217
|
const id = propsId !== null && propsId !== void 0 ? propsId : _id;
|
|
1212
1218
|
const theme = useTheme(propsTheme);
|
|
@@ -1327,8 +1333,45 @@ const sizeToDimension$3 = size => {
|
|
|
1327
1333
|
};
|
|
1328
1334
|
}
|
|
1329
1335
|
};
|
|
1336
|
+
const statsBy$1 = (arr, sortingMethod) => {
|
|
1337
|
+
const isKeyArray = Array.isArray(arr[0].key);
|
|
1338
|
+
const counts = arr.reduce((prev, curr) => {
|
|
1339
|
+
if (!curr.value) {
|
|
1340
|
+
return prev;
|
|
1341
|
+
}
|
|
1342
|
+
const currentKey = isKeyArray ? curr.key[1] : 'default';
|
|
1343
|
+
if (!prev[currentKey]) {
|
|
1344
|
+
prev[currentKey] = {
|
|
1345
|
+
value: curr.value,
|
|
1346
|
+
min: curr.value,
|
|
1347
|
+
max: curr.value,
|
|
1348
|
+
values: [curr.value]
|
|
1349
|
+
};
|
|
1350
|
+
} else {
|
|
1351
|
+
prev[currentKey] = {
|
|
1352
|
+
value: prev[currentKey].value + curr.value,
|
|
1353
|
+
min: Math.min(prev[currentKey].min, curr.value),
|
|
1354
|
+
max: Math.max(prev[currentKey].max, curr.value),
|
|
1355
|
+
values: [...prev[currentKey].values, curr.value]
|
|
1356
|
+
};
|
|
1357
|
+
}
|
|
1358
|
+
return prev;
|
|
1359
|
+
}, {});
|
|
1360
|
+
return Object.keys(counts).map(key => ({
|
|
1361
|
+
key: key,
|
|
1362
|
+
value: counts[key].value,
|
|
1363
|
+
min: counts[key].min,
|
|
1364
|
+
max: counts[key].max,
|
|
1365
|
+
values: counts[key].values,
|
|
1366
|
+
first: counts[key].values[0],
|
|
1367
|
+
last: counts[key].values[counts[key].values.length - 1],
|
|
1368
|
+
trending: {
|
|
1369
|
+
overall: (counts[key].values[counts[key].values.length - 1] - counts[key].values[0]) * 100 / counts[key].values[0]
|
|
1370
|
+
}
|
|
1371
|
+
})).sort(getSortingMethod(sortingMethod));
|
|
1372
|
+
};
|
|
1330
1373
|
|
|
1331
|
-
const _excluded$
|
|
1374
|
+
const _excluded$k = ["className", "emptyComponent", "size", "localeText"];
|
|
1332
1375
|
const EmptyBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1333
1376
|
const {
|
|
1334
1377
|
className,
|
|
@@ -1336,7 +1379,7 @@ const EmptyBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1336
1379
|
size,
|
|
1337
1380
|
localeText
|
|
1338
1381
|
} = props,
|
|
1339
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
1382
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$k);
|
|
1340
1383
|
const theme = useTheme();
|
|
1341
1384
|
const chartDimensions = sizeToDimension$3(size);
|
|
1342
1385
|
const width = chartDimensions.width;
|
|
@@ -1375,20 +1418,20 @@ const EmptyBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1375
1418
|
})))));
|
|
1376
1419
|
});
|
|
1377
1420
|
|
|
1378
|
-
const _excluded$
|
|
1421
|
+
const _excluded$j = ["className"];
|
|
1379
1422
|
const LoadingBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1380
1423
|
const {
|
|
1381
1424
|
className
|
|
1382
1425
|
} = props,
|
|
1383
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
1426
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$j);
|
|
1384
1427
|
return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({}, forwardedProps, {
|
|
1385
1428
|
className: className,
|
|
1386
1429
|
ref: ref
|
|
1387
1430
|
}), "Loading...");
|
|
1388
1431
|
});
|
|
1389
1432
|
|
|
1390
|
-
const _excluded$
|
|
1391
|
-
const
|
|
1433
|
+
const _excluded$i = ["areXLabelsRotated", "barProps", "caping", "className", "data", "id", "isBarSelected", "labelDecorator", "margins", "onBarClick", "orientation", "others", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues"];
|
|
1434
|
+
const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1392
1435
|
const {
|
|
1393
1436
|
areXLabelsRotated,
|
|
1394
1437
|
barProps,
|
|
@@ -1422,7 +1465,7 @@ const RenderedBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1422
1465
|
yAxisTickSize,
|
|
1423
1466
|
yAxisTickValues
|
|
1424
1467
|
} = props,
|
|
1425
|
-
forwardedProps = _objectWithoutProperties(props, _excluded$
|
|
1468
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$i);
|
|
1426
1469
|
const cache = useRef();
|
|
1427
1470
|
const theme = useTheme();
|
|
1428
1471
|
const {
|
|
@@ -1455,8 +1498,8 @@ const RenderedBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1455
1498
|
const chartWidth = width - margins.left - margins.right;
|
|
1456
1499
|
const numberOfRows = data.filter(datum => datum.value).length;
|
|
1457
1500
|
const gap = 5;
|
|
1458
|
-
const barHeight =
|
|
1459
|
-
const barWidth =
|
|
1501
|
+
const barHeight = chartHeight / numberOfRows - gap;
|
|
1502
|
+
const barWidth = chartWidth / numberOfRows - gap;
|
|
1460
1503
|
const total = sum(data, d => d.value);
|
|
1461
1504
|
const scale = useMemo(() => scaleLinear().domain([0, Math.max(...data.map(_ref => {
|
|
1462
1505
|
let {
|
|
@@ -1522,7 +1565,9 @@ const RenderedBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1522
1565
|
tickSize: yAxisTickSize,
|
|
1523
1566
|
tickFormat: yAxisTickFormat,
|
|
1524
1567
|
variant: yAxisVariant
|
|
1525
|
-
}) : null,
|
|
1568
|
+
}) : null), /*#__PURE__*/React__default.createElement("g", {
|
|
1569
|
+
transform: `translate(${margins.left},${margins.top})`
|
|
1570
|
+
}, data.filter(datum => datum.value).map((datum, index) => {
|
|
1526
1571
|
const percent = datum.value / total;
|
|
1527
1572
|
const to = {
|
|
1528
1573
|
data: _objectSpread2(_objectSpread2({}, datum), {}, {
|
|
@@ -1548,12 +1593,223 @@ const RenderedBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1548
1593
|
previousData: from,
|
|
1549
1594
|
role: barRole,
|
|
1550
1595
|
scale: scale,
|
|
1596
|
+
scalePosition: scaleCategory,
|
|
1551
1597
|
tooltipVariant: tooltipVariant,
|
|
1552
1598
|
width: isHorizontal ? undefined : barWidth
|
|
1553
1599
|
}));
|
|
1554
1600
|
}))));
|
|
1555
1601
|
});
|
|
1556
1602
|
|
|
1603
|
+
const _excluded$h = ["barProps", "className", "data", "id", "isBarSelected", "labelDecorator", "margins", "onBarClick", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "dateParser"];
|
|
1604
|
+
const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1605
|
+
const {
|
|
1606
|
+
barProps,
|
|
1607
|
+
className,
|
|
1608
|
+
data: propsData,
|
|
1609
|
+
id,
|
|
1610
|
+
isBarSelected,
|
|
1611
|
+
labelDecorator,
|
|
1612
|
+
margins: propsMargins,
|
|
1613
|
+
onBarClick,
|
|
1614
|
+
size,
|
|
1615
|
+
sortingMethod,
|
|
1616
|
+
barRole,
|
|
1617
|
+
colorTheme,
|
|
1618
|
+
tooltipVariant,
|
|
1619
|
+
xAxisVariant: propsXAxisVariant,
|
|
1620
|
+
xAxisPlacement,
|
|
1621
|
+
xAxisTickFormat: propsXAxisTickFormat,
|
|
1622
|
+
xAxisTickPadding,
|
|
1623
|
+
xAxisTickRotation,
|
|
1624
|
+
xAxisTickSize,
|
|
1625
|
+
xAxisTickValues,
|
|
1626
|
+
yAxisVariant: propsYAxisVariant,
|
|
1627
|
+
yAxisPlacement,
|
|
1628
|
+
yAxisTickFormat,
|
|
1629
|
+
yAxisTickPadding,
|
|
1630
|
+
yAxisTickRotation,
|
|
1631
|
+
yAxisTickSize,
|
|
1632
|
+
yAxisTickValues,
|
|
1633
|
+
dateParser
|
|
1634
|
+
} = props,
|
|
1635
|
+
forwardedProps = _objectWithoutProperties(props, _excluded$h);
|
|
1636
|
+
const cache = useRef();
|
|
1637
|
+
const theme = useTheme();
|
|
1638
|
+
const xScaleType = propsData[0].key instanceof Date ? 'Date' : typeof propsData[0].key === 'number' ? 'number' : typeof propsData[0].key === 'string' && isValidDate(propsData[0].key) ? 'dateString' : undefined;
|
|
1639
|
+
const data = xScaleType === 'number' ? propsData.filter(datum => typeof datum.key === 'number' && !Number.isNaN(datum.key)) : xScaleType === 'dateString' ? propsData.filter(datum => isValidDate(datum.key)) : xScaleType === 'Date' ? propsData.filter(datum => datum.key instanceof Date) : propsData;
|
|
1640
|
+
useEffect(() => {
|
|
1641
|
+
cache.current = data;
|
|
1642
|
+
});
|
|
1643
|
+
const svgRef = useRef();
|
|
1644
|
+
const xAxisVariant = propsXAxisVariant ? propsXAxisVariant : AxisVariant.tickValue;
|
|
1645
|
+
const yAxisVariant = propsYAxisVariant ? propsYAxisVariant : AxisVariant.default;
|
|
1646
|
+
const chartDimensions = sizeToDimension$3(size);
|
|
1647
|
+
const width = chartDimensions.width;
|
|
1648
|
+
const height = chartDimensions.height;
|
|
1649
|
+
const margins = _objectSpread2({
|
|
1650
|
+
top: xAxisVariant === AxisVariant.default || xAxisVariant === AxisVariant.tickValue ? 24 : 8,
|
|
1651
|
+
left: yAxisVariant === AxisVariant.default || yAxisVariant === AxisVariant.tickValue ? 48 : 8,
|
|
1652
|
+
right: yAxisVariant === AxisVariant.default || yAxisVariant === AxisVariant.tickValue ? 48 : 8,
|
|
1653
|
+
bottom: xAxisVariant === AxisVariant.default || xAxisVariant === AxisVariant.tickValue ? 24 : 8
|
|
1654
|
+
}, propsMargins);
|
|
1655
|
+
const chartHeight = height - margins.top - margins.bottom;
|
|
1656
|
+
const chartWidth = width - margins.left - margins.right;
|
|
1657
|
+
const numberOfRows = data.filter(datum => datum.value).length;
|
|
1658
|
+
const gap = 5;
|
|
1659
|
+
let barWidth = chartWidth / (numberOfRows * 2) - gap;
|
|
1660
|
+
const scaleX = (() => {
|
|
1661
|
+
if (xScaleType === 'number') {
|
|
1662
|
+
const domain = extent(data, d => d.key);
|
|
1663
|
+
const gap = domain[1] - domain[0];
|
|
1664
|
+
domain[0] -= gap * 0.1;
|
|
1665
|
+
domain[1] += gap * 0.1;
|
|
1666
|
+
return scaleLinear().domain(domain).range([0, chartWidth]).nice();
|
|
1667
|
+
} else if (xScaleType === 'dateString' || xScaleType === 'Date') {
|
|
1668
|
+
const domain = xScaleType === 'dateString' ? extent(data, d => Date.parse(d.key)) : extent(data, d => d.key.valueOf());
|
|
1669
|
+
const startDate = xAxisTickValues && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[0]), -1) : new Date(domain[0]);
|
|
1670
|
+
const endDate = xAxisTickValues && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[1]), 0) : new Date(domain[1]);
|
|
1671
|
+
return scaleTime().domain([startDate, endDate]).range([0, chartWidth]).nice();
|
|
1672
|
+
} else {
|
|
1673
|
+
return scalePoint().domain(xAxisTickValues && Array.isArray(xAxisTickValues) ? xAxisTickValues : data.map(d => d.key)).range([0, chartWidth]);
|
|
1674
|
+
}
|
|
1675
|
+
})();
|
|
1676
|
+
const scaleY = (() => {
|
|
1677
|
+
const domain = extent(data, d => d.value);
|
|
1678
|
+
return scaleLinear().domain(domain).range([chartHeight, 0]).nice();
|
|
1679
|
+
})();
|
|
1680
|
+
const xAxisTickFormat = propsXAxisTickFormat !== null && propsXAxisTickFormat !== void 0 ? propsXAxisTickFormat : xScaleType === 'Date' || xScaleType === 'dateString' ? scaleX.tickFormat() : undefined;
|
|
1681
|
+
const statsByCategory = statsBy$1(data, sortingMethod);
|
|
1682
|
+
const colorScale = useColor({
|
|
1683
|
+
data: statsByCategory,
|
|
1684
|
+
colorTheme: colorTheme,
|
|
1685
|
+
category: d => d.key,
|
|
1686
|
+
theme
|
|
1687
|
+
});
|
|
1688
|
+
const bars = data.sort((a, b) => {
|
|
1689
|
+
const currentKeyA = a.key;
|
|
1690
|
+
const currentKeyB = b.key;
|
|
1691
|
+
if (xScaleType === 'number') {
|
|
1692
|
+
if (currentKeyA < currentKeyB) return -1;
|
|
1693
|
+
if (currentKeyA > currentKeyB) return 1;
|
|
1694
|
+
return 0;
|
|
1695
|
+
} else if (xScaleType === 'dateString') {
|
|
1696
|
+
if (Date.parse(currentKeyA) < Date.parse(currentKeyB)) return -1;
|
|
1697
|
+
if (Date.parse(currentKeyA) > Date.parse(currentKeyB)) return 1;
|
|
1698
|
+
return 0;
|
|
1699
|
+
} else if (xScaleType === 'Date') {
|
|
1700
|
+
if (currentKeyA.valueOf() < currentKeyB.valueOf()) return -1;
|
|
1701
|
+
if (currentKeyA.valueOf() > currentKeyB.valueOf()) return 1;
|
|
1702
|
+
return 0;
|
|
1703
|
+
} else if (xScaleType === 'string' && xAxisTickValues && Array.isArray(xAxisTickValues)) {
|
|
1704
|
+
if (xAxisTickValues.indexOf(currentKeyA) < xAxisTickValues.indexOf(currentKeyB)) return -1;
|
|
1705
|
+
if (xAxisTickValues.indexOf(currentKeyA) > xAxisTickValues.indexOf(currentKeyB)) return 1;
|
|
1706
|
+
return 0;
|
|
1707
|
+
}
|
|
1708
|
+
return 0;
|
|
1709
|
+
}).filter(d => d.value !== null).map(d => {
|
|
1710
|
+
const currentKeyD = d.key;
|
|
1711
|
+
return {
|
|
1712
|
+
category: 'default',
|
|
1713
|
+
key: xScaleType === 'dateString' ? dateParser ? dateParser(currentKeyD) : new Date(Date.parse(currentKeyD)) : currentKeyD,
|
|
1714
|
+
value: d.value
|
|
1715
|
+
};
|
|
1716
|
+
});
|
|
1717
|
+
if (xScaleType) {
|
|
1718
|
+
const minimalGap = Math.min(...bars.map((bar, i) => i > 0 ? Math.abs(bar.key - bars[i - 1].key) : undefined).filter(k => k)) * 0.9;
|
|
1719
|
+
barWidth = Math.min(chartWidth / ((scaleX.domain()[1] - scaleX.domain()[0]) / minimalGap), barWidth);
|
|
1720
|
+
}
|
|
1721
|
+
return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({}, forwardedProps, {
|
|
1722
|
+
id: id,
|
|
1723
|
+
className: className,
|
|
1724
|
+
ref: ref
|
|
1725
|
+
}), /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
1726
|
+
flexDirection: "column",
|
|
1727
|
+
alignItems: "center",
|
|
1728
|
+
gap: "8"
|
|
1729
|
+
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
1730
|
+
ref: svgRef,
|
|
1731
|
+
width: width,
|
|
1732
|
+
height: height
|
|
1733
|
+
}, /*#__PURE__*/React__default.createElement("g", {
|
|
1734
|
+
transform: `translate(${margins.left},${margins.top})`
|
|
1735
|
+
}, bars.map((bar, index) => {
|
|
1736
|
+
const to = {
|
|
1737
|
+
data: _objectSpread2({}, bar)
|
|
1738
|
+
};
|
|
1739
|
+
const from = cache.current ? {
|
|
1740
|
+
data: cache.current[index]
|
|
1741
|
+
} : undefined;
|
|
1742
|
+
return /*#__PURE__*/React__default.createElement(Bar, _extends({}, barProps, {
|
|
1743
|
+
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.category),
|
|
1744
|
+
data: to,
|
|
1745
|
+
gap: gap,
|
|
1746
|
+
height: undefined,
|
|
1747
|
+
id: `id${id}__bar-${index}`,
|
|
1748
|
+
index: index,
|
|
1749
|
+
isSelected: Boolean(isBarSelected(to)),
|
|
1750
|
+
key: `bar _${index}`,
|
|
1751
|
+
labelDecorator: labelDecorator,
|
|
1752
|
+
maxHeight: chartHeight,
|
|
1753
|
+
onClick: onBarClick,
|
|
1754
|
+
orientation: BarOrientation.vertical,
|
|
1755
|
+
previousData: from,
|
|
1756
|
+
role: barRole,
|
|
1757
|
+
scale: scaleY,
|
|
1758
|
+
scalePosition: scaleX,
|
|
1759
|
+
tooltipVariant: tooltipVariant,
|
|
1760
|
+
width: barWidth
|
|
1761
|
+
}));
|
|
1762
|
+
}), ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
1763
|
+
position: "bottom",
|
|
1764
|
+
length: chartWidth,
|
|
1765
|
+
scale: scaleX,
|
|
1766
|
+
x: 0,
|
|
1767
|
+
y: chartHeight,
|
|
1768
|
+
tickValues: xAxisTickValues !== null && xAxisTickValues !== void 0 ? xAxisTickValues : 8,
|
|
1769
|
+
tickPadding: xAxisTickPadding,
|
|
1770
|
+
tickRotation: xAxisTickRotation,
|
|
1771
|
+
tickSize: xAxisTickSize,
|
|
1772
|
+
tickFormat: xAxisTickFormat,
|
|
1773
|
+
variant: xAxisVariant
|
|
1774
|
+
}) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
1775
|
+
position: "top",
|
|
1776
|
+
length: chartWidth,
|
|
1777
|
+
scale: scaleX,
|
|
1778
|
+
x: 0,
|
|
1779
|
+
y: 0,
|
|
1780
|
+
tickValues: xAxisTickValues !== null && xAxisTickValues !== void 0 ? xAxisTickValues : 8,
|
|
1781
|
+
tickPadding: xAxisTickPadding,
|
|
1782
|
+
tickRotation: xAxisTickRotation,
|
|
1783
|
+
tickSize: xAxisTickSize,
|
|
1784
|
+
tickFormat: xAxisTickFormat,
|
|
1785
|
+
variant: xAxisVariant
|
|
1786
|
+
}) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
1787
|
+
position: "left",
|
|
1788
|
+
length: chartHeight,
|
|
1789
|
+
scale: scaleY,
|
|
1790
|
+
x: 0,
|
|
1791
|
+
y: chartHeight,
|
|
1792
|
+
tickValues: yAxisTickValues !== null && yAxisTickValues !== void 0 ? yAxisTickValues : 8,
|
|
1793
|
+
tickPadding: yAxisTickPadding,
|
|
1794
|
+
tickRotation: yAxisTickRotation,
|
|
1795
|
+
tickSize: yAxisTickSize,
|
|
1796
|
+
tickFormat: yAxisTickFormat,
|
|
1797
|
+
variant: yAxisVariant
|
|
1798
|
+
}) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
1799
|
+
position: "right",
|
|
1800
|
+
length: chartHeight,
|
|
1801
|
+
scale: scaleY,
|
|
1802
|
+
x: chartWidth,
|
|
1803
|
+
y: chartHeight,
|
|
1804
|
+
tickValues: yAxisTickValues !== null && yAxisTickValues !== void 0 ? yAxisTickValues : 8,
|
|
1805
|
+
tickPadding: yAxisTickPadding,
|
|
1806
|
+
tickRotation: yAxisTickRotation,
|
|
1807
|
+
tickSize: yAxisTickSize,
|
|
1808
|
+
tickFormat: yAxisTickFormat,
|
|
1809
|
+
variant: yAxisVariant
|
|
1810
|
+
}) : null))));
|
|
1811
|
+
});
|
|
1812
|
+
|
|
1557
1813
|
const _excluded$g = ["caping", "chartRef", "className", "data", "emptyComponent", "id", "isBarSelected", "labelDecorator", "localeText", "onBarClick", "orientation", "others", "size", "barRole", "theme", "tooltipDecorator", "colorTheme", "tooltipVariant"];
|
|
1558
1814
|
const COMPONENT_NAME$7 = 'BarChart';
|
|
1559
1815
|
const CLASSNAME$7 = 'redsift-barchart';
|
|
@@ -1613,26 +1869,48 @@ const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1613
1869
|
ref: ref
|
|
1614
1870
|
}));
|
|
1615
1871
|
}
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1872
|
+
const dataType = Array.isArray(propsData[0].key) ? 'TwoCategoryData' : propsData[0].key instanceof Date ? 'LinearData' : typeof propsData[0].key === 'number' ? 'LinearData' : typeof propsData[0].key === 'string' && isValidDate(propsData[0].key) ? 'LinearData' : typeof propsData[0].key === 'string' ? 'CategoryData' : 'CategoryData';
|
|
1873
|
+
if (dataType === 'CategoryData') {
|
|
1874
|
+
return /*#__PURE__*/React__default.createElement(RenderedOrdinalBarChart, _extends({
|
|
1875
|
+
barRole: barRole,
|
|
1876
|
+
caping: caping,
|
|
1877
|
+
chartRef: chartRef,
|
|
1878
|
+
className: classNames(BarChart.className, className),
|
|
1879
|
+
data: propsData,
|
|
1880
|
+
id: id,
|
|
1881
|
+
isBarSelected: isBarSelected,
|
|
1882
|
+
labelDecorator: labelDecorator,
|
|
1883
|
+
onBarClick: onBarClick,
|
|
1884
|
+
orientation: orientation,
|
|
1885
|
+
others: others,
|
|
1886
|
+
size: size,
|
|
1887
|
+
theme: theme,
|
|
1888
|
+
tooltipDecorator: tooltipDecorator,
|
|
1889
|
+
colorTheme: colorTheme,
|
|
1890
|
+
tooltipVariant: tooltipVariant
|
|
1891
|
+
}, forwardedProps, {
|
|
1892
|
+
ref: ref
|
|
1893
|
+
}));
|
|
1894
|
+
} else if (dataType === 'LinearData') {
|
|
1895
|
+
return /*#__PURE__*/React__default.createElement(RenderedLinearBarChart, _extends({
|
|
1896
|
+
barRole: barRole,
|
|
1897
|
+
chartRef: chartRef,
|
|
1898
|
+
className: classNames(BarChart.className, className),
|
|
1899
|
+
data: propsData,
|
|
1900
|
+
id: id,
|
|
1901
|
+
isBarSelected: isBarSelected,
|
|
1902
|
+
labelDecorator: labelDecorator,
|
|
1903
|
+
onBarClick: onBarClick,
|
|
1904
|
+
size: size,
|
|
1905
|
+
theme: theme,
|
|
1906
|
+
tooltipDecorator: tooltipDecorator,
|
|
1907
|
+
colorTheme: colorTheme,
|
|
1908
|
+
tooltipVariant: tooltipVariant
|
|
1909
|
+
}, forwardedProps, {
|
|
1910
|
+
ref: ref
|
|
1911
|
+
}));
|
|
1912
|
+
}
|
|
1913
|
+
return null;
|
|
1636
1914
|
});
|
|
1637
1915
|
BarChart.className = CLASSNAME$7;
|
|
1638
1916
|
BarChart.defaultProps = DEFAULT_PROPS$7;
|
|
@@ -2188,10 +2466,6 @@ const EmptyLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2188
2466
|
});
|
|
2189
2467
|
|
|
2190
2468
|
const _excluded$9 = ["className", "data", "dotRole", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onDotClick", "size", "sortingMethod", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "dateParser"];
|
|
2191
|
-
const isValidDate = value => {
|
|
2192
|
-
const date = new Date(value);
|
|
2193
|
-
return date instanceof Date && !isNaN(date) && !isNaN(Date.parse(value));
|
|
2194
|
-
};
|
|
2195
2469
|
const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2196
2470
|
const {
|
|
2197
2471
|
className,
|
|
@@ -3585,5 +3859,5 @@ ScatterPlot.className = CLASSNAME;
|
|
|
3585
3859
|
ScatterPlot.defaultProps = DEFAULT_PROPS;
|
|
3586
3860
|
ScatterPlot.displayName = COMPONENT_NAME;
|
|
3587
3861
|
|
|
3588
|
-
export { Arc, Arcs, Axis, AxisPosition, AxisVariant, Bar, BarChart, BarOrientation, ChartContainer, ChartSize, ColorTheme, DataPoint, Dot, DotVariant, LabelVariant, Legend, LegendVariant, Line, LineChart, LineChartLegendVariant, PieChart, PieChartLegendVariant, PieChartVariant, ScatterPlot, ScatterPlotLegendVariant, ScatterPlotVariant, StyledArc, StyledArcs, StyledAxis, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerTitle, StyledDataPoint, StyledDot, StyledLegend, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledScatterPlot, StyledScatterPlotEmptyText, TooltipVariant, empty, getColorScale, getSortingMethod, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|
|
3862
|
+
export { Arc, Arcs, Axis, AxisPosition, AxisVariant, Bar, BarChart, BarOrientation, ChartContainer, ChartSize, ColorTheme, DataPoint, Dot, DotVariant, LabelVariant, Legend, LegendVariant, Line, LineChart, LineChartLegendVariant, PieChart, PieChartLegendVariant, PieChartVariant, ScatterPlot, ScatterPlotLegendVariant, ScatterPlotVariant, StyledArc, StyledArcs, StyledAxis, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerTitle, StyledDataPoint, StyledDot, StyledLegend, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledScatterPlot, StyledScatterPlotEmptyText, TooltipVariant, empty, getColorScale, getSortingMethod, isValidDate, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|
|
3589
3863
|
//# sourceMappingURL=index.js.map
|