@cdc/chart 4.23.10 → 4.24.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.
Files changed (125) hide show
  1. package/dist/cdcchart.js +34606 -32218
  2. package/examples/feature/bar/additional-column-tooltip.json +446 -0
  3. package/examples/feature/bar/example-bar-chart.json +1 -46
  4. package/examples/feature/bar/lollipop.json +156 -0
  5. package/examples/feature/bar/tall-data.json +98 -0
  6. package/examples/feature/combo/planet-combo-example-config.json +99 -9
  7. package/examples/feature/dev-4261.json +399 -0
  8. package/examples/feature/forest-plot/forest-plot.json +63 -19
  9. package/examples/feature/forest-plot/{broken.json → linear.json} +77 -23
  10. package/examples/feature/forest-plot/log.json +26 -0
  11. package/examples/feature/forest-plot/logarithmic.json +271 -0
  12. package/examples/feature/line/line-chart-preliminary.json +346 -0
  13. package/examples/feature/line/line-points.json +340 -0
  14. package/examples/feature/regions/index.json +462 -0
  15. package/examples/feature/scatterplot/scatterplot.json +272 -33
  16. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +181 -48
  17. package/examples/private/chart-t.json +3740 -0
  18. package/examples/private/combo.json +369 -0
  19. package/examples/private/epi-data.csv +13 -0
  20. package/examples/private/epi-data.json +62 -0
  21. package/examples/private/epi.json +403 -0
  22. package/examples/private/occupancy.json +109283 -0
  23. package/examples/private/prod-line-config.json +401 -0
  24. package/examples/private/region-data.json +822 -0
  25. package/examples/private/region-testing.json +312 -0
  26. package/examples/private/scaling.json +45325 -0
  27. package/examples/private/testing-data.json +1739 -0
  28. package/examples/private/testing.json +816 -0
  29. package/examples/sparkline-multilple.json +846 -0
  30. package/index.html +12 -8
  31. package/package.json +3 -3
  32. package/src/CdcChart.tsx +42 -211
  33. package/src/ConfigContext.tsx +6 -0
  34. package/src/_stories/Chart.stories.tsx +188 -0
  35. package/src/_stories/Chart.tooltip.stories.tsx +305 -0
  36. package/src/_stories/ChartBrush.stories.tsx +19 -0
  37. package/src/_stories/ChartEditor.stories.tsx +22 -0
  38. package/src/_stories/ChartLine.preliminary.tsx +19 -0
  39. package/src/_stories/ChartSuppress.stories.tsx +19 -0
  40. package/src/_stories/_mock/brush_mock.json +393 -0
  41. package/src/_stories/_mock/pie_config.json +191 -0
  42. package/src/_stories/_mock/pie_data.json +218 -0
  43. package/src/_stories/_mock/preliminary_mock.json +346 -0
  44. package/src/_stories/_mock/suppress_mock.json +911 -0
  45. package/src/components/{AreaChart.Stacked.jsx → AreaChart/components/AreaChart.Stacked.jsx} +6 -7
  46. package/src/components/{AreaChart.jsx → AreaChart/components/AreaChart.jsx} +7 -36
  47. package/src/components/AreaChart/index.tsx +4 -0
  48. package/src/components/{BarChart.Horizontal.jsx → BarChart/components/BarChart.Horizontal.tsx} +111 -34
  49. package/src/components/{BarChart.StackedHorizontal.jsx → BarChart/components/BarChart.StackedHorizontal.tsx} +55 -20
  50. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +106 -0
  51. package/src/components/{BarChart.Vertical.jsx → BarChart/components/BarChart.Vertical.tsx} +162 -34
  52. package/src/components/BarChart/components/BarChart.jsx +39 -0
  53. package/src/components/{BarChartType.jsx → BarChart/components/BarChartType.jsx} +0 -2
  54. package/src/components/BarChart/components/context.tsx +13 -0
  55. package/src/components/BarChart/index.tsx +3 -0
  56. package/src/components/{BoxPlot.jsx → BoxPlot/BoxPlot.jsx} +1 -1
  57. package/src/components/BoxPlot/index.tsx +3 -0
  58. package/src/components/DeviationBar.jsx +4 -3
  59. package/src/components/{EditorPanel.jsx → EditorPanel/EditorPanel.tsx} +807 -865
  60. package/src/components/EditorPanel/components/Panel.DateHighlighting.tsx +109 -0
  61. package/src/components/{ForestPlotSettings.jsx → EditorPanel/components/Panel.ForestPlotSettings.tsx} +190 -220
  62. package/src/components/EditorPanel/components/Panel.Regions.tsx +168 -0
  63. package/src/components/{Series.jsx → EditorPanel/components/Panel.Series.tsx} +23 -4
  64. package/src/components/EditorPanel/components/PanelProps.ts +3 -0
  65. package/src/components/EditorPanel/components/Panels.tsx +13 -0
  66. package/src/components/EditorPanel/components/panels.scss +72 -0
  67. package/src/components/EditorPanel/editor-panel.scss +751 -0
  68. package/src/components/EditorPanel/index.tsx +3 -0
  69. package/src/{hooks → components/EditorPanel}/useEditorPermissions.js +50 -5
  70. package/src/components/{Forecasting.jsx → Forecasting/Forecasting.jsx} +1 -1
  71. package/src/components/Forecasting/index.tsx +3 -0
  72. package/src/components/ForestPlot/ForestPlot.tsx +254 -0
  73. package/src/components/ForestPlot/ForestPlotProps.ts +18 -0
  74. package/src/components/ForestPlot/index.scss +1 -0
  75. package/src/components/ForestPlot/index.tsx +3 -0
  76. package/src/components/Legend/Legend.tsx +347 -0
  77. package/src/components/Legend/index.tsx +3 -0
  78. package/src/components/LineChart/LineChartProps.ts +46 -0
  79. package/src/components/{LineChart.Circle.tsx → LineChart/components/LineChart.Circle.tsx} +36 -30
  80. package/src/components/LineChart/helpers.ts +45 -0
  81. package/src/components/LineChart/index.scss +1 -0
  82. package/src/components/{LineChart.tsx → LineChart/index.tsx} +83 -42
  83. package/src/components/LinearChart.jsx +125 -82
  84. package/src/components/PairedBarChart.jsx +2 -2
  85. package/src/components/{PieChart.jsx → PieChart/PieChart.tsx} +16 -7
  86. package/src/components/PieChart/index.tsx +3 -0
  87. package/src/components/Regions/components/Regions.tsx +135 -0
  88. package/src/components/Regions/index.tsx +3 -0
  89. package/src/components/{ScatterPlot.jsx → ScatterPlot/ScatterPlot.jsx} +3 -3
  90. package/src/components/ScatterPlot/index.tsx +3 -0
  91. package/src/components/{SparkLine.jsx → Sparkline/SparkLine.jsx} +2 -2
  92. package/src/components/Sparkline/index.tsx +3 -0
  93. package/src/components/ZoomBrush.tsx +168 -0
  94. package/src/data/initial-state.js +30 -16
  95. package/src/helpers/abbreviateNumber.ts +17 -0
  96. package/src/helpers/computeMarginBottom.ts +55 -0
  97. package/src/helpers/filterData.ts +18 -0
  98. package/src/helpers/generateColorsArray.ts +8 -0
  99. package/src/helpers/getQuartiles.ts +30 -0
  100. package/src/helpers/handleChartAriaLabels.ts +19 -0
  101. package/src/helpers/handleLineType.ts +18 -0
  102. package/src/helpers/lineOptions.ts +18 -0
  103. package/src/helpers/sort.ts +7 -0
  104. package/src/helpers/tests/computeMarginBottom.test.ts +20 -0
  105. package/src/hooks/useBarChart.js +72 -7
  106. package/src/hooks/useColorScale.ts +50 -0
  107. package/src/hooks/{useMinMax.js → useMinMax.ts} +75 -23
  108. package/src/hooks/{useRightAxis.js → useRightAxis.ts} +10 -2
  109. package/src/hooks/{useScales.js → useScales.ts} +64 -17
  110. package/src/hooks/{useTooltip.jsx → useTooltip.tsx} +84 -55
  111. package/src/scss/main.scss +70 -38
  112. package/src/types/ChartConfig.ts +178 -0
  113. package/src/types/ChartContext.ts +54 -0
  114. package/src/types/ForestPlot.ts +53 -0
  115. package/examples/feature/scatterplot/scatterplot-continuous.csv +0 -17
  116. package/src/ConfigContext.jsx +0 -5
  117. package/src/components/BarChart.StackedVertical.jsx +0 -95
  118. package/src/components/BarChart.jsx +0 -30
  119. package/src/components/ForestPlot.jsx +0 -191
  120. package/src/components/Legend.jsx +0 -277
  121. package/src/scss/LinearChart.scss +0 -0
  122. package/src/scss/editor-panel.scss +0 -745
  123. package/src/scss/legend.scss +0 -206
  124. package/src/scss/mixins.scss +0 -0
  125. package/src/scss/variables.scss +0 -1
@@ -0,0 +1,462 @@
1
+ {
2
+ "type": "chart",
3
+ "debugSvg": false,
4
+ "chartMessage": {
5
+ "noData": "No Data Available"
6
+ },
7
+ "title": "Example Line Chart with Region",
8
+ "showTitle": true,
9
+ "showDownloadMediaButton": false,
10
+ "theme": "theme-cyan",
11
+ "animate": false,
12
+ "fontSize": "medium",
13
+ "lineDatapointStyle": "hover",
14
+ "lineDatapointColor": "Same as Line",
15
+ "barHasBorder": "false",
16
+ "isLollipopChart": false,
17
+ "lollipopShape": "circle",
18
+ "lollipopColorStyle": "two-tone",
19
+ "visualizationSubType": "regular",
20
+ "barStyle": "",
21
+ "roundingStyle": "standard",
22
+ "tipRounding": "top",
23
+ "isResponsiveTicks": false,
24
+ "general": {
25
+ "showDownloadButton": false
26
+ },
27
+ "padding": {
28
+ "left": 5,
29
+ "right": 5
30
+ },
31
+ "suppressedData": [],
32
+ "yAxis": {
33
+ "hideAxis": false,
34
+ "displayNumbersOnBar": false,
35
+ "hideLabel": false,
36
+ "hideTicks": false,
37
+ "size": "75",
38
+ "gridLines": false,
39
+ "enablePadding": false,
40
+ "min": "",
41
+ "max": "",
42
+ "labelColor": "#333",
43
+ "tickLabelColor": "#333",
44
+ "tickColor": "#333",
45
+ "rightHideAxis": true,
46
+ "rightAxisSize": 50,
47
+ "rightLabel": "",
48
+ "rightLabelOffsetSize": 0,
49
+ "rightAxisLabelColor": "#333",
50
+ "rightAxisTickLabelColor": "#333",
51
+ "rightAxisTickColor": "#333",
52
+ "numTicks": "9",
53
+ "axisPadding": 0,
54
+ "tickRotation": 0,
55
+ "anchors": [],
56
+ "label": "Y-Axis Example Label"
57
+ },
58
+ "boxplot": {
59
+ "plots": [],
60
+ "borders": "true",
61
+ "firstQuartilePercentage": 25,
62
+ "thirdQuartilePercentage": 75,
63
+ "boxWidthPercentage": 40,
64
+ "plotOutlierValues": false,
65
+ "plotNonOutlierValues": true,
66
+ "legend": {
67
+ "showHowToReadText": false,
68
+ "howToReadText": ""
69
+ },
70
+ "labels": {
71
+ "q1": "Lower Quartile",
72
+ "q2": "q2",
73
+ "q3": "Upper Quartile",
74
+ "q4": "q4",
75
+ "minimum": "Minimum",
76
+ "maximum": "Maximum",
77
+ "mean": "Mean",
78
+ "median": "Median",
79
+ "sd": "Standard Deviation",
80
+ "iqr": "Interquartile Range",
81
+ "total": "Total",
82
+ "outliers": "Outliers",
83
+ "values": "Values",
84
+ "lowerBounds": "Lower Bounds",
85
+ "upperBounds": "Upper Bounds"
86
+ }
87
+ },
88
+ "topAxis": {
89
+ "hasLine": false
90
+ },
91
+ "isLegendValue": false,
92
+ "barThickness": 0.35,
93
+ "barHeight": 25,
94
+ "barSpace": 15,
95
+ "heights": {
96
+ "vertical": 300,
97
+ "horizontal": 750
98
+ },
99
+ "xAxis": {
100
+ "sortDates": false,
101
+ "anchors": [],
102
+ "type": "date",
103
+ "showTargetLabel": true,
104
+ "targetLabel": "Target",
105
+ "hideAxis": false,
106
+ "hideLabel": false,
107
+ "hideTicks": false,
108
+ "size": "77",
109
+ "tickRotation": "25",
110
+ "min": "",
111
+ "max": "",
112
+ "labelColor": "#333",
113
+ "tickLabelColor": "#333",
114
+ "tickColor": "#333",
115
+ "numTicks": "",
116
+ "labelOffset": 65,
117
+ "axisPadding": 0,
118
+ "target": 0,
119
+ "maxTickRotation": 0,
120
+ "dataKey": "Date",
121
+ "label": "X-Axis Example Label",
122
+ "dateParseFormat": "%m/%d/%Y",
123
+ "dateDisplayFormat": "%m/%d/%Y",
124
+ "tickWidthMax": 91
125
+ },
126
+ "table": {
127
+ "label": "Data Table",
128
+ "expanded": false,
129
+ "limitHeight": false,
130
+ "height": "",
131
+ "caption": "",
132
+ "showDownloadUrl": false,
133
+ "showDataTableLink": true,
134
+ "indexLabel": "Data Group",
135
+ "download": true,
136
+ "showVertical": false,
137
+ "show": true
138
+ },
139
+ "orientation": "vertical",
140
+ "color": "pinkpurple",
141
+ "columns": {},
142
+ "legend": {
143
+ "hide": false,
144
+ "behavior": "isolate",
145
+ "singleRow": false,
146
+ "colorCode": "",
147
+ "reverseLabelOrder": false,
148
+ "description": "",
149
+ "dynamicLegend": false,
150
+ "dynamicLegendDefaultText": "Show All",
151
+ "dynamicLegendItemLimit": 5,
152
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
153
+ "dynamicLegendChartMessage": "Select Options from the Legend",
154
+ "lineMode": false,
155
+ "verticalSorted": false,
156
+ "position": "right",
157
+ "label": "Type of Data"
158
+ },
159
+ "brush": {
160
+ "height": 25,
161
+ "data": [
162
+ {
163
+ "Date": "1/15/2016",
164
+ "Data 1": "90",
165
+ "Data 2": "135",
166
+ "Data 3": "300",
167
+ "Data 4": "95",
168
+ "Data 5": "120",
169
+ "Data 6": "310"
170
+ },
171
+ {
172
+ "Date": "2/15/2016",
173
+ "Data 1": "40",
174
+ "Data 2": "90",
175
+ "Data 3": "240",
176
+ "Data 4": "60",
177
+ "Data 5": "160",
178
+ "Data 6": "200"
179
+ },
180
+ {
181
+ "Date": "3/15/2016",
182
+ "Data 1": "50",
183
+ "Data 2": "300",
184
+ "Data 3": "290",
185
+ "Data 4": "100",
186
+ "Data 5": "200",
187
+ "Data 6": "250"
188
+ },
189
+ {
190
+ "Date": "4/15/2016",
191
+ "Data 1": "120",
192
+ "Data 2": "160",
193
+ "Data 3": "230",
194
+ "Data 4": "180",
195
+ "Data 5": "160",
196
+ "Data 6": "220"
197
+ },
198
+ {
199
+ "Date": "5/15/2016",
200
+ "Data 1": "80",
201
+ "Data 2": "350",
202
+ "Data 3": "300",
203
+ "Data 4": "150",
204
+ "Data 5": "130",
205
+ "Data 6": "100"
206
+ },
207
+ {
208
+ "Date": "6/15/2016",
209
+ "Data 1": "90",
210
+ "Data 2": "220",
211
+ "Data 3": "320",
212
+ "Data 4": "100",
213
+ "Data 5": "220",
214
+ "Data 6": "300"
215
+ }
216
+ ],
217
+ "active": false,
218
+ "pattern_id": "brush_pattern",
219
+ "accent_color": "#ddd"
220
+ },
221
+ "exclusions": {
222
+ "active": false,
223
+ "keys": []
224
+ },
225
+ "palette": "qualitative-bold",
226
+ "isPaletteReversed": false,
227
+ "twoColor": {
228
+ "palette": "monochrome-1",
229
+ "isPaletteReversed": false
230
+ },
231
+ "labels": false,
232
+ "dataFormat": {
233
+ "commas": false,
234
+ "prefix": "",
235
+ "suffix": "",
236
+ "abbreviated": false,
237
+ "bottomSuffix": "",
238
+ "bottomPrefix": "",
239
+ "bottomAbbreviated": false
240
+ },
241
+ "confidenceKeys": {},
242
+ "visual": {
243
+ "border": true,
244
+ "accent": true,
245
+ "background": true,
246
+ "verticalHoverLine": false,
247
+ "horizontalHoverLine": false
248
+ },
249
+ "useLogScale": false,
250
+ "filterBehavior": "Filter Change",
251
+ "highlightedBarValues": [],
252
+ "series": [
253
+ {
254
+ "dataKey": "Data 1",
255
+ "type": "Bar",
256
+ "tooltip": true,
257
+ "axis": "Left"
258
+ },
259
+ {
260
+ "dataKey": "Data 2",
261
+ "type": "Bar",
262
+ "tooltip": true,
263
+ "axis": "Left"
264
+ },
265
+ {
266
+ "dataKey": "Data 3",
267
+ "type": "Bar",
268
+ "tooltip": true,
269
+ "axis": "Left"
270
+ },
271
+ {
272
+ "dataKey": "Data 4",
273
+ "type": "Bar",
274
+ "tooltip": true,
275
+ "axis": "Left"
276
+ }
277
+ ],
278
+ "tooltips": {
279
+ "opacity": 90
280
+ },
281
+ "forestPlot": {
282
+ "startAt": 0,
283
+ "colors": {
284
+ "line": "",
285
+ "shape": ""
286
+ },
287
+ "lineOfNoEffect": {
288
+ "show": true
289
+ },
290
+ "type": "",
291
+ "pooledResult": {
292
+ "diamondHeight": 5,
293
+ "column": ""
294
+ },
295
+ "estimateField": "",
296
+ "estimateRadius": "",
297
+ "shape": "",
298
+ "rowHeight": 20,
299
+ "description": {
300
+ "show": true,
301
+ "text": "description",
302
+ "location": 0
303
+ },
304
+ "result": {
305
+ "show": true,
306
+ "text": "result",
307
+ "location": 100
308
+ },
309
+ "radius": {
310
+ "min": 1,
311
+ "max": 8,
312
+ "scalingColumn": ""
313
+ },
314
+ "regression": {
315
+ "lower": 0,
316
+ "upper": 0,
317
+ "estimateField": 0
318
+ },
319
+ "leftWidthOffset": 0,
320
+ "rightWidthOffset": 0,
321
+ "showZeroLine": false,
322
+ "hideDateCategoryCol": false,
323
+ "leftLabel": "",
324
+ "rightLabel": "",
325
+ "width": "auto",
326
+ "lowerCiField": "",
327
+ "upperCiField": ""
328
+ },
329
+ "area": {
330
+ "isStacked": false
331
+ },
332
+ "showChartBrush": false,
333
+ "height": "375",
334
+ "data": [
335
+ {
336
+ "Date": "1/15/2016",
337
+ "Data 1": "90",
338
+ "Data 2": "135",
339
+ "Data 3": "300",
340
+ "Data 4": "95",
341
+ "Data 5": "120",
342
+ "Data 6": "310"
343
+ },
344
+ {
345
+ "Date": "2/15/2016",
346
+ "Data 1": "40",
347
+ "Data 2": "90",
348
+ "Data 3": "240",
349
+ "Data 4": "60",
350
+ "Data 5": "160",
351
+ "Data 6": "200"
352
+ },
353
+ {
354
+ "Date": "3/15/2016",
355
+ "Data 1": "50",
356
+ "Data 2": "300",
357
+ "Data 3": "290",
358
+ "Data 4": "100",
359
+ "Data 5": "200",
360
+ "Data 6": "250"
361
+ },
362
+ {
363
+ "Date": "4/15/2016",
364
+ "Data 1": "120",
365
+ "Data 2": "160",
366
+ "Data 3": "230",
367
+ "Data 4": "180",
368
+ "Data 5": "160",
369
+ "Data 6": "220"
370
+ },
371
+ {
372
+ "Date": "5/15/2016",
373
+ "Data 1": "80",
374
+ "Data 2": "350",
375
+ "Data 3": "300",
376
+ "Data 4": "150",
377
+ "Data 5": "130",
378
+ "Data 6": "100"
379
+ },
380
+ {
381
+ "Date": "6/15/2016",
382
+ "Data 1": "90",
383
+ "Data 2": "220",
384
+ "Data 3": "320",
385
+ "Data 4": "100",
386
+ "Data 5": "220",
387
+ "Data 6": "300"
388
+ }
389
+ ],
390
+ "visualizationType": "Bar",
391
+ "regions": [
392
+ {
393
+ "from": "03/15/2016",
394
+ "to": "05/15/2016",
395
+ "label": "Region Applied to Timeline",
396
+ "color": "Black",
397
+ "background": "Grey"
398
+ }
399
+ ],
400
+ "validated": 4.23,
401
+ "formattedData": [
402
+ {
403
+ "Date": "1/15/2016",
404
+ "Data 1": "90",
405
+ "Data 2": "135",
406
+ "Data 3": "300",
407
+ "Data 4": "95",
408
+ "Data 5": "120",
409
+ "Data 6": "310"
410
+ },
411
+ {
412
+ "Date": "2/15/2016",
413
+ "Data 1": "40",
414
+ "Data 2": "90",
415
+ "Data 3": "240",
416
+ "Data 4": "60",
417
+ "Data 5": "160",
418
+ "Data 6": "200"
419
+ },
420
+ {
421
+ "Date": "3/15/2016",
422
+ "Data 1": "50",
423
+ "Data 2": "300",
424
+ "Data 3": "290",
425
+ "Data 4": "100",
426
+ "Data 5": "200",
427
+ "Data 6": "250"
428
+ },
429
+ {
430
+ "Date": "4/15/2016",
431
+ "Data 1": "120",
432
+ "Data 2": "160",
433
+ "Data 3": "230",
434
+ "Data 4": "180",
435
+ "Data 5": "160",
436
+ "Data 6": "220"
437
+ },
438
+ {
439
+ "Date": "5/15/2016",
440
+ "Data 1": "80",
441
+ "Data 2": "350",
442
+ "Data 3": "300",
443
+ "Data 4": "150",
444
+ "Data 5": "130",
445
+ "Data 6": "100"
446
+ },
447
+ {
448
+ "Date": "6/15/2016",
449
+ "Data 1": "90",
450
+ "Data 2": "220",
451
+ "Data 3": "320",
452
+ "Data 4": "100",
453
+ "Data 5": "220",
454
+ "Data 6": "300"
455
+ }
456
+ ],
457
+ "dataDescription": {
458
+ "horizontal": false,
459
+ "series": false
460
+ },
461
+ "dynamicMarginTop": 0
462
+ }