@cdc/chart 4.25.10 → 4.26.1
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/dist/{cdcchart-1a1724a1.es.js → cdcchart-dgT_1dIT.es.js} +136 -151
- package/dist/cdcchart.js +44003 -43518
- package/examples/feature/__data__/planet-example-data.json +1 -1
- package/examples/feature/boxplot/valid-boxplot.csv +38 -17
- package/examples/feature/pie/planet-pie-example-config.json +48 -2
- package/examples/private/DEV-11825.json +573 -0
- package/examples/private/DEV-12100.json +1303 -0
- package/examples/private/cat-y.json +1235 -0
- package/examples/private/data-points.json +228 -0
- package/examples/private/height.json +3915 -0
- package/examples/private/links.json +569 -0
- package/examples/private/na.json +913 -0
- package/examples/private/quadrant.txt +30 -0
- package/examples/private/test-data.csv +28 -0
- package/examples/private/test-forecast.json +5510 -0
- package/examples/private/warming-stripe-test.json +2578 -0
- package/examples/private/warming-stripes.json +4763 -0
- package/examples/tech-adoption-with-links.json +560 -0
- package/index.html +16 -140
- package/package.json +6 -5
- package/preview.html +1616 -0
- package/src/CdcChart.tsx +8 -11
- package/src/CdcChartComponent.tsx +329 -124
- package/src/_stories/Chart.Combo.stories.tsx +18 -0
- package/src/_stories/Chart.Forecast.stories.tsx +36 -0
- package/src/_stories/Chart.HTMLInDataTable.stories.tsx +520 -0
- package/src/_stories/Chart.Patterns.stories.tsx +2 -1
- package/src/_stories/Chart.PreserveDecimals.stories.tsx +220 -0
- package/src/_stories/Chart.Regions.Categorical.stories.tsx +148 -0
- package/src/_stories/Chart.Regions.DateScale.stories.tsx +197 -0
- package/src/_stories/Chart.Regions.DateTimeScale.stories.tsx +297 -0
- package/src/_stories/Chart.SmallMultiples.stories.tsx +47 -0
- package/src/_stories/Chart.stories.tsx +8 -0
- package/src/_stories/ChartAnnotation.stories.tsx +6 -3
- package/src/_stories/ChartBar.Editor.stories.tsx +3585 -0
- package/src/_stories/ChartBrush.Editor.stories.tsx +295 -0
- package/src/_stories/ChartBrush.stories.tsx +50 -0
- package/src/_stories/ChartEditor.Editor.stories.tsx +656 -0
- package/src/_stories/ChartEditor.stories.tsx +1 -2
- package/src/_stories/TechAdoptionWithLinks.stories.tsx +27 -0
- package/src/_stories/_mock/brush_enabled.json +326 -0
- package/src/_stories/_mock/brush_mock.json +2 -69
- package/src/_stories/_mock/combo.json +451 -0
- package/src/_stories/_mock/editor-test-configs.json +376 -0
- package/src/_stories/_mock/editor-test-datasets.json +477 -0
- package/src/_stories/_mock/editor-tests/bar-chart-editor-test.json +255 -0
- package/src/_stories/_mock/editor-tests/bar-chart-general-test.json +267 -0
- package/src/_stories/_mock/editor-tests/bar-chart-test.json +237 -0
- package/src/_stories/_mock/forecast_combo_with_gaps.json +913 -0
- package/src/_stories/_mock/horizontal-bars-dynamic-y-axis.json +413 -0
- package/src/_stories/_mock/pie_config.json +257 -62
- package/src/_stories/_mock/small_multiples/small_multiples_bars.json +1944 -0
- package/src/_stories/_mock/small_multiples/small_multiples_big_data_bars.json +1114 -0
- package/src/_stories/_mock/small_multiples/small_multiples_lines.json +2646 -0
- package/src/_stories/_mock/small_multiples/small_multiples_lines_colors.json +1305 -0
- package/src/_stories/_mock/small_multiples/small_multiples_stacked_bars.json +1936 -0
- package/src/components/Annotations/components/findNearestDatum.ts +6 -41
- package/src/components/AreaChart/components/AreaChart.Stacked.jsx +10 -7
- package/src/components/AreaChart/index.tsx +1 -2
- package/src/components/Axis/Categorical.Axis.tsx +6 -7
- package/src/components/BarChart/components/BarChart.Horizontal.tsx +181 -27
- package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +3 -1
- package/src/components/BarChart/components/BarChart.StackedVertical.tsx +1 -0
- package/src/components/BarChart/components/BarChart.Vertical.tsx +8 -9
- package/src/components/BarChart/components/context.tsx +1 -0
- package/src/components/BarChart/helpers/useBarChart.ts +14 -2
- package/src/components/BoxPlot/helpers/index.ts +3 -3
- package/src/components/Brush/BrushSelector.tsx +1258 -0
- package/src/components/Brush/MiniChartPreview.tsx +283 -0
- package/src/components/DeviationBar.jsx +9 -7
- package/src/components/EditorPanel/EditorPanel.tsx +2720 -2586
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +96 -111
- package/src/components/EditorPanel/components/Panels/Panel.ForestPlotSettings.tsx +56 -34
- package/src/components/EditorPanel/components/Panels/Panel.General.tsx +76 -31
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +104 -55
- package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +54 -49
- package/src/components/EditorPanel/components/Panels/Panel.SmallMultiples.tsx +427 -0
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +96 -48
- package/src/components/EditorPanel/components/Panels/index.tsx +3 -1
- package/src/components/EditorPanel/editor-panel.scss +0 -20
- package/src/components/EditorPanel/useEditorPermissions.ts +36 -31
- package/src/components/Forecasting/Forecasting.tsx +139 -21
- package/src/components/Legend/Legend.Component.tsx +16 -9
- package/src/components/Legend/Legend.tsx +3 -2
- package/src/components/Legend/helpers/createFormatLabels.tsx +325 -176
- package/src/components/Legend/helpers/getLegendClasses.ts +0 -1
- package/src/components/Legend/helpers/index.ts +10 -6
- package/src/components/LineChart/LineChartProps.ts +0 -3
- package/src/components/LineChart/helpers.ts +1 -1
- package/src/components/LineChart/index.tsx +36 -13
- package/src/components/LinearChart.tsx +559 -499
- package/src/components/PairedBarChart.jsx +20 -3
- package/src/components/Regions/components/Regions.tsx +366 -144
- package/src/components/Sankey/types/index.ts +1 -1
- package/src/components/ScatterPlot/ScatterPlot.jsx +2 -2
- package/src/components/SmallMultiples/SmallMultipleTile.tsx +202 -0
- package/src/components/SmallMultiples/SmallMultiples.css +32 -0
- package/src/components/SmallMultiples/SmallMultiples.tsx +271 -0
- package/src/components/SmallMultiples/index.ts +2 -0
- package/src/components/WarmingStripes/WarmingStripes.tsx +160 -0
- package/src/components/WarmingStripes/WarmingStripesGradientLegend.css +35 -0
- package/src/components/WarmingStripes/WarmingStripesGradientLegend.tsx +104 -0
- package/src/components/WarmingStripes/index.tsx +3 -0
- package/src/data/initial-state.js +16 -2
- package/src/helpers/buildForecastPaletteOptions.ts +0 -38
- package/src/helpers/calculateHorizontalBarCategoryLabelWidth.ts +57 -0
- package/src/helpers/getColorScale.ts +10 -0
- package/src/{hooks/useMinMax.ts → helpers/getMinMax.ts} +26 -14
- package/src/helpers/getYAxisAutoPadding.ts +53 -0
- package/src/helpers/sizeHelpers.ts +0 -20
- package/src/helpers/smallMultiplesHelpers.ts +529 -0
- package/src/hooks/useChartHoverAnalytics.tsx +10 -9
- package/src/hooks/useProgrammaticTooltip.ts +96 -0
- package/src/hooks/useScales.ts +98 -34
- package/src/hooks/useSmallMultipleSynchronization.ts +59 -0
- package/src/hooks/useTooltip.tsx +91 -25
- package/src/scss/DataTable.scss +0 -4
- package/src/scss/main.scss +18 -83
- package/src/store/chart.actions.ts +2 -0
- package/src/store/chart.reducer.ts +4 -0
- package/src/test/CdcChart.test.jsx +1 -1
- package/src/types/ChartConfig.ts +27 -6
- package/src/types/ChartContext.ts +3 -0
- package/src/types/Label.ts +1 -0
- package/src/utils/analyticsTracking.ts +19 -0
- package/LICENSE +0 -201
- package/src/_stories/_mock/pie_data.json +0 -218
- package/src/components/AreaChart/components/AreaChart.jsx +0 -109
- package/src/components/Brush/BrushChart.tsx +0 -128
- package/src/components/Brush/BrushController.tsx +0 -71
- package/src/components/Brush/types.tsx +0 -8
- package/src/components/BrushChart.tsx +0 -223
- package/src/helpers/sort.ts +0 -7
- package/src/hooks/useActiveElement.js +0 -19
- package/src/hooks/useChartClasses.js +0 -41
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Quadrant Setup
|
|
2
|
+
|
|
3
|
+
When looking at segments, think of them as being arranged in a grid with quadrants
|
|
4
|
+
Starting segment (left quadrants) should always be in Quadrants 2 or 3 (check work)
|
|
5
|
+
Ending segment (right quadrants) should always be in Quadrants 1 and 4 (check work)
|
|
6
|
+
|
|
7
|
+
First Data Point Rules:
|
|
8
|
+
|
|
9
|
+
Position label 0.5rem / 9px above point when segment is in Quadrant 3
|
|
10
|
+
If the point isn't near the x-axis, position label 0.5rem / 9px below point when segment is in Quadrant 1
|
|
11
|
+
If point is 20 pixels or less above x-axis (i.e., it's a low value and close to 0) position label 0.5rem / 9px above and 0.25rem / 4.5px to the left of point
|
|
12
|
+
|
|
13
|
+
Last Data Point Rules:
|
|
14
|
+
Position label 0.5rem / 9px above point when final segment is in Quadrant 4. This also works for when last data point is near x-axis (i.e. it's a low value that's close to 0)
|
|
15
|
+
If the point isn't near the x-axis and final segment is in Quadrant 2, position label 0.5rem / 9px below point
|
|
16
|
+
If the point is 20 pixels or less above x-axis (i.e., it's a low value and close to 0) then position label 0.5rem / 9px above and 0.25rem / 4.5px to the right of point
|
|
17
|
+
|
|
18
|
+
Middle Data Point Rules:
|
|
19
|
+
Position label 0.5rem / 9px above point when starting segment is in Quadrant 3 and ending segment is in Quadrant 4 and the angle created is 0°–180°
|
|
20
|
+
|
|
21
|
+
If the point isn't near the x-axis, position label 0.5rem / 9px below it when starting segment is in Quadrant 2 and ending segment is in Quadrant 1 and the angle created is 1°–179°
|
|
22
|
+
If the point is 20 pixels or less above x-axis (i.e., it's a low value and close to 0) and starting sement is in Quadrant 2 and ending segment is in Quadrant 1 then calculate the angle between the 2 segments:
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
If it's 135°–180° then position the label 0.5rem / 9px above the point
|
|
27
|
+
If it's less than135°, calculate the angle created by the ending segment, if it's 68° or more then position the label 0.5rem / 9px above and 0.5rem / 9px to the right of the point
|
|
28
|
+
Otherwise, position the label 0.5rem / 9px above and 0.5rem / 9px to the left of the point
|
|
29
|
+
Position the label 0.5rem / 9px above and 0.5rem / 9px to the left of the point if starting segment is in Quadrant 3 and ending segment is in Quadrant 1 and the angle created is 92°–269°
|
|
30
|
+
Position the label 0.5rem / 9px above and 0.5rem / 9px to the right of the point if starting segment is in Quadrant 2 and ending segment is in Quadrant 4 and the angle created is 92°–269°
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Date,Cases,Deaths,Hospitalizations,Footnote
|
|
2
|
+
2024-01-01,1250,45,320,"Data collected from <strong>primary sources</strong>
|
|
3
|
+
Preliminary data subject to change"
|
|
4
|
+
2024-02-01,1450,52,385,"Includes <em>confirmed</em> and probable cases"
|
|
5
|
+
2024-03-01,1680,58,425,"Note: Data updated on <a href='#'>March 15, 2024</a>
|
|
6
|
+
May include backlog of cases from previous month"
|
|
7
|
+
2024-04-01,1320,48,350,"<sup>*</sup>Holiday weekend affected reporting
|
|
8
|
+
Data normalized for comparison"
|
|
9
|
+
2024-05-01,980,35,275,"See methodology at <a href='https://example.com'>example.com</a>"
|
|
10
|
+
2024-06-01,750,28,210,"<strong>Note:</strong> New testing protocols implemented
|
|
11
|
+
Results may not be directly comparable to prior months"
|
|
12
|
+
2024-07-01,620,22,180,"Summer decline observed
|
|
13
|
+
Typical seasonal pattern per <em>historical data</em>"
|
|
14
|
+
2024-08-01,890,31,245,"<sup>†</sup>Estimated values based on incomplete reporting"
|
|
15
|
+
2024-09-01,1150,42,310,"Data source: <strong>State Health Departments</strong>
|
|
16
|
+
Reported as of September 30, 2024"
|
|
17
|
+
2024-10-01,1425,50,370,"Includes revisions from <em>prior reporting periods</em>
|
|
18
|
+
See details below"
|
|
19
|
+
2024-11-01,1680,55,415,"<strong>Important:</strong> Reporting delays due to system maintenance
|
|
20
|
+
Data may be updated"
|
|
21
|
+
2024-12-01,1890,62,465,"Year-end summary includes <sup>1</sup>adjustments
|
|
22
|
+
<a href='#notes'>See detailed notes</a>"
|
|
23
|
+
2025-01-01,2150,68,520,"<strong>New Year</strong> reporting period
|
|
24
|
+
Data collection ongoing"
|
|
25
|
+
2025-02-01,1980,61,485,"Preliminary <em>February</em> data
|
|
26
|
+
Subject to revision"
|
|
27
|
+
2025-03-01,1725,54,430,"Latest available data as of <strong>March 10, 2025</strong>
|
|
28
|
+
Updates posted weekly at <a href='https://example.com/updates'>Updates Page</a>"
|