@cdc/chart 4.23.11 → 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 (103) hide show
  1. package/dist/cdcchart.js +30220 -29764
  2. package/examples/feature/bar/additional-column-tooltip.json +446 -0
  3. package/examples/feature/bar/tall-data.json +98 -0
  4. package/examples/feature/forest-plot/forest-plot.json +63 -19
  5. package/examples/feature/forest-plot/linear.json +52 -3
  6. package/examples/feature/forest-plot/log.json +26 -0
  7. package/examples/feature/forest-plot/logarithmic.json +0 -35
  8. package/examples/feature/line/line-chart-preliminary.json +346 -0
  9. package/examples/feature/scatterplot/scatterplot.json +272 -33
  10. package/examples/private/chart-t.json +3740 -0
  11. package/examples/private/combo.json +369 -0
  12. package/examples/private/epi-data.csv +13 -0
  13. package/examples/private/epi-data.json +62 -0
  14. package/examples/private/epi.json +403 -0
  15. package/examples/private/occupancy.json +109283 -0
  16. package/examples/private/prod-line-config.json +401 -0
  17. package/examples/private/region-data.json +822 -0
  18. package/examples/private/region-testing.json +312 -0
  19. package/examples/private/scaling.json +45325 -0
  20. package/examples/private/testing-data.json +1739 -0
  21. package/examples/private/testing.json +816 -0
  22. package/index.html +7 -7
  23. package/package.json +2 -2
  24. package/src/CdcChart.tsx +29 -210
  25. package/src/ConfigContext.tsx +6 -0
  26. package/src/_stories/ChartEditor.stories.tsx +22 -0
  27. package/src/_stories/ChartLine.preliminary.tsx +19 -0
  28. package/src/_stories/_mock/pie_config.json +191 -0
  29. package/src/_stories/_mock/pie_data.json +218 -0
  30. package/src/_stories/_mock/preliminary_mock.json +346 -0
  31. package/src/components/{AreaChart.Stacked.jsx → AreaChart/components/AreaChart.Stacked.jsx} +2 -2
  32. package/src/components/{AreaChart.jsx → AreaChart/components/AreaChart.jsx} +1 -1
  33. package/src/components/AreaChart/index.tsx +4 -0
  34. package/src/components/{BarChart.Horizontal.tsx → BarChart/components/BarChart.Horizontal.tsx} +8 -8
  35. package/src/components/{BarChart.StackedHorizontal.tsx → BarChart/components/BarChart.StackedHorizontal.tsx} +37 -7
  36. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +106 -0
  37. package/src/components/{BarChart.Vertical.tsx → BarChart/components/BarChart.Vertical.tsx} +41 -57
  38. package/src/components/BarChart/components/BarChart.jsx +39 -0
  39. package/src/components/{BarChartType.jsx → BarChart/components/BarChartType.jsx} +0 -2
  40. package/src/components/BarChart/components/context.tsx +13 -0
  41. package/src/components/BarChart/index.tsx +3 -0
  42. package/src/components/{BoxPlot.jsx → BoxPlot/BoxPlot.jsx} +1 -1
  43. package/src/components/BoxPlot/index.tsx +3 -0
  44. package/src/components/{EditorPanel.jsx → EditorPanel/EditorPanel.tsx} +667 -851
  45. package/src/components/EditorPanel/components/Panel.DateHighlighting.tsx +109 -0
  46. package/src/components/{ForestPlotSettings.jsx → EditorPanel/components/Panel.ForestPlotSettings.tsx} +87 -166
  47. package/src/components/EditorPanel/components/Panel.Regions.tsx +168 -0
  48. package/src/components/{Series.jsx → EditorPanel/components/Panel.Series.tsx} +1 -1
  49. package/src/components/EditorPanel/components/PanelProps.ts +3 -0
  50. package/src/components/EditorPanel/components/Panels.tsx +13 -0
  51. package/src/components/EditorPanel/components/panels.scss +72 -0
  52. package/src/components/EditorPanel/editor-panel.scss +751 -0
  53. package/src/components/EditorPanel/index.tsx +3 -0
  54. package/src/{hooks → components/EditorPanel}/useEditorPermissions.js +29 -2
  55. package/src/components/{Forecasting.jsx → Forecasting/Forecasting.jsx} +1 -1
  56. package/src/components/Forecasting/index.tsx +3 -0
  57. package/src/components/ForestPlot/ForestPlot.tsx +254 -0
  58. package/src/components/ForestPlot/ForestPlotProps.ts +7 -0
  59. package/src/components/ForestPlot/index.tsx +1 -209
  60. package/src/components/{Legend.jsx → Legend/Legend.tsx} +150 -113
  61. package/src/components/Legend/index.tsx +3 -0
  62. package/src/components/LineChart/LineChartProps.ts +29 -0
  63. package/src/components/LineChart/{LineChart.Circle.tsx → components/LineChart.Circle.tsx} +12 -3
  64. package/src/components/LineChart/helpers.ts +45 -0
  65. package/src/components/LineChart/index.tsx +20 -8
  66. package/src/components/LinearChart.jsx +52 -69
  67. package/src/components/{PieChart.jsx → PieChart/PieChart.tsx} +16 -7
  68. package/src/components/PieChart/index.tsx +3 -0
  69. package/src/components/Regions/components/Regions.tsx +135 -0
  70. package/src/components/Regions/index.tsx +3 -0
  71. package/src/components/{ScatterPlot.jsx → ScatterPlot/ScatterPlot.jsx} +3 -3
  72. package/src/components/ScatterPlot/index.tsx +3 -0
  73. package/src/components/{SparkLine.jsx → Sparkline/SparkLine.jsx} +2 -2
  74. package/src/components/Sparkline/index.tsx +3 -0
  75. package/src/data/initial-state.js +5 -6
  76. package/src/helpers/abbreviateNumber.ts +17 -0
  77. package/src/helpers/computeMarginBottom.ts +55 -0
  78. package/src/helpers/filterData.ts +18 -0
  79. package/src/helpers/generateColorsArray.ts +8 -0
  80. package/src/helpers/getQuartiles.ts +30 -0
  81. package/src/helpers/handleChartAriaLabels.ts +19 -0
  82. package/src/helpers/handleLineType.ts +18 -0
  83. package/src/helpers/lineOptions.ts +18 -0
  84. package/src/helpers/sort.ts +7 -0
  85. package/src/helpers/tests/computeMarginBottom.test.ts +20 -0
  86. package/src/hooks/useBarChart.js +7 -6
  87. package/src/hooks/useScales.ts +1 -1
  88. package/src/hooks/{useTooltip.jsx → useTooltip.tsx} +23 -21
  89. package/src/scss/main.scss +67 -3
  90. package/src/types/ChartConfig.ts +158 -23
  91. package/src/types/ChartContext.ts +26 -10
  92. package/src/types/ForestPlot.ts +7 -14
  93. package/examples/feature/scatterplot/scatterplot-continuous.csv +0 -17
  94. package/src/ConfigContext.jsx +0 -5
  95. package/src/components/BarChart.StackedVertical.tsx +0 -91
  96. package/src/components/BarChart.jsx +0 -30
  97. package/src/components/ForestPlot/Readme.md +0 -0
  98. package/src/scss/LinearChart.scss +0 -0
  99. package/src/scss/editor-panel.scss +0 -745
  100. package/src/scss/legend.scss +0 -206
  101. package/src/scss/mixins.scss +0 -0
  102. package/src/scss/variables.scss +0 -1
  103. package/src/types/ChartProps.ts +0 -7
@@ -0,0 +1,312 @@
1
+ {
2
+ "type": "chart",
3
+ "debugSvg": false,
4
+ "chartMessage": {
5
+ "noData": "No Data Available"
6
+ },
7
+ "title": "",
8
+ "showTitle": true,
9
+ "showDownloadMediaButton": false,
10
+ "theme": "theme-blue",
11
+ "animate": false,
12
+ "fontSize": "small",
13
+ "lineDatapointStyle": "hover",
14
+ "lineDatapointColor": "Same as Line",
15
+ "barHasBorder": "false",
16
+ "isLollipopChart": false,
17
+ "lollipopShape": "circle",
18
+ "lollipopColorStyle": "two-tone",
19
+ "visualizationSubType": "stacked",
20
+ "barStyle": "rounded",
21
+ "roundingStyle": "finger",
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": "66",
38
+ "gridLines": true,
39
+ "enablePadding": false,
40
+ "min": "",
41
+ "max": "8",
42
+ "labelColor": "#333",
43
+ "tickLabelColor": "#333",
44
+ "tickColor": "#333",
45
+ "rightHideAxis": true,
46
+ "rightAxisSize": 0,
47
+ "rightLabel": "",
48
+ "rightLabelOffsetSize": 0,
49
+ "rightAxisLabelColor": "#333",
50
+ "rightAxisTickLabelColor": "#333",
51
+ "rightAxisTickColor": "#333",
52
+ "numTicks": "",
53
+ "axisPadding": 0,
54
+ "tickRotation": 0,
55
+ "anchors": [],
56
+ "label": "Percent of Deaths"
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.65",
93
+ "barHeight": 25,
94
+ "barSpace": 15,
95
+ "heights": {
96
+ "vertical": "375",
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": "85",
109
+ "tickRotation": "45",
110
+ "min": "",
111
+ "max": "",
112
+ "labelColor": "#333",
113
+ "tickLabelColor": "#333",
114
+ "tickColor": "#333",
115
+ "numTicks": "13",
116
+ "labelOffset": 65,
117
+ "axisPadding": 0,
118
+ "target": 0,
119
+ "maxTickRotation": 0,
120
+ "dataKey": "week_end",
121
+ "dateParseFormat": "%Y-%m-%d",
122
+ "dateDisplayFormat": "%m/%d/%Y",
123
+ "label": "Week Ending",
124
+ "tickWidthMax": 81
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": "Week Ending",
135
+ "download": false,
136
+ "showVertical": true,
137
+ "show": true
138
+ },
139
+ "orientation": "vertical",
140
+ "color": "pinkpurple",
141
+ "columns": {},
142
+ "legend": {
143
+ "hide": false,
144
+ "behavior": "isolate",
145
+ "singleRow": true,
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
+ "highlightOnHover": false,
157
+ "position": "bottom"
158
+ },
159
+ "brush": {
160
+ "height": 25,
161
+ "data": [],
162
+ "active": false,
163
+ "pattern_id": "brush_pattern",
164
+ "accent_color": "#ddd"
165
+ },
166
+ "exclusions": {
167
+ "active": false,
168
+ "keys": []
169
+ },
170
+ "palette": "qualitative-bold",
171
+ "isPaletteReversed": false,
172
+ "twoColor": {
173
+ "palette": "monochrome-1",
174
+ "isPaletteReversed": false
175
+ },
176
+ "labels": false,
177
+ "dataFormat": {
178
+ "commas": false,
179
+ "prefix": "",
180
+ "suffix": "%",
181
+ "abbreviated": false,
182
+ "bottomSuffix": "",
183
+ "bottomPrefix": "",
184
+ "bottomAbbreviated": false,
185
+ "roundTo": "1"
186
+ },
187
+ "confidenceKeys": {},
188
+ "visual": {
189
+ "border": true,
190
+ "accent": true,
191
+ "background": true,
192
+ "verticalHoverLine": true,
193
+ "horizontalHoverLine": false
194
+ },
195
+ "useLogScale": false,
196
+ "filterBehavior": "Filter Change",
197
+ "highlightedBarValues": [],
198
+ "series": [
199
+ {
200
+ "dataKey": "COVID-19",
201
+ "type": "Bar",
202
+ "axis": "Left",
203
+ "tooltip": true
204
+ },
205
+ {
206
+ "dataKey": "Influenza",
207
+ "type": "Bar",
208
+ "axis": "Left",
209
+ "tooltip": true
210
+ },
211
+ {
212
+ "dataKey": "RSV",
213
+ "type": "Bar",
214
+ "axis": "Left",
215
+ "tooltip": true
216
+ }
217
+ ],
218
+ "tooltips": {
219
+ "opacity": 90,
220
+ "singleSeries": false
221
+ },
222
+ "forestPlot": {
223
+ "startAt": 0,
224
+ "colors": {
225
+ "line": "",
226
+ "shape": ""
227
+ },
228
+ "lineOfNoEffect": {
229
+ "show": true
230
+ },
231
+ "type": "",
232
+ "pooledResult": {
233
+ "diamondHeight": 5,
234
+ "column": ""
235
+ },
236
+ "estimateField": "",
237
+ "estimateRadius": "",
238
+ "shape": "",
239
+ "rowHeight": 20,
240
+ "description": {
241
+ "show": true,
242
+ "text": "description",
243
+ "location": 0
244
+ },
245
+ "result": {
246
+ "show": true,
247
+ "text": "result",
248
+ "location": 100
249
+ },
250
+ "radius": {
251
+ "min": 1,
252
+ "max": 8,
253
+ "scalingColumn": ""
254
+ },
255
+ "regression": {
256
+ "lower": 0,
257
+ "upper": 0,
258
+ "estimateField": 0
259
+ },
260
+ "leftWidthOffset": 0,
261
+ "rightWidthOffset": 0,
262
+ "showZeroLine": false,
263
+ "hideDateCategoryCol": false,
264
+ "leftLabel": "",
265
+ "rightLabel": "",
266
+ "width": "auto",
267
+ "lowerCiField": "",
268
+ "upperCiField": ""
269
+ },
270
+ "area": {
271
+ "isStacked": false
272
+ },
273
+ "showChartBrush": false,
274
+ "datasets": {},
275
+ "visualizationType": "Combo",
276
+ "dataUrl": "/examples/private/region-data.json",
277
+ "customColors": [
278
+ "#f06f19",
279
+ "#0a58d6",
280
+ "#890664",
281
+ "#000000",
282
+ "#0A6C75",
283
+ "#00a089",
284
+ "#87b6f9",
285
+ "#867a77",
286
+ "#000000"
287
+ ],
288
+ "dataFileName": "/wcms/vizdata/Respitory_Viruses/NVSSConsolidatedNationalDataAggregated.json",
289
+ "dataFileSourceType": "url",
290
+ "dataDescription": {
291
+ "horizontal": false,
292
+ "series": true,
293
+ "singleRow": false,
294
+ "seriesKey": "pathogen",
295
+ "xKey": "week_end",
296
+ "valueKeys": [
297
+ "percent_deaths_selected_pathogen_currentweek"
298
+ ]
299
+ },
300
+ "validated": 4.23,
301
+ "dynamicMarginTop": 0,
302
+ "description": "<p class=\"fnote\">One or more data points are based on death counts between 1-9 and have been suppressed in accordance with National Center for Health Statistics confidentiality standards. </p><br/><div class=\"fnote text-left\">Data presented through: <span class=\"date_max_3\"></span>; Data as of: <span class=\"date_min_3\"></span></div><a href=\"https://data.cdc.gov/Health-Statistics/Provisional-Percent-of-Deaths-for-COVID-19-Influen/4bc2-bbpq\">Dataset on data.cdc.gov</a> | <a href=\"/wcms/vizdata/Respitory_Viruses/NVSSConsolidatedNationalDataAggregated.json\">Link to Dataset</a>",
303
+ "regions": [
304
+ {
305
+ "from": "2023-12-09",
306
+ "to": "2023-12-30",
307
+ "background": "#cccccc",
308
+ "color": "",
309
+ "label": ""
310
+ }
311
+ ]
312
+ }