@redsift/charts 9.4.0 → 9.4.1
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 -3
- package/index.js +48 -12
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BrushBehavior, ScaleLinear as ScaleLinear$1, ScaleOrdinal, Arc as Arc$1, ScaleTime as ScaleTime$2, ScalePoint as ScalePoint$2, Line as Line$1 } from 'd3';
|
|
2
2
|
import * as _redsift_design_system from '@redsift/design-system';
|
|
3
3
|
import { ValueOf, Comp, ContainerProps } from '@redsift/design-system';
|
|
4
|
-
import { MutableRefObject, ComponentProps, ReactElement, RefObject, ReactNode } from 'react';
|
|
5
4
|
import { PieArcDatum } from 'd3-shape';
|
|
5
|
+
import { MutableRefObject, ComponentProps, ReactElement, RefObject, ReactNode } from 'react';
|
|
6
6
|
import * as d3_scale from 'd3-scale';
|
|
7
7
|
import { ScaleLinear as ScaleLinear$2, ScaleLogarithmic, ScaleSymLog, ScalePoint as ScalePoint$1, ScaleBand as ScaleBand$1, ScaleTime as ScaleTime$1 } from 'd3-scale';
|
|
8
8
|
import * as styled_components from 'styled-components';
|
|
@@ -191,17 +191,22 @@ interface UseColorProps {
|
|
|
191
191
|
}
|
|
192
192
|
declare const useColor: ({ data, theme, category }: UseColorProps) => ScaleOrdinal<string, string, never>;
|
|
193
193
|
|
|
194
|
+
type SortingMethod = 'none' | 'asc-key' | 'desc-key' | 'asc-value' | 'desc-value' | string[] | ((a: CategoryDatum, b: CategoryDatum) => 1 | -1);
|
|
195
|
+
declare const getSortingMethod: (sortingMethod: SortingMethod) => (a: CategoryDatum, b: CategoryDatum) => 1 | -1;
|
|
196
|
+
|
|
194
197
|
interface UseFormatCategoricalDataProps {
|
|
195
198
|
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
196
199
|
data: CategoryData;
|
|
197
200
|
/** Theme. */
|
|
198
201
|
theme: ChartTheme;
|
|
202
|
+
/** Define how to sort categories. */
|
|
203
|
+
sortingMethod: SortingMethod;
|
|
199
204
|
/** Number of categories to use, the rest being put into a new category called "Others". */
|
|
200
205
|
caping?: number;
|
|
201
206
|
/** Whether a category should be displayed for categories that has been removed by the caping option. Optionaly, this prop can be used to change the label of this category. */
|
|
202
207
|
others?: boolean | string;
|
|
203
208
|
}
|
|
204
|
-
declare const useFormatCategoricalData: ({ data, caping, others, theme, }: UseFormatCategoricalDataProps) => {
|
|
209
|
+
declare const useFormatCategoricalData: ({ data, caping, sortingMethod, others, theme, }: UseFormatCategoricalDataProps) => {
|
|
205
210
|
data: CategoryData;
|
|
206
211
|
colorScale: d3_scale.ScaleOrdinal<string, string, never>;
|
|
207
212
|
};
|
|
@@ -492,6 +497,8 @@ interface BarChartProps extends ChartContainerProps {
|
|
|
492
497
|
others?: boolean | string;
|
|
493
498
|
/** BarChart size. */
|
|
494
499
|
size?: ChartSize | BarChartDimensions;
|
|
500
|
+
/** Define how to sort categories. */
|
|
501
|
+
sortingMethod?: SortingMethod;
|
|
495
502
|
/** Bar role. Used to indicate that bars are to be considered buttons or links. If an onClick is provided, the bars will have the role `button` unless specifically set to `link` with this prop. */
|
|
496
503
|
barRole?: BarProps['role'];
|
|
497
504
|
/** Color palette to use. You can choose among the list of available color palette or also choose to use the success/warning/danger theme for which you have to specify which key corresponds to which status. */
|
|
@@ -654,6 +661,8 @@ interface LineChartProps extends ChartContainerProps {
|
|
|
654
661
|
onDotClick?: (datum: DotDatum) => void;
|
|
655
662
|
/** LineChart size. */
|
|
656
663
|
size?: ChartSize | LineChartDimensions;
|
|
664
|
+
/** Define how to sort categories. */
|
|
665
|
+
sortingMethod?: SortingMethod;
|
|
657
666
|
/** Reference to the SVG tag. */
|
|
658
667
|
svgRef?: MutableRefObject<SVGSVGElement>;
|
|
659
668
|
/** Color palette to use. You can choose among the list of available color palette or also choose to use the success/warning/danger theme for which you have to specify which key corresponds to which status. */
|
|
@@ -753,6 +762,8 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
753
762
|
sliceProps?: Omit<ComponentProps<'g'>, 'onClick' | 'ref' | 'width'>;
|
|
754
763
|
/** Slice role. Used to indicate that slices are to be considered buttons or links. If an onClick is provided, the slices will have the role `button` unless specifically set to `link` with this prop. */
|
|
755
764
|
sliceRole?: ArcProps['role'];
|
|
765
|
+
/** Define how to sort categories. */
|
|
766
|
+
sortingMethod?: SortingMethod;
|
|
756
767
|
/** Secondary text to be displayed in the middle of the chart, between the main text and subtext. Recommended to be used with donut variants only. */
|
|
757
768
|
middleText?: string | ReactElement | ((data: PieArcDatum<CategoryDatum>[], total: number) => string | ReactElement);
|
|
758
769
|
/** Secondary text to be displayed in the middle of the chart, above the main text. Recommended to be used with `donut` variants only. */
|
|
@@ -845,6 +856,8 @@ interface ScatterPlotProps extends ChartContainerProps {
|
|
|
845
856
|
onDotClick?: (datum: DotDatum) => void;
|
|
846
857
|
/** ScatterPlot size. */
|
|
847
858
|
size?: ChartSize | ScatterPlotDimensions;
|
|
859
|
+
/** Define how to sort categories. */
|
|
860
|
+
sortingMethod?: SortingMethod;
|
|
848
861
|
/** Reference to the SVG tag. */
|
|
849
862
|
svgRef?: MutableRefObject<SVGSVGElement>;
|
|
850
863
|
/** Color palette to use. You can choose among the list of available color palette or also choose to use the success/warning/danger theme for which you have to specify which key corresponds to which status. */
|
|
@@ -875,4 +888,4 @@ declare const StyledScatterPlotEmptyText: styled_components.StyledComponent<"div
|
|
|
875
888
|
$textSize: number;
|
|
876
889
|
}, never>;
|
|
877
890
|
|
|
878
|
-
export { AnyScale, Arc, ArcDatum, ArcProps, Arcs, ArcsProps, Axis, AxisPosition, AxisProps, AxisVariant, Bar, BarChart, BarChartDimensions, BarChartProps, BarDatum, BarOrientation, BarProps, CategoryData, CategoryDatum, CategoryDim, 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, Line, LineChart, LineChartDimensions, LineChartLabelVariant, LineChartProps, LinePointDatum, LineProps, NumericValue, PieChart, PieChartDimensions, PieChartLabelVariant, PieChartProps, PieChartVariant, Scale, ScaleBand, ScaleLinear, ScaleLog, ScalePoint, ScaleSymlog, ScaleTime, ScaleTypeToScale, ScaleValue, ScaleWithBandwidth, ScatterPlot, ScatterPlotDimensions, ScatterPlotLabelVariant, ScatterPlotProps, ScatterPlotVariant, 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, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|
|
891
|
+
export { AnyScale, Arc, ArcDatum, ArcProps, Arcs, ArcsProps, Axis, AxisPosition, AxisProps, AxisVariant, Bar, BarChart, BarChartDimensions, BarChartProps, BarDatum, BarOrientation, BarProps, CategoryData, CategoryDatum, CategoryDim, 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, Line, LineChart, LineChartDimensions, LineChartLabelVariant, LineChartProps, LinePointDatum, LineProps, NumericValue, PieChart, PieChartDimensions, PieChartLabelVariant, PieChartProps, PieChartVariant, Scale, ScaleBand, ScaleLinear, ScaleLog, ScalePoint, ScaleSymlog, ScaleTime, ScaleTypeToScale, ScaleValue, ScaleWithBandwidth, ScatterPlot, ScatterPlotDimensions, ScatterPlotLabelVariant, 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 };
|
package/index.js
CHANGED
|
@@ -187,10 +187,36 @@ function _toPropertyKey(arg) {
|
|
|
187
187
|
return typeof key === "symbol" ? key : String(key);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
const getSortingMethod = sortingMethod => {
|
|
191
|
+
if (sortingMethod === 'asc-key') {
|
|
192
|
+
return (a, b) => a.key === b.key ? a.value > b.value ? -1 : 1 : a.key < b.key ? -1 : 1;
|
|
193
|
+
} else if (sortingMethod === 'desc-key') {
|
|
194
|
+
return (a, b) => a.key === b.key ? a.value > b.value ? 1 : -1 : a.key < b.key ? 1 : -1;
|
|
195
|
+
} else if (sortingMethod === 'asc-value') {
|
|
196
|
+
return (a, b) => a.value === b.value ? a.key > b.key ? -1 : 1 : a.value < b.value ? -1 : 1;
|
|
197
|
+
} else if (sortingMethod === 'desc-value') {
|
|
198
|
+
return (a, b) => a.value === b.value ? a.key > b.key ? 1 : -1 : a.value < b.value ? 1 : -1;
|
|
199
|
+
} else if (typeof sortingMethod === 'function') {
|
|
200
|
+
return sortingMethod;
|
|
201
|
+
} else if (Array.isArray(sortingMethod)) {
|
|
202
|
+
return (a, b) => {
|
|
203
|
+
if (sortingMethod.indexOf(a.key) === -1) {
|
|
204
|
+
return 1;
|
|
205
|
+
}
|
|
206
|
+
if (sortingMethod.indexOf(b.key) === -1) {
|
|
207
|
+
return -1;
|
|
208
|
+
}
|
|
209
|
+
return sortingMethod.indexOf(a.key) === sortingMethod.indexOf(b.key) ? a.key > b.key ? 1 : -1 : sortingMethod.indexOf(a.key) < sortingMethod.indexOf(b.key) ? -1 : 1;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
return () => -1;
|
|
213
|
+
};
|
|
214
|
+
|
|
190
215
|
const useFormatCategoricalData = _ref => {
|
|
191
216
|
let {
|
|
192
217
|
data,
|
|
193
218
|
caping,
|
|
219
|
+
sortingMethod,
|
|
194
220
|
others,
|
|
195
221
|
theme
|
|
196
222
|
} = _ref;
|
|
@@ -199,7 +225,7 @@ const useFormatCategoricalData = _ref => {
|
|
|
199
225
|
if (data === undefined || data === null) {
|
|
200
226
|
return undefined;
|
|
201
227
|
}
|
|
202
|
-
computedData = [...data].sort((
|
|
228
|
+
computedData = [...data].sort(getSortingMethod(sortingMethod));
|
|
203
229
|
if (caping) {
|
|
204
230
|
if (typeof others === 'boolean' && !others) {
|
|
205
231
|
computedData = computedData.slice(0, caping);
|
|
@@ -1277,7 +1303,7 @@ const LoadingBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1277
1303
|
}), "Loading...");
|
|
1278
1304
|
});
|
|
1279
1305
|
|
|
1280
|
-
const _excluded$h = ["areXLabelsRotated", "barProps", "caping", "className", "data", "id", "isBarSelected", "labelDecorator", "onBarClick", "orientation", "others", "size", "barRole", "theme", "tooltipVariant"];
|
|
1306
|
+
const _excluded$h = ["areXLabelsRotated", "barProps", "caping", "className", "data", "id", "isBarSelected", "labelDecorator", "onBarClick", "orientation", "others", "size", "sortingMethod", "barRole", "theme", "tooltipVariant"];
|
|
1281
1307
|
const RenderedBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1282
1308
|
const {
|
|
1283
1309
|
areXLabelsRotated,
|
|
@@ -1292,6 +1318,7 @@ const RenderedBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1292
1318
|
orientation,
|
|
1293
1319
|
others,
|
|
1294
1320
|
size,
|
|
1321
|
+
sortingMethod,
|
|
1295
1322
|
barRole,
|
|
1296
1323
|
theme,
|
|
1297
1324
|
tooltipVariant
|
|
@@ -1304,6 +1331,7 @@ const RenderedBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1304
1331
|
} = useFormatCategoricalData({
|
|
1305
1332
|
data: propsData,
|
|
1306
1333
|
theme: theme,
|
|
1334
|
+
sortingMethod: sortingMethod,
|
|
1307
1335
|
caping,
|
|
1308
1336
|
others
|
|
1309
1337
|
});
|
|
@@ -1408,6 +1436,7 @@ const DEFAULT_PROPS$7 = {
|
|
|
1408
1436
|
orientation: BarOrientation.horizontal,
|
|
1409
1437
|
others: true,
|
|
1410
1438
|
size: ChartSize.medium,
|
|
1439
|
+
sortingMethod: 'desc-value',
|
|
1411
1440
|
theme: ColorTheme.default,
|
|
1412
1441
|
tooltipVariant: TooltipVariant.value,
|
|
1413
1442
|
localeText: {
|
|
@@ -1914,7 +1943,7 @@ const sizeToDimension$2 = size => {
|
|
|
1914
1943
|
};
|
|
1915
1944
|
}
|
|
1916
1945
|
};
|
|
1917
|
-
const statsBy = arr => {
|
|
1946
|
+
const statsBy = (arr, sortingMethod) => {
|
|
1918
1947
|
const counts = arr.reduce((prev, curr) => {
|
|
1919
1948
|
if (!curr.value) {
|
|
1920
1949
|
return prev;
|
|
@@ -1947,7 +1976,7 @@ const statsBy = arr => {
|
|
|
1947
1976
|
trending: {
|
|
1948
1977
|
overall: (counts[key].values[counts[key].values.length - 1] - counts[key].values[0]) * 100 / counts[key].values[0]
|
|
1949
1978
|
}
|
|
1950
|
-
})).sort((
|
|
1979
|
+
})).sort(getSortingMethod(sortingMethod));
|
|
1951
1980
|
};
|
|
1952
1981
|
|
|
1953
1982
|
const _excluded$a = ["className", "data", "emptyComponent", "localeText", "size"];
|
|
@@ -1996,7 +2025,7 @@ const EmptyLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1996
2025
|
})))));
|
|
1997
2026
|
});
|
|
1998
2027
|
|
|
1999
|
-
const _excluded$9 = ["className", "data", "dotRole", "id", "isDotSelected", "labelDecorator", "labelVariant", "legendProps", "onDotClick", "size", "theme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "dateParser"];
|
|
2028
|
+
const _excluded$9 = ["className", "data", "dotRole", "id", "isDotSelected", "labelDecorator", "labelVariant", "legendProps", "onDotClick", "size", "sortingMethod", "theme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "dateParser"];
|
|
2000
2029
|
const isValidDate = value => {
|
|
2001
2030
|
const date = new Date(value);
|
|
2002
2031
|
return date instanceof Date && !isNaN(date) && !isNaN(Date.parse(value));
|
|
@@ -2013,6 +2042,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2013
2042
|
legendProps,
|
|
2014
2043
|
onDotClick,
|
|
2015
2044
|
size,
|
|
2045
|
+
sortingMethod,
|
|
2016
2046
|
theme,
|
|
2017
2047
|
tooltipVariant,
|
|
2018
2048
|
xAxisVariant,
|
|
@@ -2062,7 +2092,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2062
2092
|
})();
|
|
2063
2093
|
const xAxisTickFormat = propsXAxisTickFormat !== null && propsXAxisTickFormat !== void 0 ? propsXAxisTickFormat : xScaleType === 'Date' || xScaleType === 'dateString' ? scaleX.tickFormat() : undefined;
|
|
2064
2094
|
const hasCategory = data[0] && data[0].key.length >= 2 && data[0].key[1] !== null && data[0].key[1] !== undefined;
|
|
2065
|
-
const statsByCategory = statsBy(data);
|
|
2095
|
+
const statsByCategory = statsBy(data, sortingMethod);
|
|
2066
2096
|
const colorScale = useColor({
|
|
2067
2097
|
data: statsByCategory,
|
|
2068
2098
|
theme: theme,
|
|
@@ -2203,6 +2233,7 @@ const DEFAULT_PROPS$2 = {
|
|
|
2203
2233
|
emptyChartText: 'No Data'
|
|
2204
2234
|
},
|
|
2205
2235
|
size: ChartSize.medium,
|
|
2236
|
+
sortingMethod: 'desc-value',
|
|
2206
2237
|
theme: ColorTheme.dark,
|
|
2207
2238
|
tooltipVariant: TooltipVariant.none,
|
|
2208
2239
|
xAxisVariant: AxisVariant.default,
|
|
@@ -2540,7 +2571,7 @@ const EmptyPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2540
2571
|
}))));
|
|
2541
2572
|
});
|
|
2542
2573
|
|
|
2543
|
-
const _excluded$5 = ["caping", "className", "data", "id", "isHalf", "isSliceSelected", "labelDecorator", "labelVariant", "legendProps", "middleText", "onSliceClick", "others", "size", "sliceProps", "sliceRole", "subtext", "text", "theme", "tooltipVariant", "variant"];
|
|
2574
|
+
const _excluded$5 = ["caping", "className", "data", "id", "isHalf", "isSliceSelected", "labelDecorator", "labelVariant", "legendProps", "middleText", "onSliceClick", "others", "size", "sliceProps", "sliceRole", "sortingMethod", "subtext", "text", "theme", "tooltipVariant", "variant"];
|
|
2544
2575
|
const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2545
2576
|
const {
|
|
2546
2577
|
caping,
|
|
@@ -2558,6 +2589,7 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2558
2589
|
size,
|
|
2559
2590
|
sliceProps,
|
|
2560
2591
|
sliceRole,
|
|
2592
|
+
sortingMethod,
|
|
2561
2593
|
subtext: propsSubtext,
|
|
2562
2594
|
text: propsText,
|
|
2563
2595
|
theme,
|
|
@@ -2574,6 +2606,7 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2574
2606
|
} = useFormatCategoricalData({
|
|
2575
2607
|
data: propsData,
|
|
2576
2608
|
theme: theme,
|
|
2609
|
+
sortingMethod: sortingMethod,
|
|
2577
2610
|
caping,
|
|
2578
2611
|
others
|
|
2579
2612
|
});
|
|
@@ -2690,6 +2723,7 @@ const DEFAULT_PROPS$1 = {
|
|
|
2690
2723
|
labelVariant: PieChartLabelVariant.none,
|
|
2691
2724
|
others: true,
|
|
2692
2725
|
size: ChartSize.medium,
|
|
2726
|
+
sortingMethod: 'desc-value',
|
|
2693
2727
|
theme: ColorTheme.default,
|
|
2694
2728
|
variant: PieChartVariant.plain,
|
|
2695
2729
|
tooltipVariant: TooltipVariant.value,
|
|
@@ -2902,12 +2936,12 @@ const group = (data, x, y) => {
|
|
|
2902
2936
|
});
|
|
2903
2937
|
return Object.values(groupDict);
|
|
2904
2938
|
};
|
|
2905
|
-
const countBy = arr => {
|
|
2939
|
+
const countBy = (arr, sortingMethod) => {
|
|
2906
2940
|
const counts = arr.reduce((prev, curr) => (prev[curr.key[2]] = ++prev[curr.key[2]] || 1, prev), {});
|
|
2907
2941
|
return Object.keys(counts).map(key => ({
|
|
2908
2942
|
key: key,
|
|
2909
2943
|
value: counts[key]
|
|
2910
|
-
})).sort((
|
|
2944
|
+
})).sort(getSortingMethod(sortingMethod));
|
|
2911
2945
|
};
|
|
2912
2946
|
|
|
2913
2947
|
const _excluded$2 = ["className", "data", "emptyComponent", "localeText", "size"];
|
|
@@ -2961,7 +2995,7 @@ var mdiChevronDown = "M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z
|
|
|
2961
2995
|
var mdiChevronRight = "M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z";
|
|
2962
2996
|
var mdiMouse = "M11,1.07C7.05,1.56 4,4.92 4,9H11M4,15A8,8 0 0,0 12,23A8,8 0 0,0 20,15V11H4M13,1.07V9H20C20,4.92 16.94,1.56 13,1.07Z";
|
|
2963
2997
|
|
|
2964
|
-
const _excluded$1 = ["isBrushable", "className", "data", "dotRole", "hideControlKeyPanel", "id", "isDotSelected", "labelDecorator", "labelVariant", "legendProps", "onBrush", "onBrushEnd", "onDotClick", "size", "theme", "tooltipVariant", "variant", "xAxisVariant", "xAxisPlacement", "yAxisVariant", "yAxisPlacement"];
|
|
2998
|
+
const _excluded$1 = ["isBrushable", "className", "data", "dotRole", "hideControlKeyPanel", "id", "isDotSelected", "labelDecorator", "labelVariant", "legendProps", "onBrush", "onBrushEnd", "onDotClick", "size", "sortingMethod", "theme", "tooltipVariant", "variant", "xAxisVariant", "xAxisPlacement", "yAxisVariant", "yAxisPlacement"];
|
|
2965
2999
|
const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2966
3000
|
const {
|
|
2967
3001
|
isBrushable,
|
|
@@ -2978,6 +3012,7 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2978
3012
|
onBrushEnd,
|
|
2979
3013
|
onDotClick,
|
|
2980
3014
|
size,
|
|
3015
|
+
sortingMethod,
|
|
2981
3016
|
theme,
|
|
2982
3017
|
tooltipVariant,
|
|
2983
3018
|
variant,
|
|
@@ -3019,7 +3054,7 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3019
3054
|
return scaleLinear().domain(domain).range([chartHeight, 0]).nice();
|
|
3020
3055
|
})();
|
|
3021
3056
|
const hasCategory = data[0] && data[0].key.length >= 3 && data[0].key[2] !== null && data[0].key[2] !== undefined;
|
|
3022
|
-
const countsByCategory = hasCategory ? countBy(data) : undefined;
|
|
3057
|
+
const countsByCategory = hasCategory ? countBy(data, sortingMethod) : undefined;
|
|
3023
3058
|
const colorScale = useColor({
|
|
3024
3059
|
data: countsByCategory || data,
|
|
3025
3060
|
theme: theme,
|
|
@@ -3205,6 +3240,7 @@ const DEFAULT_PROPS = {
|
|
|
3205
3240
|
emptyChartText: 'No Data'
|
|
3206
3241
|
},
|
|
3207
3242
|
size: ChartSize.medium,
|
|
3243
|
+
sortingMethod: 'desc-value',
|
|
3208
3244
|
theme: ColorTheme.default,
|
|
3209
3245
|
tooltipVariant: TooltipVariant.none,
|
|
3210
3246
|
variant: ScatterPlotVariant.default,
|
|
@@ -3274,5 +3310,5 @@ ScatterPlot.className = CLASSNAME;
|
|
|
3274
3310
|
ScatterPlot.defaultProps = DEFAULT_PROPS;
|
|
3275
3311
|
ScatterPlot.displayName = COMPONENT_NAME;
|
|
3276
3312
|
|
|
3277
|
-
export { Arc, Arcs, Axis, AxisPosition, AxisVariant, Bar, BarChart, BarOrientation, ChartContainer, ChartSize, ColorTheme, DataPoint, Dot, DotVariant, LabelVariant, Legend, Line, LineChart, LineChartLabelVariant, PieChart, PieChartLabelVariant, PieChartVariant, ScatterPlot, ScatterPlotLabelVariant, ScatterPlotVariant, StyledArc, StyledArcs, StyledAxis, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerTitle, StyledDataPoint, StyledDot, StyledLegend, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledScatterPlot, StyledScatterPlotEmptyText, TooltipVariant, empty, getColorScale, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|
|
3313
|
+
export { Arc, Arcs, Axis, AxisPosition, AxisVariant, Bar, BarChart, BarOrientation, ChartContainer, ChartSize, ColorTheme, DataPoint, Dot, DotVariant, LabelVariant, Legend, Line, LineChart, LineChartLabelVariant, PieChart, PieChartLabelVariant, PieChartVariant, ScatterPlot, ScatterPlotLabelVariant, 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 };
|
|
3278
3314
|
//# sourceMappingURL=index.js.map
|