@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.
- package/CONFIG.md +349 -29
- package/LICENSE +201 -0
- package/dist/cdcchart.js +34247 -32805
- package/examples/feature/heatmap/average-age-categorical.json +313 -0
- package/examples/feature/heatmap/calendar-heatmap.json +134 -0
- package/examples/feature/heatmap/cell-values-bottom-axis.json +181 -0
- package/examples/feature/heatmap/sparse-aggregation.json +158 -0
- package/examples/private/bump-chart.json +1116 -0
- package/examples/private/test-123.json +624 -0
- package/package.json +4 -3
- package/src/CdcChartComponent.tsx +135 -54
- package/src/_stories/Chart.AltText.stories.tsx +136 -0
- package/src/_stories/Chart.HeatMap.stories.tsx +187 -0
- package/src/_stories/Chart.Sankey.smoke.stories.tsx +62 -0
- package/src/_stories/Chart.SmallMultiples.smoke.stories.tsx +29 -0
- package/src/_stories/ChartAxisTitles.smoke.stories.tsx +13 -0
- package/src/_stories/ChartBar.Editor.stories.tsx +63 -0
- package/src/_stories/ChartBrush.Interaction.stories.tsx +112 -0
- package/src/_stories/ChartBrush.smoke.stories.tsx +13 -4
- package/src/_stories/_mock/alt_text_metadata.json +38 -0
- package/src/_stories/_mock/heatmap-average-age-categorical.json +315 -0
- package/src/_stories/_mock/heatmap.json +156 -0
- package/src/_stories/_mock/reported_pertussis_cases.json +1643 -0
- package/src/_stories/_mock/sankey_mock.json +78 -0
- package/src/_stories/_mock/small_multiples/small_multiples_lines.json +1 -1
- package/src/components/Annotations/components/AnnotationDraggable.tsx +1 -1
- package/src/components/Annotations/components/AnnotationDropdown.tsx +5 -2
- package/src/components/Axis/LeftAxis.tsx +14 -11
- package/src/components/Axis/LeftAxisGridlines.tsx +14 -11
- package/src/components/Brush/BrushSelector.tsx +88 -187
- package/src/components/Brush/brushInteraction.ts +22 -0
- package/src/components/Brush/tests/brushInteraction.test.ts +38 -0
- package/src/components/EditorPanel/EditorPanel.tsx +310 -49
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +13 -0
- package/src/components/EditorPanel/components/Panels/Panel.General.tsx +105 -13
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +1 -0
- package/src/components/EditorPanel/components/Panels/Panel.Regions.tsx +5 -0
- package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +2 -2
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +1 -1
- package/src/components/EditorPanel/helpers/getVisualizationTypeConfigUpdate.ts +57 -0
- package/src/components/EditorPanel/helpers/tests/getVisualizationTypeConfigUpdate.test.ts +56 -0
- package/src/components/EditorPanel/useEditorPermissions.test.tsx +70 -0
- package/src/components/EditorPanel/useEditorPermissions.ts +42 -22
- package/src/components/HeatMap/components/HeatMap.tsx +762 -0
- package/src/components/HeatMap/components/HeatMapGradientLegend.tsx +114 -0
- package/src/components/HeatMap/heatmap.constants.ts +13 -0
- package/src/components/HeatMap/heatmap.css +71 -0
- package/src/components/HeatMap/helpers/index.ts +261 -0
- package/src/components/HeatMap/index.tsx +5 -0
- package/src/components/HeatMap/tests/HeatMap.test.tsx +1040 -0
- package/src/components/HeatMap/tests/helpers.test.ts +167 -0
- package/src/components/LineChart/components/LineChart.BumpCircle.tsx +19 -22
- package/src/components/LineChart/helpers.test.ts +345 -0
- package/src/components/LineChart/helpers.ts +15 -5
- package/src/components/LineChart/index.tsx +7 -1
- package/src/components/LinearChart/tests/LinearChart.test.tsx +107 -33
- package/src/components/LinearChart/tests/mockConfigContext.ts +1 -0
- package/src/components/LinearChart.tsx +58 -37
- package/src/components/PieChart/PieChart.tsx +4 -1
- package/src/components/RadarChart/RadarChart.tsx +3 -1
- package/src/components/Regions/components/Regions.tsx +195 -41
- package/src/components/Sankey/components/Sankey.tsx +7 -3
- package/src/components/Sankey/helpers/getSankeyTooltip.tsx +7 -6
- package/src/components/SmallMultiples/SmallMultipleTile.tsx +30 -3
- package/src/components/SmallMultiples/SmallMultiples.css +12 -0
- package/src/components/SmallMultiples/SmallMultiples.tsx +15 -9
- package/src/components/SmallMultiples/tests/SmallMultipleTile.test.tsx +152 -0
- package/src/components/Sparkline/components/SparkLine.tsx +4 -9
- package/src/components/WarmingStripes/WarmingStripesGradientLegend.css +1 -1
- package/src/components/WarmingStripes/WarmingStripesGradientLegend.tsx +2 -2
- package/src/data/initial-state.js +11 -0
- package/src/helpers/axisLabelFontSize.ts +8 -0
- package/src/helpers/bumpChartTooltip.ts +54 -0
- package/src/helpers/calculateLeftYAxisWidth.ts +4 -0
- package/src/helpers/ensureSpecialChartAxisTypes.ts +11 -0
- package/src/helpers/getMinMax.ts +2 -3
- package/src/helpers/getYAxisAutoPadding.ts +8 -6
- package/src/helpers/getYAxisAutoPaddingMode.ts +17 -0
- package/src/helpers/handleChartAriaLabels.ts +23 -10
- package/src/helpers/seriesHighlight.ts +26 -0
- package/src/helpers/tests/axisLabelFontSize.test.ts +15 -0
- package/src/helpers/tests/bumpChartTooltip.test.ts +75 -0
- package/src/helpers/tests/ensureSpecialChartAxisTypes.test.ts +30 -0
- package/src/helpers/tests/getYAxisAutoPadding.test.ts +37 -0
- package/src/helpers/tests/getYAxisAutoPaddingMode.test.ts +90 -0
- package/src/helpers/tests/handleChartAriaLabels.test.ts +71 -0
- package/src/helpers/tests/seriesHighlight.test.ts +61 -0
- package/src/hooks/tests/useScales.test.tsx +105 -0
- package/src/hooks/useScales.ts +19 -9
- package/src/index.jsx +5 -2
- package/src/scss/main.scss +32 -49
- package/src/types/ChartConfig.ts +18 -0
- package/src/types/ChartContext.ts +2 -0
package/src/types/ChartConfig.ts
CHANGED
|
@@ -41,6 +41,7 @@ export type VisualizationType =
|
|
|
41
41
|
| 'Box Plot'
|
|
42
42
|
| 'Deviation Bar'
|
|
43
43
|
| 'Forest Plot'
|
|
44
|
+
| 'HeatMap'
|
|
44
45
|
| 'Horizon Chart'
|
|
45
46
|
| 'Line'
|
|
46
47
|
| 'Paired Bar'
|
|
@@ -53,6 +54,18 @@ export type VisualizationType =
|
|
|
53
54
|
| 'Sankey'
|
|
54
55
|
| 'Bump Chart'
|
|
55
56
|
| 'Warming Stripes'
|
|
57
|
+
|
|
58
|
+
export type HeatMapXAxisPosition = 'top' | 'bottom'
|
|
59
|
+
|
|
60
|
+
export type HeatMapConfig = {
|
|
61
|
+
cellPadding?: number
|
|
62
|
+
rowLabelGap?: number
|
|
63
|
+
columnLabelGap?: number
|
|
64
|
+
colorBucketCount?: number
|
|
65
|
+
xAxisPosition?: HeatMapXAxisPosition
|
|
66
|
+
showCellValues?: boolean
|
|
67
|
+
}
|
|
68
|
+
|
|
56
69
|
export interface PreliminaryDataItem {
|
|
57
70
|
column: string
|
|
58
71
|
displayLegend: boolean
|
|
@@ -143,7 +156,11 @@ type Visual = {
|
|
|
143
156
|
maximumShapeAmount: 7
|
|
144
157
|
}
|
|
145
158
|
|
|
159
|
+
import { type AltTextConfig } from '@cdc/core/types/AltText'
|
|
160
|
+
export type { AltTextConfig }
|
|
161
|
+
|
|
146
162
|
export type AllChartsConfig = {
|
|
163
|
+
altText?: AltTextConfig
|
|
147
164
|
annotations: Annotation[]
|
|
148
165
|
animate: boolean
|
|
149
166
|
general: General
|
|
@@ -174,6 +191,7 @@ export type AllChartsConfig = {
|
|
|
174
191
|
footnotes: Footnotes
|
|
175
192
|
forestPlot: ForestPlotConfigSettings
|
|
176
193
|
formattedData: Object[] & { urlFiltered: boolean }
|
|
194
|
+
heatmap?: HeatMapConfig
|
|
177
195
|
heights: {
|
|
178
196
|
vertical: number
|
|
179
197
|
horizontal: number
|
|
@@ -20,6 +20,8 @@ type SharedChartContext = {
|
|
|
20
20
|
currentViewport?: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
|
|
21
21
|
vizViewport?: 'lg' | 'md' | 'sm' | 'xs' | 'xxs'
|
|
22
22
|
dashboardConfig?: DashboardConfig
|
|
23
|
+
excludedData?: Object[]
|
|
24
|
+
filteredData?: Object[]
|
|
23
25
|
// process top level chart aria label for each chart type
|
|
24
26
|
handleChartAriaLabels: (config: any) => string
|
|
25
27
|
handleDragStateChange: (isDragging: any) => void
|