@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,218 @@
1
+ [
2
+ {
3
+ "location": "united_states",
4
+ "age": "all_ages",
5
+ "use": "excessive_alcohol_use",
6
+ "data_group": "sex",
7
+ "data_sub_group": null,
8
+ "overall": "104,557",
9
+ "males": "97,182",
10
+ "females": "43,375",
11
+ "0-19": null,
12
+ "20-34": null,
13
+ "35-49": null,
14
+ "50-64": null,
15
+ "65+": null,
16
+ "cause_type": "all_causes",
17
+ "cause_category": "summary",
18
+ "row_type": "row_group_total"
19
+ },
20
+ {
21
+ "location": "united_states",
22
+ "age": "all_ages",
23
+ "use": "excessive_alcohol_use",
24
+ "data_group": "age",
25
+ "data_sub_group": "overall",
26
+ "overall": null,
27
+ "males": null,
28
+ "females": null,
29
+ "0-19": "123",
30
+ "20-34": "123",
31
+ "35-49": "123",
32
+ "50-64": "123",
33
+ "65+": "123",
34
+ "cause_type": "all_causes",
35
+ "cause_category": "summary",
36
+ "row_type": "row_group_total"
37
+ },
38
+ {
39
+ "location": "united_states",
40
+ "age": "all_ages",
41
+ "use": "excessive_alcohol_use",
42
+ "data_group": "age",
43
+ "data_sub_group": "male_only",
44
+ "overall": null,
45
+ "males": null,
46
+ "females": null,
47
+ "0-19": "123",
48
+ "20-34": "123",
49
+ "35-49": "123",
50
+ "50-64": "123",
51
+ "65+": "123",
52
+ "cause_type": "all_causes",
53
+ "cause_category": "summary",
54
+ "row_type": "row_group_total"
55
+ },
56
+ {
57
+ "location": "united_states",
58
+ "age": "all_ages",
59
+ "use": "excessive_alcohol_use",
60
+ "data_group": "age",
61
+ "data_sub_group": "female_only",
62
+ "overall": null,
63
+ "males": null,
64
+ "females": null,
65
+ "0-19": "123",
66
+ "20-34": "123",
67
+ "35-49": "123",
68
+ "50-64": "123",
69
+ "65+": "123",
70
+ "cause_type": "all_causes",
71
+ "cause_category": "summary",
72
+ "row_type": "row_group_total"
73
+ },
74
+ {
75
+ "location": "united_states",
76
+ "age": "all_ages",
77
+ "use": "excessive_alcohol_use",
78
+ "data_group": "sex",
79
+ "data_sub_group": null,
80
+ "overall": "58,277",
81
+ "males": "43,063",
82
+ "females": "15,214",
83
+ "0-19": null,
84
+ "20-34": null,
85
+ "35-49": null,
86
+ "50-64": null,
87
+ "65+": null,
88
+ "cause_type": "acute_causes",
89
+ "cause_category": "summary",
90
+ "row_type": null
91
+ },
92
+ {
93
+ "location": "united_states",
94
+ "age": "all_ages",
95
+ "use": "excessive_alcohol_use",
96
+ "data_group": "age",
97
+ "data_sub_group": "overall",
98
+ "overall": null,
99
+ "males": null,
100
+ "females": null,
101
+ "0-19": "123",
102
+ "20-34": "123",
103
+ "35-49": "123",
104
+ "50-64": "123",
105
+ "65+": "123",
106
+ "cause_type": "acute_causes",
107
+ "cause_category": "summary",
108
+ "row_type": null
109
+ },
110
+ {
111
+ "location": "united_states",
112
+ "age": "all_ages",
113
+ "use": "excessive_alcohol_use",
114
+ "data_group": "age",
115
+ "data_sub_group": "male_only",
116
+ "overall": null,
117
+ "males": null,
118
+ "females": null,
119
+ "0-19": "123",
120
+ "20-34": "123",
121
+ "35-49": "123",
122
+ "50-64": "123",
123
+ "65+": "123",
124
+ "cause_type": "acute_causes",
125
+ "cause_category": "summary",
126
+ "row_type": null
127
+ },
128
+ {
129
+ "location": "united_states",
130
+ "age": "all_ages",
131
+ "use": "excessive_alcohol_use",
132
+ "data_group": "age",
133
+ "data_sub_group": "female_only",
134
+ "overall": null,
135
+ "males": null,
136
+ "females": null,
137
+ "0-19": "123",
138
+ "20-34": "123",
139
+ "35-49": "123",
140
+ "50-64": "123",
141
+ "65+": "123",
142
+ "cause_type": "acute_causes",
143
+ "cause_category": "summary",
144
+ "row_type": null
145
+ },
146
+ {
147
+ "location": "united_states",
148
+ "age": "all_ages",
149
+ "use": "excessive_alcohol_use",
150
+ "data_group": "sex",
151
+ "data_sub_group": null,
152
+ "overall": "82,279",
153
+ "males": "54,119",
154
+ "females": "28,161",
155
+ "0-19": null,
156
+ "20-34": null,
157
+ "35-49": null,
158
+ "50-64": null,
159
+ "65+": null,
160
+ "cause_type": "chronic_causes",
161
+ "cause_category": "summary",
162
+ "row_type": null
163
+ },
164
+ {
165
+ "location": "united_states",
166
+ "age": "all_ages",
167
+ "use": "excessive_alcohol_use",
168
+ "data_group": "age",
169
+ "data_sub_group": "overall",
170
+ "overall": null,
171
+ "males": null,
172
+ "females": null,
173
+ "0-19": "123",
174
+ "20-34": "123",
175
+ "35-49": "123",
176
+ "50-64": "123",
177
+ "65+": "123",
178
+ "cause_type": "chronic_causes",
179
+ "cause_category": "summary",
180
+ "row_type": null
181
+ },
182
+ {
183
+ "location": "united_states",
184
+ "age": "all_ages",
185
+ "use": "excessive_alcohol_use",
186
+ "data_group": "age",
187
+ "data_sub_group": "male_only",
188
+ "overall": null,
189
+ "males": null,
190
+ "females": null,
191
+ "0-19": "123",
192
+ "20-34": "123",
193
+ "35-49": "123",
194
+ "50-64": "123",
195
+ "65+": "123",
196
+ "cause_type": "chronic_causes",
197
+ "cause_category": "summary",
198
+ "row_type": null
199
+ },
200
+ {
201
+ "location": "united_states",
202
+ "age": "all_ages",
203
+ "use": "excessive_alcohol_use",
204
+ "data_group": "age",
205
+ "data_sub_group": "female_only",
206
+ "overall": null,
207
+ "males": null,
208
+ "females": null,
209
+ "0-19": "123",
210
+ "20-34": "123",
211
+ "35-49": "123",
212
+ "50-64": "123",
213
+ "65+": "123",
214
+ "cause_type": "chronic_causes",
215
+ "cause_category": "summary",
216
+ "row_type": null
217
+ }
218
+ ]
@@ -0,0 +1,346 @@
1
+ {
2
+ "type": "chart",
3
+ "debugSvg": false,
4
+ "chartMessage": {
5
+ "noData": "No Data Available"
6
+ },
7
+ "title": "Example Stacked Bar Chart",
8
+ "showTitle": true,
9
+ "showDownloadMediaButton": false,
10
+ "theme": "theme-orange",
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": "stacked",
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
+ "preliminaryData": [
33
+ {
34
+ "type": "effect",
35
+ "label": "Dashed Large",
36
+ "column": "Data 2",
37
+ "value": "20",
38
+ "style": "Dashed Large",
39
+ "seriesKey": "Data 1"
40
+ },
41
+ {
42
+ "type": "effect",
43
+ "label": "Circle",
44
+ "column": "Data 1",
45
+ "value": "35",
46
+ "style": "Open Circles",
47
+ "seriesKey": "Data 2"
48
+ },
49
+ {
50
+ "type": "effect",
51
+ "label": "Dashed Medium",
52
+ "column": "Data 2",
53
+ "value": "20",
54
+ "style": "Dashed Medium",
55
+ "seriesKey": "Data 3"
56
+ }
57
+ ],
58
+ "yAxis": {
59
+ "hideAxis": false,
60
+ "displayNumbersOnBar": false,
61
+ "hideLabel": false,
62
+ "hideTicks": false,
63
+ "size": "64",
64
+ "gridLines": false,
65
+ "enablePadding": false,
66
+ "min": "",
67
+ "max": "",
68
+ "labelColor": "#333",
69
+ "tickLabelColor": "#333",
70
+ "tickColor": "#333",
71
+ "rightHideAxis": true,
72
+ "rightAxisSize": 0,
73
+ "rightLabel": "",
74
+ "rightLabelOffsetSize": 0,
75
+ "rightAxisLabelColor": "#333",
76
+ "rightAxisTickLabelColor": "#333",
77
+ "rightAxisTickColor": "#333",
78
+ "numTicks": "",
79
+ "axisPadding": 0,
80
+ "tickRotation": 0,
81
+ "anchors": [],
82
+ "label": "Y-Axis Label Example"
83
+ },
84
+ "boxplot": {
85
+ "plots": [],
86
+ "borders": "true",
87
+ "firstQuartilePercentage": 25,
88
+ "thirdQuartilePercentage": 75,
89
+ "boxWidthPercentage": 40,
90
+ "plotOutlierValues": false,
91
+ "plotNonOutlierValues": true,
92
+ "legend": {
93
+ "showHowToReadText": false,
94
+ "howToReadText": ""
95
+ },
96
+ "labels": {
97
+ "q1": "Lower Quartile",
98
+ "q2": "q2",
99
+ "q3": "Upper Quartile",
100
+ "q4": "q4",
101
+ "minimum": "Minimum",
102
+ "maximum": "Maximum",
103
+ "mean": "Mean",
104
+ "median": "Median",
105
+ "sd": "Standard Deviation",
106
+ "iqr": "Interquartile Range",
107
+ "total": "Total",
108
+ "outliers": "Outliers",
109
+ "values": "Values",
110
+ "lowerBounds": "Lower Bounds",
111
+ "upperBounds": "Upper Bounds"
112
+ }
113
+ },
114
+ "topAxis": {
115
+ "hasLine": false
116
+ },
117
+ "isLegendValue": false,
118
+ "barThickness": 0.35,
119
+ "barHeight": 25,
120
+ "barSpace": 15,
121
+ "heights": {
122
+ "vertical": 300,
123
+ "horizontal": 750
124
+ },
125
+ "xAxis": {
126
+ "sortDates": false,
127
+ "anchors": [],
128
+ "type": "categorical",
129
+ "showTargetLabel": true,
130
+ "targetLabel": "Target",
131
+ "hideAxis": false,
132
+ "hideLabel": false,
133
+ "hideTicks": false,
134
+ "size": "67",
135
+ "tickRotation": "25",
136
+ "min": "",
137
+ "max": "",
138
+ "labelColor": "#333",
139
+ "tickLabelColor": "#333",
140
+ "tickColor": "#333",
141
+ "numTicks": "",
142
+ "labelOffset": 65,
143
+ "axisPadding": 0,
144
+ "target": 0,
145
+ "maxTickRotation": 0,
146
+ "dataKey": "Year",
147
+ "label": "X-Axis Label Example",
148
+ "tickWidthMax": 41
149
+ },
150
+ "table": {
151
+ "label": "Data Table",
152
+ "expanded": true,
153
+ "limitHeight": false,
154
+ "height": "",
155
+ "caption": "",
156
+ "showDownloadUrl": false,
157
+ "showDataTableLink": true,
158
+ "indexLabel": "",
159
+ "download": true,
160
+ "showVertical": false,
161
+ "show": true
162
+ },
163
+ "orientation": "vertical",
164
+ "color": "pinkpurple",
165
+ "columns": {},
166
+ "legend": {
167
+ "hide": false,
168
+ "behavior": "isolate",
169
+ "singleRow": false,
170
+ "colorCode": "",
171
+ "reverseLabelOrder": false,
172
+ "description": "",
173
+ "dynamicLegend": false,
174
+ "dynamicLegendDefaultText": "Show All",
175
+ "dynamicLegendItemLimit": 5,
176
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
177
+ "dynamicLegendChartMessage": "Select Options from the Legend",
178
+ "lineMode": false,
179
+ "verticalSorted": false,
180
+ "highlightOnHover": false,
181
+ "position": "right",
182
+ "label": "Data Type"
183
+ },
184
+ "brush": {
185
+ "height": 25,
186
+ "data": [
187
+ {
188
+ "Year": "2015",
189
+ "Data 1": "25",
190
+ "Data 2": "20",
191
+ "Data 3": "55"
192
+ },
193
+ {
194
+ "Year": "2016",
195
+ "Data 1": "35",
196
+ "Data 2": "30",
197
+ "Data 3": "35"
198
+ },
199
+ {
200
+ "Year": "2017",
201
+ "Data 1": "22",
202
+ "Data 2": "38",
203
+ "Data 3": "40"
204
+ },
205
+ {
206
+ "Year": "2018",
207
+ "Data 1": "40",
208
+ "Data 2": "40",
209
+ "Data 3": "20"
210
+ }
211
+ ],
212
+ "active": false
213
+ },
214
+ "exclusions": {
215
+ "active": false,
216
+ "keys": []
217
+ },
218
+ "palette": "qualitative-bold",
219
+ "isPaletteReversed": false,
220
+ "twoColor": {
221
+ "palette": "monochrome-1",
222
+ "isPaletteReversed": false
223
+ },
224
+ "labels": false,
225
+ "dataFormat": {
226
+ "commas": false,
227
+ "prefix": "",
228
+ "suffix": "%",
229
+ "abbreviated": false,
230
+ "bottomSuffix": "",
231
+ "bottomPrefix": "",
232
+ "bottomAbbreviated": false
233
+ },
234
+ "confidenceKeys": {},
235
+ "visual": {
236
+ "border": true,
237
+ "accent": true,
238
+ "background": true,
239
+ "verticalHoverLine": false,
240
+ "horizontalHoverLine": false
241
+ },
242
+ "useLogScale": false,
243
+ "filterBehavior": "Filter Change",
244
+ "highlightedBarValues": [],
245
+ "series": [
246
+ {
247
+ "dataKey": "Data 1",
248
+ "type": "Bar",
249
+ "tooltip": true,
250
+ "axis": "Left"
251
+ },
252
+ {
253
+ "dataKey": "Data 2",
254
+ "type": "Bar",
255
+ "tooltip": true,
256
+ "axis": "Left"
257
+ },
258
+ {
259
+ "dataKey": "Data 3",
260
+ "type": "Bar",
261
+ "tooltip": true,
262
+ "axis": "Left"
263
+ }
264
+ ],
265
+ "tooltips": {
266
+ "opacity": 90,
267
+ "singleSeries": false
268
+ },
269
+ "forestPlot": {
270
+ "startAt": 0,
271
+ "colors": {
272
+ "line": "",
273
+ "shape": ""
274
+ },
275
+ "lineOfNoEffect": {
276
+ "show": true
277
+ },
278
+ "type": "",
279
+ "pooledResult": {
280
+ "diamondHeight": 5,
281
+ "column": ""
282
+ },
283
+ "estimateField": "",
284
+ "estimateRadius": "",
285
+ "shape": "square",
286
+ "rowHeight": 20,
287
+ "description": {
288
+ "show": true,
289
+ "text": "description",
290
+ "location": 0
291
+ },
292
+ "result": {
293
+ "show": true,
294
+ "text": "result",
295
+ "location": 100
296
+ },
297
+ "radius": {
298
+ "min": 2,
299
+ "max": 10,
300
+ "scalingColumn": ""
301
+ },
302
+ "regression": {
303
+ "lower": 0,
304
+ "upper": 0,
305
+ "estimateField": 0
306
+ },
307
+ "leftWidthOffset": 0,
308
+ "rightWidthOffset": 0,
309
+ "showZeroLine": false,
310
+ "leftLabel": "",
311
+ "rightLabel": ""
312
+ },
313
+ "area": {
314
+ "isStacked": false
315
+ },
316
+ "height": "375",
317
+ "data": [
318
+ {
319
+ "Year": "2015",
320
+ "Data 1": "25",
321
+ "Data 2": "20",
322
+ "Data 3": "55"
323
+ },
324
+ {
325
+ "Year": "2016",
326
+ "Data 1": "35",
327
+ "Data 2": "30",
328
+ "Data 3": "35"
329
+ },
330
+ {
331
+ "Year": "2017",
332
+ "Data 1": "22",
333
+ "Data 2": "38",
334
+ "Data 3": "40"
335
+ },
336
+ {
337
+ "Year": "2018",
338
+ "Data 1": "40",
339
+ "Data 2": "40",
340
+ "Data 3": "20"
341
+ }
342
+ ],
343
+ "visualizationType": "Line",
344
+ "validated": 4.23,
345
+ "dynamicMarginTop": 0
346
+ }
@@ -1,7 +1,7 @@
1
1
  import React, { useContext, memo } from 'react'
2
2
 
3
3
  // cdc
4
- import ConfigContext from '../ConfigContext'
4
+ import ConfigContext from '../../../ConfigContext'
5
5
  import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
6
6
 
7
7
  // visx & d3
@@ -53,7 +53,7 @@ const AreaChartStacked = ({ xScale, yScale, yMax, xMax, handleTooltipMouseOver,
53
53
  d={path(stack) || ''}
54
54
  strokeWidth={2}
55
55
  stroke={displayArea ? colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[stack.key] : stack.key) : '#000' : 'transparent'}
56
- fillOpacity={transparentArea ? 0.25 : 0.5}
56
+ fillOpacity={transparentArea ? 0.2 : 1}
57
57
  fill={displayArea ? colorScale ? colorScale(config.runtime.seriesLabels ? config.runtime.seriesLabels[stack.key] : stack.key) : '#000' : 'transparent'}
58
58
  />
59
59
  )
@@ -1,7 +1,7 @@
1
1
  import React, { useContext, memo } from 'react'
2
2
 
3
3
  // cdc
4
- import ConfigContext from '../ConfigContext'
4
+ import ConfigContext from '../../../ConfigContext'
5
5
  import ErrorBoundary from '@cdc/core/components/ErrorBoundary'
6
6
 
7
7
  // visx & d3
@@ -0,0 +1,4 @@
1
+ import AreaChart from './components/AreaChart'
2
+ import AreaChartStacked from './components/AreaChart.Stacked'
3
+
4
+ export { AreaChart, AreaChartStacked }
@@ -1,20 +1,20 @@
1
1
  import React, { useContext } from 'react'
2
- import ConfigContext from '../ConfigContext'
3
- import { useBarChart } from '../hooks/useBarChart'
2
+ import ConfigContext from '../../../ConfigContext'
3
+ import { useBarChart } from '../../../hooks/useBarChart'
4
4
  import { Group } from '@visx/group'
5
5
  import { Text } from '@visx/text'
6
6
  import { BarGroup } from '@visx/shape'
7
- import { useHighlightedBars } from '../hooks/useHighlightedBars'
7
+ import { useHighlightedBars } from '../../../hooks/useHighlightedBars'
8
8
  import { FaStar } from 'react-icons/fa'
9
9
 
10
10
  // third party
11
11
  import chroma from 'chroma-js'
12
+ import BarChartContext, { BarChartContextValues } from './context'
13
+ import { ChartContext } from '../../../types/ChartContext'
12
14
 
13
- import { type BarChartProps } from '../types/ChartProps'
14
-
15
- export const BarChartHorizontal = (props: BarChartProps) => {
16
- const { xScale, yScale, yMax, seriesScale } = props
17
- const { transformedData: data, colorScale, seriesHighlight, config, formatNumber, formatDate, parseDate, setSharedFilter, isNumber, getTextWidth, getYAxisData, getXAxisData } = useContext(ConfigContext)
15
+ export const BarChartHorizontal = () => {
16
+ const { xScale, yScale, yMax, seriesScale } = useContext<BarChartContextValues>(BarChartContext)
17
+ const { transformedData: data, colorScale, seriesHighlight, config, formatNumber, formatDate, parseDate, setSharedFilter, isNumber, getTextWidth, getYAxisData, getXAxisData } = useContext<ChartContext>(ConfigContext)
18
18
  const {
19
19
  isHorizontal,
20
20
  barBorderWidth,
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from 'react'
2
- import ConfigContext from '../ConfigContext'
3
- import { useBarChart } from '../hooks/useBarChart'
2
+ import ConfigContext from '../../../ConfigContext'
3
+ import { useBarChart } from '../../../hooks/useBarChart'
4
4
  import { BarStackHorizontal } from '@visx/shape'
5
5
  import { Group } from '@visx/group'
6
6
  import { Text } from '@visx/text'
@@ -8,12 +8,42 @@ import { Text } from '@visx/text'
8
8
  // third party
9
9
  import chroma from 'chroma-js'
10
10
 
11
- import { type BarChartProps } from '../types/ChartProps'
11
+ // types
12
+ import BarChartContext, { type BarChartContextValues } from './context'
13
+ import { type ChartContext } from '../../../types/ChartContext'
14
+
15
+ const BarChartStackedHorizontal = () => {
16
+ const { yMax, yScale, xScale } = useContext<BarChartContextValues>(BarChartContext)
17
+
18
+ // prettier-ignore
19
+ const {
20
+ animatedChart,
21
+ colorScale,
22
+ config,
23
+ formatDate,
24
+ formatNumber,
25
+ getTextWidth,
26
+ parseDate,
27
+ seriesHighlight,
28
+ setSharedFilter,
29
+ transformedData: data
30
+ } = useContext<ChartContext>(ConfigContext)
31
+
32
+ // prettier-ignore
33
+ const {
34
+ applyRadius,
35
+ barBorderWidth,
36
+ displayNumbersOnBar,
37
+ fontSize,
38
+ getAdditionalColumn,
39
+ hoveredBar,
40
+ isHorizontal,
41
+ isLabelBelowBar,
42
+ onMouseLeaveBar,
43
+ onMouseOverBar,
44
+ updateBars
45
+ } = useBarChart()
12
46
 
13
- const BarChartStackedHorizontal = (props: BarChartProps) => {
14
- const { xScale, yScale, xMax, yMax } = props
15
- const { transformedData: data, colorScale, seriesHighlight, config, formatNumber, formatDate, parseDate, setSharedFilter, animatedChart, getTextWidth, setSeriesHighlight } = useContext(ConfigContext)
16
- const { isHorizontal, barBorderWidth, hasMultipleSeries, applyRadius, updateBars, isLabelBelowBar, displayNumbersOnBar, fontSize, getAdditionalColumn, hoveredBar, onMouseLeaveBar, onMouseOverBar } = useBarChart()
17
47
  const { orientation, visualizationSubType } = config
18
48
 
19
49
  return (