@cdc/chart 4.25.3 → 4.25.6

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 (86) hide show
  1. package/dist/cdcchart.js +46641 -42561
  2. package/index.html +130 -129
  3. package/package.json +22 -27
  4. package/src/CdcChartComponent.tsx +75 -35
  5. package/src/_stories/Chart.CI.stories.tsx +10 -0
  6. package/src/_stories/Chart.DynamicSeries.stories.tsx +68 -49
  7. package/src/_stories/Chart.stories.tsx +99 -86
  8. package/src/_stories/ChartPrefixSuffix.stories.tsx +29 -32
  9. package/{examples/private/line-issue.json → src/_stories/_mock/barchart_labels.mock.json} +150 -35
  10. package/src/_stories/_mock/dynamic_series_bar_config.json +1 -1
  11. package/src/_stories/_mock/dynamic_series_suppression_mock.json +610 -0
  12. package/{examples/private/not-loading.json → src/_stories/_mock/pie_calculated_area.json} +152 -95
  13. package/src/components/Annotations/components/AnnotationDropdown.tsx +2 -2
  14. package/src/components/AreaChart/components/AreaChart.jsx +33 -5
  15. package/src/components/Axis/Categorical.Axis.tsx +2 -2
  16. package/src/components/BarChart/components/BarChart.Horizontal.tsx +38 -37
  17. package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +18 -8
  18. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +8 -8
  19. package/src/components/BarChart/components/BarChart.Vertical.tsx +47 -36
  20. package/src/components/BarChart/components/{BarChart.jsx → BarChart.tsx} +23 -5
  21. package/src/components/BarChart/components/context.tsx +20 -2
  22. package/src/components/BarChart/helpers/getBarHeights.ts +47 -0
  23. package/src/components/BarChart/helpers/index.ts +5 -2
  24. package/src/components/BarChart/helpers/tests/getBarHeights.test.ts +83 -0
  25. package/src/{hooks → components/BarChart/helpers}/useBarChart.ts +9 -46
  26. package/src/components/BoxPlot/BoxPlot.tsx +2 -1
  27. package/src/components/Brush/BrushChart.tsx +73 -0
  28. package/src/components/Brush/BrushController..tsx +39 -0
  29. package/src/components/DeviationBar.jsx +2 -2
  30. package/src/components/EditorPanel/EditorPanel.tsx +232 -147
  31. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +36 -36
  32. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +52 -25
  33. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +12 -4
  34. package/src/components/EditorPanel/components/Panels/panelVisual.styles.css +8 -0
  35. package/src/components/EditorPanel/useEditorPermissions.ts +5 -5
  36. package/src/components/ForestPlot/ForestPlot.tsx +2 -2
  37. package/src/components/HoverLine/HoverLine.tsx +74 -0
  38. package/src/components/Legend/Legend.Component.tsx +1 -1
  39. package/src/components/Legend/Legend.Suppression.tsx +59 -25
  40. package/src/components/Legend/helpers/createFormatLabels.tsx +28 -0
  41. package/src/components/Legend/helpers/index.ts +1 -1
  42. package/src/components/LineChart/LineChartProps.ts +3 -1
  43. package/src/components/LineChart/components/LineChart.Circle.tsx +72 -119
  44. package/src/components/LineChart/helpers.ts +133 -56
  45. package/src/components/LineChart/index.tsx +106 -55
  46. package/src/components/LinearChart.tsx +178 -198
  47. package/src/components/PairedBarChart.jsx +3 -2
  48. package/src/components/PieChart/PieChart.tsx +127 -102
  49. package/src/components/ScatterPlot/ScatterPlot.jsx +5 -0
  50. package/src/components/Sparkline/components/SparkLine.tsx +80 -18
  51. package/src/data/initial-state.js +11 -6
  52. package/src/helpers/countNumOfTicks.ts +1 -1
  53. package/src/helpers/dataHelpers.ts +23 -2
  54. package/src/helpers/getNewRuntime.ts +35 -0
  55. package/src/helpers/getPiePercent.ts +22 -0
  56. package/src/helpers/getTransformedData.ts +22 -0
  57. package/src/helpers/sizeHelpers.ts +1 -1
  58. package/src/helpers/tests/getNewRuntime.test.ts +82 -0
  59. package/src/helpers/tests/getPiePercent.test.ts +38 -0
  60. package/src/hooks/useMinMax.ts +21 -28
  61. package/src/hooks/useRightAxis.ts +5 -3
  62. package/src/hooks/useScales.ts +15 -6
  63. package/src/hooks/useTooltip.tsx +218 -203
  64. package/src/index.jsx +2 -2
  65. package/src/scss/main.scss +13 -6
  66. package/src/store/chart.actions.ts +2 -6
  67. package/src/store/chart.reducer.ts +23 -23
  68. package/src/types/ChartConfig.ts +11 -3
  69. package/src/types/ChartContext.ts +0 -2
  70. package/examples/private/DEV-8850-2.json +0 -493
  71. package/examples/private/DEV-9822.json +0 -574
  72. package/examples/private/DEV-9840.json +0 -553
  73. package/examples/private/DEV-9850-3.json +0 -461
  74. package/examples/private/chart.json +0 -1084
  75. package/examples/private/ci_formatted.json +0 -202
  76. package/examples/private/ci_issue.json +0 -3016
  77. package/examples/private/completed.json +0 -634
  78. package/examples/private/dem-data-long.csv +0 -20
  79. package/examples/private/dem-data-long.json +0 -36
  80. package/examples/private/demographic_data.csv +0 -157
  81. package/examples/private/demographic_data.json +0 -2654
  82. package/examples/private/demographic_dynamic.json +0 -443
  83. package/examples/private/demographic_standard.json +0 -560
  84. package/examples/private/ehdi.json +0 -29939
  85. package/examples/private/test.json +0 -493
  86. package/src/components/ZoomBrush.tsx +0 -251
@@ -15,49 +15,55 @@ const meta: Meta<typeof Chart> = {
15
15
 
16
16
  type Story = StoryObj<typeof Chart>
17
17
 
18
- export const Top_Suffix: Story = {
18
+ export const Inline_Label: Story = {
19
19
  args: {
20
20
  config: editConfigKeys(barConfig, [
21
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
22
- { path: ['dataFormat', 'suffix'], value: ' Somethings per Something' },
21
+ { path: ['yAxis', 'inlineLabel'], value: ' Somethings per Something' },
23
22
  { path: ['yAxis', 'gridLines'], value: true }
24
23
  ])
25
24
  }
26
25
  }
27
-
28
- export const Top_Suffix_Worst_Case: Story = {
26
+ export const Inline_Label_With_Suffix: Story = {
29
27
  args: {
30
- config: editConfigKeys(annotationConfig, [
31
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
32
- { path: ['dataFormat', 'suffix'], value: ' Somethings per Something' }
28
+ config: editConfigKeys(barConfig, [
29
+ { path: ['yAxis', 'inlineLabel'], value: ' Somethings per Something' },
30
+ { path: ['dataFormat', 'suffix'], value: '%' },
31
+ { path: ['yAxis', 'gridLines'], value: true }
33
32
  ])
34
33
  }
35
34
  }
36
35
 
37
- export const Top_Suffix_With_Options: Story = {
36
+ export const Inline_Label_Worst_Case: Story = {
37
+ args: {
38
+ config: editConfigKeys(annotationConfig, [{ path: ['yAxis', 'inlineLabel'], value: ' Somethings per Something' }])
39
+ }
40
+ }
41
+
42
+ export const Inline_Label_With_Options: Story = {
38
43
  args: {
39
44
  config: editConfigKeys(annotationConfig, [
40
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
45
+ { path: ['yAxis', 'inlineLabel'], value: ' units' },
46
+ { path: ['dataFormat', 'suffix'], value: '' },
41
47
  { path: ['yAxis', 'tickRotation'], value: 45 },
42
48
  { path: ['yAxis', 'tickLabelColor'], value: 'red' }
43
49
  ])
44
50
  }
45
51
  }
46
52
 
47
- export const Top_Suffix_No_Space: Story = {
53
+ export const Inline_Label_No_Space: Story = {
48
54
  args: {
49
55
  config: editConfigKeys(annotationConfig, [
50
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
51
- { path: ['dataFormat', 'suffix'], value: 'lbs' }
56
+ { path: ['yAxis', 'inlineLabel'], value: 'lbs' },
57
+ { path: ['dataFormat', 'suffix'], value: '' }
52
58
  ])
53
59
  }
54
60
  }
55
61
 
56
- export const Top_Suffix_With_Space: Story = {
62
+ export const Inline_Label_With_Space: Story = {
57
63
  args: {
58
64
  config: editConfigKeys(annotationConfig, [
59
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
60
- { path: ['dataFormat', 'suffix'], value: 'lbs of something' }
65
+ { path: ['yAxis', 'inlineLabel'], value: 'lbs of something' },
66
+ { path: ['dataFormat', 'suffix'], value: '' }
61
67
  ])
62
68
  }
63
69
  }
@@ -67,15 +73,7 @@ export const Suffix: Story = {
67
73
  config: annotationConfig
68
74
  }
69
75
  }
70
- export const Top_Prefix: Story = {
71
- args: {
72
- config: editConfigKeys(annotationConfig, [
73
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
74
- { path: ['dataFormat', 'prefix'], value: '$' },
75
- { path: ['dataFormat', 'suffix'], value: '' }
76
- ])
77
- }
78
- }
76
+
79
77
  export const Prefix: Story = {
80
78
  args: {
81
79
  config: editConfigKeys(areaPrefix, [
@@ -85,10 +83,10 @@ export const Prefix: Story = {
85
83
  }
86
84
  }
87
85
 
88
- export const Top_Prefix_And_Suffix: Story = {
86
+ export const Prefix_Suffix_And_Inline_Title: Story = {
89
87
  args: {
90
88
  config: editConfigKeys(annotationConfig, [
91
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
89
+ { path: ['yAxis', 'inlineLabel'], value: 'lbs of something' },
92
90
  { path: ['dataFormat', 'prefix'], value: '$' }
93
91
  ])
94
92
  }
@@ -102,11 +100,11 @@ export const Horizontal_Bar: Story = {
102
100
  }
103
101
  }
104
102
 
105
- export const Top_Suffix_On_Line: Story = {
103
+ export const Inline_Title_On_Line: Story = {
106
104
  args: {
107
105
  config: editConfigKeys(barConfig, [
108
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
109
- { path: ['dataFormat', 'suffix'], value: ' Somethings per Something' },
106
+ { path: ['yAxis', 'inlineLabel'], value: 'lbs of something' },
107
+ { path: ['dataFormat', 'suffix'], value: '' },
110
108
  { path: ['yAxis', 'gridLines'], value: true },
111
109
  { path: ['yAxis', 'labelsAboveGridlines'], value: true },
112
110
  { path: ['yAxis', 'hideAxis'], value: true }
@@ -128,9 +126,8 @@ export const Values_On_Line_All_Suffix: Story = {
128
126
  export const Values_on_Line_Top_Suffix_Only_Area_Worst_Case: Story = {
129
127
  args: {
130
128
  config: editConfigKeys(annotationConfig, [
131
- { path: ['dataFormat', 'onlyShowTopPrefixSuffix'], value: true },
129
+ { path: ['yAxis', 'inlineLabel'], value: ' of something' },
132
130
  { path: ['dataFormat', 'prefix'], value: 'pre' },
133
- { path: ['dataFormat', 'suffix'], value: ' Somethings per Something' },
134
131
  { path: ['yAxis', 'labelsAboveGridlines'], value: true },
135
132
  { path: ['yAxis', 'gridLines'], value: true }
136
133
  ])
@@ -24,11 +24,11 @@
24
24
  "isResponsiveTicks": true,
25
25
  "general": {
26
26
  "annotationDropdownText": "Annotations",
27
- "showDownloadButton": false,
28
27
  "showMissingDataLabel": false,
29
28
  "showSuppressedSymbol": true,
30
29
  "showZeroValueData": false,
31
- "hideNullValue": true
30
+ "hideNullValue": true,
31
+ "showDownloadButton": false
32
32
  },
33
33
  "padding": {
34
34
  "left": 5,
@@ -127,8 +127,8 @@
127
127
  "dataKey": "Year",
128
128
  "label": "Year",
129
129
  "manual": true,
130
- "axisBBox": 52.939998626708984,
131
- "tickWidthMax": 41
130
+ "axisBBox": 62.779998779296875,
131
+ "tickWidthMax": 39
132
132
  },
133
133
  "table": {
134
134
  "label": "Data Table",
@@ -172,6 +172,8 @@
172
172
  "seriesHighlight": [],
173
173
  "style": "boxes",
174
174
  "subStyle": "linear blocks",
175
+ "groupBy": "",
176
+ "shape": "circle",
175
177
  "tickRotation": "",
176
178
  "hideBorder": {
177
179
  "side": false,
@@ -193,7 +195,7 @@
193
195
  "palette": "monochrome-1",
194
196
  "isPaletteReversed": false
195
197
  },
196
- "labels": false,
198
+ "labels": true,
197
199
  "dataFormat": {
198
200
  "commas": false,
199
201
  "prefix": "",
@@ -210,36 +212,14 @@
210
212
  "accent": true,
211
213
  "background": true,
212
214
  "verticalHoverLine": false,
213
- "horizontalHoverLine": false
215
+ "horizontalHoverLine": false,
216
+ "lineDatapointSymbol": "none",
217
+ "maximumShapeAmount": 7
214
218
  },
215
219
  "useLogScale": false,
216
220
  "filterBehavior": "Filter Change",
217
221
  "highlightedBarValues": [],
218
222
  "series": [
219
- {
220
- "dataKey": "American Indian/Alaska Native",
221
- "type": "Line",
222
- "axis": "Left",
223
- "tooltip": true
224
- },
225
- {
226
- "dataKey": "Asian/Pacific Islander",
227
- "type": "Line",
228
- "axis": "Left",
229
- "tooltip": true
230
- },
231
- {
232
- "dataKey": "Black, non-Hispanic",
233
- "type": "Line",
234
- "axis": "Left",
235
- "tooltip": true
236
- },
237
- {
238
- "dataKey": "White, non-Hispanic",
239
- "type": "Line",
240
- "axis": "Left",
241
- "tooltip": true
242
- },
243
223
  {
244
224
  "dataKey": "Hispanic",
245
225
  "type": "Line",
@@ -354,7 +334,7 @@
354
334
  "_owner": null
355
335
  },
356
336
  "content": "Present one or more data trends over time.",
357
- "visualizationType": "Line",
337
+ "visualizationType": "Bar",
358
338
  "datasets": {},
359
339
  "activeVizButtonID": 4,
360
340
  "data": [
@@ -490,8 +470,143 @@
490
470
  "dataFileName": "chart_data 2-6.csv",
491
471
  "dataFileSourceType": "file",
492
472
  "dataDescription": {
493
- "horizontal": true
473
+ "horizontal": false,
474
+ "series": false
494
475
  },
495
- "version": "4.24.10",
496
- "dynamicMarginTop": 0
497
- }
476
+ "version": "4.25.1",
477
+ "dynamicMarginTop": 0,
478
+ "formattedData": [
479
+ {
480
+ "Year": "2007",
481
+ "American Indian/Alaska Native": "1.4",
482
+ "Asian/Pacific Islander": "0.9",
483
+ "Black, non-Hispanic": "2.3",
484
+ "White, non-Hispanic": "1",
485
+ "Hispanic": "1"
486
+ },
487
+ {
488
+ "Year": "2008",
489
+ "American Indian/Alaska Native": "1.8",
490
+ "Asian/Pacific Islander": "0.8",
491
+ "Black, non-Hispanic": "2.2",
492
+ "White, non-Hispanic": "0.9",
493
+ "Hispanic": "0.8"
494
+ },
495
+ {
496
+ "Year": "2009",
497
+ "American Indian/Alaska Native": "1",
498
+ "Asian/Pacific Islander": "0.7",
499
+ "Black, non-Hispanic": "1.7",
500
+ "White, non-Hispanic": "0.8",
501
+ "Hispanic": "0.7"
502
+ },
503
+ {
504
+ "Year": "2010",
505
+ "American Indian/Alaska Native": "1.1",
506
+ "Asian/Pacific Islander": "0.6",
507
+ "Black, non-Hispanic": "1.7",
508
+ "White, non-Hispanic": "0.8",
509
+ "Hispanic": "0.6"
510
+ },
511
+ {
512
+ "Year": "2011",
513
+ "American Indian/Alaska Native": "0.5",
514
+ "Asian/Pacific Islander": "0.4",
515
+ "Black, non-Hispanic": "1.4",
516
+ "White, non-Hispanic": "0.8",
517
+ "Hispanic": "0.4"
518
+ },
519
+ {
520
+ "Year": "2012",
521
+ "American Indian/Alaska Native": "0.7",
522
+ "Asian/Pacific Islander": "0.4",
523
+ "Black, non-Hispanic": "1.1",
524
+ "White, non-Hispanic": "0.8",
525
+ "Hispanic": "0.4"
526
+ },
527
+ {
528
+ "Year": "2013",
529
+ "American Indian/Alaska Native": "0.7",
530
+ "Asian/Pacific Islander": "0.3",
531
+ "Black, non-Hispanic": "0.9",
532
+ "White, non-Hispanic": "0.9",
533
+ "Hispanic": "0.4"
534
+ },
535
+ {
536
+ "Year": "2014",
537
+ "American Indian/Alaska Native": "0.8",
538
+ "Asian/Pacific Islander": "0.3",
539
+ "Black, non-Hispanic": "0.8",
540
+ "White, non-Hispanic": "0.9",
541
+ "Hispanic": "0.3"
542
+ },
543
+ {
544
+ "Year": "2015",
545
+ "American Indian/Alaska Native": "0.7",
546
+ "Asian/Pacific Islander": "0.4",
547
+ "Black, non-Hispanic": "1",
548
+ "White, non-Hispanic": "1.1",
549
+ "Hispanic": "0.3"
550
+ },
551
+ {
552
+ "Year": "2016",
553
+ "American Indian/Alaska Native": "0.5",
554
+ "Asian/Pacific Islander": "0.3",
555
+ "Black, non-Hispanic": "0.9",
556
+ "White, non-Hispanic": "1",
557
+ "Hispanic": "0.3"
558
+ },
559
+ {
560
+ "Year": "2017",
561
+ "American Indian/Alaska Native": "0.7",
562
+ "Asian/Pacific Islander": "0.3",
563
+ "Black, non-Hispanic": "1",
564
+ "White, non-Hispanic": "1.1",
565
+ "Hispanic": "0.3"
566
+ },
567
+ {
568
+ "Year": "2018",
569
+ "American Indian/Alaska Native": "0.9",
570
+ "Asian/Pacific Islander": "0.3",
571
+ "Black, non-Hispanic": "1",
572
+ "White, non-Hispanic": "1",
573
+ "Hispanic": "0.4"
574
+ },
575
+ {
576
+ "Year": "2019",
577
+ "American Indian/Alaska Native": "0.6",
578
+ "Asian/Pacific Islander": "0.3",
579
+ "Black, non-Hispanic": "0.9",
580
+ "White, non-Hispanic": "1",
581
+ "Hispanic": "0.4"
582
+ },
583
+ {
584
+ "Year": "2020",
585
+ "American Indian/Alaska Native": "0.4",
586
+ "Asian/Pacific Islander": "0.2",
587
+ "Black, non-Hispanic": "0.7",
588
+ "White, non-Hispanic": "0.7",
589
+ "Hispanic": "0.3"
590
+ },
591
+ {
592
+ "Year": "2021",
593
+ "American Indian/Alaska Native": "0.4",
594
+ "Asian/Pacific Islander": "0.2",
595
+ "Black, non-Hispanic": "0.9",
596
+ "White, non-Hispanic": "0.6",
597
+ "Hispanic": "0.4"
598
+ },
599
+ {
600
+ "Year": "2022",
601
+ "American Indian/Alaska Native": "0.4",
602
+ "Asian/Pacific Islander": "0.3",
603
+ "Black, non-Hispanic": "1",
604
+ "White, non-Hispanic": "0.6",
605
+ "Hispanic": "0.4"
606
+ }
607
+ ],
608
+ "filters": [],
609
+ "migrations": {
610
+ "addColorMigration": true
611
+ }
612
+ }
@@ -196,7 +196,7 @@
196
196
  ],
197
197
  "tooltips": {
198
198
  "opacity": 90,
199
- "singleSeries": false,
199
+ "singleSeries": true,
200
200
  "dateDisplayFormat": ""
201
201
  },
202
202
  "area": {