@cdc/chart 1.3.3 → 9.22.9

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 (42) hide show
  1. package/dist/cdcchart.js +6 -6
  2. package/examples/cutoff-example-config.json +2 -0
  3. package/examples/cutoff-example-data.json +1 -1
  4. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +198 -0
  5. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +241 -0
  6. package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +248 -0
  7. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +137 -0
  8. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +80 -0
  9. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +81 -0
  10. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +68 -0
  11. package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +111 -0
  12. package/examples/gallery/lollipop/lollipop-style-horizontal.json +220 -0
  13. package/examples/gallery/paired-bar/paired-bar-chart.json +196 -0
  14. package/examples/horizontal-chart.json +3 -0
  15. package/examples/paired-bar-data.json +1 -1
  16. package/examples/paired-bar-example.json +2 -0
  17. package/examples/planet-combo-example-config.json +2 -0
  18. package/examples/planet-example-config.json +2 -2
  19. package/examples/planet-example-data.json +1 -1
  20. package/examples/planet-pie-example-config.json +2 -0
  21. package/examples/private/line-test-data.json +22 -0
  22. package/examples/private/line-test-two.json +216 -0
  23. package/examples/private/line-test.json +102 -0
  24. package/examples/stacked-vertical-bar-example.json +228 -0
  25. package/package.json +3 -3
  26. package/src/CdcChart.tsx +79 -47
  27. package/src/components/BarChart.tsx +82 -39
  28. package/src/components/DataTable.tsx +17 -10
  29. package/src/components/EditorPanel.js +233 -169
  30. package/src/components/LineChart.tsx +3 -0
  31. package/src/components/LinearChart.tsx +171 -77
  32. package/src/components/PairedBarChart.tsx +139 -42
  33. package/src/components/PieChart.tsx +31 -6
  34. package/src/components/SparkLine.js +4 -1
  35. package/src/components/useIntersectionObserver.tsx +32 -0
  36. package/src/data/initial-state.js +17 -7
  37. package/src/hooks/useReduceData.ts +50 -23
  38. package/src/index.html +5 -9
  39. package/src/scss/editor-panel.scss +34 -4
  40. package/src/scss/main.scss +165 -5
  41. package/LICENSE +0 -201
  42. package/src/components/BarStackVertical.js +0 -0
@@ -2,6 +2,8 @@
2
2
  "title": "Data Cutoff Example (< 0.1)",
3
3
  "theme": "theme-blue",
4
4
  "dataUrl": "/examples/cutoff-example-data.json",
5
+ "animate": true,
6
+ "animateReplay": true,
5
7
  "visualizationType": "Line",
6
8
  "series": [{"dataKey": "Value"}],
7
9
  "barThickness": 0.3,
@@ -21,7 +21,7 @@
21
21
  },
22
22
  {
23
23
  "Category": "Category 6",
24
- "Value": "0.03"
24
+ "Value": null
25
25
  },
26
26
  {
27
27
  "Category": "Category 7",
@@ -0,0 +1,198 @@
1
+ {
2
+ "type": "chart",
3
+ "title": "Example of Horizontal Bar Chart with Numbers on Bar",
4
+ "theme": "theme-blue",
5
+ "fontSize": "medium",
6
+ "lineDatapointStyle": "hover",
7
+ "barHasBorder": "true",
8
+ "padding": {
9
+ "left": 5,
10
+ "right": 5
11
+ },
12
+ "yAxis": {
13
+ "size": 50,
14
+ "gridLines": false,
15
+ "type": "chart",
16
+ "title": "Example of Horizontal Bar Chart with Numbers on Bar",
17
+ "theme": "theme-blue",
18
+ "fontSize": "medium",
19
+ "lineDatapointStyle": "hover",
20
+ "barHasBorder": "true",
21
+ "padding": {
22
+ "left": 5,
23
+ "right": 5
24
+ },
25
+ "yAxis": {
26
+ "size": 50,
27
+ "gridLines": false,
28
+ "label": "Number of Accidents"
29
+ },
30
+ "barThickness": "0.5",
31
+ "height": 450,
32
+ "xAxis": {
33
+ "size": 75,
34
+ "tickRotation": 0,
35
+ "dataKey": "Injury Type",
36
+ "label": "Injury Type"
37
+ },
38
+ "table": {
39
+ "label": "Data Table",
40
+ "expanded": false,
41
+ "show": true
42
+ },
43
+ "legend": {
44
+ "behavior": "isolate",
45
+ "position": "right",
46
+ "label": "Accident Year"
47
+ },
48
+ "palette": "qualitative-bold",
49
+ "labels": false,
50
+ "dataFormat": {},
51
+ "confidenceKeys": {},
52
+ "data": [
53
+ {
54
+ "2017": "12",
55
+ "2018": "8",
56
+ "Injury Type": "Falling"
57
+ },
58
+ {
59
+ "2017": "25",
60
+ "2018": "10",
61
+ "Injury Type": "Machinery"
62
+ },
63
+ {
64
+ "2017": "1",
65
+ "2018": "0",
66
+ "Injury Type": "Alergic Reaction"
67
+ },
68
+ {
69
+ "2017": "3",
70
+ "2018": "4",
71
+ "Injury Type": "Chemical"
72
+ },
73
+ {
74
+ "2017": "3",
75
+ "2018": "2",
76
+ "Injury Type": "Burns"
77
+ }
78
+ ],
79
+ "dataFileName": "job_place_injury_2 years_FINAL.json",
80
+ "dataFileSourceType": "file",
81
+ "visualizationType": "Bar",
82
+ "visualizationSubType": "horizontal",
83
+ "series": [
84
+ {
85
+ "dataKey": "2017",
86
+ "type": "Bar"
87
+ },
88
+ {
89
+ "dataKey": "2018",
90
+ "type": "Bar"
91
+ }
92
+ ],
93
+ "runtime": {
94
+ "seriesLabels": {
95
+ "2017": "2017",
96
+ "2018": "2018"
97
+ },
98
+ "seriesLabelsAll": [
99
+ "2017",
100
+ "2018"
101
+ ],
102
+ "originalXAxis": {
103
+ "size": 75,
104
+ "tickRotation": 0,
105
+ "dataKey": "Injury Type",
106
+ "label": "Injury Type"
107
+ },
108
+ "seriesKeys": [
109
+ "2017",
110
+ "2018"
111
+ ],
112
+ "xAxis": {
113
+ "size": 50,
114
+ "gridLines": false,
115
+ "label": "Number of Accidents"
116
+ },
117
+ "yAxis": {
118
+ "size": 75,
119
+ "tickRotation": 0,
120
+ "dataKey": "Injury Type",
121
+ "label": "Injury Type"
122
+ },
123
+ "horizontal": true,
124
+ "uniqueId": 1635525153525,
125
+ "editorErrorMessage": ""
126
+ },
127
+ "barPadding": 40,
128
+ "barHeight": 25,
129
+ "labelPlacement": "Below Bar",
130
+ "displayNumbersOnBar": true
131
+ },
132
+ "barThickness": "0.5",
133
+ "height": 450,
134
+ "xAxis": {
135
+ "size": 75,
136
+ "tickRotation": 0,
137
+ "dataKey": "Injury Type",
138
+ "label": "Injury Type"
139
+ },
140
+ "table": {
141
+ "label": "Data Table",
142
+ "expanded": false,
143
+ "show": true
144
+ },
145
+ "legend": {
146
+ "behavior": "isolate",
147
+ "position": "right",
148
+ "label": "Accident Year"
149
+ },
150
+ "palette": "qualitative-bold",
151
+ "labels": false,
152
+ "dataFormat": {},
153
+ "confidenceKeys": {},
154
+ "data": [
155
+ {
156
+ "2017": "12",
157
+ "2018": "8",
158
+ "Injury Type": "Falling"
159
+ },
160
+ {
161
+ "2017": "25",
162
+ "2018": "10",
163
+ "Injury Type": "Machinery"
164
+ },
165
+ {
166
+ "2017": "1",
167
+ "2018": "0",
168
+ "Injury Type": "Alergic Reaction"
169
+ },
170
+ {
171
+ "2017": "3",
172
+ "2018": "4",
173
+ "Injury Type": "Chemical"
174
+ },
175
+ {
176
+ "2017": "3",
177
+ "2018": "2",
178
+ "Injury Type": "Burns"
179
+ }
180
+ ],
181
+ "dataFileName": "job_place_injury_2 years_FINAL.json",
182
+ "dataFileSourceType": "file",
183
+ "visualizationType": "Bar",
184
+ "visualizationSubType": "horizontal",
185
+ "series": [
186
+ {
187
+ "dataKey": "2017",
188
+ "type": "Bar"
189
+ },
190
+ {
191
+ "dataKey": "2018",
192
+ "type": "Bar"
193
+ }
194
+ ],
195
+ "barPadding": 40,
196
+ "barHeight": 25,
197
+ "description": " Also note that the border around the bars has been added in the Visualization Editor"
198
+ }
@@ -0,0 +1,241 @@
1
+ {
2
+ "type": "chart",
3
+ "title": "Example Horizontal Bar Chart",
4
+ "theme": "theme-teal",
5
+ "fontSize": "small",
6
+ "lineDatapointStyle": "hover",
7
+ "barHasBorder": "false",
8
+ "padding": {
9
+ "left": 5,
10
+ "right": 5
11
+ },
12
+ "yAxis": {
13
+ "size": 50,
14
+ "gridLines": false,
15
+ "type": "chart",
16
+ "title": "Example Horizontal Bar Chart",
17
+ "theme": "theme-teal",
18
+ "fontSize": "small",
19
+ "lineDatapointStyle": "hover",
20
+ "barHasBorder": "false",
21
+ "padding": {
22
+ "left": 5,
23
+ "right": 5
24
+ },
25
+ "yAxis": {
26
+ "size": 50,
27
+ "gridLines": false,
28
+ "label": "X-Axis Example Label",
29
+ "numTicks": "10"
30
+ },
31
+ "barThickness": "0.7",
32
+ "height": 560,
33
+ "xAxis": {
34
+ "type": "categorical",
35
+ "size": "0",
36
+ "tickRotation": 0,
37
+ "dataKey": "Group",
38
+ "label": ""
39
+ },
40
+ "table": {
41
+ "label": "Data Table",
42
+ "expanded": true,
43
+ "download": false,
44
+ "show": true
45
+ },
46
+ "legend": {
47
+ "behavior": "isolate",
48
+ "position": "right",
49
+ "label": "Type of Data"
50
+ },
51
+ "exclusions": {
52
+ "active": false,
53
+ "keys": []
54
+ },
55
+ "palette": "qualitative-soft",
56
+ "labels": false,
57
+ "dataFormat": {},
58
+ "confidenceKeys": {},
59
+ "data": [
60
+ {
61
+ "Group": "Combined Total of Group A",
62
+ "Vehicle": "100",
63
+ "Home": "120",
64
+ "Work": "140",
65
+ "Office": "120"
66
+ },
67
+ {
68
+ "Group": "Combined Total of Group B",
69
+ "Vehicle": "150",
70
+ "Home": "140",
71
+ "Work": "100",
72
+ "Office": "90"
73
+ },
74
+ {
75
+ "Group": "Combined Total of Group C",
76
+ "Vehicle": "90",
77
+ "Home": "90",
78
+ "Work": "80",
79
+ "Office": "80"
80
+ },
81
+ {
82
+ "Group": "Combined Total of Group D",
83
+ "Vehicle": "70",
84
+ "Home": "60",
85
+ "Work": "50",
86
+ "Office": "70"
87
+ }
88
+ ],
89
+ "visualizationType": "Bar",
90
+ "visualizationSubType": "horizontal",
91
+ "series": [
92
+ {
93
+ "dataKey": "Vehicle",
94
+ "type": "Bar"
95
+ },
96
+ {
97
+ "dataKey": "Home",
98
+ "type": "Bar"
99
+ },
100
+ {
101
+ "dataKey": "Work",
102
+ "type": "Bar"
103
+ },
104
+ {
105
+ "dataKey": "Office",
106
+ "type": "Bar"
107
+ }
108
+ ],
109
+ "description": "This example shows a horizontal bar chart created in the visualization editor in WCMS",
110
+ "runtime": {
111
+ "seriesLabels": {
112
+ "Vehicle": "Vehicle",
113
+ "Home": "Home",
114
+ "Work": "Work",
115
+ "Office": "Office"
116
+ },
117
+ "seriesLabelsAll": [
118
+ "Vehicle",
119
+ "Home",
120
+ "Work",
121
+ "Office"
122
+ ],
123
+ "originalXAxis": {
124
+ "type": "categorical",
125
+ "size": "0",
126
+ "tickRotation": 0,
127
+ "dataKey": "Group",
128
+ "label": ""
129
+ },
130
+ "seriesKeys": [
131
+ "Vehicle",
132
+ "Home",
133
+ "Work",
134
+ "Office"
135
+ ],
136
+ "xAxis": {
137
+ "size": 50,
138
+ "gridLines": false,
139
+ "label": "X-Axis Example Label",
140
+ "numTicks": "10"
141
+ },
142
+ "yAxis": {
143
+ "type": "categorical",
144
+ "size": "0",
145
+ "tickRotation": 0,
146
+ "dataKey": "Group",
147
+ "label": ""
148
+ },
149
+ "horizontal": true,
150
+ "uniqueId": 1644353484184,
151
+ "editorErrorMessage": ""
152
+ },
153
+ "barPadding": 40,
154
+ "barHeight": 25,
155
+ "labelPlacement": "Below Bar",
156
+ "label": "Accidents"
157
+ },
158
+ "barThickness": "0.7",
159
+ "height": 560,
160
+ "xAxis": {
161
+ "type": "categorical",
162
+ "size": "0",
163
+ "tickRotation": 0,
164
+ "dataKey": "Group",
165
+ "label": ""
166
+ },
167
+ "table": {
168
+ "label": "Data Table",
169
+ "expanded": true,
170
+ "download": false,
171
+ "show": true
172
+ },
173
+ "legend": {
174
+ "behavior": "isolate",
175
+ "position": "right",
176
+ "label": "Location"
177
+ },
178
+ "exclusions": {
179
+ "active": false,
180
+ "keys": []
181
+ },
182
+ "palette": "qualitative-soft",
183
+ "labels": false,
184
+ "dataFormat": {},
185
+ "confidenceKeys": {},
186
+ "data": [
187
+ {
188
+ "Group": "Group A Survey Results",
189
+ "Vehicle": "100",
190
+ "Home": "120",
191
+ "Work": "140",
192
+ "Office": "120"
193
+ },
194
+ {
195
+ "Group": "Group B Survey Results",
196
+ "Vehicle": "150",
197
+ "Home": "140",
198
+ "Work": "100",
199
+ "Office": "90"
200
+ },
201
+ {
202
+ "Group": "Group C Survey Results",
203
+ "Vehicle": "90",
204
+ "Home": "90",
205
+ "Work": "80",
206
+ "Office": "80"
207
+ },
208
+ {
209
+ "Group": "Group D Survey Results",
210
+ "Vehicle": "70",
211
+ "Home": "60",
212
+ "Work": "50",
213
+ "Office": "70"
214
+ }
215
+ ],
216
+ "visualizationType": "Bar",
217
+ "visualizationSubType": "horizontal",
218
+ "series": [
219
+ {
220
+ "dataKey": "Vehicle",
221
+ "type": "Bar"
222
+ },
223
+ {
224
+ "dataKey": "Home",
225
+ "type": "Bar"
226
+ },
227
+ {
228
+ "dataKey": "Work",
229
+ "type": "Bar"
230
+ },
231
+ {
232
+ "dataKey": "Office",
233
+ "type": "Bar"
234
+ }
235
+ ],
236
+ "description": "This example shows a horizontal bar chart created in the visualization editor in WCMS",
237
+ "barPadding": 40,
238
+ "barHeight": 25,
239
+ "dataFileName": "3-CSV_Source_Example_for_Horizontal_Bar_viz - Fixed.csv",
240
+ "dataFileSourceType": "file"
241
+ }
@@ -0,0 +1,248 @@
1
+ {
2
+ "type": "chart",
3
+ "title": "Example Stacked Horizontal Bar Chart",
4
+ "theme": "theme-blue",
5
+ "fontSize": "small",
6
+ "lineDatapointStyle": "hover",
7
+ "barHasBorder": "true",
8
+ "isLollipopChart": false,
9
+ "lollipopShape": "circle",
10
+ "lollipopColorStyle": "two-tone",
11
+ "visualizationSubType": "stacked",
12
+ "padding": {
13
+ "left": 5,
14
+ "right": 5
15
+ },
16
+ "yAxis": {
17
+ "hideAxis": true,
18
+ "hideLabel": false,
19
+ "hideTicks": false,
20
+ "size": "13",
21
+ "gridLines": false,
22
+ "type": "chart",
23
+ "title": "",
24
+ "theme": "theme-blue",
25
+ "fontSize": "medium",
26
+ "lineDatapointStyle": "hover",
27
+ "barHasBorder": "false",
28
+ "isLollipopChart": false,
29
+ "lollipopShape": "circle",
30
+ "lollipopColorStyle": "two-tone",
31
+ "visualizationSubType": "stacked",
32
+ "padding": {
33
+ "left": 5,
34
+ "right": 5
35
+ },
36
+ "yAxis": {
37
+ "hideAxis": false,
38
+ "hideLabel": false,
39
+ "hideTicks": false,
40
+ "size": 50,
41
+ "gridLines": false
42
+ },
43
+ "barThickness": 0.35,
44
+ "height": 260,
45
+ "xAxis": {
46
+ "type": "categorical",
47
+ "hideAxis": false,
48
+ "hideLabel": false,
49
+ "hideTicks": false,
50
+ "size": 75,
51
+ "tickRotation": 0,
52
+ "dataKey": "Year"
53
+ },
54
+ "table": {
55
+ "label": "Data Table",
56
+ "expanded": true,
57
+ "show": true
58
+ },
59
+ "orientation": "horizontal",
60
+ "legend": {
61
+ "behavior": "isolate",
62
+ "position": "right"
63
+ },
64
+ "exclusions": {
65
+ "active": false,
66
+ "keys": []
67
+ },
68
+ "palette": "qualitative-bold",
69
+ "isPaletteReversed": false,
70
+ "labels": false,
71
+ "dataFormat": {},
72
+ "confidenceKeys": {},
73
+ "data": [
74
+ {
75
+ "Year": "2015",
76
+ "Data 1": "25",
77
+ "Data 2": "20",
78
+ "Data 3": "55"
79
+ },
80
+ {
81
+ "Year": "2016",
82
+ "Data 1": "35",
83
+ "Data 2": "30",
84
+ "Data 3": "35"
85
+ },
86
+ {
87
+ "Year": "2017",
88
+ "Data 1": "22",
89
+ "Data 2": "38",
90
+ "Data 3": "40"
91
+ },
92
+ {
93
+ "Year": "2018",
94
+ "Data 1": "40",
95
+ "Data 2": "40",
96
+ "Data 3": "20"
97
+ }
98
+ ],
99
+ "dataFileName": "JSON_Source_Data_Example_Viz_Stacked.json",
100
+ "dataFileSourceType": "file",
101
+ "visualizationType": "Bar",
102
+ "runtime": {
103
+ "seriesLabels": {
104
+ "Data 1": "Data 1",
105
+ "Data 2": "Data 2",
106
+ "Data 3": "Data 3"
107
+ },
108
+ "seriesLabelsAll": [
109
+ "Data 1",
110
+ "Data 2",
111
+ "Data 3"
112
+ ],
113
+ "originalXAxis": {
114
+ "type": "categorical",
115
+ "hideAxis": false,
116
+ "hideLabel": false,
117
+ "hideTicks": false,
118
+ "size": 75,
119
+ "tickRotation": 0,
120
+ "dataKey": "Year"
121
+ },
122
+ "seriesKeys": [
123
+ "Data 1",
124
+ "Data 2",
125
+ "Data 3"
126
+ ],
127
+ "xAxis": {
128
+ "hideAxis": false,
129
+ "hideLabel": false,
130
+ "hideTicks": false,
131
+ "size": 50,
132
+ "gridLines": false
133
+ },
134
+ "yAxis": {
135
+ "type": "categorical",
136
+ "hideAxis": false,
137
+ "hideLabel": false,
138
+ "hideTicks": false,
139
+ "size": 75,
140
+ "tickRotation": 0,
141
+ "dataKey": "Year"
142
+ },
143
+ "horizontal": true,
144
+ "uniqueId": 1654259674387,
145
+ "editorErrorMessage": ""
146
+ },
147
+ "series": [
148
+ {
149
+ "dataKey": "Data 1",
150
+ "type": "Bar"
151
+ },
152
+ {
153
+ "dataKey": "Data 2",
154
+ "type": "Bar"
155
+ },
156
+ {
157
+ "dataKey": "Data 3",
158
+ "type": "Bar"
159
+ }
160
+ ],
161
+ "barHeight": 25,
162
+ "barPadding": 40,
163
+ "labelPlacement": "Below Bar",
164
+ "displayNumbersOnBar": true,
165
+ "label": ""
166
+ },
167
+ "barThickness": 0.35,
168
+ "height": 288,
169
+ "xAxis": {
170
+ "type": "categorical",
171
+ "hideAxis": true,
172
+ "hideLabel": true,
173
+ "hideTicks": true,
174
+ "size": "45",
175
+ "tickRotation": 0,
176
+ "dataKey": "Year",
177
+ "label": "Year"
178
+ },
179
+ "table": {
180
+ "label": "Data Table",
181
+ "expanded": false,
182
+ "show": true,
183
+ "indexLabel": "Data Type"
184
+ },
185
+ "orientation": "horizontal",
186
+ "legend": {
187
+ "behavior": "isolate",
188
+ "position": "right",
189
+ "reverseLabelOrder": false
190
+ },
191
+ "exclusions": {
192
+ "active": false,
193
+ "keys": []
194
+ },
195
+ "palette": "qualitative-soft",
196
+ "isPaletteReversed": false,
197
+ "labels": false,
198
+ "dataFormat": {
199
+ "suffix": "%"
200
+ },
201
+ "confidenceKeys": {},
202
+ "data": [
203
+ {
204
+ "Year": "2015",
205
+ "Data 1": "25",
206
+ "Data 2": "20",
207
+ "Data 3": "55"
208
+ },
209
+ {
210
+ "Year": "2016",
211
+ "Data 1": "35",
212
+ "Data 2": "30",
213
+ "Data 3": "35"
214
+ },
215
+ {
216
+ "Year": "2017",
217
+ "Data 1": "22",
218
+ "Data 2": "38",
219
+ "Data 3": "40"
220
+ },
221
+ {
222
+ "Year": "2018",
223
+ "Data 1": "40",
224
+ "Data 2": "40",
225
+ "Data 3": "20"
226
+ }
227
+ ],
228
+ "dataFileName": "JSON_Source_Data_Example_Viz_Stacked.json",
229
+ "dataFileSourceType": "file",
230
+ "visualizationType": "Bar",
231
+ "series": [
232
+ {
233
+ "dataKey": "Data 1",
234
+ "type": "Bar"
235
+ },
236
+ {
237
+ "dataKey": "Data 2",
238
+ "type": "Bar"
239
+ },
240
+ {
241
+ "dataKey": "Data 3",
242
+ "type": "Bar"
243
+ }
244
+ ],
245
+ "barHeight": 32,
246
+ "barPadding": 40,
247
+ "description": "Subtext"
248
+ }