@cdc/chart 4.22.10 → 4.22.11

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 (72) hide show
  1. package/README.md +5 -5
  2. package/dist/cdcchart.js +4 -4
  3. package/examples/age-adjusted-rates.json +1486 -1218
  4. package/examples/case-rate-example-config.json +1 -1
  5. package/examples/covid-confidence-example-config.json +33 -33
  6. package/examples/covid-example-config.json +34 -34
  7. package/examples/covid-example-data-confidence.json +30 -30
  8. package/examples/covid-example-data.json +20 -20
  9. package/examples/cutoff-example-config.json +36 -36
  10. package/examples/cutoff-example-data.json +36 -36
  11. package/examples/date-exclusions-config.json +1 -1
  12. package/examples/dynamic-legends.json +124 -124
  13. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +191 -197
  14. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +230 -240
  15. package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +239 -247
  16. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +136 -136
  17. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +79 -79
  18. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +80 -80
  19. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +67 -67
  20. package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +110 -110
  21. package/examples/gallery/lollipop/lollipop-style-horizontal.json +215 -219
  22. package/examples/gallery/paired-bar/paired-bar-chart.json +195 -195
  23. package/examples/horizontal-chart.json +35 -35
  24. package/examples/horizontal-stacked-bar-chart.json +34 -34
  25. package/examples/line-chart.json +75 -75
  26. package/examples/paired-bar-data.json +16 -14
  27. package/examples/paired-bar-example.json +48 -48
  28. package/examples/paired-bar-formatted.json +36 -36
  29. package/examples/planet-chart-horizontal-example-config.json +33 -33
  30. package/examples/planet-combo-example-config.json +34 -31
  31. package/examples/planet-example-config.json +35 -33
  32. package/examples/planet-example-data.json +56 -56
  33. package/examples/planet-pie-example-config.json +28 -28
  34. package/examples/private/filters.json +170 -0
  35. package/examples/private/line-test-data.json +21 -21
  36. package/examples/private/line-test-two.json +209 -215
  37. package/examples/private/line-test.json +101 -101
  38. package/examples/private/new.json +48800 -0
  39. package/examples/private/shawn.json +1105 -1295
  40. package/examples/private/test.json +10123 -10123
  41. package/examples/private/yaxis-test.json +4 -3
  42. package/examples/private/yaxis.json +26 -26
  43. package/examples/stacked-vertical-bar-example.json +1 -1
  44. package/examples/temp-example-config.json +61 -54
  45. package/examples/temp-example-data.json +1 -1
  46. package/package.json +2 -2
  47. package/src/CdcChart.tsx +339 -380
  48. package/src/components/BarChart.tsx +425 -469
  49. package/src/components/DataTable.tsx +164 -195
  50. package/src/components/EditorPanel.js +1009 -710
  51. package/src/components/Legend.js +279 -329
  52. package/src/components/LineChart.tsx +90 -79
  53. package/src/components/LinearChart.tsx +376 -434
  54. package/src/components/PairedBarChart.tsx +197 -213
  55. package/src/components/PieChart.tsx +95 -151
  56. package/src/components/SparkLine.js +179 -201
  57. package/src/components/useIntersectionObserver.tsx +17 -20
  58. package/src/context.tsx +3 -3
  59. package/src/data/initial-state.js +37 -16
  60. package/src/hooks/useActiveElement.js +13 -13
  61. package/src/hooks/useChartClasses.js +34 -28
  62. package/src/hooks/useColorPalette.ts +56 -63
  63. package/src/hooks/useLegendClasses.js +18 -10
  64. package/src/hooks/useReduceData.ts +62 -78
  65. package/src/hooks/useRightAxis.js +25 -0
  66. package/src/hooks/useTopAxis.js +6 -0
  67. package/src/index.html +45 -45
  68. package/src/index.tsx +13 -16
  69. package/src/scss/DataTable.scss +5 -4
  70. package/src/scss/editor-panel.scss +71 -69
  71. package/src/scss/main.scss +157 -114
  72. package/src/scss/variables.scss +1 -1
@@ -1,125 +1,125 @@
1
1
  {
2
- "type": "chart",
3
- "title": "Example Line Chart",
4
- "theme": "theme-green",
5
- "fontSize": "medium",
6
- "height": "375",
7
- "padding": {
8
- "left": 5,
9
- "right": 5
10
- },
11
- "yAxis": {
12
- "size": "75",
13
- "gridLines": false,
14
- "label": "Y-Axis Example Label",
15
- "numTicks": "9"
16
- },
17
- "barThickness": 0.35,
18
- "xAxis": {
19
- "size": "77",
20
- "tickRotation": "25",
21
- "dataKey": "Date",
22
- "label": "X-Axis Example Label",
23
- "type": "date",
24
- "dateParseFormat": "%d/%m/%Y",
25
- "dateDisplayFormat": "%d/%m/%Y"
26
- },
27
- "table": {
28
- "label": "Data Table",
29
- "expanded": true,
30
- "download": true
31
- },
32
- "legend": {
33
- "behavior": "isolate",
34
- "position": "right",
35
- "label": "Type of Data",
36
- "dynamicLegend": true
37
- },
38
- "palette": "qualitative-bold",
39
- "labels": false,
40
- "dataFormat": {},
41
- "confidenceKeys": {},
42
- "data": [
43
- {
44
- "Date": "1/15/2016",
45
- "Alabama": "90",
46
- "Alaska": "135",
47
- "Arizona": "300",
48
- "Arkansas": "95",
49
- "California": "120",
50
- "Colorado": "310"
51
- },
52
- {
53
- "Date": "2/15/2016",
54
- "Alabama": "40",
55
- "Alaska": "90",
56
- "Arizona": "240",
57
- "Arkansas": "60",
58
- "California": "160",
59
- "Colorado": "200"
60
- },
61
- {
62
- "Date": "3/15/2016",
63
- "Alabama": "50",
64
- "Alaska": "300",
65
- "Arizona": "290",
66
- "Arkansas": "100",
67
- "California": "200",
68
- "Colorado": "250"
69
- },
70
- {
71
- "Date": "4/15/2016",
72
- "Alabama": "120",
73
- "Alaska": "160",
74
- "Arizona": "230",
75
- "Arkansas": "180",
76
- "California": "160",
77
- "Colorado": "220"
78
- },
79
- {
80
- "Date": "5/15/2016",
81
- "Alabama": "80",
82
- "Alaska": "350",
83
- "Arizona": "300",
84
- "Arkansas": "150",
85
- "California": "130",
86
- "Colorado": "100"
87
- },
88
- {
89
- "Date": "6/15/2016",
90
- "Alabama": "90",
91
- "Alaska": "220",
92
- "Arizona": "320",
93
- "Arkansas": "100",
94
- "California": "220",
95
- "Colorado": "300"
96
- }
97
- ],
98
- "visualizationType": "Line",
99
- "series": [
100
- {
101
- "dataKey": "Alabama",
102
- "type": "Bar"
103
- },
104
- {
105
- "dataKey": "Alaska",
106
- "type": "Bar"
107
- },
108
- {
109
- "dataKey": "Arizona",
110
- "type": "Bar"
111
- },
112
- {
113
- "dataKey": "Arkansas",
114
- "type": "Bar"
115
- },
116
- {
117
- "dataKey": "California",
118
- "type": "Bar"
119
- },
120
- {
121
- "dataKey": "Colorado",
122
- "type": "Bar"
123
- }
124
- ]
125
- }
2
+ "type": "chart",
3
+ "title": "Example Line Chart",
4
+ "theme": "theme-green",
5
+ "fontSize": "medium",
6
+ "height": "375",
7
+ "padding": {
8
+ "left": 5,
9
+ "right": 5
10
+ },
11
+ "yAxis": {
12
+ "size": "75",
13
+ "gridLines": false,
14
+ "label": "Y-Axis Example Label",
15
+ "numTicks": "9"
16
+ },
17
+ "barThickness": 0.35,
18
+ "xAxis": {
19
+ "size": "77",
20
+ "tickRotation": "25",
21
+ "dataKey": "Date",
22
+ "label": "X-Axis Example Label",
23
+ "type": "date",
24
+ "dateParseFormat": "%d/%m/%Y",
25
+ "dateDisplayFormat": "%d/%m/%Y"
26
+ },
27
+ "table": {
28
+ "label": "Data Table",
29
+ "expanded": true,
30
+ "download": true
31
+ },
32
+ "legend": {
33
+ "behavior": "isolate",
34
+ "position": "right",
35
+ "label": "Type of Data",
36
+ "dynamicLegend": true
37
+ },
38
+ "palette": "qualitative-bold",
39
+ "labels": false,
40
+ "dataFormat": {},
41
+ "confidenceKeys": {},
42
+ "data": [
43
+ {
44
+ "Date": "1/15/2016",
45
+ "Alabama": "90",
46
+ "Alaska": "135",
47
+ "Arizona": "300",
48
+ "Arkansas": "95",
49
+ "California": "120",
50
+ "Colorado": "310"
51
+ },
52
+ {
53
+ "Date": "2/15/2016",
54
+ "Alabama": "40",
55
+ "Alaska": "90",
56
+ "Arizona": "240",
57
+ "Arkansas": "60",
58
+ "California": "160",
59
+ "Colorado": "200"
60
+ },
61
+ {
62
+ "Date": "3/15/2016",
63
+ "Alabama": "50",
64
+ "Alaska": "300",
65
+ "Arizona": "290",
66
+ "Arkansas": "100",
67
+ "California": "200",
68
+ "Colorado": "250"
69
+ },
70
+ {
71
+ "Date": "4/15/2016",
72
+ "Alabama": "120",
73
+ "Alaska": "160",
74
+ "Arizona": "230",
75
+ "Arkansas": "180",
76
+ "California": "160",
77
+ "Colorado": "220"
78
+ },
79
+ {
80
+ "Date": "5/15/2016",
81
+ "Alabama": "80",
82
+ "Alaska": "350",
83
+ "Arizona": "300",
84
+ "Arkansas": "150",
85
+ "California": "130",
86
+ "Colorado": "100"
87
+ },
88
+ {
89
+ "Date": "6/15/2016",
90
+ "Alabama": "90",
91
+ "Alaska": "220",
92
+ "Arizona": "320",
93
+ "Arkansas": "100",
94
+ "California": "220",
95
+ "Colorado": "300"
96
+ }
97
+ ],
98
+ "visualizationType": "Line",
99
+ "series": [
100
+ {
101
+ "dataKey": "Alabama",
102
+ "type": "Bar"
103
+ },
104
+ {
105
+ "dataKey": "Alaska",
106
+ "type": "Bar"
107
+ },
108
+ {
109
+ "dataKey": "Arizona",
110
+ "type": "Bar"
111
+ },
112
+ {
113
+ "dataKey": "Arkansas",
114
+ "type": "Bar"
115
+ },
116
+ {
117
+ "dataKey": "California",
118
+ "type": "Bar"
119
+ },
120
+ {
121
+ "dataKey": "Colorado",
122
+ "type": "Bar"
123
+ }
124
+ ]
125
+ }
@@ -1,198 +1,192 @@
1
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
- }
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": ["2017", "2018"],
99
+ "originalXAxis": {
100
+ "size": 75,
101
+ "tickRotation": 0,
102
+ "dataKey": "Injury Type",
103
+ "label": "Injury Type"
104
+ },
105
+ "seriesKeys": ["2017", "2018"],
106
+ "xAxis": {
107
+ "size": 50,
108
+ "gridLines": false,
109
+ "label": "Number of Accidents"
110
+ },
111
+ "yAxis": {
112
+ "size": 75,
113
+ "tickRotation": 0,
114
+ "dataKey": "Injury Type",
115
+ "label": "Injury Type"
116
+ },
117
+ "horizontal": true,
118
+ "uniqueId": 1635525153525,
119
+ "editorErrorMessage": ""
120
+ },
121
+ "barPadding": 40,
122
+ "barHeight": 25,
123
+ "labelPlacement": "Below Bar",
124
+ "displayNumbersOnBar": true
125
+ },
126
+ "barThickness": "0.5",
127
+ "height": 450,
128
+ "xAxis": {
129
+ "size": 75,
130
+ "tickRotation": 0,
131
+ "dataKey": "Injury Type",
132
+ "label": "Injury Type"
133
+ },
134
+ "table": {
135
+ "label": "Data Table",
136
+ "expanded": false,
137
+ "show": true
138
+ },
139
+ "legend": {
140
+ "behavior": "isolate",
141
+ "position": "right",
142
+ "label": "Accident Year"
143
+ },
144
+ "palette": "qualitative-bold",
145
+ "labels": false,
146
+ "dataFormat": {},
147
+ "confidenceKeys": {},
148
+ "data": [
149
+ {
150
+ "2017": "12",
151
+ "2018": "8",
152
+ "Injury Type": "Falling"
153
+ },
154
+ {
155
+ "2017": "25",
156
+ "2018": "10",
157
+ "Injury Type": "Machinery"
158
+ },
159
+ {
160
+ "2017": "1",
161
+ "2018": "0",
162
+ "Injury Type": "Alergic Reaction"
163
+ },
164
+ {
165
+ "2017": "3",
166
+ "2018": "4",
167
+ "Injury Type": "Chemical"
168
+ },
169
+ {
170
+ "2017": "3",
171
+ "2018": "2",
172
+ "Injury Type": "Burns"
173
+ }
174
+ ],
175
+ "dataFileName": "job_place_injury_2 years_FINAL.json",
176
+ "dataFileSourceType": "file",
177
+ "visualizationType": "Bar",
178
+ "visualizationSubType": "horizontal",
179
+ "series": [
180
+ {
181
+ "dataKey": "2017",
182
+ "type": "Bar"
183
+ },
184
+ {
185
+ "dataKey": "2018",
186
+ "type": "Bar"
187
+ }
188
+ ],
189
+ "barPadding": 40,
190
+ "barHeight": 25,
191
+ "description": " Also note that the border around the bars has been added in the Visualization Editor"
192
+ }