@cdc/chart 4.25.8 → 4.25.11
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/.claude/settings.local.json +9 -0
- package/dist/{cdcchart-1a1724a1.es.js → cdcchart-dgT_1dIT.es.js} +136 -151
- package/dist/cdcchart.js +44236 -40355
- package/examples/feature/__data__/planet-example-data.json +0 -30
- package/examples/feature/boxplot/valid-boxplot.csv +38 -17
- package/examples/grouped-bar-test.json +400 -0
- package/examples/private/DEV-11825.json +573 -0
- package/examples/private/d.json +382 -0
- package/examples/private/example-2.json +49784 -0
- package/examples/private/f2.json +1 -0
- package/examples/private/f4.json +1577 -0
- package/examples/private/forecast.json +1180 -0
- package/examples/private/lollipop.json +468 -0
- package/examples/private/na.json +913 -0
- package/examples/private/new.json +48756 -0
- package/examples/private/pie-chart-legend.json +904 -0
- package/examples/private/test-data.csv +28 -0
- package/examples/suppressed_tooltip.json +480 -0
- package/index.html +2 -133
- package/package.json +25 -7
- package/src/CdcChart.tsx +9 -13
- package/src/CdcChartComponent.tsx +403 -92
- package/src/_stories/Chart.Anchors.stories.tsx +2 -2
- package/src/_stories/Chart.BoxPlot.stories.tsx +1 -1
- package/src/_stories/Chart.CI.stories.tsx +1 -1
- package/src/_stories/Chart.Combo.stories.tsx +18 -0
- package/src/_stories/Chart.CustomColors.stories.tsx +1 -1
- package/src/_stories/Chart.DynamicSeries.stories.tsx +2 -2
- package/src/_stories/Chart.Filters.stories.tsx +2 -2
- package/src/_stories/Chart.Forecast.stories.tsx +36 -0
- package/src/_stories/Chart.HTMLInDataTable.stories.tsx +520 -0
- package/src/_stories/Chart.Legend.Gradient.stories.tsx +2 -2
- package/src/_stories/Chart.Patterns.stories.tsx +20 -0
- package/src/_stories/Chart.PreserveDecimals.stories.tsx +220 -0
- package/src/_stories/Chart.ScatterPlot.stories.tsx +1 -1
- package/src/_stories/Chart.SmallMultiples.stories.tsx +47 -0
- package/src/_stories/Chart.stories.tsx +8 -5
- package/src/_stories/Chart.tooltip.stories.tsx +1 -1
- package/src/_stories/ChartAnnotation.stories.tsx +7 -4
- package/src/_stories/ChartAxisLabels.stories.tsx +2 -2
- package/src/_stories/ChartAxisTitles.stories.tsx +2 -2
- package/src/_stories/ChartBar.Editor.stories.tsx +3580 -0
- package/src/_stories/ChartEditor.Editor.stories.tsx +658 -0
- package/src/_stories/ChartEditor.stories.tsx +59 -60
- package/src/_stories/ChartLine.Suppression.stories.tsx +1 -1
- package/src/_stories/ChartLine.Symbols.stories.tsx +1 -1
- package/src/_stories/ChartPrefixSuffix.stories.tsx +2 -2
- 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/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/_stories/_mock/stacked-pattern-test.json +520 -0
- package/src/components/Annotations/components/AnnotationDraggable.tsx +1 -0
- package/src/components/Annotations/components/AnnotationDropdown.tsx +1 -1
- package/src/components/Annotations/components/findNearestDatum.ts +6 -41
- package/src/components/AreaChart/components/AreaChart.Stacked.jsx +10 -6
- package/src/components/AreaChart/index.tsx +1 -2
- package/src/components/BarChart/components/BarChart.Horizontal.tsx +161 -22
- package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +138 -5
- package/src/components/BarChart/components/BarChart.StackedVertical.tsx +215 -73
- package/src/components/BarChart/components/BarChart.Vertical.tsx +155 -22
- package/src/components/BarChart/helpers/index.ts +43 -4
- package/src/components/BarChart/helpers/lollipopColors.ts +27 -0
- package/src/components/BarChart/helpers/useBarChart.ts +25 -3
- package/src/components/BoxPlot/BoxPlot.Vertical.tsx +2 -1
- package/src/components/BoxPlot/helpers/index.ts +3 -3
- package/src/components/Brush/BrushChart.tsx +1 -1
- package/src/components/DeviationBar.jsx +9 -6
- package/src/components/EditorPanel/EditorPanel.tsx +563 -229
- package/src/components/EditorPanel/EditorPanelContext.ts +3 -0
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +96 -111
- package/src/components/EditorPanel/components/Panels/Panel.General.tsx +19 -1
- package/src/components/EditorPanel/components/Panels/Panel.PatternSettings.tsx +461 -0
- package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +80 -67
- package/src/components/EditorPanel/components/Panels/Panel.SmallMultiples.tsx +422 -0
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +188 -139
- package/src/components/EditorPanel/components/Panels/index.tsx +5 -1
- package/src/components/EditorPanel/components/Panels/panelVisual.styles.css +0 -8
- package/src/components/EditorPanel/editor-panel.scss +0 -20
- package/src/components/EditorPanel/helpers/updateFieldRankByValue.ts +49 -48
- package/src/components/EditorPanel/useEditorPermissions.ts +7 -15
- package/src/components/Forecasting/Forecasting.tsx +175 -27
- package/src/components/ForestPlot/ForestPlot.tsx +11 -7
- package/src/components/ForestPlot/ForestPlotProps.ts +1 -1
- package/src/components/Legend/Legend.Component.tsx +114 -14
- package/src/components/Legend/helpers/createFormatLabels.tsx +230 -171
- package/src/components/Legend/helpers/getLegendClasses.ts +0 -1
- package/src/components/LegendWrapper.tsx +1 -1
- package/src/components/LineChart/LineChartProps.ts +0 -3
- package/src/components/LineChart/components/LineChart.Circle.tsx +2 -2
- package/src/components/LineChart/helpers.ts +1 -1
- package/src/components/LineChart/index.tsx +38 -15
- package/src/components/LinearChart.tsx +96 -84
- package/src/components/PairedBarChart.jsx +6 -4
- package/src/components/PieChart/PieChart.tsx +170 -54
- package/src/components/Regions/components/Regions.tsx +3 -24
- package/src/components/Sankey/components/Sankey.tsx +7 -1
- package/src/components/Sankey/types/index.ts +1 -1
- package/src/components/ScatterPlot/ScatterPlot.jsx +32 -4
- package/src/components/SmallMultiples/SmallMultipleTile.tsx +198 -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/data/initial-state.js +327 -293
- package/src/helpers/buildForecastPaletteMappings.ts +112 -0
- package/src/helpers/buildForecastPaletteOptions.ts +71 -0
- package/src/helpers/getColorScale.ts +82 -8
- package/src/{hooks/useMinMax.ts → helpers/getMinMax.ts} +14 -7
- package/src/helpers/getNewRuntime.ts +1 -1
- package/src/helpers/getTransformedData.ts +1 -1
- package/src/helpers/getYAxisAutoPadding.ts +53 -0
- package/src/helpers/smallMultiplesHelpers.ts +529 -0
- package/src/hooks/useChartHoverAnalytics.tsx +44 -0
- package/src/hooks/useProgrammaticTooltip.ts +96 -0
- package/src/hooks/useReduceData.ts +105 -70
- package/src/hooks/useScales.ts +88 -34
- package/src/hooks/useSmallMultipleSynchronization.ts +59 -0
- package/src/hooks/useTooltip.tsx +116 -29
- package/src/index.jsx +0 -2
- package/src/scss/main.scss +13 -80
- package/src/store/chart.actions.ts +2 -0
- package/src/store/chart.reducer.ts +5 -1
- package/src/test/CdcChart.test.jsx +8 -3
- package/src/types/ChartConfig.ts +53 -11
- package/src/types/ChartContext.ts +4 -0
- package/vite.config.js +1 -1
- package/vitest.config.ts +16 -0
- package/src/_stories/_mock/pie_data.json +0 -218
- package/src/components/AreaChart/components/AreaChart.jsx +0 -109
- package/src/coreStyles_chart.scss +0 -3
- package/src/helpers/configHelpers.ts +0 -28
- package/src/helpers/generateColorsArray.ts +0 -8
- package/src/helpers/sort.ts +0 -7
- package/src/hooks/useActiveElement.js +0 -19
- package/src/hooks/useChartClasses.js +0 -41
- package/src/hooks/useColorPalette.js +0 -76
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/chart",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.11",
|
|
4
4
|
"description": "React component for visualizing tabular data in various types of charts",
|
|
5
5
|
"moduleName": "CdcChart",
|
|
6
6
|
"main": "dist/cdcchart",
|
|
@@ -26,40 +26,58 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cdc/core": "^4.25.
|
|
29
|
+
"@cdc/core": "^4.25.11",
|
|
30
30
|
"@hello-pangea/dnd": "^16.2.0",
|
|
31
31
|
"@react-spring/web": "^9.7.5",
|
|
32
|
+
"@rollup/plugin-dsv": "^3.0.2",
|
|
33
|
+
"@visx/annotation": "^3.3.0",
|
|
32
34
|
"@visx/axis": "3.12.0",
|
|
35
|
+
"@visx/brush": "^3.12.0",
|
|
33
36
|
"@visx/curve": "3.12.0",
|
|
37
|
+
"@visx/drag": "^3.12.0",
|
|
34
38
|
"@visx/event": "3.12.0",
|
|
35
39
|
"@visx/glyph": "3.12.0",
|
|
36
40
|
"@visx/gradient": "3.12.0",
|
|
41
|
+
"@visx/legend": "3.12.0",
|
|
37
42
|
"@visx/marker": "3.12.0",
|
|
38
43
|
"@visx/mock-data": "3.12.0",
|
|
44
|
+
"@visx/pattern": "^3.0.0",
|
|
45
|
+
"@visx/responsive": "^2.10.0",
|
|
39
46
|
"@visx/scale": "3.12.0",
|
|
40
47
|
"@visx/shape": "3.12.0",
|
|
41
48
|
"@visx/stats": "3.12.0",
|
|
42
49
|
"@visx/text": "3.12.0",
|
|
43
50
|
"@visx/tooltip": "3.12.0",
|
|
51
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
52
|
+
"chroma-js": "3.1.2",
|
|
44
53
|
"d3-array": "3.2.4",
|
|
45
54
|
"d3-format": "^3.1.0",
|
|
46
55
|
"d3-sankey": "^0.12.3",
|
|
47
56
|
"d3-time-format": "4.1.0",
|
|
57
|
+
"dompurify": "^3.1.5",
|
|
58
|
+
"html-react-parser": "5.2.3",
|
|
48
59
|
"js-base64": "^2.5.2",
|
|
49
|
-
"
|
|
60
|
+
"lodash": "^4.17.21",
|
|
61
|
+
"papaparse": "5.5.2",
|
|
62
|
+
"react-accessible-accordion": "^5.0.1",
|
|
50
63
|
"react-icons": "5.5.0",
|
|
51
|
-
"
|
|
64
|
+
"react-tooltip": "5.8.2-beta.3",
|
|
65
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
66
|
+
"use-debounce": "^6.0.1",
|
|
67
|
+
"vite": "^5.4.21",
|
|
68
|
+
"vite-plugin-css-injected-by-js": "^2.4.0",
|
|
69
|
+
"vite-plugin-svgr": "^2.4.0",
|
|
70
|
+
"whatwg-fetch": "3.6.20"
|
|
52
71
|
},
|
|
53
72
|
"peerDependencies": {
|
|
54
73
|
"react": "^18.2.0",
|
|
55
74
|
"react-dom": "^18.2.0"
|
|
56
75
|
},
|
|
57
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "5f09a137c22f454111ab5f4cd7fdf1d2d58e31bd",
|
|
58
77
|
"devDependencies": {
|
|
59
78
|
"@types/d3-array": "^3.2.1",
|
|
60
79
|
"@types/d3-format": "^3.0.4",
|
|
61
80
|
"@types/d3-sankey": "^0.12.4",
|
|
62
|
-
"@types/d3-time-format": "^4.0.3"
|
|
63
|
-
"resize-observer-polyfill": "^1.5.1"
|
|
81
|
+
"@types/d3-time-format": "^4.0.3"
|
|
64
82
|
}
|
|
65
83
|
}
|
package/src/CdcChart.tsx
CHANGED
|
@@ -3,12 +3,11 @@ import CdcChart from './CdcChartComponent'
|
|
|
3
3
|
import { ChartConfig } from './types/ChartConfig'
|
|
4
4
|
import { getFileExtension } from '@cdc/core/helpers/getFileExtension'
|
|
5
5
|
import { isSolrCsv, isSolrJson } from '@cdc/core/helpers/isSolr'
|
|
6
|
-
import
|
|
7
|
-
import 'react-tooltip/dist/react-tooltip.css'
|
|
6
|
+
import { parseCsvWithQuotes } from '@cdc/core/helpers/parseCsvWithQuotes'
|
|
8
7
|
import cacheBustingString from '@cdc/core/helpers/cacheBustingString'
|
|
9
8
|
import Loading from '@cdc/core/components/Loading'
|
|
10
9
|
import _ from 'lodash'
|
|
11
|
-
import EditorContext from '
|
|
10
|
+
import EditorContext from '@cdc/core/contexts/EditorContext'
|
|
12
11
|
interface CdcChartProps {
|
|
13
12
|
configUrl?: string
|
|
14
13
|
isEditor?: boolean
|
|
@@ -50,8 +49,9 @@ const CdcChartWrapper: React.FC<CdcChartProps> = ({
|
|
|
50
49
|
let isUpdateNeeded = false
|
|
51
50
|
|
|
52
51
|
config.filters?.forEach(filter => {
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
const activeValue = Array.isArray(filter.active) ? filter.active.join(',') : filter.active
|
|
53
|
+
if (filter.type === 'url' && qsParams[filter.queryParameter] !== decodeURIComponent(activeValue)) {
|
|
54
|
+
qsParams[filter.queryParameter] = activeValue
|
|
55
55
|
isUpdateNeeded = true
|
|
56
56
|
}
|
|
57
57
|
})
|
|
@@ -102,14 +102,10 @@ const CdcChartWrapper: React.FC<CdcChartProps> = ({
|
|
|
102
102
|
export default CdcChartWrapper
|
|
103
103
|
|
|
104
104
|
const parseCsv = (responseText: string, delimiter = '|') => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
dynamicTyping: true,
|
|
110
|
-
skipEmptyLines: true,
|
|
111
|
-
delimiter
|
|
112
|
-
}).data
|
|
105
|
+
return parseCsvWithQuotes(responseText, {
|
|
106
|
+
delimiter,
|
|
107
|
+
dynamicTyping: true
|
|
108
|
+
})
|
|
113
109
|
}
|
|
114
110
|
|
|
115
111
|
const fetchAndParseData = async (url: string, ext: string) => {
|