@cdc/chart 4.24.3 → 4.24.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 (39) hide show
  1. package/dist/cdcchart.js +34377 -33726
  2. package/examples/feature/line/line-chart.json +361 -37
  3. package/examples/region-issue.json +2065 -0
  4. package/examples/test.json +5409 -0
  5. package/index.html +13 -11
  6. package/package.json +2 -2
  7. package/src/CdcChart.tsx +159 -89
  8. package/src/_stories/Chart.stories.tsx +8 -0
  9. package/src/_stories/_mock/bar-chart-suppressed.json +474 -0
  10. package/src/components/AreaChart/components/AreaChart.jsx +2 -2
  11. package/src/components/BarChart/components/BarChart.Horizontal.tsx +61 -63
  12. package/src/components/BarChart/components/BarChart.Vertical.tsx +79 -94
  13. package/src/components/DeviationBar.jsx +4 -2
  14. package/src/components/EditorPanel/EditorPanel.tsx +1580 -1924
  15. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +19 -2
  16. package/src/components/EditorPanel/components/Panels/Panel.Sankey.tsx +0 -1
  17. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +4 -5
  18. package/src/components/EditorPanel/editor-panel.scss +0 -724
  19. package/src/components/EditorPanel/useEditorPermissions.js +4 -1
  20. package/src/components/Legend/Legend.Component.tsx +82 -58
  21. package/src/components/Legend/Legend.tsx +5 -1
  22. package/src/components/LineChart/LineChartProps.ts +13 -6
  23. package/src/components/LineChart/components/LineChart.Circle.tsx +22 -11
  24. package/src/components/LineChart/helpers.ts +134 -10
  25. package/src/components/LineChart/index.tsx +69 -42
  26. package/src/components/LinearChart.jsx +156 -139
  27. package/src/components/ZoomBrush.tsx +40 -21
  28. package/src/data/initial-state.js +4 -4
  29. package/src/hooks/useBarChart.js +47 -22
  30. package/src/hooks/useMinMax.ts +21 -2
  31. package/src/hooks/useScales.ts +33 -1
  32. package/src/hooks/useTooltip.tsx +11 -11
  33. package/src/scss/main.scss +80 -5
  34. package/src/types/ChartConfig.ts +3 -13
  35. package/src/types/ChartContext.ts +4 -0
  36. package/src/_stories/ChartLine.preliminary.tsx +0 -19
  37. package/src/_stories/ChartSuppress.stories.tsx +0 -19
  38. package/src/_stories/_mock/suppress_mock.json +0 -911
  39. package/src/helpers/computeMarginBottom.ts +0 -56
package/index.html CHANGED
@@ -5,16 +5,17 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
6
6
  <style>
7
7
  body {
8
- /* max-width: 1000px; */
9
- margin: 0 auto !important;
10
- display: flex;
11
- flex-direction: column;
12
- justify-content: center;
8
+ margin: 0;
9
+ border-top: none !important;
13
10
  }
14
11
 
15
- .react-container + .react-container {
16
- margin-top: 3rem;
12
+ .cdc-map-outer-container {
13
+ min-height: 100vh;
17
14
  }
15
+
16
+ /* .react-container + .react-container {
17
+ margin-top: 3rem;
18
+ } */
18
19
  </style>
19
20
  <link rel="stylesheet prefetch" href="https://www.cdc.gov/TemplatePackage/contrib/libs/bootstrap/latest/css/bootstrap.min.css?_=39423" />
20
21
  <link rel="stylesheet prefetch" href="https://www.cdc.gov/TemplatePackage/4.0/assets/css/app.min.css?_=39423" />
@@ -45,6 +46,7 @@
45
46
  -->
46
47
 
47
48
  <!-- GENERIC CHART TYPES -->
49
+ <!-- <div class="react-container" data-config="/examples/test.json"></div> -->
48
50
  <!-- <div class="react-container" data-config="/examples/private/rvr.json"></div> -->
49
51
  <!-- <div class="react-container" data-config="/examples/feature/filters/url-filter.json"></div> -->
50
52
  <!-- <div class="react-container" data-config="/examples/feature/bar/additional-column-tooltip.json"></div> -->
@@ -69,7 +71,7 @@
69
71
  <!-- <div class="react-container" data-config="/examples/feature/boxplot/boxplot.json"></div> -->
70
72
  <!-- <div class="react-container" data-config="/examples/feature/combo/planet-combo-example-config.json"></div> -->
71
73
  <!-- <div class="react-container" data-config="/examples/feature/combo/right-issues.json"></div> -->
72
- <div class="react-container" data-config="/examples/region-issue.json"></div>
74
+ <!-- <div class="react-container" data-config="/examples/region-issue.json"></div> -->
73
75
 
74
76
  <!-- BAR -->
75
77
  <!-- <div class="react-container" data-config="/examples/feature/bar/planet-example-config.json"></div> -->
@@ -115,7 +117,7 @@
115
117
  <!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/example-bar-chart-nonnumeric.json"></div> -->
116
118
  <!-- <div class="react-container" data-config="/examples/sparkline.json"></div> -->
117
119
  <!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/sparkline-chart-nonnumeric.json"></div> -->
118
- <!-- <div class="react-container" data-config="/examples/feature/bar/lollipop.json"></div> -->
120
+ <!-- <div class="react-container" data-config="/examples/region-issue.json"></div> -->
119
121
  <!-- <div class="react-container" data-config="/examples/feature/tests-non-numerics/stacked-vertical-bar-example-nonnumerics.json"></div> -->
120
122
 
121
123
  <!-- TESTS CUTOFF -->
@@ -141,9 +143,9 @@
141
143
  <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-horizontal/horizontal-stacked.json"></div> -->
142
144
 
143
145
  <!-- VERTICAL BAR CHARTS -->
144
- <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/combo-line-chart.json"></div> -->
146
+ <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/combo-line-chart.json"></div>
145
147
  <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json"></div> -->
146
- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json"></div>
148
+ <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json"></div> -->
147
149
  <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart-confidence.json"></div> -->
148
150
  <!-- <div class="react-container" data-config="/examples/gallery/bar-chart-vertical/vertical-bar-chart.json"></div> -->
149
151
  <!-- <div class="react-container" data-config="https://www.cdc.gov/respiratory-viruses/modules/respiratory-virus-activity/emergency-dept-visits_live.json"></div> -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdc/chart",
3
- "version": "4.24.3",
3
+ "version": "4.24.5",
4
4
  "description": "React component for visualizing tabular data in various types of charts",
5
5
  "moduleName": "CdcChart",
6
6
  "main": "dist/cdcchart",
@@ -60,7 +60,7 @@
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0"
62
62
  },
63
- "gitHead": "9c7ef7ca74f2d2a1e04d923b133fe0fc557a62bf",
63
+ "gitHead": "def85aaf4cd9dc1983e80f2900199f35de82af95",
64
64
  "devDependencies": {
65
65
  "@types/d3-sankey": "^0.12.4",
66
66
  "resize-observer-polyfill": "^1.5.1"
package/src/CdcChart.tsx CHANGED
@@ -1,9 +1,11 @@
1
- import React, { useState, useEffect, useCallback, useRef } from 'react'
1
+ import React, { useState, useEffect, useCallback, useRef, useId } from 'react'
2
2
 
3
3
  // IE11
4
4
  import ResizeObserver from 'resize-observer-polyfill'
5
5
  import 'whatwg-fetch'
6
6
  import * as d3 from 'd3-array'
7
+ import Layout from '@cdc/core/components/Layout'
8
+ import Button from '@cdc/core/components/elements/Button'
7
9
 
8
10
  // External Libraries
9
11
  import { scaleOrdinal } from '@visx/scale'
@@ -34,7 +36,6 @@ import { handleChartAriaLabels } from './helpers/handleChartAriaLabels'
34
36
  import { lineOptions } from './helpers/lineOptions'
35
37
  import { handleLineType } from './helpers/handleLineType'
36
38
  import { generateColorsArray } from './helpers/generateColorsArray'
37
- import { computeMarginBottom } from './helpers/computeMarginBottom'
38
39
  import Loading from '@cdc/core/components/Loading'
39
40
  import Filters from '@cdc/core/components/Filters'
40
41
  import MediaControls from '@cdc/core/components/MediaControls'
@@ -76,6 +77,11 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
76
77
  const [coveLoadedEventRan, setCoveLoadedEventRan] = useState(false)
77
78
  const [dynamicLegendItems, setDynamicLegendItems] = useState<any[]>([])
78
79
  const [imageId] = useState(`cove-${Math.random().toString(16).slice(-4)}`)
80
+ const [brushConfig, setBrushConfig] = useState({
81
+ data: [],
82
+ isActive: false,
83
+ isBrushing: false
84
+ })
79
85
  type Config = typeof config
80
86
  let legendMemo = useRef(new Map()) // map collection
81
87
  let innerContainerRef = useRef()
@@ -94,8 +100,8 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
94
100
  if (config.table && (!config.table?.label || config.table?.label === '')) config.table.label = 'Data Table'
95
101
 
96
102
  const { barBorderClass, lineDatapointClass, contentClasses, sparkLineStyles } = useDataVizClasses(config)
97
-
98
- const handleChartTabbing = !config.legend?.hide ? `legend` : config?.title ? `dataTableSection__${config.title.replace(/\s/g, '')}` : `dataTableSection`
103
+ const legendId = useId()
104
+ const handleChartTabbing = !config.legend?.hide ? legendId : config?.title ? `dataTableSection__${config.title.replace(/\s/g, '')}` : `dataTableSection`
99
105
 
100
106
  const reloadURLData = async () => {
101
107
  if (config.dataUrl) {
@@ -238,8 +244,10 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
238
244
  }
239
245
  if (undefined === newConfig.table.show) newConfig.table.show = !isDashboard
240
246
 
241
- newConfig.series.map(series => {
242
- if (!series.tooltip) series.tooltip = true
247
+ newConfig.series.forEach(series => {
248
+ if (series.tooltip === undefined || series.tooltip === null) {
249
+ series.tooltip = true
250
+ }
243
251
  if (!series.axis) series.axis = 'Left'
244
252
  })
245
253
 
@@ -443,7 +451,7 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
443
451
  if (series.type === 'Forecasting') {
444
452
  newConfig.runtime.forecastingSeriesKeys.push(series)
445
453
  }
446
- if (series.type === 'Bar') {
454
+ if (series.type === 'Bar' || series.type === 'Combo') {
447
455
  newConfig.runtime.barSeriesKeys.push(series.dataKey)
448
456
  }
449
457
  if (series.type === 'Line' || series.type === 'dashed-sm' || series.type === 'dashed-md' || series.type === 'dashed-lg') {
@@ -747,7 +755,7 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
747
755
  }
748
756
 
749
757
  // function calculates the width of given text and its font-size
750
- function getTextWidth(text, font) {
758
+ function getTextWidth(text: string, font: string): number | undefined {
751
759
  const canvas = document.createElement('canvas')
752
760
  const context = canvas.getContext('2d')
753
761
  if (!context) {
@@ -1008,6 +1016,63 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
1008
1016
  return formattedValue
1009
1017
  }
1010
1018
 
1019
+ const Confirm = () => {
1020
+ const confirmDone = e => {
1021
+ if (e) {
1022
+ e.preventDefault()
1023
+ }
1024
+
1025
+ let newConfig = { ...config }
1026
+ delete newConfig.newViz
1027
+
1028
+ updateConfig(newConfig)
1029
+ }
1030
+
1031
+ const styles = {
1032
+ position: 'relative',
1033
+ height: '100vh',
1034
+ width: '100%',
1035
+ display: 'flex',
1036
+ justifyContent: 'center',
1037
+ alignItems: 'center',
1038
+ gridArea: 'content'
1039
+ }
1040
+
1041
+ return (
1042
+ <section className='waiting' style={styles}>
1043
+ <section className='waiting-container'>
1044
+ <h3>Finish Configuring</h3>
1045
+ <p>Set all required options to the left and confirm below to display a preview of the chart.</p>
1046
+ <Button className='btn' style={{ margin: '1em auto' }} disabled={missingRequiredSections()} onClick={e => confirmDone(e)}>
1047
+ I'm Done
1048
+ </Button>
1049
+ </section>
1050
+ </section>
1051
+ )
1052
+ }
1053
+
1054
+ const Error = () => {
1055
+ const styles = {
1056
+ position: 'absolute',
1057
+ background: 'white',
1058
+ zIndex: '999',
1059
+ height: '100vh',
1060
+ width: '100%',
1061
+ display: 'flex',
1062
+ justifyContent: 'center',
1063
+ alignItems: 'center',
1064
+ gridArea: 'content'
1065
+ }
1066
+ return (
1067
+ <section className='waiting' style={styles}>
1068
+ <section className='waiting-container'>
1069
+ <h3>Error With Configuration</h3>
1070
+ <p>{config.runtime.editorErrorMessage}</p>
1071
+ </section>
1072
+ </section>
1073
+ )
1074
+ }
1075
+
1011
1076
  // this is passed DOWN into the various components
1012
1077
  // then they do a lookup based on the bin number as index into here (TT)
1013
1078
  const applyLegendToRow = rowObj => {
@@ -1042,6 +1107,17 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
1042
1107
  // Prevent render if loading
1043
1108
  let body = <Loading />
1044
1109
 
1110
+ const getChartWrapperClasses = () => {
1111
+ const classes = ['chart-container', 'p-relative']
1112
+ if (config.legend.position === 'bottom') classes.push('bottom')
1113
+ if (config.legend.hide) classes.push('legend-hidden')
1114
+ if (lineDatapointClass) classes.push(lineDatapointClass)
1115
+ if (!config.barHasBorder) classes.push('chart-bar--no-border')
1116
+ if (isDebug) classes.push('debug')
1117
+ classes.push(...contentClasses)
1118
+ return classes
1119
+ }
1120
+
1045
1121
  if (!loading) {
1046
1122
  const tableLink = (
1047
1123
  <a href={`#data-table-${config.dataKey}`} className='margin-left-href'>
@@ -1051,80 +1127,77 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
1051
1127
  body = (
1052
1128
  <>
1053
1129
  {isEditor && <EditorPanel />}
1054
- {!missingRequiredSections() && !config.newViz && (
1055
- <div className='cdc-chart-inner-container' aria-label={handleChartAriaLabels(config)} tabIndex={0}>
1056
- <Title showTitle={config.showTitle} isDashboard={isDashboard} title={title} superTitle={config.superTitle} classes={['chart-title', `${config.theme}`, 'cove-component__header']} style={undefined} />
1057
- <SkipTo skipId={handleChartTabbing} skipMessage='Skip Over Chart Container' />
1058
-
1059
- {/* Filters */}
1060
- {config.filters && !externalFilters && config.visualizationType !== 'Spark Line' && <Filters config={config} setConfig={setConfig} setFilteredData={setFilteredData} filteredData={filteredData} excludedData={excludedData} filterData={filterData} dimensions={dimensions} />}
1061
- {/* Visualization */}
1062
- {config?.introText && config.visualizationType !== 'Spark Line' && <section className='introText'>{parse(config.introText)}</section>}
1063
- <div
1064
- style={{ marginBottom: computeMarginBottom(config, legend, currentViewport) }}
1065
- className={`chart-container p-relative ${config.legend.position === 'bottom' ? 'bottom' : ''}${config.legend.hide ? ' legend-hidden' : ''}${lineDatapointClass}${barBorderClass} ${contentClasses.join(' ')} ${isDebug ? 'debug' : ''}`}
1066
- >
1067
- {/* All charts except sparkline */}
1068
- {config.visualizationType !== 'Spark Line' && chartComponents[config.visualizationType]}
1069
-
1070
- {/* Sparkline */}
1071
- {config.visualizationType === 'Spark Line' && (
1072
- <>
1073
- <Filters config={config} setConfig={setConfig} setFilteredData={setFilteredData} filteredData={filteredData} excludedData={excludedData} filterData={filterData} dimensions={dimensions} />
1074
- {config?.introText && (
1075
- <section className='introText' style={{ padding: '0px 0 35px' }}>
1076
- {parse(config.introText)}
1077
- </section>
1078
- )}
1079
- <div style={{ height: `100px`, width: `100%`, ...sparkLineStyles }}>
1080
- <ParentSize>{parent => <SparkLine width={parent.width} height={parent.height} />}</ParentSize>
1081
- </div>
1082
- {description && (
1083
- <div className='subtext' style={{ padding: '35px 0 15px' }}>
1084
- {parse(description)}
1130
+ <Layout.Responsive isEditor={isEditor}>
1131
+ {config.newViz && <Confirm />}
1132
+ {undefined === config.newViz && isEditor && config.runtime && config.runtime?.editorErrorMessage && <Error />}
1133
+ {!missingRequiredSections() && !config.newViz && (
1134
+ <div className='cdc-chart-inner-container cove-component__content' aria-label={handleChartAriaLabels(config)} tabIndex={0}>
1135
+ <Title showTitle={config.showTitle} isDashboard={isDashboard} title={title} superTitle={config.superTitle} classes={['chart-title', `${config.theme}`, 'cove-component__header']} style={undefined} />
1136
+
1137
+ {/* Filters */}
1138
+ {config.filters && !externalFilters && config.visualizationType !== 'Spark Line' && <Filters config={config} setConfig={setConfig} setFilteredData={setFilteredData} filteredData={filteredData} excludedData={excludedData} filterData={filterData} dimensions={dimensions} />}
1139
+ <SkipTo skipId={handleChartTabbing} skipMessage='Skip Over Chart Container' />
1140
+ {/* Visualization */}
1141
+ {config?.introText && config.visualizationType !== 'Spark Line' && <section className='introText'>{parse(config.introText)}</section>}
1142
+ <div className={getChartWrapperClasses().join(' ')}>
1143
+ {/* All charts except sparkline */}
1144
+ {config.visualizationType !== 'Spark Line' && chartComponents[config.visualizationType]}
1145
+ {/* Sparkline */}
1146
+ {config.visualizationType === 'Spark Line' && (
1147
+ <>
1148
+ <Filters config={config} setConfig={setConfig} setFilteredData={setFilteredData} filteredData={filteredData} excludedData={excludedData} filterData={filterData} dimensions={dimensions} />
1149
+ {config?.introText && (
1150
+ <section className='introText' style={{ padding: '0px 0 35px' }}>
1151
+ {parse(config.introText)}
1152
+ </section>
1153
+ )}
1154
+ <div style={{ height: `100px`, width: `100%`, ...sparkLineStyles }}>
1155
+ <ParentSize>{parent => <SparkLine width={parent.width} height={parent.height} />}</ParentSize>
1085
1156
  </div>
1086
- )}
1087
- </>
1157
+ {description && (
1158
+ <div className='subtext' style={{ padding: '35px 0 15px' }}>
1159
+ {parse(description)}
1160
+ </div>
1161
+ )}
1162
+ </>
1163
+ )}
1164
+ {/* Sankey */}
1165
+ {config.visualizationType === 'Sankey' && <ParentSize aria-hidden='true'>{parent => <SankeyChart runtime={config.runtime} width={parent.width} height={parent.height} />}</ParentSize>}
1166
+ {!config.legend.hide && config.visualizationType !== 'Spark Line' && config.visualizationType !== 'Sankey' && <Legend ref={legendRef} />}
1167
+ </div>
1168
+ {/* Link */}
1169
+ {isDashboard && config.table && config.table.show && config.table.showDataTableLink ? tableLink : link && link}
1170
+ {/* Description */}
1171
+ {description && config.visualizationType !== 'Spark Line' && <div className={'column ' + config.isResponsiveTicks ? 'subtext--responsive-ticks' : 'subtext'}>{parse(description)}</div>}
1172
+ {/* buttons */}
1173
+ <MediaControls.Section classes={['download-buttons']}>
1174
+ {config.table.showDownloadImgButton && <MediaControls.Button text='Download Image' title='Download Chart as Image' type='image' state={config} elementToCapture={imageId} />}
1175
+ {config.table.showDownloadPdfButton && <MediaControls.Button text='Download PDF' title='Download Chart as PDF' type='pdf' state={config} elementToCapture={imageId} />}
1176
+ </MediaControls.Section>
1177
+ {/* Data Table */}
1178
+ {((config.xAxis.dataKey && config.table.show && config.visualizationType !== 'Spark Line' && config.visualizationType !== 'Sankey') || (config.visualizationType === 'Sankey' && config.table.show)) && (
1179
+ <DataTable
1180
+ config={config}
1181
+ rawData={config.visualizationType === 'Sankey' ? config?.data?.[0]?.tableData : config.table.customTableConfig ? filterData(config.filters, config.data) : config.data}
1182
+ runtimeData={config.visualizationType === 'Sankey' ? config?.data?.[0]?.tableData : filteredData || excludedData}
1183
+ expandDataTable={config.table.expanded}
1184
+ columns={config.columns}
1185
+ displayDataAsText={displayDataAsText}
1186
+ displayGeoName={displayGeoName}
1187
+ applyLegendToRow={applyLegendToRow}
1188
+ tableTitle={config.table.label}
1189
+ indexTitle={config.table.indexLabel}
1190
+ vizTitle={title}
1191
+ viewport={currentViewport}
1192
+ tabbingId={handleChartTabbing}
1193
+ colorScale={colorScale}
1194
+ />
1088
1195
  )}
1089
- {/* Sankey */}
1090
- {config.visualizationType === 'Sankey' && <ParentSize aria-hidden='true'>{parent => <SankeyChart runtime={config.runtime} width={parent.width} height={parent.height} />}</ParentSize>}
1091
- {!config.legend.hide && config.visualizationType !== 'Spark Line' && config.visualizationType !== 'Sankey' && <Legend ref={legendRef} />}
1196
+ {config?.footnotes && <section className='footnotes'>{parse(config.footnotes)}</section>}
1197
+ {/* show pdf or image button */}
1092
1198
  </div>
1093
- {/* Link */}
1094
- {isDashboard && config.table && config.table.show && config.table.showDataTableLink ? tableLink : link && link}
1095
-
1096
- {/* Description */}
1097
- {description && config.visualizationType !== 'Spark Line' && <div className={'column ' + config.isResponsiveTicks ? 'subtext--responsive-ticks' : 'subtext'}>{parse(description)}</div>}
1098
-
1099
- {/* buttons */}
1100
- <MediaControls.Section classes={['download-buttons']}>
1101
- {config.table.showDownloadImgButton && <MediaControls.Button text='Download Image' title='Download Chart as Image' type='image' state={config} elementToCapture={imageId} />}
1102
- {config.table.showDownloadPdfButton && <MediaControls.Button text='Download PDF' title='Download Chart as PDF' type='pdf' state={config} elementToCapture={imageId} />}
1103
- </MediaControls.Section>
1104
-
1105
- {/* Data Table */}
1106
- {((config.xAxis.dataKey && config.table.show && config.visualizationType !== 'Spark Line' && config.visualizationType !== 'Sankey') || (config.visualizationType === 'Sankey' && config.table.show)) && (
1107
- <DataTable
1108
- config={config}
1109
- rawData={config.visualizationType === 'Sankey' ? config?.data?.[0]?.tableData : config.table.customTableConfig ? filterData(config.filters, config.data) : config.data}
1110
- runtimeData={config.visualizationType === 'Sankey' ? config?.data?.[0]?.tableData : transform.applySuppression(filteredData || excludedData, config.suppressedData)}
1111
- expandDataTable={config.table.expanded}
1112
- columns={config.columns}
1113
- displayDataAsText={displayDataAsText}
1114
- displayGeoName={displayGeoName}
1115
- applyLegendToRow={applyLegendToRow}
1116
- tableTitle={config.table.label}
1117
- indexTitle={config.table.indexLabel}
1118
- vizTitle={title}
1119
- viewport={currentViewport}
1120
- tabbingId={handleChartTabbing}
1121
- colorScale={colorScale}
1122
- />
1123
- )}
1124
- {config?.footnotes && <section className='footnotes'>{parse(config.footnotes)}</section>}
1125
- {/* show pdf or image button */}
1126
- </div>
1127
- )}
1199
+ )}
1200
+ </Layout.Responsive>
1128
1201
  </>
1129
1202
  )
1130
1203
  }
@@ -1135,9 +1208,11 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
1135
1208
  const capitalize = str => {
1136
1209
  return str.charAt(0).toUpperCase() + str.slice(1)
1137
1210
  }
1211
+
1138
1212
  const contextValues = {
1213
+ brushConfig,
1214
+ setBrushConfig,
1139
1215
  capitalize,
1140
- computeMarginBottom,
1141
1216
  getXAxisData,
1142
1217
  getYAxisData,
1143
1218
  config,
@@ -1182,20 +1257,15 @@ export default function CdcChart({ configUrl, config: configObj, isEditor = fals
1182
1257
  setSharedFilter,
1183
1258
  setSharedFilterValue,
1184
1259
  dashboardConfig,
1185
- debugSvg: isDebug
1260
+ debugSvg: isDebug,
1261
+ clean
1186
1262
  }
1187
1263
 
1188
- const classes = ['cdc-open-viz-module', 'type-chart', `${currentViewport}`, `font-${config.fontSize}`, `${config.theme}`]
1189
-
1190
- config.visualizationType === 'Spark Line' && classes.push(`type-sparkline`)
1191
- isEditor && classes.push('spacing-wrapper')
1192
- isEditor && classes.push('isEditor')
1193
-
1194
1264
  return (
1195
1265
  <ConfigContext.Provider value={contextValues}>
1196
- <div className={`${classes.join(' ')}`} ref={outerContainerRef} data-lollipop={config.isLollipopChart} data-download-id={imageId}>
1266
+ <Layout.VisualizationWrapper config={config} isEditor={isEditor} currentViewport={currentViewport} ref={outerContainerRef} imageId={imageId} showEditorPanel={config?.showEditorPanel}>
1197
1267
  {body}
1198
- </div>
1268
+ </Layout.VisualizationWrapper>
1199
1269
  </ConfigContext.Provider>
1200
1270
  )
1201
1271
  }
@@ -1,4 +1,5 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react'
2
+ import SuppressedConfig from './_mock/bar-chart-suppressed.json'
2
3
 
3
4
  import Chart from '../CdcChart'
4
5
 
@@ -185,4 +186,11 @@ export const Lollipop: Story = {
185
186
  }
186
187
  }
187
188
 
189
+ export const Suppression: Story = {
190
+ args: {
191
+ config: SuppressedConfig,
192
+ isEditor: false
193
+ }
194
+ }
195
+
188
196
  export default meta