@redsift/charts 10.0.0 → 10.1.0-alpha.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 +29 -8
- package/index.js +379 -53
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ interface AxisProps extends Omit<ComponentProps<'g'>, 'scale'> {
|
|
|
59
59
|
tickRotation?: number;
|
|
60
60
|
tickSize?: number;
|
|
61
61
|
tickValues?: TicksSpec;
|
|
62
|
+
tickRemodelling?: (tickValues: any[]) => any[];
|
|
62
63
|
/** Variant. */
|
|
63
64
|
variant?: AxisVariant;
|
|
64
65
|
/** X position. */
|
|
@@ -96,6 +97,12 @@ type ChartAxesProps = {
|
|
|
96
97
|
xAxisTickSize?: AxisProps['tickSize'];
|
|
97
98
|
/** X axis tick values. */
|
|
98
99
|
xAxisTickValues?: AxisProps['tickValues'];
|
|
100
|
+
/** X axis min value. */
|
|
101
|
+
xAxisMinValue?: number | string;
|
|
102
|
+
/** X axis min value. */
|
|
103
|
+
xAxisMaxValue?: number | string;
|
|
104
|
+
/** Y axis tick remodelling. */
|
|
105
|
+
xAxisTickRemodelling?: (tickValues: any[]) => any[];
|
|
99
106
|
/** Y axis variant. */
|
|
100
107
|
yAxisVariant?: AxisVariant;
|
|
101
108
|
/** Y axis placement. */
|
|
@@ -110,6 +117,12 @@ type ChartAxesProps = {
|
|
|
110
117
|
yAxisTickSize?: AxisProps['tickSize'];
|
|
111
118
|
/** Y axis tick values. */
|
|
112
119
|
yAxisTickValues?: AxisProps['tickValues'];
|
|
120
|
+
/** Y axis min value. */
|
|
121
|
+
yAxisMinValue?: number | string;
|
|
122
|
+
/** Y axis min value. */
|
|
123
|
+
yAxisMaxValue?: number | string;
|
|
124
|
+
/** Y axis tick remodelling. */
|
|
125
|
+
yAxisTickRemodelling?: (tickValues: any[]) => any[];
|
|
113
126
|
};
|
|
114
127
|
|
|
115
128
|
type JSONValue = string | number | boolean | Date | {
|
|
@@ -130,19 +143,24 @@ type EmptyDatum<T> = {
|
|
|
130
143
|
percent?: number;
|
|
131
144
|
};
|
|
132
145
|
type CategoryDim = string;
|
|
133
|
-
type
|
|
134
|
-
type
|
|
146
|
+
type LinearDim = number | Date | string;
|
|
147
|
+
type CategoricalOrLinearDim = CategoryDim | LinearDim;
|
|
148
|
+
type TwoCategoryDim = [CategoricalOrLinearDim, CategoryDim | undefined | null];
|
|
149
|
+
type CoordinatesCategoryDim = [number, number, CategoryDim | undefined | null];
|
|
135
150
|
type CategoryDatum = Datum<CategoryDim>;
|
|
151
|
+
type LinearDatum = Datum<LinearDim>;
|
|
136
152
|
type TwoCategoryDatum = EmptyDatum<TwoCategoryDim>;
|
|
137
153
|
type CoordinatesCategoryDatum = Datum<CoordinatesCategoryDim>;
|
|
138
154
|
type CategoryData = CategoryDatum[];
|
|
155
|
+
type LinearData = LinearDatum[];
|
|
139
156
|
type TwoCategoryData = TwoCategoryDatum[];
|
|
140
157
|
type CoordinatesCategoryData = CoordinatesCategoryDatum[];
|
|
141
158
|
type ArcDatum = PieArcDatum<CategoryDatum>;
|
|
142
159
|
type BarDatum = {
|
|
143
|
-
data: CategoryDatum
|
|
160
|
+
data: CategoryDatum | LinearDatum | Datum<TwoCategoryDim>;
|
|
144
161
|
height?: number;
|
|
145
162
|
width?: number;
|
|
163
|
+
category?: string | null;
|
|
146
164
|
};
|
|
147
165
|
type DotDatum = {
|
|
148
166
|
data: EmptyDatum<CoordinatesCategoryDim | TwoCategoryDim>;
|
|
@@ -297,6 +315,7 @@ declare const useColor: ({ data, colorTheme, category, theme }: UseColorProps) =
|
|
|
297
315
|
|
|
298
316
|
type SortingMethod = 'none' | 'asc-key' | 'desc-key' | 'asc-value' | 'desc-value' | string[] | ((a: CategoryDatum, b: CategoryDatum) => 1 | -1);
|
|
299
317
|
declare const getSortingMethod: (sortingMethod: SortingMethod) => (a: CategoryDatum, b: CategoryDatum) => 1 | -1;
|
|
318
|
+
declare const isValidDate: (value: string) => boolean;
|
|
300
319
|
|
|
301
320
|
interface UseFormatCategoricalDataProps {
|
|
302
321
|
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
@@ -484,10 +503,12 @@ interface BarProps extends DataPointProps<BarDatum> {
|
|
|
484
503
|
orientation?: BarOrientation;
|
|
485
504
|
/** A linear continuous scale defined over a numeric domain used to determine the width or height of the bar (depending on the orientation). */
|
|
486
505
|
scale: ScaleLinear$1<number, number, never>;
|
|
506
|
+
/** A scale defined over a numeric/time/ordinal domain used to determine the position of the bar. */
|
|
507
|
+
scalePosition: ScaleLinear$1<number, number, never> | ScaleTime$2<number, number, never> | ScalePoint$2<string>;
|
|
487
508
|
/** Width of the bar in vertical orientation. */
|
|
488
509
|
width?: number;
|
|
489
510
|
}
|
|
490
|
-
type StyledBarProps = StyledDataPointProps & Omit<BarProps, 'scale'> & {
|
|
511
|
+
type StyledBarProps = StyledDataPointProps & Omit<BarProps, 'scale' | 'scalePosition'> & {
|
|
491
512
|
$theme: Theme;
|
|
492
513
|
};
|
|
493
514
|
|
|
@@ -498,7 +519,7 @@ declare const Bar: Comp<BarProps, SVGGElement>;
|
|
|
498
519
|
*/
|
|
499
520
|
declare const StyledBar: styled_components.StyledComponent<_redsift_design_system.Comp<DataPointProps<any>, SVGGElement>, any, Omit<DataPointProps<any>, "data"> & {
|
|
500
521
|
$clickable: boolean;
|
|
501
|
-
} & Omit<BarProps, "scale"> & {
|
|
522
|
+
} & Omit<BarProps, "scale" | "scalePosition"> & {
|
|
502
523
|
$theme: Theme;
|
|
503
524
|
}, never>;
|
|
504
525
|
|
|
@@ -557,7 +578,7 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
557
578
|
/** Number of categories to use, the rest being put into a new category called "Others". */
|
|
558
579
|
caping?: number;
|
|
559
580
|
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
560
|
-
data?: CategoryData;
|
|
581
|
+
data?: CategoryData | LinearData | TwoCategoryData;
|
|
561
582
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
562
583
|
emptyComponent?: ReactNode;
|
|
563
584
|
/** Method to determine whether a slice is selected or not. */
|
|
@@ -623,7 +644,7 @@ type DotVariant = ValueOf<typeof DotVariant>;
|
|
|
623
644
|
* Component props.
|
|
624
645
|
*/
|
|
625
646
|
interface DotProps extends DataPointProps<DotDatum> {
|
|
626
|
-
/** A
|
|
647
|
+
/** A scale defined over a numeric/time/ordinal domain used to determine the x position based on the coordinates. */
|
|
627
648
|
scaleX: ScaleLinear$1<number, number, never> | ScaleTime$2<number, number, never> | ScalePoint$2<string>;
|
|
628
649
|
/** A linear continuous scale defined over a numeric domain used to determine the y position based on the coordinates. */
|
|
629
650
|
scaleY: ScaleLinear$1<number, number, never>;
|
|
@@ -1025,4 +1046,4 @@ declare const StyledScatterPlotEmptyText: styled_components.StyledComponent<"div
|
|
|
1025
1046
|
$theme: Theme;
|
|
1026
1047
|
}, never>;
|
|
1027
1048
|
|
|
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 };
|
|
1049
|
+
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 };
|