@cdc/chart 4.23.10 → 4.23.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 (56) hide show
  1. package/dist/cdcchart.js +30989 -29057
  2. package/examples/feature/bar/example-bar-chart.json +1 -46
  3. package/examples/feature/bar/lollipop.json +156 -0
  4. package/examples/feature/combo/planet-combo-example-config.json +99 -9
  5. package/examples/feature/dev-4261.json +399 -0
  6. package/examples/feature/forest-plot/{broken.json → linear.json} +55 -50
  7. package/examples/feature/forest-plot/logarithmic.json +306 -0
  8. package/examples/feature/line/line-points.json +340 -0
  9. package/examples/feature/regions/index.json +462 -0
  10. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +181 -48
  11. package/examples/sparkline-multilple.json +846 -0
  12. package/index.html +10 -6
  13. package/package.json +3 -3
  14. package/src/CdcChart.tsx +75 -63
  15. package/src/_stories/Chart.stories.tsx +188 -0
  16. package/src/_stories/Chart.tooltip.stories.tsx +305 -0
  17. package/src/_stories/ChartBrush.stories.tsx +19 -0
  18. package/src/_stories/ChartSuppress.stories.tsx +19 -0
  19. package/src/_stories/_mock/brush_mock.json +393 -0
  20. package/src/_stories/_mock/suppress_mock.json +911 -0
  21. package/src/components/AreaChart.Stacked.jsx +4 -5
  22. package/src/components/AreaChart.jsx +6 -35
  23. package/src/components/{BarChart.Horizontal.jsx → BarChart.Horizontal.tsx} +106 -29
  24. package/src/components/{BarChart.StackedHorizontal.jsx → BarChart.StackedHorizontal.tsx} +22 -17
  25. package/src/components/{BarChart.StackedVertical.jsx → BarChart.StackedVertical.tsx} +22 -26
  26. package/src/components/{BarChart.Vertical.jsx → BarChart.Vertical.tsx} +175 -31
  27. package/src/components/BarChart.jsx +1 -1
  28. package/src/components/DeviationBar.jsx +4 -3
  29. package/src/components/EditorPanel.jsx +176 -50
  30. package/src/components/ForestPlot/ForestPlotProps.ts +11 -0
  31. package/src/components/ForestPlot/Readme.md +0 -0
  32. package/src/components/ForestPlot/index.scss +1 -0
  33. package/src/components/{ForestPlot.jsx → ForestPlot/index.tsx} +51 -31
  34. package/src/components/ForestPlotSettings.jsx +162 -113
  35. package/src/components/Legend.jsx +36 -3
  36. package/src/components/{LineChart.Circle.tsx → LineChart/LineChart.Circle.tsx} +26 -29
  37. package/src/components/LineChart/LineChartProps.ts +17 -0
  38. package/src/components/LineChart/index.scss +1 -0
  39. package/src/components/{LineChart.tsx → LineChart/index.tsx} +64 -35
  40. package/src/components/LinearChart.jsx +120 -60
  41. package/src/components/PairedBarChart.jsx +2 -2
  42. package/src/components/Series.jsx +22 -3
  43. package/src/components/ZoomBrush.tsx +168 -0
  44. package/src/data/initial-state.js +27 -12
  45. package/src/hooks/useBarChart.js +71 -7
  46. package/src/hooks/useColorScale.ts +50 -0
  47. package/src/hooks/useEditorPermissions.js +22 -4
  48. package/src/hooks/{useMinMax.js → useMinMax.ts} +75 -23
  49. package/src/hooks/{useRightAxis.js → useRightAxis.ts} +10 -2
  50. package/src/hooks/{useScales.js → useScales.ts} +64 -17
  51. package/src/hooks/useTooltip.jsx +68 -41
  52. package/src/scss/main.scss +3 -35
  53. package/src/types/ChartConfig.ts +43 -0
  54. package/src/types/ChartContext.ts +38 -0
  55. package/src/types/ChartProps.ts +7 -0
  56. package/src/types/ForestPlot.ts +60 -0
@@ -0,0 +1,306 @@
1
+ {
2
+ "type": "chart",
3
+ "debugSvg": false,
4
+ "title": "",
5
+ "showTitle": true,
6
+ "showDownloadMediaButton": false,
7
+ "showChartBrush": false,
8
+ "theme": "theme-blue",
9
+ "animate": false,
10
+ "fontSize": "medium",
11
+ "lineDatapointStyle": "hover",
12
+ "barHasBorder": "false",
13
+ "isLollipopChart": false,
14
+ "lollipopShape": "circle",
15
+ "lollipopColorStyle": "two-tone",
16
+ "visualizationSubType": "regular",
17
+ "barStyle": "",
18
+ "roundingStyle": "standard",
19
+ "tipRounding": "top",
20
+ "isResponsiveTicks": false,
21
+ "general": {
22
+ "showDownloadButton": false
23
+ },
24
+ "padding": {
25
+ "left": 5,
26
+ "right": 5
27
+ },
28
+ "yAxis": {
29
+ "hideAxis": false,
30
+ "displayNumbersOnBar": false,
31
+ "hideLabel": false,
32
+ "hideTicks": false,
33
+ "size": 50,
34
+ "gridLines": false,
35
+ "enablePadding": false,
36
+ "min": "",
37
+ "max": "",
38
+ "labelColor": "#333",
39
+ "tickLabelColor": "#333",
40
+ "tickColor": "#333",
41
+ "rightHideAxis": true,
42
+ "rightAxisSize": 0,
43
+ "rightLabel": "",
44
+ "rightLabelOffsetSize": 0,
45
+ "rightAxisLabelColor": "#333",
46
+ "rightAxisTickLabelColor": "#333",
47
+ "rightAxisTickColor": "#333",
48
+ "numTicks": "",
49
+ "axisPadding": 0,
50
+ "tickRotation": 0,
51
+ "anchors": []
52
+ },
53
+ "boxplot": {
54
+ "plots": [],
55
+ "borders": "true",
56
+ "firstQuartilePercentage": 25,
57
+ "thirdQuartilePercentage": 75,
58
+ "boxWidthPercentage": 40,
59
+ "plotOutlierValues": false,
60
+ "plotNonOutlierValues": true,
61
+ "legend": {
62
+ "showHowToReadText": false,
63
+ "howToReadText": ""
64
+ },
65
+ "labels": {
66
+ "q1": "Lower Quartile",
67
+ "q2": "q2",
68
+ "q3": "Upper Quartile",
69
+ "q4": "q4",
70
+ "minimum": "Minimum",
71
+ "maximum": "Maximum",
72
+ "mean": "Mean",
73
+ "median": "Median",
74
+ "sd": "Standard Deviation",
75
+ "iqr": "Interquartile Range",
76
+ "total": "Total",
77
+ "outliers": "Outliers",
78
+ "values": "Values",
79
+ "lowerBounds": "Lower Bounds",
80
+ "upperBounds": "Upper Bounds"
81
+ }
82
+ },
83
+ "topAxis": {
84
+ "hasLine": false
85
+ },
86
+ "isLegendValue": false,
87
+ "barThickness": 0.35,
88
+ "barHeight": 25,
89
+ "barSpace": 15,
90
+ "heights": {
91
+ "vertical": 300,
92
+ "horizontal": 750
93
+ },
94
+ "xAxis": {
95
+ "anchors": [],
96
+ "type": "categorical",
97
+ "showTargetLabel": true,
98
+ "targetLabel": "Target",
99
+ "hideAxis": false,
100
+ "hideLabel": false,
101
+ "hideTicks": false,
102
+ "size": 0,
103
+ "tickRotation": 0,
104
+ "min": "",
105
+ "max": "",
106
+ "labelColor": "#333",
107
+ "tickLabelColor": "#333",
108
+ "tickColor": "#333",
109
+ "numTicks": "",
110
+ "labelOffset": 65,
111
+ "axisPadding": 0,
112
+ "target": 0,
113
+ "maxTickRotation": 0,
114
+ "dataKey": "description"
115
+ },
116
+ "table": {
117
+ "label": "Data Table",
118
+ "expanded": true,
119
+ "limitHeight": false,
120
+ "height": "",
121
+ "caption": "",
122
+ "showDownloadUrl": false,
123
+ "showDataTableLink": true,
124
+ "indexLabel": "",
125
+ "download": false,
126
+ "showVertical": true,
127
+ "show": true
128
+ },
129
+ "orientation": "horizontal",
130
+ "color": "pinkpurple",
131
+ "columns": {
132
+ "additionalColumn1": {
133
+ "label": "Estimate Field",
134
+ "dataTable": true,
135
+ "tooltips": true,
136
+ "prefix": "",
137
+ "suffix": "",
138
+ "forestPlot": false,
139
+ "startingPoint": "0",
140
+ "forestPlotAlignRight": false,
141
+ "name": "effect"
142
+ },
143
+ "additionalColumn2": {
144
+ "label": "Low",
145
+ "dataTable": true,
146
+ "tooltips": true,
147
+ "prefix": "",
148
+ "suffix": "",
149
+ "forestPlot": false,
150
+ "startingPoint": "0",
151
+ "forestPlotAlignRight": false,
152
+ "name": "low"
153
+ },
154
+ "additionalColumn3": {
155
+ "label": "High",
156
+ "dataTable": true,
157
+ "tooltips": true,
158
+ "prefix": "",
159
+ "suffix": "",
160
+ "forestPlot": false,
161
+ "startingPoint": "0",
162
+ "forestPlotAlignRight": false,
163
+ "name": "high"
164
+ }
165
+ },
166
+ "legend": {
167
+ "behavior": "isolate",
168
+ "singleRow": false,
169
+ "colorCode": "",
170
+ "reverseLabelOrder": false,
171
+ "description": "",
172
+ "dynamicLegend": false,
173
+ "dynamicLegendDefaultText": "Show All",
174
+ "dynamicLegendItemLimit": 5,
175
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
176
+ "dynamicLegendChartMessage": "Select Options from the Legend",
177
+ "hide": true
178
+ },
179
+ "exclusions": {
180
+ "active": false,
181
+ "keys": []
182
+ },
183
+ "palette": "qualitative-bold",
184
+ "isPaletteReversed": false,
185
+ "twoColor": {
186
+ "palette": "monochrome-1",
187
+ "isPaletteReversed": false
188
+ },
189
+ "labels": false,
190
+ "dataFormat": {
191
+ "commas": false,
192
+ "prefix": "",
193
+ "suffix": "",
194
+ "abbreviated": false,
195
+ "bottomSuffix": "",
196
+ "bottomPrefix": "",
197
+ "bottomAbbreviated": false
198
+ },
199
+ "confidenceKeys": {},
200
+ "visual": {
201
+ "border": true,
202
+ "accent": true,
203
+ "background": true,
204
+ "verticalHoverLine": false,
205
+ "horizontalHoverLine": false
206
+ },
207
+ "useLogScale": false,
208
+ "filterBehavior": "Filter Change",
209
+ "highlightedBarValues": [],
210
+ "series": [],
211
+ "tooltips": {
212
+ "opacity": 90
213
+ },
214
+ "forestPlot": {
215
+ "startAt": 0,
216
+ "colors": {
217
+ "line": "",
218
+ "shape": ""
219
+ },
220
+ "lineOfNoEffect": {
221
+ "show": true
222
+ },
223
+ "type": "Logarithmic",
224
+ "pooledResult": {
225
+ "diamondHeight": 5
226
+ },
227
+ "estimateField": "effect",
228
+ "estimateRadius": "",
229
+ "shape": "circle",
230
+ "rowHeight": 20,
231
+ "description": {
232
+ "show": true,
233
+ "text": "description",
234
+ "location": 0
235
+ },
236
+ "result": {
237
+ "show": true,
238
+ "text": "result",
239
+ "location": 100
240
+ },
241
+ "radius": {
242
+ "min": 1,
243
+ "max": 8,
244
+ "scalingColumn": ""
245
+ },
246
+ "regression": {
247
+ "lower": 0,
248
+ "upper": 0,
249
+ "estimateField": 0,
250
+ "showDiamond": false
251
+ },
252
+ "leftWidthOffset": "0",
253
+ "rightWidthOffset": "0",
254
+ "showZeroLine": false,
255
+ "hideDateCategoryCol": false,
256
+ "leftLabel": "left label",
257
+ "rightLabel": "right label",
258
+ "width": "auto",
259
+ "outcome": "",
260
+ "lowerCiField": "",
261
+ "upperCiField": "",
262
+ "lower": "low",
263
+ "upper": "high",
264
+ "rightWidthOffsetMobile": "0",
265
+ "title": "test",
266
+ "leftWidthOffsetMobile": "51"
267
+ },
268
+ "brush": {
269
+ "pattern_id": "brush_pattern",
270
+ "accent_color": "#ddd"
271
+ },
272
+ "datasets": {},
273
+ "visualizationType": "Forest Plot",
274
+ "data": [
275
+ {
276
+ "description": "Study 1",
277
+ "low": 0.88,
278
+ "high": 0.95,
279
+ "effect": 0.92
280
+ },
281
+ {
282
+ "description": "Study 2",
283
+ "low": 0.84,
284
+ "high": 0.94,
285
+ "effect": 0.89
286
+ },
287
+ {
288
+ "description": "Study 3",
289
+ "low": 0.88,
290
+ "high": 0.98,
291
+ "effect": 0.93
292
+ },
293
+ {
294
+ "description": "Study 4",
295
+ "low": 0.91,
296
+ "high": 0.99,
297
+ "effect": 0.97
298
+ }
299
+ ],
300
+ "dataDescription": {
301
+ "horizontal": false,
302
+ "series": false
303
+ },
304
+ "validated": 4.23,
305
+ "dynamicMarginTop": 0
306
+ }
@@ -0,0 +1,340 @@
1
+ {
2
+ "type": "chart",
3
+ "debugSvg": false,
4
+ "chartMessage": {
5
+ "noData": "No Data Available"
6
+ },
7
+ "title": "Combo Bar-Line Chart",
8
+ "showTitle": true,
9
+ "showDownloadMediaButton": false,
10
+ "theme": "theme-purple",
11
+ "animate": true,
12
+ "fontSize": "medium",
13
+ "lineDatapointStyle": "always show",
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": "68",
38
+ "gridLines": false,
39
+ "enablePadding": false,
40
+ "min": "",
41
+ "max": "",
42
+ "labelColor": "#333",
43
+ "tickLabelColor": "#333",
44
+ "tickColor": "#333",
45
+ "rightHideAxis": true,
46
+ "rightAxisSize": 50,
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": "Y-Axis Label Example"
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
+ }
85
+ },
86
+ "topAxis": {
87
+ "hasLine": false
88
+ },
89
+ "isLegendValue": false,
90
+ "barThickness": 0.35,
91
+ "barHeight": 25,
92
+ "barSpace": 15,
93
+ "heights": {
94
+ "vertical": 300,
95
+ "horizontal": 750
96
+ },
97
+ "xAxis": {
98
+ "sortDates": false,
99
+ "anchors": [],
100
+ "type": "date",
101
+ "showTargetLabel": true,
102
+ "targetLabel": "Target",
103
+ "hideAxis": false,
104
+ "hideLabel": false,
105
+ "hideTicks": false,
106
+ "size": "78",
107
+ "tickRotation": "25",
108
+ "min": "",
109
+ "max": "",
110
+ "labelColor": "#333",
111
+ "tickLabelColor": "#333",
112
+ "tickColor": "#333",
113
+ "numTicks": "",
114
+ "labelOffset": 65,
115
+ "axisPadding": 0,
116
+ "target": 0,
117
+ "maxTickRotation": 0,
118
+ "dataKey": "Date",
119
+ "label": "X-Axis Example Label",
120
+ "dateParseFormat": "%d/%m/%Y",
121
+ "dateDisplayFormat": "%d/%m/%Y",
122
+ "tickWidthMax": 91
123
+ },
124
+ "table": {
125
+ "label": "Data Table",
126
+ "expanded": true,
127
+ "limitHeight": false,
128
+ "height": "",
129
+ "caption": "",
130
+ "showDownloadUrl": false,
131
+ "showDataTableLink": true,
132
+ "indexLabel": "",
133
+ "download": true,
134
+ "showVertical": false,
135
+ "show": true
136
+ },
137
+ "orientation": "vertical",
138
+ "color": "pinkpurple",
139
+ "columns": {},
140
+ "legend": {
141
+ "hide": false,
142
+ "behavior": "highlight",
143
+ "singleRow": false,
144
+ "colorCode": "",
145
+ "reverseLabelOrder": false,
146
+ "description": "",
147
+ "dynamicLegend": false,
148
+ "dynamicLegendDefaultText": "Show All",
149
+ "dynamicLegendItemLimit": 5,
150
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
151
+ "dynamicLegendChartMessage": "Select Options from the Legend",
152
+ "lineMode": false,
153
+ "verticalSorted": false,
154
+ "position": "right",
155
+ "label": "Data Type"
156
+ },
157
+ "brush": {
158
+ "height": 25,
159
+ "data": [
160
+ {
161
+ "Date": "1/15/2016",
162
+ "Data 1": "1000",
163
+ "Data 2": "110",
164
+ "Data 3": "100",
165
+ "Data 4": "90",
166
+ "Monthly-Goal": "100"
167
+ }
168
+ ],
169
+ "active": false
170
+ },
171
+ "exclusions": {
172
+ "active": false,
173
+ "keys": []
174
+ },
175
+ "palette": "qualitative-soft",
176
+ "isPaletteReversed": false,
177
+ "twoColor": {
178
+ "palette": "monochrome-1",
179
+ "isPaletteReversed": false
180
+ },
181
+ "labels": false,
182
+ "dataFormat": {
183
+ "commas": false,
184
+ "prefix": "",
185
+ "suffix": "",
186
+ "abbreviated": false,
187
+ "bottomSuffix": "",
188
+ "bottomPrefix": "",
189
+ "bottomAbbreviated": false
190
+ },
191
+ "confidenceKeys": {},
192
+ "visual": {
193
+ "border": true,
194
+ "accent": true,
195
+ "background": true,
196
+ "verticalHoverLine": false,
197
+ "horizontalHoverLine": false
198
+ },
199
+ "useLogScale": false,
200
+ "filterBehavior": "Filter Change",
201
+ "highlightedBarValues": [],
202
+ "series": [
203
+ {
204
+ "dataKey": "Data 2",
205
+ "type": "Line",
206
+ "axis": "Left",
207
+ "tooltip": true
208
+ }
209
+ ],
210
+ "tooltips": {
211
+ "opacity": 90
212
+ },
213
+ "forestPlot": {
214
+ "startAt": 0,
215
+ "colors": {
216
+ "line": "",
217
+ "shape": ""
218
+ },
219
+ "lineOfNoEffect": {
220
+ "show": true
221
+ },
222
+ "type": "",
223
+ "pooledResult": {
224
+ "diamondHeight": 5,
225
+ "column": ""
226
+ },
227
+ "estimateField": "",
228
+ "estimateRadius": "",
229
+ "shape": "",
230
+ "rowHeight": 20,
231
+ "description": {
232
+ "show": true,
233
+ "text": "description",
234
+ "location": 0
235
+ },
236
+ "result": {
237
+ "show": true,
238
+ "text": "result",
239
+ "location": 100
240
+ },
241
+ "radius": {
242
+ "min": 1,
243
+ "max": 8,
244
+ "scalingColumn": ""
245
+ },
246
+ "regression": {
247
+ "lower": 0,
248
+ "upper": 0,
249
+ "estimateField": 0
250
+ },
251
+ "leftWidthOffset": 0,
252
+ "rightWidthOffset": 0,
253
+ "showZeroLine": false,
254
+ "hideDateCategoryCol": false,
255
+ "leftLabel": "",
256
+ "rightLabel": ""
257
+ },
258
+ "area": {
259
+ "isStacked": false
260
+ },
261
+ "height": "332",
262
+ "data": [
263
+ {
264
+ "Date": "1/15/2016",
265
+ "Data 1": "$1,000",
266
+ "Data 2": "110",
267
+ "Data 3": "100",
268
+ "Data 4": "90",
269
+ "Monthly-Goal": "100"
270
+ },
271
+ {
272
+ "Date": "2/15/2016",
273
+ "Data 1": "100",
274
+ "Data 2": "110",
275
+ "Data 3": "100",
276
+ "Data 4": "100",
277
+ "Monthly-Goal": "100"
278
+ },
279
+ {
280
+ "Date": "3/15/2016",
281
+ "Data 1": "80",
282
+ "Data 2": "90",
283
+ "Data 3": "100",
284
+ "Data 4": "120",
285
+ "Monthly-Goal": "110"
286
+ },
287
+ {
288
+ "Date": "4/15/2016",
289
+ "Data 1": "80",
290
+ "Data 2": "90",
291
+ "Data 3": "110",
292
+ "Data 4": "120",
293
+ "Monthly-Goal": "110"
294
+ },
295
+ {
296
+ "Date": "5/15/2016",
297
+ "Data 1": "70",
298
+ "Data 2": "90",
299
+ "Data 3": "110",
300
+ "Data 4": "130",
301
+ "Monthly-Goal": "120"
302
+ },
303
+ {
304
+ "Date": "6/15/2016",
305
+ "Data 1": "100",
306
+ "Data 2": "120",
307
+ "Data 3": "120",
308
+ "Data 4": "130",
309
+ "Monthly-Goal": "120"
310
+ },
311
+ {
312
+ "Date": "7/15/2016",
313
+ "Data 1": "110",
314
+ "Data 2": "140",
315
+ "Data 3": "120",
316
+ "Data 4": "130",
317
+ "Monthly-Goal": "130"
318
+ },
319
+ {
320
+ "Date": "8/15/2016",
321
+ "Data 1": "110",
322
+ "Data 2": "130",
323
+ "Data 3": "120",
324
+ "Data 4": "140",
325
+ "Monthly-Goal": "130"
326
+ },
327
+ {
328
+ "Date": "9/15/2016",
329
+ "Data 1": "120",
330
+ "Data 2": "130",
331
+ "Data 3": "120",
332
+ "Data 4": "150",
333
+ "Monthly-Goal": "140"
334
+ }
335
+ ],
336
+ "visualizationType": "Line",
337
+ "filters": [],
338
+ "validated": 4.23,
339
+ "dynamicMarginTop": 0
340
+ }