@cdc/chart 4.26.4 → 4.26.5

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 (93) hide show
  1. package/CONFIG.md +349 -29
  2. package/LICENSE +201 -0
  3. package/dist/cdcchart.js +34247 -32805
  4. package/examples/feature/heatmap/average-age-categorical.json +313 -0
  5. package/examples/feature/heatmap/calendar-heatmap.json +134 -0
  6. package/examples/feature/heatmap/cell-values-bottom-axis.json +181 -0
  7. package/examples/feature/heatmap/sparse-aggregation.json +158 -0
  8. package/examples/private/bump-chart.json +1116 -0
  9. package/examples/private/test-123.json +624 -0
  10. package/package.json +4 -3
  11. package/src/CdcChartComponent.tsx +135 -54
  12. package/src/_stories/Chart.AltText.stories.tsx +136 -0
  13. package/src/_stories/Chart.HeatMap.stories.tsx +187 -0
  14. package/src/_stories/Chart.Sankey.smoke.stories.tsx +62 -0
  15. package/src/_stories/Chart.SmallMultiples.smoke.stories.tsx +29 -0
  16. package/src/_stories/ChartAxisTitles.smoke.stories.tsx +13 -0
  17. package/src/_stories/ChartBar.Editor.stories.tsx +63 -0
  18. package/src/_stories/ChartBrush.Interaction.stories.tsx +112 -0
  19. package/src/_stories/ChartBrush.smoke.stories.tsx +13 -4
  20. package/src/_stories/_mock/alt_text_metadata.json +38 -0
  21. package/src/_stories/_mock/heatmap-average-age-categorical.json +315 -0
  22. package/src/_stories/_mock/heatmap.json +156 -0
  23. package/src/_stories/_mock/reported_pertussis_cases.json +1643 -0
  24. package/src/_stories/_mock/sankey_mock.json +78 -0
  25. package/src/_stories/_mock/small_multiples/small_multiples_lines.json +1 -1
  26. package/src/components/Annotations/components/AnnotationDraggable.tsx +1 -1
  27. package/src/components/Annotations/components/AnnotationDropdown.tsx +5 -2
  28. package/src/components/Axis/LeftAxis.tsx +14 -11
  29. package/src/components/Axis/LeftAxisGridlines.tsx +14 -11
  30. package/src/components/Brush/BrushSelector.tsx +88 -187
  31. package/src/components/Brush/brushInteraction.ts +22 -0
  32. package/src/components/Brush/tests/brushInteraction.test.ts +38 -0
  33. package/src/components/EditorPanel/EditorPanel.tsx +310 -49
  34. package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +13 -0
  35. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +105 -13
  36. package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +1 -0
  37. package/src/components/EditorPanel/components/Panels/Panel.Regions.tsx +5 -0
  38. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +2 -2
  39. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +1 -1
  40. package/src/components/EditorPanel/helpers/getVisualizationTypeConfigUpdate.ts +57 -0
  41. package/src/components/EditorPanel/helpers/tests/getVisualizationTypeConfigUpdate.test.ts +56 -0
  42. package/src/components/EditorPanel/useEditorPermissions.test.tsx +70 -0
  43. package/src/components/EditorPanel/useEditorPermissions.ts +42 -22
  44. package/src/components/HeatMap/components/HeatMap.tsx +762 -0
  45. package/src/components/HeatMap/components/HeatMapGradientLegend.tsx +114 -0
  46. package/src/components/HeatMap/heatmap.constants.ts +13 -0
  47. package/src/components/HeatMap/heatmap.css +71 -0
  48. package/src/components/HeatMap/helpers/index.ts +261 -0
  49. package/src/components/HeatMap/index.tsx +5 -0
  50. package/src/components/HeatMap/tests/HeatMap.test.tsx +1040 -0
  51. package/src/components/HeatMap/tests/helpers.test.ts +167 -0
  52. package/src/components/LineChart/components/LineChart.BumpCircle.tsx +19 -22
  53. package/src/components/LineChart/helpers.test.ts +345 -0
  54. package/src/components/LineChart/helpers.ts +15 -5
  55. package/src/components/LineChart/index.tsx +7 -1
  56. package/src/components/LinearChart/tests/LinearChart.test.tsx +107 -33
  57. package/src/components/LinearChart/tests/mockConfigContext.ts +1 -0
  58. package/src/components/LinearChart.tsx +58 -37
  59. package/src/components/PieChart/PieChart.tsx +4 -1
  60. package/src/components/RadarChart/RadarChart.tsx +3 -1
  61. package/src/components/Regions/components/Regions.tsx +195 -41
  62. package/src/components/Sankey/components/Sankey.tsx +7 -3
  63. package/src/components/Sankey/helpers/getSankeyTooltip.tsx +7 -6
  64. package/src/components/SmallMultiples/SmallMultipleTile.tsx +30 -3
  65. package/src/components/SmallMultiples/SmallMultiples.css +12 -0
  66. package/src/components/SmallMultiples/SmallMultiples.tsx +15 -9
  67. package/src/components/SmallMultiples/tests/SmallMultipleTile.test.tsx +152 -0
  68. package/src/components/Sparkline/components/SparkLine.tsx +4 -9
  69. package/src/components/WarmingStripes/WarmingStripesGradientLegend.css +1 -1
  70. package/src/components/WarmingStripes/WarmingStripesGradientLegend.tsx +2 -2
  71. package/src/data/initial-state.js +11 -0
  72. package/src/helpers/axisLabelFontSize.ts +8 -0
  73. package/src/helpers/bumpChartTooltip.ts +54 -0
  74. package/src/helpers/calculateLeftYAxisWidth.ts +4 -0
  75. package/src/helpers/ensureSpecialChartAxisTypes.ts +11 -0
  76. package/src/helpers/getMinMax.ts +2 -3
  77. package/src/helpers/getYAxisAutoPadding.ts +8 -6
  78. package/src/helpers/getYAxisAutoPaddingMode.ts +17 -0
  79. package/src/helpers/handleChartAriaLabels.ts +23 -10
  80. package/src/helpers/seriesHighlight.ts +26 -0
  81. package/src/helpers/tests/axisLabelFontSize.test.ts +15 -0
  82. package/src/helpers/tests/bumpChartTooltip.test.ts +75 -0
  83. package/src/helpers/tests/ensureSpecialChartAxisTypes.test.ts +30 -0
  84. package/src/helpers/tests/getYAxisAutoPadding.test.ts +37 -0
  85. package/src/helpers/tests/getYAxisAutoPaddingMode.test.ts +90 -0
  86. package/src/helpers/tests/handleChartAriaLabels.test.ts +71 -0
  87. package/src/helpers/tests/seriesHighlight.test.ts +61 -0
  88. package/src/hooks/tests/useScales.test.tsx +105 -0
  89. package/src/hooks/useScales.ts +19 -9
  90. package/src/index.jsx +5 -2
  91. package/src/scss/main.scss +32 -49
  92. package/src/types/ChartConfig.ts +18 -0
  93. package/src/types/ChartContext.ts +2 -0
@@ -0,0 +1,158 @@
1
+ {
2
+ "version": "4.26.6",
3
+ "type": "chart",
4
+ "visualizationType": "HeatMap",
5
+ "visualizationSubType": "regular",
6
+ "title": "Sparse Aggregated Case Rates by Region",
7
+ "showTitle": true,
8
+ "theme": "theme-blue",
9
+ "animate": false,
10
+ "orientation": "vertical",
11
+ "data": [
12
+ {
13
+ "week": "2024-01-01",
14
+ "Northeast": 12,
15
+ "South": 30,
16
+ "West": 18,
17
+ "notes": "Baseline"
18
+ },
19
+ {
20
+ "week": "2024-02-01",
21
+ "Northeast": 18,
22
+ "South": 34,
23
+ "notes": "West missing"
24
+ },
25
+ {
26
+ "week": "2024-03-01",
27
+ "Northeast": 24,
28
+ "South": 29,
29
+ "West": 22,
30
+ "notes": "Stable"
31
+ },
32
+ {
33
+ "week": "2024-03-01",
34
+ "Northeast": 6,
35
+ "South": 7,
36
+ "West": 3,
37
+ "notes": "Late report"
38
+ }
39
+ ],
40
+ "xAxis": {
41
+ "type": "date",
42
+ "dataKey": "week",
43
+ "label": "Week",
44
+ "dateParseFormat": "%Y-%m-%d",
45
+ "dateDisplayFormat": "%b %-d",
46
+ "tickRotation": 45,
47
+ "maxTickRotation": 45,
48
+ "hideAxis": false,
49
+ "hideLabel": false,
50
+ "hideTicks": false
51
+ },
52
+ "yAxis": {
53
+ "type": "categorical",
54
+ "label": "Region",
55
+ "hideAxis": false,
56
+ "hideLabel": false,
57
+ "hideTicks": false,
58
+ "size": 80
59
+ },
60
+ "series": [
61
+ {
62
+ "dataKey": "Northeast",
63
+ "name": "Northeast",
64
+ "type": "HeatMap",
65
+ "axis": "Left",
66
+ "tooltip": true
67
+ },
68
+ {
69
+ "dataKey": "South",
70
+ "name": "South",
71
+ "type": "HeatMap",
72
+ "axis": "Left",
73
+ "tooltip": true
74
+ },
75
+ {
76
+ "dataKey": "West",
77
+ "name": "West",
78
+ "type": "HeatMap",
79
+ "axis": "Left",
80
+ "tooltip": true
81
+ }
82
+ ],
83
+ "columns": {
84
+ "week": {
85
+ "name": "week",
86
+ "label": "Week",
87
+ "dataTable": true
88
+ },
89
+ "Northeast": {
90
+ "name": "Northeast",
91
+ "label": "Northeast",
92
+ "dataTable": true
93
+ },
94
+ "South": {
95
+ "name": "South",
96
+ "label": "South",
97
+ "dataTable": true
98
+ },
99
+ "West": {
100
+ "name": "West",
101
+ "label": "West",
102
+ "dataTable": true
103
+ },
104
+ "notes": {
105
+ "name": "notes",
106
+ "label": "Notes",
107
+ "dataTable": true,
108
+ "tooltips": true
109
+ }
110
+ },
111
+ "heatmap": {
112
+ "cellPadding": 1,
113
+ "rowLabelGap": 32,
114
+ "columnLabelGap": 56,
115
+ "xAxisPosition": "top",
116
+ "showCellValues": false
117
+ },
118
+ "legend": {
119
+ "hide": false,
120
+ "position": "top",
121
+ "style": "gradient",
122
+ "subStyle": "smooth",
123
+ "label": "Cases per 100,000",
124
+ "hideBorder": false
125
+ },
126
+ "general": {
127
+ "palette": {
128
+ "name": "sequential_blue",
129
+ "version": "2.0",
130
+ "isReversed": false
131
+ }
132
+ },
133
+ "tooltips": {
134
+ "opacity": 90,
135
+ "singleSeries": false,
136
+ "dateDisplayFormat": "%B %-d, %Y"
137
+ },
138
+ "dataFormat": {
139
+ "abbreviated": false,
140
+ "roundTo": 0,
141
+ "commas": true
142
+ },
143
+ "table": {
144
+ "showVertical": true,
145
+ "show": true,
146
+ "showDataTableLink": true,
147
+ "expanded": false
148
+ },
149
+ "heights": {
150
+ "vertical": 340,
151
+ "horizontal": 340,
152
+ "mobileVertical": 260
153
+ },
154
+ "filters": [],
155
+ "chartMessage": {
156
+ "noData": "No Data Available"
157
+ }
158
+ }