@cdc/chart 4.24.10 → 4.24.12-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 (94) hide show
  1. package/dist/cdcchart.js +35019 -34301
  2. package/examples/feature/boxplot/boxplot-data.json +88 -22
  3. package/examples/feature/boxplot/boxplot.json +540 -16
  4. package/examples/feature/boxplot/testing.csv +7 -7
  5. package/examples/feature/sankey/sankey-example-data.json +126 -14
  6. package/examples/feature/tests-date-exclusions/date-exclusions-config.json +372 -12
  7. package/examples/private/DEV-8850-2.json +493 -0
  8. package/examples/private/DEV-9822.json +574 -0
  9. package/examples/private/DEV-9840.json +553 -0
  10. package/examples/private/DEV-9850-3.json +461 -0
  11. package/examples/private/chart.json +1084 -0
  12. package/examples/private/ci_formatted.json +202 -0
  13. package/examples/private/ci_issue.json +3016 -0
  14. package/examples/private/completed.json +634 -0
  15. package/examples/private/dem-data-long.csv +20 -0
  16. package/examples/private/dem-data-long.json +36 -0
  17. package/examples/private/demographic_data.csv +157 -0
  18. package/examples/private/demographic_data.json +2654 -0
  19. package/examples/private/demographic_dynamic.json +443 -0
  20. package/examples/private/demographic_standard.json +560 -0
  21. package/examples/private/ehdi.json +29939 -0
  22. package/examples/private/test.json +493 -0
  23. package/index.html +10 -7
  24. package/package.json +2 -2
  25. package/src/CdcChart.tsx +132 -152
  26. package/src/_stories/Chart.Anchors.stories.tsx +31 -0
  27. package/src/_stories/Chart.CustomColors.stories.tsx +19 -0
  28. package/src/_stories/Chart.DynamicSeries.stories.tsx +34 -0
  29. package/src/_stories/Chart.Legend.Gradient.stories.tsx +42 -1
  30. package/src/_stories/Chart.stories.tsx +37 -6
  31. package/src/_stories/ChartAxisLabels.stories.tsx +4 -1
  32. package/src/_stories/ChartEditor.stories.tsx +27 -0
  33. package/src/_stories/ChartLine.Suppression.stories.tsx +25 -0
  34. package/src/_stories/ChartPrefixSuffix.stories.tsx +8 -0
  35. package/{examples/feature/area/area-chart-date-city-temperature.json → src/_stories/_mock/area_chart_stacked.json} +125 -27
  36. package/src/_stories/_mock/boxplot_multiseries.json +647 -0
  37. package/src/_stories/_mock/dynamic_series_bar_config.json +723 -0
  38. package/src/_stories/_mock/dynamic_series_config.json +979 -0
  39. package/src/_stories/_mock/line_chart_dynamic_ci.json +493 -0
  40. package/src/_stories/_mock/line_chart_non_dynamic_ci.json +522 -0
  41. package/{examples/feature/scatterplot/scatterplot.json → src/_stories/_mock/scatterplot_mock.json} +62 -92
  42. package/src/_stories/_mock/short_dates.json +288 -0
  43. package/src/_stories/_mock/suppression_mock.json +1549 -0
  44. package/src/components/AreaChart/components/AreaChart.Stacked.jsx +15 -3
  45. package/src/components/Axis/Categorical.Axis.tsx +2 -2
  46. package/src/components/BarChart/components/BarChart.Horizontal.tsx +46 -37
  47. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +43 -9
  48. package/src/components/BarChart/components/BarChart.Vertical.tsx +53 -47
  49. package/src/components/BarChart/helpers/getBarData.ts +28 -0
  50. package/src/components/BarChart/helpers/index.ts +1 -2
  51. package/src/components/BarChart/helpers/tests/getBarData.test.ts +74 -0
  52. package/src/components/BoxPlot/BoxPlot.tsx +131 -0
  53. package/src/components/BoxPlot/helpers/index.ts +54 -0
  54. package/src/components/BrushChart.tsx +23 -26
  55. package/src/components/EditorPanel/EditorPanel.tsx +117 -139
  56. package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +3 -3
  57. package/src/components/EditorPanel/components/Panels/Panel.BoxPlot.tsx +51 -6
  58. package/src/components/EditorPanel/components/Panels/Panel.Regions.tsx +40 -9
  59. package/src/components/EditorPanel/components/Panels/Panel.Sankey.tsx +3 -3
  60. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +122 -56
  61. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +1 -2
  62. package/src/components/EditorPanel/useEditorPermissions.ts +20 -2
  63. package/src/components/Legend/Legend.Component.tsx +11 -12
  64. package/src/components/Legend/Legend.tsx +16 -16
  65. package/src/components/Legend/helpers/getLegendClasses.ts +59 -0
  66. package/src/components/Legend/helpers/index.ts +2 -1
  67. package/src/components/Legend/tests/getLegendClasses.test.ts +115 -0
  68. package/src/components/LineChart/components/LineChart.Circle.tsx +1 -1
  69. package/src/components/LineChart/helpers.ts +49 -43
  70. package/src/components/LineChart/index.tsx +135 -83
  71. package/src/components/LinearChart.tsx +196 -181
  72. package/src/components/PieChart/PieChart.tsx +7 -1
  73. package/src/components/Sankey/components/ColumnList.tsx +19 -0
  74. package/src/components/Sankey/components/Sankey.tsx +479 -0
  75. package/src/components/Sankey/helpers/getSankeyTooltip.tsx +33 -0
  76. package/src/components/Sankey/index.tsx +1 -492
  77. package/src/components/Sankey/sankey.scss +22 -21
  78. package/src/components/Sankey/types/index.ts +1 -1
  79. package/src/components/Sankey/useSankeyAlert.tsx +60 -0
  80. package/src/components/ScatterPlot/ScatterPlot.jsx +20 -4
  81. package/src/data/initial-state.js +7 -12
  82. package/src/helpers/countNumOfTicks.ts +57 -0
  83. package/src/helpers/getQuartiles.ts +15 -18
  84. package/src/hooks/useMinMax.ts +44 -16
  85. package/src/hooks/useReduceData.ts +43 -10
  86. package/src/hooks/useScales.ts +90 -35
  87. package/src/hooks/useTooltip.tsx +59 -50
  88. package/src/scss/DataTable.scss +5 -0
  89. package/src/scss/main.scss +6 -20
  90. package/src/types/ChartConfig.ts +6 -19
  91. package/src/types/ChartContext.ts +4 -1
  92. package/src/types/ForestPlot.ts +8 -0
  93. package/src/components/BoxPlot/BoxPlot.jsx +0 -111
  94. package/src/hooks/useLegendClasses.ts +0 -72
@@ -13,7 +13,10 @@ type Story = StoryObj<typeof Chart>
13
13
 
14
14
  export const Abbreviated_Dates: Story = {
15
15
  args: {
16
- config: editConfigKeys(SimplifiedLineConfig, [{ path: ['xAxis', 'showYearsOnce'], value: true }])
16
+ config: editConfigKeys(SimplifiedLineConfig, [
17
+ { path: ['xAxis', 'showYearsOnce'], value: true },
18
+ { path: ['tooltips', 'dateDisplayFormat'], value: '%b. %d %Y' }
19
+ ])
17
20
  }
18
21
  }
19
22
 
@@ -4,6 +4,7 @@ import Chart from '../CdcChart'
4
4
  import pieChartExample from './_mock/pie_config.json'
5
5
  import pieData from './_mock/pie_data.json'
6
6
  import urlFilterExample from './_mock/url_filter.json'
7
+ import mockScatterPlot from './_mock/scatterplot_mock.json'
7
8
 
8
9
  const meta: Meta<typeof Chart> = {
9
10
  title: 'Components/Templates/Chart/Editor',
@@ -30,4 +31,30 @@ export const Url_Filter: Story = {
30
31
  }
31
32
  }
32
33
 
34
+ export const ScatterPlot: Story = {
35
+ args: {
36
+ config: mockScatterPlot,
37
+ isEditor: true
38
+ },
39
+ play: async ({ canvasElement }) => {
40
+ const canvas = within(canvasElement)
41
+ const user = userEvent.setup()
42
+ // play is running before full rendering is complete so sleep function
43
+ // is needed to delay the execution.
44
+ // possible related bug: https://github.com/storybookjs/storybook/issues/18258
45
+ await sleep(3000)
46
+ const dateCategoryAccordion = await canvas.findByRole('button', { name: /Date\/Category Axis/i })
47
+ user.click(dateCategoryAccordion)
48
+ await sleep(1000)
49
+ const minValueInput = await canvas.findByLabelText('min value')
50
+ const maxValueInput = await canvas.findByLabelText('max value')
51
+ await user.type(minValueInput, '0')
52
+ await user.type(maxValueInput, '100')
53
+ await sleep(1000)
54
+ // Scroll to the top of the screen
55
+ user.click(dateCategoryAccordion)
56
+ await canvasElement.scrollTo(0, 0)
57
+ }
58
+ }
59
+
33
60
  export default meta
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+ import Chart from '../CdcChart'
3
+ import suppressionConfig from './_mock/suppression_mock.json'
4
+ import SuppressedConfig from './_mock/bar-chart-suppressed.json'
5
+ const meta: Meta<typeof Chart> = {
6
+ title: 'Components/Templates/Chart/Suppression',
7
+ component: Chart
8
+ }
9
+
10
+ type Story = StoryObj<typeof Chart>
11
+
12
+ export const SuppressedLines: Story = {
13
+ args: {
14
+ config: suppressionConfig,
15
+ isEditor: false
16
+ }
17
+ }
18
+ export const SuppressedBars: Story = {
19
+ args: {
20
+ config: SuppressedConfig,
21
+ isEditor: false
22
+ }
23
+ }
24
+
25
+ export default meta
@@ -3,6 +3,7 @@ import barConfig from './_mock/line_chart_two_points_new_chart.json'
3
3
  import annotationConfig from './_mock/annotation_category_mock.json'
4
4
  import areaPrefix from './_mock/annotation_category_mock.json'
5
5
  import horizontalBarConfig from './_mock/horizontal_bar.json'
6
+ import scatterPlotConfig from './_mock/scatterplot_mock.json'
6
7
 
7
8
  import Chart from '../CdcChart'
8
9
  import { editConfigKeys } from '../helpers/configHelpers'
@@ -148,4 +149,11 @@ export const Top_Suffix_Above_Gridlines_With_Options: Story = {
148
149
  }
149
150
  }
150
151
 
152
+ export const ScatterPlot_Bottom_Commas: Story = {
153
+ args: {
154
+ config: editConfigKeys(scatterPlotConfig, [{ path: ['dataFormat', 'bottomCommas'], value: true }])
155
+ },
156
+ isEditor: true
157
+ }
158
+
151
159
  export default meta
@@ -1,30 +1,40 @@
1
1
  {
2
+ "annotations": [],
2
3
  "type": "chart",
3
4
  "debugSvg": false,
5
+ "chartMessage": {
6
+ "noData": "No Data Available"
7
+ },
4
8
  "title": "Example Area Chart - City Temperature Data",
5
9
  "showTitle": true,
6
10
  "showDownloadMediaButton": false,
7
- "showChartBrush": false,
8
11
  "theme": "theme-blue",
9
12
  "animate": false,
10
13
  "fontSize": "medium",
11
14
  "lineDatapointStyle": "hover",
15
+ "lineDatapointColor": "Same as Line",
12
16
  "barHasBorder": "false",
13
17
  "isLollipopChart": false,
14
18
  "lollipopShape": "circle",
15
19
  "lollipopColorStyle": "two-tone",
16
- "visualizationSubType": "regular",
20
+ "visualizationSubType": "stacked",
17
21
  "barStyle": "",
18
22
  "roundingStyle": "standard",
19
23
  "tipRounding": "top",
20
24
  "isResponsiveTicks": false,
21
25
  "general": {
22
- "showDownloadButton": false
26
+ "annotationDropdownText": "Annotations",
27
+ "showDownloadButton": false,
28
+ "showMissingDataLabel": true,
29
+ "showSuppressedSymbol": true,
30
+ "showZeroValueData": true,
31
+ "hideNullValue": true
23
32
  },
24
33
  "padding": {
25
34
  "left": 5,
26
35
  "right": 5
27
36
  },
37
+ "preliminaryData": [],
28
38
  "yAxis": {
29
39
  "hideAxis": false,
30
40
  "displayNumbersOnBar": false,
@@ -47,23 +57,20 @@
47
57
  "rightAxisTickColor": "#333",
48
58
  "numTicks": "",
49
59
  "axisPadding": 0,
60
+ "scalePadding": 10,
50
61
  "tickRotation": 0,
51
62
  "anchors": [],
63
+ "shoMissingDataLabel": true,
64
+ "showMissingDataLine": true,
65
+ "categories": [],
52
66
  "isLegendValue": false,
53
67
  "label": "Y Axis - Temperature"
54
68
  },
55
69
  "boxplot": {
56
70
  "plots": [],
57
71
  "borders": "true",
58
- "firstQuartilePercentage": 25,
59
- "thirdQuartilePercentage": 75,
60
- "boxWidthPercentage": 40,
61
72
  "plotOutlierValues": false,
62
73
  "plotNonOutlierValues": true,
63
- "legend": {
64
- "showHowToReadText": false,
65
- "howToReadText": ""
66
- },
67
74
  "labels": {
68
75
  "q1": "Lower Quartile",
69
76
  "q2": "q2",
@@ -80,6 +87,13 @@
80
87
  "values": "Values",
81
88
  "lowerBounds": "Lower Bounds",
82
89
  "upperBounds": "Upper Bounds"
90
+ },
91
+ "firstQuartilePercentage": 25,
92
+ "thirdQuartilePercentage": 75,
93
+ "boxWidthPercentage": 40,
94
+ "legend": {
95
+ "showHowToReadText": false,
96
+ "howToReadText": ""
83
97
  }
84
98
  },
85
99
  "topAxis": {
@@ -94,8 +108,9 @@
94
108
  "horizontal": 750
95
109
  },
96
110
  "xAxis": {
111
+ "sortDates": false,
97
112
  "anchors": [],
98
- "type": "date",
113
+ "type": "date-time",
99
114
  "showTargetLabel": true,
100
115
  "targetLabel": "Target",
101
116
  "hideAxis": false,
@@ -109,15 +124,20 @@
109
124
  "tickLabelColor": "#333",
110
125
  "tickColor": "#333",
111
126
  "numTicks": "6",
112
- "labelOffset": 65,
127
+ "labelOffset": 0,
113
128
  "axisPadding": 0,
114
129
  "target": 0,
115
130
  "maxTickRotation": 0,
131
+ "padding": "0",
132
+ "showYearsOnce": false,
133
+ "sortByRecentDate": false,
116
134
  "isLegendValue": false,
117
135
  "dataKey": "Date",
118
136
  "label": "X Axis Example Label",
119
137
  "dateParseFormat": "%Y-%m-%d",
120
- "dateDisplayFormat": "%m/%d/%Y"
138
+ "dateDisplayFormat": "%m/%d/%Y",
139
+ "axisBBox": 95.58972930908203,
140
+ "tickWidthMax": 91
121
141
  },
122
142
  "table": {
123
143
  "label": "Data Type by Date",
@@ -127,16 +147,22 @@
127
147
  "caption": "",
128
148
  "showDownloadUrl": true,
129
149
  "showDataTableLink": true,
150
+ "showDownloadLinkBelow": true,
130
151
  "indexLabel": "",
131
152
  "download": true,
132
153
  "showVertical": false,
154
+ "dateDisplayFormat": "",
155
+ "showMissingDataLabel": true,
156
+ "showSuppressedSymbol": true,
133
157
  "show": true
134
158
  },
135
159
  "orientation": "vertical",
136
160
  "color": "pinkpurple",
137
161
  "columns": {},
138
162
  "legend": {
163
+ "hide": false,
139
164
  "behavior": "isolate",
165
+ "axisAlign": true,
140
166
  "singleRow": false,
141
167
  "colorCode": "",
142
168
  "reverseLabelOrder": false,
@@ -146,8 +172,27 @@
146
172
  "dynamicLegendItemLimit": 5,
147
173
  "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
148
174
  "dynamicLegendChartMessage": "Select Options from the Legend",
149
- "position": "right",
150
- "label": "Type of Data"
175
+ "label": "Type of Data",
176
+ "lineMode": false,
177
+ "verticalSorted": false,
178
+ "highlightOnHover": false,
179
+ "hideSuppressedLabels": false,
180
+ "hideSuppressionLink": false,
181
+ "seriesHighlight": [],
182
+ "style": "circles",
183
+ "subStyle": "linear blocks",
184
+ "tickRotation": "",
185
+ "hideBorder": {
186
+ "side": false,
187
+ "topBottom": true
188
+ },
189
+ "position": "right"
190
+ },
191
+ "brush": {
192
+ "height": 25,
193
+ "active": false,
194
+ "pattern_id": "brush_pattern",
195
+ "accent_color": "#ddd"
151
196
  },
152
197
  "exclusions": {
153
198
  "active": true,
@@ -185,7 +230,8 @@
185
230
  {
186
231
  "dataKey": "Austin",
187
232
  "type": "Area Chart",
188
- "tooltip": true
233
+ "tooltip": true,
234
+ "axis": "Left"
189
235
  },
190
236
  {
191
237
  "dataKey": "San Francisco",
@@ -195,22 +241,28 @@
195
241
  }
196
242
  ],
197
243
  "tooltips": {
198
- "opacity": 90
244
+ "opacity": 90,
245
+ "singleSeries": false,
246
+ "dateDisplayFormat": ""
199
247
  },
200
248
  "forestPlot": {
201
249
  "startAt": 0,
202
- "width": "auto",
203
250
  "colors": {
204
251
  "line": "",
205
252
  "shape": ""
206
253
  },
254
+ "lineOfNoEffect": {
255
+ "show": true
256
+ },
257
+ "type": "",
258
+ "pooledResult": {
259
+ "diamondHeight": 5,
260
+ "column": ""
261
+ },
207
262
  "estimateField": "",
208
263
  "estimateRadius": "",
209
- "lowerCiField": "",
210
- "upperCiField": "",
211
264
  "shape": "",
212
265
  "rowHeight": 20,
213
- "showZeroLine": false,
214
266
  "description": {
215
267
  "show": true,
216
268
  "text": "description",
@@ -232,15 +284,60 @@
232
284
  "estimateField": 0
233
285
  },
234
286
  "leftWidthOffset": 0,
235
- "rightWidthOffset": 0
236
- },
237
- "brush": {
238
- "pattern_id": "brush_pattern",
239
- "accent_color": "#ddd"
287
+ "rightWidthOffset": 0,
288
+ "showZeroLine": false,
289
+ "leftLabel": "",
290
+ "rightLabel": "",
291
+ "width": "auto",
292
+ "lowerCiField": "",
293
+ "upperCiField": ""
240
294
  },
241
295
  "area": {
242
296
  "isStacked": true
243
297
  },
298
+ "sankey": {
299
+ "title": {
300
+ "defaultColor": "black"
301
+ },
302
+ "iterations": 1,
303
+ "rxValue": 0.9,
304
+ "overallSize": {
305
+ "width": 900,
306
+ "height": 700
307
+ },
308
+ "margin": {
309
+ "margin_y": 25,
310
+ "margin_x": 0
311
+ },
312
+ "nodeSize": {
313
+ "nodeWidth": 26,
314
+ "nodeHeight": 40
315
+ },
316
+ "nodePadding": 55,
317
+ "nodeFontColor": "black",
318
+ "nodeColor": {
319
+ "default": "#ff8500",
320
+ "inactive": "#808080"
321
+ },
322
+ "linkColor": {
323
+ "default": "#ffc900",
324
+ "inactive": "#D3D3D3"
325
+ },
326
+ "opacity": {
327
+ "nodeOpacityDefault": 1,
328
+ "nodeOpacityInactive": 0.1,
329
+ "LinkOpacityDefault": 1,
330
+ "LinkOpacityInactive": 0.1
331
+ },
332
+ "storyNodeFontColor": "#006778",
333
+ "storyNodeText": [],
334
+ "nodeValueStyle": {
335
+ "textBefore": "(",
336
+ "textAfter": ")"
337
+ },
338
+ "data": []
339
+ },
340
+ "showChartBrush": false,
244
341
  "dataDescription": {
245
342
  "horizontal": false,
246
343
  "series": false
@@ -4648,5 +4745,6 @@
4648
4745
  "description": "This example shows a bar chart created in the visualization editor in WCMS",
4649
4746
  "dataCutoff": "0",
4650
4747
  "validated": 4.23,
4651
- "dynamicMarginTop": 0
4748
+ "dynamicMarginTop": 0,
4749
+ "version": "4.24.10"
4652
4750
  }