@redsift/charts 9.2.3-patch → 9.2.3
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/coverage/clover.xml +1096 -0
- package/coverage/coverage-final.json +60 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/components/Arc/Arc.tsx.html +304 -0
- package/coverage/lcov-report/components/Arc/index.html +146 -0
- package/coverage/lcov-report/components/Arc/index.ts.html +94 -0
- package/coverage/lcov-report/components/Arc/styles.ts.html +208 -0
- package/coverage/lcov-report/components/Arcs/Arcs.tsx.html +409 -0
- package/coverage/lcov-report/components/Arcs/index.html +146 -0
- package/coverage/lcov-report/components/Arcs/index.ts.html +94 -0
- package/coverage/lcov-report/components/Arcs/styles.ts.html +106 -0
- package/coverage/lcov-report/components/Axis/Axis.tsx.html +754 -0
- package/coverage/lcov-report/components/Axis/computeTicks.ts.html +481 -0
- package/coverage/lcov-report/components/Axis/index.html +176 -0
- package/coverage/lcov-report/components/Axis/index.ts.html +94 -0
- package/coverage/lcov-report/components/Axis/styles.ts.html +148 -0
- package/coverage/lcov-report/components/Axis/types.ts.html +253 -0
- package/coverage/lcov-report/components/Bar/Bar.tsx.html +421 -0
- package/coverage/lcov-report/components/Bar/index.html +161 -0
- package/coverage/lcov-report/components/Bar/index.ts.html +94 -0
- package/coverage/lcov-report/components/Bar/styles.ts.html +247 -0
- package/coverage/lcov-report/components/Bar/types.ts.html +178 -0
- package/coverage/lcov-report/components/BarChart/BarChart.tsx.html +352 -0
- package/coverage/lcov-report/components/BarChart/EmptyBarChart.tsx.html +259 -0
- package/coverage/lcov-report/components/BarChart/LoadingBarChart.tsx.html +145 -0
- package/coverage/lcov-report/components/BarChart/RenderedBarChart.tsx.html +430 -0
- package/coverage/lcov-report/components/BarChart/index.html +206 -0
- package/coverage/lcov-report/components/BarChart/index.ts.html +94 -0
- package/coverage/lcov-report/components/BarChart/styles.ts.html +190 -0
- package/coverage/lcov-report/components/BarChart/utils.ts.html +145 -0
- package/coverage/lcov-report/components/BottomAxis/BottomAxis.tsx.html +247 -0
- package/coverage/lcov-report/components/BottomAxis/index.html +146 -0
- package/coverage/lcov-report/components/BottomAxis/index.ts.html +94 -0
- package/coverage/lcov-report/components/BottomAxis/styles.ts.html +139 -0
- package/coverage/lcov-report/components/ChartContainer/ChartContainer.tsx.html +361 -0
- package/coverage/lcov-report/components/ChartContainer/index.html +146 -0
- package/coverage/lcov-report/components/ChartContainer/index.ts.html +94 -0
- package/coverage/lcov-report/components/ChartContainer/intl/index.html +116 -0
- package/coverage/lcov-report/components/ChartContainer/intl/index.ts.html +106 -0
- package/coverage/lcov-report/components/ChartContainer/styles.ts.html +208 -0
- package/coverage/lcov-report/components/DataPoint/DataPoint.tsx.html +391 -0
- package/coverage/lcov-report/components/DataPoint/index.html +146 -0
- package/coverage/lcov-report/components/DataPoint/index.ts.html +94 -0
- package/coverage/lcov-report/components/DataPoint/styles.ts.html +109 -0
- package/coverage/lcov-report/components/Dot/Dot.tsx.html +232 -0
- package/coverage/lcov-report/components/Dot/index.html +146 -0
- package/coverage/lcov-report/components/Dot/index.ts.html +94 -0
- package/coverage/lcov-report/components/Dot/styles.ts.html +184 -0
- package/coverage/lcov-report/components/HorizontalBar/HorizontalBar.tsx.html +541 -0
- package/coverage/lcov-report/components/HorizontalBar/index.html +161 -0
- package/coverage/lcov-report/components/HorizontalBar/index.ts.html +94 -0
- package/coverage/lcov-report/components/HorizontalBar/styles.ts.html +187 -0
- package/coverage/lcov-report/components/HorizontalBar/types.ts.html +301 -0
- package/coverage/lcov-report/components/HorizontalBarChart/HorizontalBarChart.tsx.html +691 -0
- package/coverage/lcov-report/components/HorizontalBarChart/index.html +146 -0
- package/coverage/lcov-report/components/HorizontalBarChart/index.ts.html +94 -0
- package/coverage/lcov-report/components/HorizontalBarChart/styles.ts.html +196 -0
- package/coverage/lcov-report/components/HorizontalBarChart/types.ts.html +301 -0
- package/coverage/lcov-report/components/Legend/Legend.tsx.html +268 -0
- package/coverage/lcov-report/components/Legend/index.html +146 -0
- package/coverage/lcov-report/components/Legend/index.ts.html +94 -0
- package/coverage/lcov-report/components/Legend/styles.ts.html +130 -0
- package/coverage/lcov-report/components/LegendItem/LegendItem.tsx.html +325 -0
- package/coverage/lcov-report/components/LegendItem/index.html +146 -0
- package/coverage/lcov-report/components/LegendItem/index.ts.html +94 -0
- package/coverage/lcov-report/components/LegendItem/styles.ts.html +205 -0
- package/coverage/lcov-report/components/PieChart/EmptyPieChart.tsx.html +343 -0
- package/coverage/lcov-report/components/PieChart/LoadingPieChart.tsx.html +145 -0
- package/coverage/lcov-report/components/PieChart/PieChart.tsx.html +385 -0
- package/coverage/lcov-report/components/PieChart/RenderedPieChart.tsx.html +607 -0
- package/coverage/lcov-report/components/PieChart/index.html +221 -0
- package/coverage/lcov-report/components/PieChart/index.ts.html +94 -0
- package/coverage/lcov-report/components/PieChart/styles.ts.html +370 -0
- package/coverage/lcov-report/components/PieChart/types.ts.html +367 -0
- package/coverage/lcov-report/components/PieChart/utils.ts.html +199 -0
- package/coverage/lcov-report/components/ScatterPlot/EmptyScatterPlot.tsx.html +295 -0
- package/coverage/lcov-report/components/ScatterPlot/LoadingScatterPlot.tsx.html +145 -0
- package/coverage/lcov-report/components/ScatterPlot/RenderedScatterPlot.tsx.html +1048 -0
- package/coverage/lcov-report/components/ScatterPlot/ScatterPlot.tsx.html +367 -0
- package/coverage/lcov-report/components/ScatterPlot/index.html +221 -0
- package/coverage/lcov-report/components/ScatterPlot/index.ts.html +94 -0
- package/coverage/lcov-report/components/ScatterPlot/styles.ts.html +190 -0
- package/coverage/lcov-report/components/ScatterPlot/types.ts.html +394 -0
- package/coverage/lcov-report/components/ScatterPlot/utils.ts.html +388 -0
- package/coverage/lcov-report/core/Arc/Arc.tsx.html +304 -0
- package/coverage/lcov-report/core/Arc/index.html +146 -0
- package/coverage/lcov-report/core/Arc/index.ts.html +94 -0
- package/coverage/lcov-report/core/Arc/styles.ts.html +202 -0
- package/coverage/lcov-report/core/Arcs/Arcs.tsx.html +421 -0
- package/coverage/lcov-report/core/Arcs/index.html +146 -0
- package/coverage/lcov-report/core/Arcs/index.ts.html +94 -0
- package/coverage/lcov-report/core/Arcs/styles.ts.html +106 -0
- package/coverage/lcov-report/core/Axis/Axis.tsx.html +754 -0
- package/coverage/lcov-report/core/Axis/computeTicks.ts.html +481 -0
- package/coverage/lcov-report/core/Axis/index.html +176 -0
- package/coverage/lcov-report/core/Axis/index.ts.html +94 -0
- package/coverage/lcov-report/core/Axis/styles.ts.html +145 -0
- package/coverage/lcov-report/core/Axis/types.ts.html +253 -0
- package/coverage/lcov-report/core/Bar/Bar.tsx.html +421 -0
- package/coverage/lcov-report/core/Bar/index.html +161 -0
- package/coverage/lcov-report/core/Bar/index.ts.html +94 -0
- package/coverage/lcov-report/core/Bar/styles.ts.html +190 -0
- package/coverage/lcov-report/core/Bar/types.ts.html +178 -0
- package/coverage/lcov-report/core/BottomAxis/BottomAxis.tsx.html +277 -0
- package/coverage/lcov-report/core/BottomAxis/index.html +146 -0
- package/coverage/lcov-report/core/BottomAxis/index.ts.html +94 -0
- package/coverage/lcov-report/core/BottomAxis/styles.ts.html +139 -0
- package/coverage/lcov-report/core/ChartConfig/ChartConfig.ts.html +97 -0
- package/coverage/lcov-report/core/ChartConfig/index.html +131 -0
- package/coverage/lcov-report/core/ChartConfig/index.ts.html +88 -0
- package/coverage/lcov-report/core/ChartContainer/ChartContainer.tsx.html +421 -0
- package/coverage/lcov-report/core/ChartContainer/index.html +146 -0
- package/coverage/lcov-report/core/ChartContainer/index.ts.html +94 -0
- package/coverage/lcov-report/core/ChartContainer/intl/index.html +116 -0
- package/coverage/lcov-report/core/ChartContainer/intl/index.ts.html +106 -0
- package/coverage/lcov-report/core/ChartContainer/styles.ts.html +205 -0
- package/coverage/lcov-report/core/DataPoint/DataPoint.tsx.html +442 -0
- package/coverage/lcov-report/core/DataPoint/index.html +146 -0
- package/coverage/lcov-report/core/DataPoint/index.ts.html +94 -0
- package/coverage/lcov-report/core/DataPoint/styles.ts.html +109 -0
- package/coverage/lcov-report/core/Dot/Dot.tsx.html +232 -0
- package/coverage/lcov-report/core/Dot/index.html +146 -0
- package/coverage/lcov-report/core/Dot/index.ts.html +94 -0
- package/coverage/lcov-report/core/Dot/styles.ts.html +184 -0
- package/coverage/lcov-report/core/Legend/Legend.tsx.html +277 -0
- package/coverage/lcov-report/core/Legend/index.html +146 -0
- package/coverage/lcov-report/core/Legend/index.ts.html +94 -0
- package/coverage/lcov-report/core/Legend/styles.ts.html +172 -0
- package/coverage/lcov-report/core/Point/Point.tsx.html +484 -0
- package/coverage/lcov-report/core/Point/index.html +146 -0
- package/coverage/lcov-report/core/Point/index.ts.html +94 -0
- package/coverage/lcov-report/core/Point/styles.ts.html +169 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/gallery/HorizontalBarChart/HorizontalBarChart.tsx.html +706 -0
- package/coverage/lcov-report/gallery/HorizontalBarChart/index.html +161 -0
- package/coverage/lcov-report/gallery/HorizontalBarChart/index.ts.html +94 -0
- package/coverage/lcov-report/gallery/HorizontalBarChart/styles.ts.html +316 -0
- package/coverage/lcov-report/gallery/HorizontalBarChart/types.ts.html +310 -0
- package/coverage/lcov-report/gallery/PieChart/PieChart.tsx.html +1252 -0
- package/coverage/lcov-report/gallery/PieChart/index.html +161 -0
- package/coverage/lcov-report/gallery/PieChart/index.ts.html +94 -0
- package/coverage/lcov-report/gallery/PieChart/styles.ts.html +517 -0
- package/coverage/lcov-report/gallery/PieChart/types.ts.html +388 -0
- package/coverage/lcov-report/gallery/ScatterPlot/index.html +146 -0
- package/coverage/lcov-report/gallery/ScatterPlot/index.ts.html +94 -0
- package/coverage/lcov-report/gallery/ScatterPlot/styles.ts.html +343 -0
- package/coverage/lcov-report/gallery/ScatterPlot/types.ts.html +433 -0
- package/coverage/lcov-report/hooks/index.html +176 -0
- package/coverage/lcov-report/hooks/index.ts.html +97 -0
- package/coverage/lcov-report/hooks/useBrush.tsx.html +430 -0
- package/coverage/lcov-report/hooks/useColor.tsx.html +163 -0
- package/coverage/lcov-report/hooks/useFormatCategoricalData.tsx.html +289 -0
- package/coverage/lcov-report/hooks/useIsEmpty.tsx.html +118 -0
- package/coverage/lcov-report/hooks/useZoom.tsx.html +235 -0
- package/coverage/lcov-report/index.html +311 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +2345 -0
- package/coverage/storybook/coverage-storybook.json +79382 -0
- package/dist/package.json +98 -0
- package/index.ts +1 -0
- package/jest.config.js +3 -0
- package/package.json +2 -3
- package/rollup.config.js +13 -0
- package/src/components/Arc/Arc.test.tsx +80 -0
- package/src/components/Arc/Arc.tsx +73 -0
- package/src/components/Arc/index.ts +3 -0
- package/src/components/Arc/styles.ts +41 -0
- package/src/components/Arc/types.ts +18 -0
- package/src/components/Arcs/Arcs.stories.tsx +177 -0
- package/src/components/Arcs/Arcs.tsx +108 -0
- package/src/components/Arcs/index.ts +3 -0
- package/src/components/Arcs/styles.ts +7 -0
- package/src/components/Arcs/types.ts +26 -0
- package/src/components/Axis/Axis.stories.tsx +297 -0
- package/src/components/Axis/Axis.tsx +223 -0
- package/src/components/Axis/computeTicks.ts +132 -0
- package/src/components/Axis/index.ts +3 -0
- package/src/components/Axis/styles.ts +21 -0
- package/src/components/Axis/types.ts +56 -0
- package/src/components/Bar/Bar.stories.tsx +152 -0
- package/src/components/Bar/Bar.test.tsx +156 -0
- package/src/components/Bar/Bar.tsx +112 -0
- package/src/components/Bar/index.ts +3 -0
- package/src/components/Bar/styles.ts +54 -0
- package/src/components/Bar/types.ts +31 -0
- package/src/components/BarChart/BarChart.stories.tsx +74 -0
- package/src/components/BarChart/BarChart.test.tsx +178 -0
- package/src/components/BarChart/BarChart.tsx +89 -0
- package/src/components/BarChart/EmptyBarChart.tsx +58 -0
- package/src/components/BarChart/LoadingBarChart.tsx +20 -0
- package/src/components/BarChart/RenderedBarChart.tsx +115 -0
- package/src/components/BarChart/__snapshots__/BarChart.test.tsx.snap +7028 -0
- package/src/components/BarChart/index.ts +3 -0
- package/src/components/BarChart/styles.ts +35 -0
- package/src/components/BarChart/types.ts +58 -0
- package/src/components/BarChart/utils.ts +20 -0
- package/src/components/ChartContainer/ChartContainer.stories.tsx +81 -0
- package/src/components/ChartContainer/ChartContainer.test.tsx +71 -0
- package/src/components/ChartContainer/ChartContainer.tsx +92 -0
- package/src/components/ChartContainer/index.ts +3 -0
- package/src/components/ChartContainer/intl/en-US.json +3 -0
- package/src/components/ChartContainer/intl/fr-FR.json +3 -0
- package/src/components/ChartContainer/intl/index.ts +7 -0
- package/src/components/ChartContainer/styles.ts +41 -0
- package/src/components/ChartContainer/types.ts +26 -0
- package/src/components/DataPoint/DataPoint.tsx +102 -0
- package/src/components/DataPoint/index.ts +3 -0
- package/src/components/DataPoint/styles.ts +8 -0
- package/src/components/DataPoint/types.ts +33 -0
- package/src/components/Dot/Dot.stories.tsx +157 -0
- package/src/components/Dot/Dot.test.tsx +136 -0
- package/src/components/Dot/Dot.tsx +49 -0
- package/src/components/Dot/index.ts +3 -0
- package/src/components/Dot/styles.ts +33 -0
- package/src/components/Dot/types.ts +16 -0
- package/src/components/Legend/Legend.stories.tsx +108 -0
- package/src/components/Legend/Legend.tsx +61 -0
- package/src/components/Legend/index.ts +3 -0
- package/src/components/Legend/styles.ts +15 -0
- package/src/components/Legend/types.ts +27 -0
- package/src/components/LegendItem/LegendItem.test.tsx +69 -0
- package/src/components/LegendItem/LegendItem.tsx +80 -0
- package/src/components/LegendItem/index.ts +3 -0
- package/src/components/LegendItem/styles.ts +40 -0
- package/src/components/LegendItem/types.ts +30 -0
- package/src/components/PieChart/EmptyPieChart.tsx +86 -0
- package/src/components/PieChart/LoadingPieChart.tsx +20 -0
- package/src/components/PieChart/PieChart.stories.tsx +85 -0
- package/src/components/PieChart/PieChart.test.tsx +183 -0
- package/src/components/PieChart/PieChart.tsx +100 -0
- package/src/components/PieChart/RenderedPieChart.tsx +174 -0
- package/src/components/PieChart/__snapshots__/PieChart.test.tsx.snap +21020 -0
- package/src/components/PieChart/index.ts +3 -0
- package/src/components/PieChart/styles.ts +95 -0
- package/src/components/PieChart/types.ts +94 -0
- package/src/components/PieChart/utils.ts +38 -0
- package/src/components/ScatterPlot/EmptyScatterPlot.tsx +70 -0
- package/src/components/ScatterPlot/LoadingScatterPlot.tsx +20 -0
- package/src/components/ScatterPlot/RenderedScatterPlot.tsx +321 -0
- package/src/components/ScatterPlot/ScatterPlot.stories.tsx +101 -0
- package/src/components/ScatterPlot/ScatterPlot.test.tsx +61 -0
- package/src/components/ScatterPlot/ScatterPlot.tsx +94 -0
- package/src/components/ScatterPlot/__snapshots__/ScatterPlot.test.tsx.snap +91712 -0
- package/src/components/ScatterPlot/index.ts +3 -0
- package/src/components/ScatterPlot/styles.ts +35 -0
- package/src/components/ScatterPlot/types.ts +103 -0
- package/src/components/ScatterPlot/utils.ts +101 -0
- package/src/config.ts +10 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useBrush.tsx +115 -0
- package/src/hooks/useColor.tsx +26 -0
- package/src/hooks/useFormatCategoricalData.tsx +68 -0
- package/src/hooks/useZoom.tsx +50 -0
- package/src/index.ts +15 -0
- package/src/scheme.ts +213 -0
- package/src/types/data.ts +52 -0
- package/src/types/index.ts +5 -0
- package/src/types/legend.ts +19 -0
- package/src/types/scale.ts +79 -0
- package/src/types/size.ts +17 -0
- package/src/types/theme.ts +27 -0
- package/tsconfig.json +3 -0
- /package/{CONTRIBUTING.md → dist/CONTRIBUTING.md} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{index.js.map → dist/index.js.map} +0 -0
package/src/scheme.ts
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { scaleOrdinal as d3scaleOrdinal, ScaleOrdinal as d3ScaleOrdinal } from 'd3';
|
|
2
|
+
import { ChartTheme } from './types';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
RedsiftColorPresentationAquaDark,
|
|
6
|
+
RedsiftColorPresentationAquaDarker,
|
|
7
|
+
RedsiftColorPresentationAquaDarkerer,
|
|
8
|
+
RedsiftColorPresentationAquaDefault,
|
|
9
|
+
RedsiftColorPresentationAquaLight,
|
|
10
|
+
RedsiftColorPresentationAquaLighter,
|
|
11
|
+
RedsiftColorPresentationAquaLighterer,
|
|
12
|
+
RedsiftColorPresentationBlueDark,
|
|
13
|
+
RedsiftColorPresentationBlueDarker,
|
|
14
|
+
RedsiftColorPresentationBlueDarkerer,
|
|
15
|
+
RedsiftColorPresentationBlueDefault,
|
|
16
|
+
RedsiftColorPresentationBlueLight,
|
|
17
|
+
RedsiftColorPresentationBlueLighter,
|
|
18
|
+
RedsiftColorPresentationBlueLighterer,
|
|
19
|
+
RedsiftColorPresentationBrownDark,
|
|
20
|
+
RedsiftColorPresentationBrownDarker,
|
|
21
|
+
RedsiftColorPresentationBrownDarkerer,
|
|
22
|
+
RedsiftColorPresentationBrownDefault,
|
|
23
|
+
RedsiftColorPresentationBrownLight,
|
|
24
|
+
RedsiftColorPresentationBrownLighter,
|
|
25
|
+
RedsiftColorPresentationBrownLighterer,
|
|
26
|
+
RedsiftColorPresentationGreenDark,
|
|
27
|
+
RedsiftColorPresentationGreenDarker,
|
|
28
|
+
RedsiftColorPresentationGreenDarkerer,
|
|
29
|
+
RedsiftColorPresentationGreenDefault,
|
|
30
|
+
RedsiftColorPresentationGreenLight,
|
|
31
|
+
RedsiftColorPresentationGreenLighter,
|
|
32
|
+
RedsiftColorPresentationGreenLighterer,
|
|
33
|
+
RedsiftColorPresentationGreyDark,
|
|
34
|
+
RedsiftColorPresentationGreyDarker,
|
|
35
|
+
RedsiftColorPresentationGreyDarkerer,
|
|
36
|
+
RedsiftColorPresentationGreyDefault,
|
|
37
|
+
RedsiftColorPresentationGreyLight,
|
|
38
|
+
RedsiftColorPresentationGreyLighter,
|
|
39
|
+
RedsiftColorPresentationGreyLighterer,
|
|
40
|
+
RedsiftColorPresentationOrangeDark,
|
|
41
|
+
RedsiftColorPresentationOrangeDarker,
|
|
42
|
+
RedsiftColorPresentationOrangeDarkerer,
|
|
43
|
+
RedsiftColorPresentationOrangeDefault,
|
|
44
|
+
RedsiftColorPresentationOrangeLight,
|
|
45
|
+
RedsiftColorPresentationOrangeLighter,
|
|
46
|
+
RedsiftColorPresentationOrangeLighterer,
|
|
47
|
+
RedsiftColorPresentationPinkDark,
|
|
48
|
+
RedsiftColorPresentationPinkDarker,
|
|
49
|
+
RedsiftColorPresentationPinkDarkerer,
|
|
50
|
+
RedsiftColorPresentationPinkDefault,
|
|
51
|
+
RedsiftColorPresentationPinkLight,
|
|
52
|
+
RedsiftColorPresentationPinkLighter,
|
|
53
|
+
RedsiftColorPresentationPinkLighterer,
|
|
54
|
+
RedsiftColorPresentationPurpleDark,
|
|
55
|
+
RedsiftColorPresentationPurpleDarker,
|
|
56
|
+
RedsiftColorPresentationPurpleDarkerer,
|
|
57
|
+
RedsiftColorPresentationPurpleDefault,
|
|
58
|
+
RedsiftColorPresentationPurpleLight,
|
|
59
|
+
RedsiftColorPresentationPurpleLighter,
|
|
60
|
+
RedsiftColorPresentationPurpleLighterer,
|
|
61
|
+
RedsiftColorPresentationRedDark,
|
|
62
|
+
RedsiftColorPresentationRedDarker,
|
|
63
|
+
RedsiftColorPresentationRedDarkerer,
|
|
64
|
+
RedsiftColorPresentationRedDefault,
|
|
65
|
+
RedsiftColorPresentationRedLight,
|
|
66
|
+
RedsiftColorPresentationRedLighter,
|
|
67
|
+
RedsiftColorPresentationRedLighterer,
|
|
68
|
+
RedsiftColorPresentationYellowDark,
|
|
69
|
+
RedsiftColorPresentationYellowDarker,
|
|
70
|
+
RedsiftColorPresentationYellowDarkerer,
|
|
71
|
+
RedsiftColorPresentationYellowDefault,
|
|
72
|
+
RedsiftColorPresentationYellowLight,
|
|
73
|
+
RedsiftColorPresentationYellowLighter,
|
|
74
|
+
RedsiftColorPresentationYellowLighterer,
|
|
75
|
+
} from '@redsift/design-system';
|
|
76
|
+
|
|
77
|
+
export const monochrome = RedsiftColorPresentationBlueDefault;
|
|
78
|
+
export const empty = RedsiftColorPresentationGreyDark;
|
|
79
|
+
|
|
80
|
+
export const scheme = {
|
|
81
|
+
default: [
|
|
82
|
+
RedsiftColorPresentationGreenDefault,
|
|
83
|
+
RedsiftColorPresentationPinkDefault,
|
|
84
|
+
RedsiftColorPresentationAquaDefault,
|
|
85
|
+
RedsiftColorPresentationBrownDefault,
|
|
86
|
+
RedsiftColorPresentationRedDefault,
|
|
87
|
+
RedsiftColorPresentationYellowDefault,
|
|
88
|
+
RedsiftColorPresentationPurpleDefault,
|
|
89
|
+
RedsiftColorPresentationOrangeDefault,
|
|
90
|
+
RedsiftColorPresentationBlueDefault,
|
|
91
|
+
RedsiftColorPresentationGreyDefault,
|
|
92
|
+
],
|
|
93
|
+
dark: [
|
|
94
|
+
RedsiftColorPresentationGreenDark,
|
|
95
|
+
RedsiftColorPresentationPinkDark,
|
|
96
|
+
RedsiftColorPresentationAquaDark,
|
|
97
|
+
RedsiftColorPresentationBrownDark,
|
|
98
|
+
RedsiftColorPresentationRedDark,
|
|
99
|
+
RedsiftColorPresentationYellowDark,
|
|
100
|
+
RedsiftColorPresentationPurpleDark,
|
|
101
|
+
RedsiftColorPresentationOrangeDark,
|
|
102
|
+
RedsiftColorPresentationBlueDark,
|
|
103
|
+
RedsiftColorPresentationGreyDark,
|
|
104
|
+
],
|
|
105
|
+
darker: [
|
|
106
|
+
RedsiftColorPresentationGreenDarker,
|
|
107
|
+
RedsiftColorPresentationPinkDarker,
|
|
108
|
+
RedsiftColorPresentationAquaDarker,
|
|
109
|
+
RedsiftColorPresentationBrownDarker,
|
|
110
|
+
RedsiftColorPresentationRedDarker,
|
|
111
|
+
RedsiftColorPresentationYellowDarker,
|
|
112
|
+
RedsiftColorPresentationPurpleDarker,
|
|
113
|
+
RedsiftColorPresentationOrangeDarker,
|
|
114
|
+
RedsiftColorPresentationBlueDarker,
|
|
115
|
+
RedsiftColorPresentationGreyDarker,
|
|
116
|
+
],
|
|
117
|
+
darkerer: [
|
|
118
|
+
RedsiftColorPresentationGreenDarkerer,
|
|
119
|
+
RedsiftColorPresentationPinkDarkerer,
|
|
120
|
+
RedsiftColorPresentationAquaDarkerer,
|
|
121
|
+
RedsiftColorPresentationBrownDarkerer,
|
|
122
|
+
RedsiftColorPresentationRedDarkerer,
|
|
123
|
+
RedsiftColorPresentationYellowDarkerer,
|
|
124
|
+
RedsiftColorPresentationPurpleDarkerer,
|
|
125
|
+
RedsiftColorPresentationOrangeDarkerer,
|
|
126
|
+
RedsiftColorPresentationBlueDarkerer,
|
|
127
|
+
RedsiftColorPresentationGreyDarkerer,
|
|
128
|
+
],
|
|
129
|
+
light: [
|
|
130
|
+
RedsiftColorPresentationGreenLight,
|
|
131
|
+
RedsiftColorPresentationPinkLight,
|
|
132
|
+
RedsiftColorPresentationAquaLight,
|
|
133
|
+
RedsiftColorPresentationBrownLight,
|
|
134
|
+
RedsiftColorPresentationRedLight,
|
|
135
|
+
RedsiftColorPresentationYellowLight,
|
|
136
|
+
RedsiftColorPresentationPurpleLight,
|
|
137
|
+
RedsiftColorPresentationOrangeLight,
|
|
138
|
+
RedsiftColorPresentationBlueLight,
|
|
139
|
+
RedsiftColorPresentationGreyLight,
|
|
140
|
+
],
|
|
141
|
+
lighter: [
|
|
142
|
+
RedsiftColorPresentationGreenLighter,
|
|
143
|
+
RedsiftColorPresentationPinkLighter,
|
|
144
|
+
RedsiftColorPresentationAquaLighter,
|
|
145
|
+
RedsiftColorPresentationBrownLighter,
|
|
146
|
+
RedsiftColorPresentationRedLighter,
|
|
147
|
+
RedsiftColorPresentationYellowLighter,
|
|
148
|
+
RedsiftColorPresentationPurpleLighter,
|
|
149
|
+
RedsiftColorPresentationOrangeLighter,
|
|
150
|
+
RedsiftColorPresentationBlueLighter,
|
|
151
|
+
RedsiftColorPresentationGreyLighter,
|
|
152
|
+
],
|
|
153
|
+
lighterer: [
|
|
154
|
+
RedsiftColorPresentationGreenLighterer,
|
|
155
|
+
RedsiftColorPresentationPinkLighterer,
|
|
156
|
+
RedsiftColorPresentationAquaLighterer,
|
|
157
|
+
RedsiftColorPresentationBrownLighterer,
|
|
158
|
+
RedsiftColorPresentationRedLighterer,
|
|
159
|
+
RedsiftColorPresentationYellowLighterer,
|
|
160
|
+
RedsiftColorPresentationPurpleLighterer,
|
|
161
|
+
RedsiftColorPresentationOrangeLighterer,
|
|
162
|
+
RedsiftColorPresentationBlueLighterer,
|
|
163
|
+
RedsiftColorPresentationGreyLighterer,
|
|
164
|
+
],
|
|
165
|
+
monochrome: [monochrome],
|
|
166
|
+
empty: [empty],
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const successDangerScheme = {
|
|
170
|
+
success: RedsiftColorPresentationGreenDefault,
|
|
171
|
+
warning: RedsiftColorPresentationOrangeDefault,
|
|
172
|
+
danger: RedsiftColorPresentationRedDefault,
|
|
173
|
+
neutral: RedsiftColorPresentationGreyDefault,
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const getColorScale = (
|
|
177
|
+
theme: ChartTheme,
|
|
178
|
+
domain?: string[],
|
|
179
|
+
isEmpty?: boolean
|
|
180
|
+
): d3ScaleOrdinal<string, string> => {
|
|
181
|
+
let d3colors = d3scaleOrdinal(scheme.default);
|
|
182
|
+
if (isEmpty) {
|
|
183
|
+
d3colors = d3scaleOrdinal(scheme.empty);
|
|
184
|
+
} else if (typeof theme === 'string') {
|
|
185
|
+
d3colors = d3scaleOrdinal().domain(domain!).range(scheme[theme]).unknown(monochrome) as d3ScaleOrdinal<
|
|
186
|
+
string,
|
|
187
|
+
string
|
|
188
|
+
>;
|
|
189
|
+
} else if (typeof theme === 'object') {
|
|
190
|
+
if (
|
|
191
|
+
Object.keys(theme).includes('success') &&
|
|
192
|
+
Object.keys(theme).includes('danger') &&
|
|
193
|
+
Object.keys(theme).includes('warning')
|
|
194
|
+
) {
|
|
195
|
+
d3colors = d3scaleOrdinal()
|
|
196
|
+
.domain([theme.success, theme.warning, theme.danger, ...(theme.neutral ? [theme.neutral] : [])])
|
|
197
|
+
.range([
|
|
198
|
+
successDangerScheme.success,
|
|
199
|
+
successDangerScheme.warning,
|
|
200
|
+
successDangerScheme.danger,
|
|
201
|
+
...(theme.neutral ? [successDangerScheme.neutral] : []),
|
|
202
|
+
])
|
|
203
|
+
.unknown(monochrome) as d3ScaleOrdinal<string, string>;
|
|
204
|
+
} else {
|
|
205
|
+
d3colors = d3scaleOrdinal()
|
|
206
|
+
.domain(Object.keys(theme))
|
|
207
|
+
.range(Object.values(theme))
|
|
208
|
+
.unknown(monochrome) as d3ScaleOrdinal<string, string>;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return d3colors;
|
|
213
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PieArcDatum as d3PieArcDatum } from 'd3-shape';
|
|
2
|
+
|
|
3
|
+
export type JSONValue =
|
|
4
|
+
| string
|
|
5
|
+
| number
|
|
6
|
+
| boolean
|
|
7
|
+
| { [x: string]: JSONValue }
|
|
8
|
+
| Array<JSONValue>
|
|
9
|
+
| undefined
|
|
10
|
+
| null;
|
|
11
|
+
|
|
12
|
+
export type JSONObject = { [x: string]: JSONValue };
|
|
13
|
+
|
|
14
|
+
export type JSONArray = Array<JSONObject>;
|
|
15
|
+
|
|
16
|
+
export type Datum<T> = {
|
|
17
|
+
key: T;
|
|
18
|
+
value: number;
|
|
19
|
+
percent?: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type CategoryDim = string;
|
|
23
|
+
export type CoordinatesCategoryDim = [
|
|
24
|
+
number,
|
|
25
|
+
number,
|
|
26
|
+
string | undefined | null
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export type CategoryDatum = Datum<CategoryDim>;
|
|
30
|
+
export type CoordinatesCategoryDatum = Datum<CoordinatesCategoryDim>;
|
|
31
|
+
|
|
32
|
+
export type CategoryData = CategoryDatum[];
|
|
33
|
+
export type CoordinatesCategoryData = CoordinatesCategoryDatum[];
|
|
34
|
+
|
|
35
|
+
export type ArcDatum = d3PieArcDatum<CategoryDatum>;
|
|
36
|
+
|
|
37
|
+
export type BarDatum = {
|
|
38
|
+
data: CategoryDatum;
|
|
39
|
+
height?: number;
|
|
40
|
+
width?: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type DotDatum = {
|
|
44
|
+
data: CoordinatesCategoryDatum;
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
r: number;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type LegendItemDatum = {
|
|
51
|
+
data: CategoryDatum;
|
|
52
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ValueOf } from '@redsift/design-system';
|
|
2
|
+
|
|
3
|
+
/** TOOLTIP */
|
|
4
|
+
|
|
5
|
+
export const TooltipVariant = {
|
|
6
|
+
none: 'none',
|
|
7
|
+
label: 'label',
|
|
8
|
+
value: 'value',
|
|
9
|
+
percent: 'percent',
|
|
10
|
+
};
|
|
11
|
+
export type TooltipVariant = ValueOf<typeof TooltipVariant>;
|
|
12
|
+
|
|
13
|
+
/** LEGEND */
|
|
14
|
+
export const LabelVariant = {
|
|
15
|
+
label: 'label',
|
|
16
|
+
value: 'value',
|
|
17
|
+
percent: 'percent',
|
|
18
|
+
} as const;
|
|
19
|
+
export type LabelVariant = ValueOf<typeof LabelVariant>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ScaleLinear as d3ScaleLinear,
|
|
3
|
+
ScalePoint as d3ScalePoint,
|
|
4
|
+
ScaleBand as d3ScaleBand,
|
|
5
|
+
ScaleLogarithmic as d3ScaleLogarithmic,
|
|
6
|
+
ScaleSymLog as d3ScaleSymLog,
|
|
7
|
+
ScaleTime as d3ScaleTime,
|
|
8
|
+
} from 'd3-scale';
|
|
9
|
+
|
|
10
|
+
export type Coordinates = {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type NumericValue = { valueOf(): number };
|
|
16
|
+
|
|
17
|
+
export type StringValue = { toString(): string };
|
|
18
|
+
|
|
19
|
+
export type ScaleValue = NumericValue | StringValue | Date;
|
|
20
|
+
|
|
21
|
+
export interface ScaleLinear<Output>
|
|
22
|
+
extends d3ScaleLinear<number, Output, never> {
|
|
23
|
+
type: 'linear';
|
|
24
|
+
// default to `false`
|
|
25
|
+
stacked: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ScaleLog extends d3ScaleLogarithmic<number, number> {
|
|
29
|
+
type: 'log';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ScaleSymlog extends d3ScaleSymLog<number, number> {
|
|
33
|
+
type: 'symlog';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ScalePoint<Input extends StringValue>
|
|
37
|
+
extends d3ScalePoint<Input> {
|
|
38
|
+
type: 'point';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ScaleBand<Input extends StringValue>
|
|
42
|
+
extends d3ScaleBand<Input> {
|
|
43
|
+
type: 'band';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ScaleTime<Input> extends d3ScaleTime<Input, number> {
|
|
47
|
+
type: 'time';
|
|
48
|
+
useUTC: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ScaleTypeToScale<Input, Output> {
|
|
52
|
+
linear: Input extends NumericValue ? ScaleLinear<Output> : never;
|
|
53
|
+
log: Input extends NumericValue ? ScaleLog : never;
|
|
54
|
+
symlog: Input extends NumericValue ? ScaleSymlog : never;
|
|
55
|
+
point: Input extends StringValue ? ScalePoint<Input> : never;
|
|
56
|
+
band: Input extends StringValue ? ScaleBand<Input> : never;
|
|
57
|
+
time: Input extends StringValue | Date ? ScaleTime<Input> : never;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type Scale<Input, Output> = ScaleTypeToScale<
|
|
61
|
+
Input,
|
|
62
|
+
Output
|
|
63
|
+
>[keyof ScaleTypeToScale<Input, Output>];
|
|
64
|
+
|
|
65
|
+
export type AnyScale = Scale<any, any>;
|
|
66
|
+
|
|
67
|
+
export type ScaleWithBandwidth = ScaleBand<any> | ScalePoint<any>;
|
|
68
|
+
|
|
69
|
+
export type TicksSpec =
|
|
70
|
+
// exact number of ticks, please note that
|
|
71
|
+
// depending on the current range of values,
|
|
72
|
+
// you might not get this exact count
|
|
73
|
+
| number
|
|
74
|
+
// string is used for Date based scales,
|
|
75
|
+
// it can express a time interval,
|
|
76
|
+
// for example: every 2 weeks
|
|
77
|
+
| string
|
|
78
|
+
// override scale ticks with custom explicit values
|
|
79
|
+
| ScaleValue[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ValueOf } from '@redsift/design-system';
|
|
2
|
+
|
|
3
|
+
export type ChartDimensions = {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
marginTop?: number;
|
|
7
|
+
marginRight?: number;
|
|
8
|
+
marginBottom?: number;
|
|
9
|
+
marginLeft?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const ChartSize = {
|
|
13
|
+
small: 'small',
|
|
14
|
+
medium: 'medium',
|
|
15
|
+
large: 'large',
|
|
16
|
+
} as const;
|
|
17
|
+
export type ChartSize = ValueOf<typeof ChartSize>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ValueOf } from '@redsift/design-system';
|
|
2
|
+
|
|
3
|
+
export const ColorTheme = {
|
|
4
|
+
default: 'default',
|
|
5
|
+
dark: 'dark',
|
|
6
|
+
darker: 'darker',
|
|
7
|
+
darkerer: 'darkerer',
|
|
8
|
+
light: 'light',
|
|
9
|
+
lighter: 'lighter',
|
|
10
|
+
lighterer: 'lighterer',
|
|
11
|
+
monochrome: 'monochrome',
|
|
12
|
+
} as const;
|
|
13
|
+
export type ColorTheme = ValueOf<typeof ColorTheme>;
|
|
14
|
+
|
|
15
|
+
export type SuccessDangerColorTheme = {
|
|
16
|
+
success: string;
|
|
17
|
+
warning: string;
|
|
18
|
+
danger: string;
|
|
19
|
+
neutral?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type CustomColorTheme = Record<string, string>;
|
|
23
|
+
|
|
24
|
+
export type ChartTheme =
|
|
25
|
+
| ColorTheme
|
|
26
|
+
| SuccessDangerColorTheme
|
|
27
|
+
| CustomColorTheme;
|
package/tsconfig.json
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|