@cdc/chart 4.25.7 → 4.25.10

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 (95) hide show
  1. package/.claude/settings.local.json +9 -0
  2. package/dist/cdcchart.js +39551 -37016
  3. package/examples/feature/__data__/planet-example-data.json +0 -30
  4. package/examples/grouped-bar-test.json +400 -0
  5. package/examples/private/d.json +382 -0
  6. package/examples/private/example-2.json +49784 -0
  7. package/examples/private/f2.json +1 -0
  8. package/examples/private/f4.json +1577 -0
  9. package/examples/private/forecast.json +1180 -0
  10. package/examples/private/lollipop.json +468 -0
  11. package/examples/private/new.json +48756 -0
  12. package/examples/private/pie-chart-legend.json +904 -0
  13. package/examples/suppressed_tooltip.json +480 -0
  14. package/index.html +10 -22
  15. package/package.json +25 -7
  16. package/src/CdcChart.tsx +10 -4
  17. package/src/CdcChartComponent.tsx +188 -32
  18. package/src/_stories/Chart.Anchors.stories.tsx +2 -2
  19. package/src/_stories/Chart.BoxPlot.stories.tsx +1 -1
  20. package/src/_stories/Chart.CI.stories.tsx +1 -1
  21. package/src/_stories/Chart.CustomColors.stories.tsx +1 -1
  22. package/src/_stories/Chart.DynamicSeries.stories.tsx +2 -2
  23. package/src/_stories/Chart.Filters.stories.tsx +2 -2
  24. package/src/_stories/Chart.Legend.Gradient.stories.tsx +2 -2
  25. package/src/_stories/Chart.Patterns.stories.tsx +19 -0
  26. package/src/_stories/Chart.ScatterPlot.stories.tsx +1 -1
  27. package/src/_stories/Chart.stories.tsx +8 -5
  28. package/src/_stories/Chart.tooltip.stories.tsx +1 -1
  29. package/src/_stories/ChartAnnotation.stories.tsx +1 -1
  30. package/src/_stories/ChartAxisLabels.stories.tsx +2 -2
  31. package/src/_stories/ChartAxisTitles.stories.tsx +2 -2
  32. package/src/_stories/ChartEditor.stories.tsx +60 -60
  33. package/src/_stories/ChartLine.Suppression.stories.tsx +1 -1
  34. package/src/_stories/ChartLine.Symbols.stories.tsx +1 -1
  35. package/src/_stories/ChartPrefixSuffix.stories.tsx +2 -2
  36. package/src/_stories/_mock/stacked-pattern-test.json +520 -0
  37. package/src/components/Annotations/components/AnnotationDraggable.tsx +1 -0
  38. package/src/components/Annotations/components/AnnotationDropdown.tsx +1 -1
  39. package/src/components/BarChart/components/BarChart.Horizontal.tsx +170 -25
  40. package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +139 -6
  41. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +215 -73
  42. package/src/components/BarChart/components/BarChart.Vertical.tsx +172 -23
  43. package/src/components/BarChart/helpers/index.ts +43 -4
  44. package/src/components/BarChart/helpers/lollipopColors.ts +27 -0
  45. package/src/components/BarChart/helpers/useBarChart.ts +25 -3
  46. package/src/components/BoxPlot/BoxPlot.Vertical.tsx +2 -1
  47. package/src/components/Brush/BrushChart.tsx +65 -10
  48. package/src/components/Brush/BrushController.tsx +37 -5
  49. package/src/components/Brush/types.tsx +8 -0
  50. package/src/components/DeviationBar.jsx +9 -6
  51. package/src/components/EditorPanel/EditorPanel.tsx +364 -39
  52. package/src/components/EditorPanel/EditorPanelContext.ts +3 -0
  53. package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +2 -2
  54. package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +414 -0
  55. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +30 -54
  56. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +115 -120
  57. package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
  58. package/src/components/EditorPanel/components/Panels/panelVisual.styles.css +0 -8
  59. package/src/components/EditorPanel/helpers/updateFieldRankByValue.ts +49 -48
  60. package/src/components/Forecasting/Forecasting.tsx +36 -6
  61. package/src/components/ForestPlot/ForestPlot.tsx +11 -7
  62. package/src/components/ForestPlot/ForestPlotProps.ts +1 -1
  63. package/src/components/Legend/Legend.Component.tsx +110 -2
  64. package/src/components/Legend/Legend.tsx +3 -1
  65. package/src/components/Legend/helpers/createFormatLabels.tsx +230 -171
  66. package/src/components/LegendWrapper.tsx +1 -1
  67. package/src/components/LineChart/components/LineChart.BumpCircle.tsx +27 -26
  68. package/src/components/LineChart/components/LineChart.Circle.tsx +2 -2
  69. package/src/components/LineChart/index.tsx +2 -2
  70. package/src/components/LinearChart.tsx +26 -9
  71. package/src/components/PairedBarChart.jsx +6 -4
  72. package/src/components/PieChart/PieChart.tsx +170 -54
  73. package/src/components/Sankey/components/Sankey.tsx +7 -1
  74. package/src/components/ScatterPlot/ScatterPlot.jsx +32 -4
  75. package/src/data/initial-state.js +315 -292
  76. package/src/helpers/buildForecastPaletteMappings.ts +112 -0
  77. package/src/helpers/buildForecastPaletteOptions.ts +109 -0
  78. package/src/helpers/getColorScale.ts +72 -8
  79. package/src/helpers/getNewRuntime.ts +1 -1
  80. package/src/helpers/getTransformedData.ts +1 -1
  81. package/src/hooks/useChartHoverAnalytics.tsx +44 -0
  82. package/src/hooks/useReduceData.ts +105 -70
  83. package/src/hooks/useTooltip.tsx +58 -16
  84. package/src/index.jsx +6 -3
  85. package/src/scss/main.scss +12 -0
  86. package/src/store/chart.reducer.ts +1 -1
  87. package/src/test/CdcChart.test.jsx +8 -3
  88. package/src/types/ChartConfig.ts +30 -6
  89. package/src/types/ChartContext.ts +1 -0
  90. package/vite.config.js +1 -1
  91. package/vitest.config.ts +16 -0
  92. package/src/coreStyles_chart.scss +0 -3
  93. package/src/helpers/configHelpers.ts +0 -28
  94. package/src/helpers/generateColorsArray.ts +0 -8
  95. package/src/hooks/useColorPalette.js +0 -76
@@ -1,60 +1,60 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
2
- import { userEvent, within } from '@storybook/testing-library'
3
- import Chart from '../CdcChartComponent'
4
- import pieChartExample from './_mock/pie_config.json'
5
- import pieData from './_mock/pie_data.json'
6
- import urlFilterExample from './_mock/url_filter.json'
7
- import mockScatterPlot from './_mock/scatterplot_mock.json'
8
-
9
- const meta: Meta<typeof Chart> = {
10
- title: 'Components/Templates/Chart/Editor',
11
- component: Chart
12
- }
13
-
14
- type Story = StoryObj<typeof Chart>
15
-
16
- export const Primary: Story = {
17
- args: {
18
- config: { ...pieChartExample, data: pieData, columns: { someCol: { name: 'females', showInViz: true } } },
19
- isEditor: true
20
- }
21
- }
22
-
23
- const sleep = ms => {
24
- return new Promise(r => setTimeout(r, ms))
25
- }
26
-
27
- export const Url_Filter: Story = {
28
- args: {
29
- config: urlFilterExample,
30
- isEditor: true
31
- }
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
-
60
- export default meta
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+ import { userEvent, within } from 'storybook/test'
3
+ import Chart from '../CdcChartComponent'
4
+ import pieChartExample from './_mock/pie_config.json'
5
+ import pieData from './_mock/pie_data.json'
6
+ import urlFilterExample from './_mock/url_filter.json'
7
+ import mockScatterPlot from './_mock/scatterplot_mock.json'
8
+
9
+ const meta: Meta<typeof Chart> = {
10
+ title: 'Components/Templates/Chart/Editor',
11
+ component: Chart
12
+ }
13
+
14
+ type Story = StoryObj<typeof Chart>
15
+
16
+ export const Primary: Story = {
17
+ args: {
18
+ config: { ...pieChartExample, data: pieData, columns: { someCol: { name: 'females', showInViz: true } } },
19
+ isEditor: true
20
+ }
21
+ }
22
+
23
+ const sleep = ms => {
24
+ return new Promise(r => setTimeout(r, ms))
25
+ }
26
+
27
+ export const Url_Filter: Story = {
28
+ args: {
29
+ config: urlFilterExample,
30
+ isEditor: true
31
+ }
32
+ }
33
+
34
+ export const ScatterPlotTests: 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
+
60
+ export default meta
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import Chart from '../CdcChartComponent'
3
3
  import suppressionConfig from './_mock/suppression_mock.json'
4
4
  import SuppressedConfig from './_mock/bar-chart-suppressed.json'
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import Chart from '../CdcChartComponent'
3
3
  import config from './_mock/line_chart_symbols.json'
4
4
  const meta: Meta<typeof Chart> = {
@@ -1,4 +1,4 @@
1
- import type { Meta, StoryObj } from '@storybook/react'
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  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'
@@ -6,7 +6,7 @@ import horizontalBarConfig from './_mock/horizontal_bar.json'
6
6
  import scatterPlotConfig from './_mock/scatterplot_mock.json'
7
7
 
8
8
  import Chart from '../CdcChartComponent'
9
- import { editConfigKeys } from '../helpers/configHelpers'
9
+ import { editConfigKeys } from '@cdc/core/helpers/configHelpers'
10
10
 
11
11
  const meta: Meta<typeof Chart> = {
12
12
  title: 'Components/Templates/Chart/Prefix Suffix',
@@ -0,0 +1,520 @@
1
+ {
2
+ "filters": [],
3
+ "filterBehavior": "Filter Change",
4
+ "openModal": true,
5
+ "uid": "chart1750783711238",
6
+ "type": "chart",
7
+ "visualizationType": "Bar",
8
+ "dataKey": "NNDSSTestConditions20162022.csv",
9
+ "description": "",
10
+ "dataDescription": {
11
+ "horizontal": false,
12
+ "series": false
13
+ },
14
+ "annotations": [],
15
+ "debugSvg": false,
16
+ "chartMessage": {
17
+ "noData": "No Data Available"
18
+ },
19
+ "title": "",
20
+ "showTitle": false,
21
+ "showDownloadMediaButton": false,
22
+ "theme": "theme-blue",
23
+ "animate": false,
24
+ "lineDatapointStyle": "hover",
25
+ "lineDatapointColor": "Same as Line",
26
+ "barHasBorder": "false",
27
+ "isLollipopChart": false,
28
+ "lollipopShape": "circle",
29
+ "lollipopColorStyle": "two-tone",
30
+ "visualizationSubType": "stacked",
31
+ "barStyle": "",
32
+ "roundingStyle": "standard",
33
+ "tipRounding": "top",
34
+ "isResponsiveTicks": false,
35
+ "general": {
36
+ "annotationDropdownText": "Annotations",
37
+ "showMissingDataLabel": false,
38
+ "showSuppressedSymbol": true,
39
+ "showZeroValueData": false,
40
+ "hideNullValue": true
41
+ },
42
+ "padding": {
43
+ "left": 5,
44
+ "right": 5
45
+ },
46
+ "preliminaryData": [],
47
+ "yAxis": {
48
+ "hideAxis": true,
49
+ "displayNumbersOnBar": false,
50
+ "hideLabel": false,
51
+ "hideTicks": true,
52
+ "size": 45,
53
+ "gridLines": true,
54
+ "enablePadding": false,
55
+ "min": "",
56
+ "max": 200,
57
+ "labelColor": "#333",
58
+ "tickLabelColor": "#333",
59
+ "tickColor": "#333",
60
+ "rightHideAxis": false,
61
+ "rightAxisSize": 0,
62
+ "rightLabel": "",
63
+ "rightLabelOffsetSize": 0,
64
+ "rightAxisLabelColor": "#333",
65
+ "rightAxisTickLabelColor": "#333",
66
+ "rightAxisTickColor": "#333",
67
+ "numTicks": "5",
68
+ "axisPadding": 0,
69
+ "scalePadding": 10,
70
+ "tickRotation": 0,
71
+ "anchors": [],
72
+ "shoMissingDataLabel": true,
73
+ "showMissingDataLine": true,
74
+ "categories": [],
75
+ "inlineLabel": " cases"
76
+ },
77
+ "boxplot": {
78
+ "plots": [],
79
+ "borders": "true",
80
+ "plotOutlierValues": false,
81
+ "plotNonOutlierValues": true,
82
+ "labels": {
83
+ "q1": "Lower Quartile",
84
+ "q2": "q2",
85
+ "q3": "Upper Quartile",
86
+ "q4": "q4",
87
+ "minimum": "Minimum",
88
+ "maximum": "Maximum",
89
+ "mean": "Mean",
90
+ "median": "Median",
91
+ "sd": "Standard Deviation",
92
+ "iqr": "Interquartile Range",
93
+ "count": "Count",
94
+ "outliers": "Outliers",
95
+ "values": "Values",
96
+ "lowerBounds": "Lower Bounds",
97
+ "upperBounds": "Upper Bounds"
98
+ }
99
+ },
100
+ "topAxis": {
101
+ "hasLine": false
102
+ },
103
+ "isLegendValue": false,
104
+ "barThickness": 0.9,
105
+ "barHeight": 25,
106
+ "barSpace": 15,
107
+ "heights": {
108
+ "vertical": 300,
109
+ "horizontal": 750,
110
+ "mobileVertical": 200
111
+ },
112
+ "xAxis": {
113
+ "sortDates": false,
114
+ "anchors": [],
115
+ "type": "date",
116
+ "showTargetLabel": true,
117
+ "targetLabel": "Target",
118
+ "hideAxis": false,
119
+ "hideLabel": false,
120
+ "hideTicks": false,
121
+ "size": 75,
122
+ "tickRotation": 0,
123
+ "min": "",
124
+ "max": "",
125
+ "labelColor": "#333",
126
+ "tickLabelColor": "#333",
127
+ "tickColor": "#333",
128
+ "numTicks": "",
129
+ "labelOffset": 0,
130
+ "axisPadding": 200,
131
+ "target": 0,
132
+ "maxTickRotation": 0,
133
+ "padding": 5,
134
+ "showYearsOnce": false,
135
+ "sortByRecentDate": false,
136
+ "brushActive": false,
137
+ "dataKey": "year",
138
+ "axisBBox": 8,
139
+ "tickWidthMax": 39,
140
+ "dateParseFormat": "%Y",
141
+ "dateDisplayFormat": "%Y",
142
+ "viewportNumTicks": {
143
+ "xs": "4",
144
+ "xxs": "4"
145
+ }
146
+ },
147
+ "table": {
148
+ "label": "Data Table",
149
+ "expanded": false,
150
+ "limitHeight": false,
151
+ "height": "",
152
+ "caption": "",
153
+ "showDownloadUrl": false,
154
+ "showDataTableLink": false,
155
+ "showDownloadLinkBelow": true,
156
+ "indexLabel": "",
157
+ "download": true,
158
+ "showVertical": true,
159
+ "dateDisplayFormat": "",
160
+ "showMissingDataLabel": true,
161
+ "showSuppressedSymbol": true,
162
+ "show": true
163
+ },
164
+ "orientation": "vertical",
165
+ "color": "pinkpurple",
166
+ "columns": {
167
+ "domestic_count": {
168
+ "label": "Domestic Cases",
169
+ "dataTable": true,
170
+ "tooltips": false,
171
+ "prefix": "",
172
+ "suffix": "",
173
+ "forestPlot": false,
174
+ "startingPoint": "0",
175
+ "forestPlotAlignRight": false,
176
+ "roundToPlace": 0,
177
+ "commas": true,
178
+ "showInViz": false,
179
+ "forestPlotStartingPoint": 0,
180
+ "name": "domestic_count"
181
+ },
182
+ "abroad_count": {
183
+ "label": "Cases Abroad",
184
+ "dataTable": true,
185
+ "tooltips": false,
186
+ "prefix": "",
187
+ "suffix": "",
188
+ "forestPlot": false,
189
+ "startingPoint": "0",
190
+ "forestPlotAlignRight": false,
191
+ "roundToPlace": 0,
192
+ "commas": true,
193
+ "showInViz": false,
194
+ "forestPlotStartingPoint": 0,
195
+ "name": "abroad_count"
196
+ },
197
+ "year": {
198
+ "label": "Year",
199
+ "dataTable": true,
200
+ "tooltips": false,
201
+ "prefix": "",
202
+ "suffix": "",
203
+ "forestPlot": false,
204
+ "startingPoint": "0",
205
+ "forestPlotAlignRight": false,
206
+ "roundToPlace": 0,
207
+ "commas": false,
208
+ "showInViz": false,
209
+ "forestPlotStartingPoint": 0,
210
+ "name": "year"
211
+ }
212
+ },
213
+ "legend": {
214
+ "hide": false,
215
+ "behavior": "isolate",
216
+ "axisAlign": true,
217
+ "singleRow": true,
218
+ "colorCode": "recon_prov",
219
+ "reverseLabelOrder": true,
220
+ "description": "",
221
+ "dynamicLegend": false,
222
+ "dynamicLegendDefaultText": "Show All",
223
+ "dynamicLegendItemLimit": 5,
224
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
225
+ "dynamicLegendChartMessage": "Select Options from the Legend",
226
+ "label": "",
227
+ "lineMode": false,
228
+ "verticalSorted": false,
229
+ "highlightOnHover": false,
230
+ "hideSuppressedLabels": false,
231
+ "hideSuppressionLink": false,
232
+ "seriesHighlight": [],
233
+ "style": "boxes",
234
+ "subStyle": "linear blocks",
235
+ "groupBy": "",
236
+ "shape": "circle",
237
+ "tickRotation": "",
238
+ "order": "dataColumn",
239
+ "hideBorder": {
240
+ "side": false,
241
+ "topBottom": true
242
+ },
243
+ "position": "top",
244
+ "orderedValues": [],
245
+ "unified": true,
246
+ "patterns": {
247
+ "Provisional": {
248
+ "label": "Provisional Data",
249
+ "color": "#000000",
250
+ "shape": "diagonalLines",
251
+ "dataKey": "recon_prov",
252
+ "dataValue": "Provisional",
253
+ "patternSize": 10
254
+ }
255
+ }
256
+ },
257
+ "brush": {
258
+ "isActive": false,
259
+ "isBrushing": false,
260
+ "data": [],
261
+ "height": 45,
262
+ "active": false
263
+ },
264
+ "exclusions": {
265
+ "active": false,
266
+ "keys": []
267
+ },
268
+ "palette": "qualitative-bold",
269
+ "isPaletteReversed": false,
270
+ "twoColor": {
271
+ "palette": "monochrome-1",
272
+ "isPaletteReversed": false
273
+ },
274
+ "labels": false,
275
+ "dataFormat": {
276
+ "commas": true,
277
+ "prefix": "",
278
+ "suffix": "",
279
+ "abbreviated": false,
280
+ "bottomSuffix": "",
281
+ "bottomPrefix": "",
282
+ "bottomAbbreviated": false
283
+ },
284
+ "confidenceKeys": {},
285
+ "visual": {
286
+ "border": true,
287
+ "accent": true,
288
+ "background": true,
289
+ "verticalHoverLine": true,
290
+ "horizontalHoverLine": false,
291
+ "lineDatapointSymbol": "none",
292
+ "maximumShapeAmount": 7
293
+ },
294
+ "useLogScale": false,
295
+ "highlightedBarValues": [],
296
+ "series": [
297
+ {
298
+ "dataKey": "domestic_count",
299
+ "type": "Bar",
300
+ "axis": "Left",
301
+ "tooltip": true,
302
+ "name": "Domestic Cases"
303
+ },
304
+ {
305
+ "dataKey": "abroad_count",
306
+ "type": "Bar",
307
+ "axis": "Left",
308
+ "tooltip": true,
309
+ "name": "Cases Abroad"
310
+ }
311
+ ],
312
+ "tooltips": {
313
+ "opacity": 90,
314
+ "singleSeries": false,
315
+ "dateDisplayFormat": ""
316
+ },
317
+ "forestPlot": {
318
+ "startAt": 0,
319
+ "colors": {
320
+ "line": "",
321
+ "shape": ""
322
+ },
323
+ "lineOfNoEffect": {
324
+ "show": true
325
+ },
326
+ "type": "",
327
+ "pooledResult": {
328
+ "diamondHeight": 5,
329
+ "column": ""
330
+ },
331
+ "estimateField": "",
332
+ "estimateRadius": "",
333
+ "shape": "square",
334
+ "rowHeight": 20,
335
+ "description": {
336
+ "show": true,
337
+ "text": "description",
338
+ "location": 0
339
+ },
340
+ "result": {
341
+ "show": true,
342
+ "text": "result",
343
+ "location": 100
344
+ },
345
+ "radius": {
346
+ "min": 2,
347
+ "max": 10,
348
+ "scalingColumn": ""
349
+ },
350
+ "regression": {
351
+ "lower": 0,
352
+ "upper": 0,
353
+ "estimateField": 0
354
+ },
355
+ "leftWidthOffset": 0,
356
+ "rightWidthOffset": 0,
357
+ "showZeroLine": false,
358
+ "leftLabel": "",
359
+ "rightLabel": ""
360
+ },
361
+ "area": {
362
+ "isStacked": false
363
+ },
364
+ "sankey": {
365
+ "title": {
366
+ "defaultColor": "black"
367
+ },
368
+ "iterations": 1,
369
+ "rxValue": 0.9,
370
+ "overallSize": {
371
+ "width": 900,
372
+ "height": 700
373
+ },
374
+ "margin": {
375
+ "margin_y": 25,
376
+ "margin_x": 0
377
+ },
378
+ "nodeSize": {
379
+ "nodeWidth": 26,
380
+ "nodeHeight": 40
381
+ },
382
+ "nodePadding": 55,
383
+ "nodeFontColor": "black",
384
+ "nodeColor": {
385
+ "default": "#ff8500",
386
+ "inactive": "#808080"
387
+ },
388
+ "linkColor": {
389
+ "default": "#ffc900",
390
+ "inactive": "#D3D3D3"
391
+ },
392
+ "opacity": {
393
+ "nodeOpacityDefault": 1,
394
+ "nodeOpacityInactive": 0.1,
395
+ "LinkOpacityDefault": 1,
396
+ "LinkOpacityInactive": 0.1
397
+ },
398
+ "storyNodeFontColor": "#006778",
399
+ "storyNodeText": [],
400
+ "nodeValueStyle": {
401
+ "textBefore": "(",
402
+ "textAfter": ")"
403
+ },
404
+ "data": []
405
+ },
406
+ "dynamicMarginTop": 0,
407
+ "dataFileName": "nndss_annual_epi_curve.json",
408
+ "dataFileSourceType": "file",
409
+ "allowLineToBarGraph": "__​undefined__",
410
+ "version": "4.25.6",
411
+ "migrations": {
412
+ "addColorMigration": true
413
+ },
414
+ "regions": [],
415
+ "customColors": ["#377eb8", "#9fd4ff"],
416
+ "data": [
417
+ {
418
+ "condition_identifier": "leptospirosis",
419
+ "na_reason": "",
420
+ "year": 2025,
421
+ "domestic_count": 46,
422
+ "abroad_count": 12,
423
+ "condition": "Leptospirosis",
424
+ "category": "Animal-borne diseases",
425
+ "recon_prov": "Provisional"
426
+ },
427
+ {
428
+ "condition_identifier": "leptospirosis",
429
+ "na_reason": "",
430
+ "year": 2024,
431
+ "domestic_count": 120,
432
+ "abroad_count": 18,
433
+ "condition": "Leptospirosis",
434
+ "category": "Animal-borne diseases",
435
+ "recon_prov": "Provisional"
436
+ },
437
+ {
438
+ "condition_identifier": "leptospirosis",
439
+ "na_reason": "",
440
+ "year": 2023,
441
+ "domestic_count": 94,
442
+ "abroad_count": 8,
443
+ "condition": "Leptospirosis",
444
+ "category": "Animal-borne diseases",
445
+ "recon_prov": "Provisional"
446
+ },
447
+ {
448
+ "condition_identifier": "leptospirosis",
449
+ "na_reason": "",
450
+ "year": 2022,
451
+ "domestic_count": 62,
452
+ "abroad_count": 15,
453
+ "condition": "Leptospirosis",
454
+ "category": "Animal-borne diseases",
455
+ "recon_prov": "Reconciled"
456
+ },
457
+ {
458
+ "condition_identifier": "leptospirosis",
459
+ "na_reason": "",
460
+ "year": 2021,
461
+ "domestic_count": 69,
462
+ "abroad_count": 22,
463
+ "condition": "Leptospirosis",
464
+ "category": "Animal-borne diseases",
465
+ "recon_prov": "Reconciled"
466
+ }
467
+ ],
468
+ "formattedData": [
469
+ {
470
+ "condition_identifier": "leptospirosis",
471
+ "na_reason": "",
472
+ "year": 2025,
473
+ "domestic_count": 46,
474
+ "abroad_count": 12,
475
+ "condition": "Leptospirosis",
476
+ "category": "Animal-borne diseases",
477
+ "recon_prov": "Provisional"
478
+ },
479
+ {
480
+ "condition_identifier": "leptospirosis",
481
+ "na_reason": "",
482
+ "year": 2024,
483
+ "domestic_count": 120,
484
+ "abroad_count": 18,
485
+ "condition": "Leptospirosis",
486
+ "category": "Animal-borne diseases",
487
+ "recon_prov": "Provisional"
488
+ },
489
+ {
490
+ "condition_identifier": "leptospirosis",
491
+ "na_reason": "",
492
+ "year": 2023,
493
+ "domestic_count": 94,
494
+ "abroad_count": 8,
495
+ "condition": "Leptospirosis",
496
+ "category": "Animal-borne diseases",
497
+ "recon_prov": "Provisional"
498
+ },
499
+ {
500
+ "condition_identifier": "leptospirosis",
501
+ "na_reason": "",
502
+ "year": 2022,
503
+ "domestic_count": 62,
504
+ "abroad_count": 15,
505
+ "condition": "Leptospirosis",
506
+ "category": "Animal-borne diseases",
507
+ "recon_prov": "Reconciled"
508
+ },
509
+ {
510
+ "condition_identifier": "leptospirosis",
511
+ "na_reason": "",
512
+ "year": 2021,
513
+ "domestic_count": 69,
514
+ "abroad_count": 22,
515
+ "condition": "Leptospirosis",
516
+ "category": "Animal-borne diseases",
517
+ "recon_prov": "Reconciled"
518
+ }
519
+ ]
520
+ }
@@ -49,6 +49,7 @@ const Annotations = ({ xScale, yScale, xScaleAnnotation, xMax, svgRef, onDragSta
49
49
 
50
50
  return (
51
51
  <AnnotationComponent
52
+ key={`annotation-${index}`}
52
53
  width={200}
53
54
  height={height}
54
55
  dx={annotation.dx} // label position
@@ -51,7 +51,7 @@ const AnnotationDropdown = () => {
51
51
  }}
52
52
  tabIndex={0}
53
53
  onKeyDown={e => {
54
- if (e.keyCode === 13) {
54
+ if (e.key === 'Enter') {
55
55
  setExpanded(!expanded)
56
56
  }
57
57
  }}