@cdc/chart 4.23.11 → 4.24.2

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 (104) hide show
  1. package/dist/cdcchart.js +35740 -35027
  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 +393 -0
  9. package/examples/feature/regions/index.json +9 -5
  10. package/examples/feature/scatterplot/scatterplot.json +272 -33
  11. package/index.html +10 -8
  12. package/package.json +2 -2
  13. package/src/CdcChart.tsx +70 -234
  14. package/src/ConfigContext.tsx +6 -0
  15. package/src/_stories/ChartEditor.stories.tsx +22 -0
  16. package/src/_stories/ChartLine.preliminary.tsx +19 -0
  17. package/src/_stories/_mock/pie_config.json +192 -0
  18. package/src/_stories/_mock/pie_data.json +218 -0
  19. package/src/_stories/_mock/preliminary_mock.json +346 -0
  20. package/src/components/{AreaChart.Stacked.jsx → AreaChart/components/AreaChart.Stacked.jsx} +2 -2
  21. package/src/components/{AreaChart.jsx → AreaChart/components/AreaChart.jsx} +2 -26
  22. package/src/components/AreaChart/index.tsx +4 -0
  23. package/src/components/{BarChart.Horizontal.tsx → BarChart/components/BarChart.Horizontal.tsx} +8 -8
  24. package/src/components/{BarChart.StackedHorizontal.tsx → BarChart/components/BarChart.StackedHorizontal.tsx} +37 -7
  25. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +108 -0
  26. package/src/components/{BarChart.Vertical.tsx → BarChart/components/BarChart.Vertical.tsx} +53 -70
  27. package/src/components/BarChart/components/BarChart.jsx +39 -0
  28. package/src/components/{BarChartType.jsx → BarChart/components/BarChartType.jsx} +0 -2
  29. package/src/components/BarChart/components/context.tsx +13 -0
  30. package/src/components/BarChart/index.tsx +3 -0
  31. package/src/components/{BoxPlot.jsx → BoxPlot/BoxPlot.jsx} +10 -9
  32. package/src/components/BoxPlot/index.tsx +3 -0
  33. package/src/components/EditorPanel/EditorPanel.tsx +2776 -0
  34. package/src/components/EditorPanel/EditorPanelContext.ts +40 -0
  35. package/src/components/EditorPanel/components/PanelProps.ts +3 -0
  36. package/src/components/EditorPanel/components/Panels/Panel.BoxPlot.tsx +148 -0
  37. package/src/components/{ForestPlotSettings.jsx → EditorPanel/components/Panels/Panel.ForestPlotSettings.tsx} +97 -167
  38. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +160 -0
  39. package/src/components/EditorPanel/components/Panels/Panel.Regions.tsx +168 -0
  40. package/src/components/{Series.jsx → EditorPanel/components/Panels/Panel.Series.tsx} +4 -4
  41. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +297 -0
  42. package/src/components/EditorPanel/components/Panels/index.tsx +17 -0
  43. package/src/components/EditorPanel/components/panels.scss +72 -0
  44. package/src/components/EditorPanel/editor-panel.scss +739 -0
  45. package/src/components/EditorPanel/index.tsx +3 -0
  46. package/src/{hooks → components/EditorPanel}/useEditorPermissions.js +34 -2
  47. package/src/components/{Forecasting.jsx → Forecasting/Forecasting.jsx} +1 -1
  48. package/src/components/Forecasting/index.tsx +3 -0
  49. package/src/components/ForestPlot/ForestPlot.tsx +254 -0
  50. package/src/components/ForestPlot/ForestPlotProps.ts +7 -0
  51. package/src/components/ForestPlot/index.tsx +1 -209
  52. package/src/components/Legend/Legend.Component.tsx +199 -0
  53. package/src/components/Legend/Legend.tsx +28 -0
  54. package/src/components/Legend/helpers/createFormatLabels.tsx +140 -0
  55. package/src/components/Legend/index.tsx +3 -0
  56. package/src/components/LineChart/LineChartProps.ts +29 -0
  57. package/src/components/LineChart/components/LineChart.Circle.tsx +147 -0
  58. package/src/components/LineChart/helpers.ts +45 -0
  59. package/src/components/LineChart/index.tsx +111 -23
  60. package/src/components/LinearChart.jsx +55 -72
  61. package/src/components/PairedBarChart.jsx +4 -2
  62. package/src/components/{PieChart.jsx → PieChart/PieChart.tsx} +93 -31
  63. package/src/components/PieChart/index.tsx +3 -0
  64. package/src/components/Regions/components/Regions.tsx +144 -0
  65. package/src/components/Regions/index.tsx +3 -0
  66. package/src/components/{ScatterPlot.jsx → ScatterPlot/ScatterPlot.jsx} +3 -3
  67. package/src/components/ScatterPlot/index.tsx +3 -0
  68. package/src/components/{SparkLine.jsx → Sparkline/SparkLine.jsx} +2 -2
  69. package/src/components/Sparkline/index.tsx +3 -0
  70. package/src/data/initial-state.js +10 -8
  71. package/src/helpers/abbreviateNumber.ts +17 -0
  72. package/src/helpers/computeMarginBottom.ts +55 -0
  73. package/src/helpers/filterData.ts +18 -0
  74. package/src/helpers/generateColorsArray.ts +8 -0
  75. package/src/helpers/getQuartiles.ts +30 -0
  76. package/src/helpers/handleChartAriaLabels.ts +19 -0
  77. package/src/helpers/handleLineType.ts +18 -0
  78. package/src/helpers/lineOptions.ts +18 -0
  79. package/src/helpers/sort.ts +7 -0
  80. package/src/helpers/tests/computeMarginBottom.test.ts +20 -0
  81. package/src/hooks/useBarChart.js +7 -6
  82. package/src/hooks/useHighlightedBars.js +1 -1
  83. package/src/hooks/useMinMax.ts +3 -3
  84. package/src/hooks/useScales.ts +19 -6
  85. package/src/hooks/{useTooltip.jsx → useTooltip.tsx} +31 -25
  86. package/src/scss/main.scss +0 -3
  87. package/src/types/ChartConfig.ts +167 -23
  88. package/src/types/ChartContext.ts +34 -12
  89. package/src/types/ForestPlot.ts +7 -14
  90. package/src/types/Label.ts +7 -0
  91. package/examples/feature/scatterplot/scatterplot-continuous.csv +0 -17
  92. package/src/ConfigContext.jsx +0 -5
  93. package/src/components/BarChart.StackedVertical.tsx +0 -91
  94. package/src/components/BarChart.jsx +0 -30
  95. package/src/components/EditorPanel.jsx +0 -3356
  96. package/src/components/ForestPlot/Readme.md +0 -0
  97. package/src/components/Legend.jsx +0 -310
  98. package/src/components/LineChart/LineChart.Circle.tsx +0 -105
  99. package/src/scss/LinearChart.scss +0 -0
  100. package/src/scss/editor-panel.scss +0 -745
  101. package/src/scss/legend.scss +0 -206
  102. package/src/scss/mixins.scss +0 -0
  103. package/src/scss/variables.scss +0 -1
  104. package/src/types/ChartProps.ts +0 -7
@@ -0,0 +1,192 @@
1
+ {
2
+ "type": "chart",
3
+ "debugSvg": false,
4
+ "chartMessage": {
5
+ "noData": "No Data Available"
6
+ },
7
+ "title": "ARDI",
8
+ "showTitle": true,
9
+ "showDownloadMediaButton": false,
10
+ "theme": "theme-blue",
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": 50,
38
+ "gridLines": false,
39
+ "enablePadding": false,
40
+ "min": "",
41
+ "max": "",
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
+ "dataKey": "males"
57
+ },
58
+ "topAxis": {
59
+ "hasLine": false
60
+ },
61
+ "isLegendValue": false,
62
+ "barThickness": 0.35,
63
+ "barHeight": 25,
64
+ "barSpace": 15,
65
+ "heights": {
66
+ "vertical": 300,
67
+ "horizontal": 750
68
+ },
69
+ "xAxis": {
70
+ "sortDates": false,
71
+ "anchors": [],
72
+ "type": "categorical",
73
+ "showTargetLabel": true,
74
+ "targetLabel": "Target",
75
+ "hideAxis": false,
76
+ "hideLabel": false,
77
+ "hideTicks": false,
78
+ "size": 75,
79
+ "tickRotation": 0,
80
+ "min": "",
81
+ "max": "",
82
+ "labelColor": "#333",
83
+ "tickLabelColor": "#333",
84
+ "tickColor": "#333",
85
+ "numTicks": "",
86
+ "labelOffset": 65,
87
+ "axisPadding": 0,
88
+ "target": 0,
89
+ "maxTickRotation": 0,
90
+ "dataKey": "cause_type"
91
+ },
92
+ "table": {
93
+ "label": "Data Table",
94
+ "expanded": true,
95
+ "limitHeight": false,
96
+ "height": "",
97
+ "caption": "",
98
+ "showDownloadUrl": false,
99
+ "showDataTableLink": true,
100
+ "indexLabel": "Cause Type",
101
+ "download": false,
102
+ "showVertical": true,
103
+ "show": true,
104
+ "customTableConfig": true,
105
+ "excludeColumns": ["location", "age", "use", "data_group", "data_sub_group", "cause_category"]
106
+ },
107
+ "orientation": "vertical",
108
+ "color": "pinkpurple",
109
+ "columns": {},
110
+ "legend": {
111
+ "hide": false,
112
+ "behavior": "isolate",
113
+ "singleRow": false,
114
+ "colorCode": "",
115
+ "reverseLabelOrder": false,
116
+ "description": "",
117
+ "dynamicLegend": false,
118
+ "dynamicLegendDefaultText": "Show All",
119
+ "dynamicLegendItemLimit": 5,
120
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
121
+ "dynamicLegendChartMessage": "Select Options from the Legend",
122
+ "lineMode": false,
123
+ "verticalSorted": false,
124
+ "highlightOnHover": false
125
+ },
126
+ "brush": {
127
+ "height": 25,
128
+ "data": [],
129
+ "active": false
130
+ },
131
+ "exclusions": {
132
+ "active": true,
133
+ "keys": ["all_causes"]
134
+ },
135
+ "palette": "qualitative-soft",
136
+ "isPaletteReversed": false,
137
+ "twoColor": {
138
+ "palette": "monochrome-1",
139
+ "isPaletteReversed": false
140
+ },
141
+ "labels": false,
142
+ "dataFormat": {
143
+ "commas": false,
144
+ "prefix": "",
145
+ "suffix": "",
146
+ "abbreviated": false,
147
+ "bottomSuffix": "",
148
+ "bottomPrefix": "",
149
+ "bottomAbbreviated": false,
150
+ "roundTo": 1
151
+ },
152
+ "confidenceKeys": {},
153
+ "visual": {
154
+ "border": true,
155
+ "accent": true,
156
+ "background": true,
157
+ "verticalHoverLine": false,
158
+ "horizontalHoverLine": false
159
+ },
160
+ "useLogScale": false,
161
+ "filterBehavior": "Filter Change",
162
+ "highlightedBarValues": [],
163
+ "series": [
164
+ {
165
+ "dataKey": "males",
166
+ "axis": "Left",
167
+ "tooltip": true
168
+ }
169
+ ],
170
+ "tooltips": {
171
+ "opacity": 90,
172
+ "singleSeries": false
173
+ },
174
+ "dashboard": {
175
+ "theme": "theme-blue",
176
+ "title": "ARDI"
177
+ },
178
+ "animateReplay": true,
179
+ "aspectRatio": 1,
180
+ "validated": 4.23,
181
+ "visualizationType": "Pie",
182
+ "pieType": "Donut",
183
+ "filters": [
184
+ {
185
+ "values": ["age", "sex"],
186
+ "active": "sex",
187
+ "filterStyle": "dropdown",
188
+ "order": "asc",
189
+ "columnName": "data_group"
190
+ }
191
+ ]
192
+ }
@@ -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
+ ]