@cdc/chart 4.25.11 → 4.26.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/dist/cdcchart.js +38898 -40013
- package/examples/feature/pie/planet-pie-example-config.json +48 -2
- package/examples/private/DEV-12100.json +1303 -0
- package/examples/private/cat-y.json +1235 -0
- package/examples/private/data-points.json +228 -0
- package/examples/private/height.json +3915 -0
- package/examples/private/links.json +569 -0
- package/examples/private/quadrant.txt +30 -0
- package/examples/private/test-forecast.json +5510 -0
- package/examples/private/warming-stripe-test.json +2578 -0
- package/examples/private/warming-stripes.json +4763 -0
- package/examples/tech-adoption-with-links.json +560 -0
- package/index.html +15 -20
- package/package.json +5 -4
- package/preview.html +1616 -0
- package/src/CdcChartComponent.tsx +111 -75
- package/src/_stories/Chart.Regions.Categorical.stories.tsx +148 -0
- package/src/_stories/Chart.Regions.DateScale.stories.tsx +197 -0
- package/src/_stories/Chart.Regions.DateTimeScale.stories.tsx +297 -0
- package/src/_stories/Chart.stories.tsx +8 -0
- package/src/_stories/ChartBar.Editor.stories.tsx +11 -6
- package/src/_stories/ChartBrush.Editor.stories.tsx +295 -0
- package/src/_stories/ChartBrush.stories.tsx +50 -0
- package/src/_stories/ChartEditor.Editor.stories.tsx +3 -5
- package/src/_stories/TechAdoptionWithLinks.stories.tsx +27 -0
- package/src/_stories/_mock/brush_enabled.json +326 -0
- package/src/_stories/_mock/brush_mock.json +2 -69
- package/src/_stories/_mock/horizontal-bars-dynamic-y-axis.json +413 -0
- package/src/components/AreaChart/components/AreaChart.Stacked.jsx +1 -2
- package/src/components/Axis/Categorical.Axis.tsx +6 -7
- package/src/components/BarChart/components/BarChart.Horizontal.tsx +178 -24
- package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +3 -1
- package/src/components/BarChart/components/BarChart.StackedVertical.tsx +1 -0
- package/src/components/BarChart/components/BarChart.Vertical.tsx +6 -8
- package/src/components/BarChart/components/context.tsx +1 -0
- package/src/components/BarChart/helpers/useBarChart.ts +14 -2
- package/src/components/Brush/BrushSelector.tsx +1258 -0
- package/src/components/Brush/MiniChartPreview.tsx +283 -0
- package/src/components/DeviationBar.jsx +9 -7
- package/src/components/EditorPanel/EditorPanel.tsx +2711 -2586
- package/src/components/EditorPanel/components/Panels/Panel.ForestPlotSettings.tsx +56 -34
- package/src/components/EditorPanel/components/Panels/Panel.General.tsx +57 -30
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +2 -0
- package/src/components/EditorPanel/components/Panels/Panel.SmallMultiples.tsx +30 -25
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +21 -27
- package/src/components/EditorPanel/useEditorPermissions.ts +31 -18
- package/src/components/Legend/Legend.tsx +3 -2
- package/src/components/Legend/helpers/createFormatLabels.tsx +151 -2
- package/src/components/Legend/helpers/index.ts +10 -6
- package/src/components/LinearChart.tsx +495 -430
- package/src/components/PairedBarChart.jsx +20 -3
- package/src/components/Regions/components/Regions.tsx +365 -122
- package/src/components/ScatterPlot/ScatterPlot.jsx +2 -2
- package/src/components/SmallMultiples/SmallMultipleTile.tsx +5 -1
- package/src/components/WarmingStripes/WarmingStripes.tsx +160 -0
- package/src/components/WarmingStripes/WarmingStripesGradientLegend.css +35 -0
- package/src/components/WarmingStripes/WarmingStripesGradientLegend.tsx +104 -0
- package/src/components/WarmingStripes/index.tsx +3 -0
- package/src/data/initial-state.js +3 -1
- package/src/helpers/calculateHorizontalBarCategoryLabelWidth.ts +57 -0
- package/src/helpers/getMinMax.ts +12 -7
- package/src/helpers/sizeHelpers.ts +0 -20
- package/src/helpers/smallMultiplesHelpers.ts +1 -1
- package/src/hooks/useChartHoverAnalytics.tsx +10 -9
- package/src/hooks/useScales.ts +11 -1
- package/src/hooks/useTooltip.tsx +31 -10
- package/src/scss/DataTable.scss +0 -4
- package/src/scss/main.scss +17 -3
- package/src/test/CdcChart.test.jsx +1 -1
- package/src/types/ChartConfig.ts +3 -0
- package/src/types/Label.ts +1 -0
- package/src/utils/analyticsTracking.ts +19 -0
- package/LICENSE +0 -201
- package/src/components/Brush/BrushChart.tsx +0 -128
- package/src/components/Brush/BrushController.tsx +0 -71
- package/src/components/Brush/types.tsx +0 -8
- package/src/components/BrushChart.tsx +0 -223
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
|
|
2
|
+
90°
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
179°
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
10
|
|
9
|
+
|
|
10
|
+
0
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
90°
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
100
|
|
17
|
+
|
|
18
|
+
90
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
179°
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
80
|
|
25
|
+
|
|
26
|
+
90
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
180°
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
269°
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
10
|
|
36
|
+
|
|
37
|
+
0
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
1°–89°
|
|
41
|
+
|
|
42
|
+
90
|
|
43
|
+
|
|
44
|
+
100
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
90
|
|
48
|
+
|
|
49
|
+
80
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
269°–360°
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
269°–360°
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
90
|
|
59
|
+
|
|
60
|
+
80
|
|
61
|
+
|
|
62
|
+
90
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
269°
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
92°
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
90
|
|
72
|
+
|
|
73
|
+
90
|
|
74
|
+
|
|
75
|
+
90
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
1°–179°
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
90
|
|
82
|
+
|
|
83
|
+
80
|
|
84
|
+
|
|
85
|
+
80
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
0°–180°
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
90
|
|
92
|
+
|
|
93
|
+
100
|
|
94
|
+
|
|
95
|
+
80
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
269°
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
92°
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
0
|
|
105
|
+
|
|
106
|
+
0
|
|
107
|
+
|
|
108
|
+
0
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
135°
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
0
|
|
115
|
+
|
|
116
|
+
0
|
|
117
|
+
|
|
118
|
+
20
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
68°
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
0
|
|
125
|
+
|
|
126
|
+
20
|
|
127
|
+
|
|
128
|
+
0
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
68°
|
|
132
|
+
|
|
133
|
+
If point is 20 pixels or less above x-axis (i.e., it's a low value and close to 0) position label 0.5rem / 9px above and 0.25rem / 4.5px to the left of point: 91°–179°
|
|
134
|
+
|
|
135
|
+
First data point
|
|
136
|
+
|
|
137
|
+
Position label 0.5rem / 9px above point when segment is in Quadrant 3 (angle created is 180°–269°)
|
|
138
|
+
|
|
139
|
+
If the point isn't near the x-axis, position label 0.5rem / 9px below point when segment is in Quadrant 2 (angle created is: 91°–179°)
|
|
140
|
+
|
|
141
|
+
Last data point
|
|
142
|
+
|
|
143
|
+
Position label 0.5rem / 9px above point when final segment is in Quadrant 4 (and angle created is 269°–360°)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
This also works for when last data point is near x-axis (i.e. it's a low value that's close to 0)
|
|
148
|
+
|
|
149
|
+
If the point isn't near the x-axis and final segment is in Quadrant 1 (angle created is: 1°–89°), position label 0.5rem / 9px below point
|
|
150
|
+
|
|
151
|
+
If the point is 20 pixels or less above x-axis (i.e., it's a low value and close to 0) and angle created is 0°–89° then position label 0.5rem / 9px above and 0.25rem / 4.5px to the right of point
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
0
|
|
155
|
+
|
|
156
|
+
10
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
0°–89°
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
Quadrant 3
|
|
163
|
+
|
|
164
|
+
Quadrant 4
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
Quadrant 2
|
|
168
|
+
|
|
169
|
+
Quadrant 1
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
would NOT have segments like this
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
Quadrant 3
|
|
176
|
+
|
|
177
|
+
Quadrant 4
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
Quadrant 2
|
|
181
|
+
|
|
182
|
+
Quadrant 1
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
ending segments on right half
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
starting segments on left half
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
When looking at segments, think of them as being arranged in a grid with quadrants
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
Starting segment (denoted in purple) should always be in Quadrants 1 or 2
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
Ending segment (denoted in pink) should always be in Quadrants 3 and 4
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
Middle data point
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
Want labels to not overlap with points/lines like so:
|
|
206
|
+
|
|
207
|
+
If the point isn't near the x-axis, position label 0.5rem / 9px below it when starting segment is in Quadrant 1 and ending segment is in Quadrant 2 and the angle created is 1°–179°
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
Position label 0.5rem / 9px above point when starting segment is in Quadrant 4 and ending segment is in Quadrant 3 and the angle created is 0°–180°
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
Mapping of possible starting and ending segments
|
|
215
|
+
|
|
216
|
+
Position the label 0.5rem / 9px above and 0.5rem / 9px to the left of the point if starting segment is in Quadrant 4 and ending segment is in Quadrant 2 and the angle created is 92°–269°
|
|
217
|
+
|
|
218
|
+
If the point is 20 pixels or less above x-axis (i.e., it's a low value and close to 0) and starting sement is in Quadrant 1 and ending segment is in Quadrant 2 then calculate the angle between the 2 segments:
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
If it's 135°–180° then position the label 0.5rem / 9px above the point
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
If it's less than135°, calculate the angle created by the ending segment, if it's 68° or more then position the label 0.5rem / 9px above and 0.5rem / 9px to the right of the point
|
|
226
|
+
Otherwise, position the label 0.5rem / 9px above and 0.5rem / 9px to the left of the point
|
|
227
|
+
Position the label 0.5rem / 9px above and 0.5rem / 9px to the right of the point if starting segment is in Quadrant 1 and ending segment is in Quadrant 3 and the angle created is 92°–269°
|
|
228
|
+
|