@cdc/chart 4.24.7 → 4.24.9
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.js +40313 -37543
- package/examples/cases-year.json +13379 -0
- package/examples/gallery/bar-chart-vertical/combo-line-chart.json +76 -15
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +5 -5
- package/index.html +17 -8
- package/package.json +2 -2
- package/src/CdcChart.tsx +383 -133
- package/src/_stories/Chart.Legend.Gradient.tsx +19 -0
- package/src/_stories/_mock/legend.gradient_mock.json +236 -0
- package/src/components/Annotations/components/AnnotationDraggable.tsx +64 -11
- package/src/components/Axis/Categorical.Axis.tsx +145 -0
- package/src/components/BarChart/components/BarChart.Horizontal.tsx +4 -3
- package/src/components/BarChart/components/BarChart.StackedHorizontal.tsx +1 -1
- package/src/components/BarChart/components/BarChart.StackedVertical.tsx +2 -5
- package/src/components/BarChart/components/BarChart.Vertical.tsx +17 -8
- package/src/components/BarChart/helpers/index.ts +5 -16
- package/src/components/BrushChart.tsx +205 -0
- package/src/components/EditorPanel/EditorPanel.tsx +1766 -509
- package/src/components/EditorPanel/components/Panels/Panel.Annotate.tsx +19 -5
- package/src/components/EditorPanel/components/Panels/Panel.General.tsx +190 -37
- package/src/components/EditorPanel/components/Panels/Panel.Sankey.tsx +43 -7
- package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +4 -4
- package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +1 -11
- package/src/components/EditorPanel/editor-panel.scss +16 -3
- package/src/components/EditorPanel/{useEditorPermissions.js → useEditorPermissions.ts} +90 -19
- package/src/components/Legend/Legend.Component.tsx +185 -193
- package/src/components/Legend/Legend.Suppression.tsx +146 -0
- package/src/components/Legend/Legend.tsx +21 -5
- package/src/components/Legend/helpers/index.ts +33 -3
- package/src/components/LegendWrapper.tsx +26 -0
- package/src/components/LineChart/LineChartProps.ts +1 -18
- package/src/components/LineChart/components/LineChart.BumpCircle.tsx +103 -0
- package/src/components/LineChart/components/LineChart.Circle.tsx +47 -8
- package/src/components/LineChart/helpers.ts +55 -11
- package/src/components/LineChart/index.tsx +113 -38
- package/src/components/LinearChart.tsx +1366 -0
- package/src/components/PieChart/PieChart.tsx +74 -17
- package/src/components/Sankey/index.tsx +22 -16
- package/src/components/Sparkline/components/SparkLine.tsx +2 -2
- package/src/data/initial-state.js +13 -3
- package/src/hooks/useLegendClasses.ts +52 -15
- package/src/hooks/useMinMax.ts +4 -4
- package/src/hooks/useScales.ts +34 -24
- package/src/hooks/useTooltip.tsx +85 -22
- package/src/scss/DataTable.scss +2 -1
- package/src/scss/main.scss +107 -14
- package/src/types/ChartConfig.ts +34 -8
- package/src/types/ChartContext.ts +5 -4
- package/examples/feature/line/line-chart.json +0 -449
- package/src/components/BrushHandle.jsx +0 -17
- package/src/components/LineChart/index.scss +0 -1
|
@@ -22,7 +22,10 @@ const PanelAnnotate: React.FC<PanelProps> = props => {
|
|
|
22
22
|
|
|
23
23
|
if (filter) {
|
|
24
24
|
Object.keys(columns).forEach(key => {
|
|
25
|
-
if (
|
|
25
|
+
if (
|
|
26
|
+
(config.series && config.series.filter(series => series.dataKey === key).length > 0) ||
|
|
27
|
+
(config.confidenceKeys && Object.keys(config.confidenceKeys).includes(key))
|
|
28
|
+
) {
|
|
26
29
|
delete columns[key]
|
|
27
30
|
}
|
|
28
31
|
})
|
|
@@ -45,7 +48,7 @@ const PanelAnnotate: React.FC<PanelProps> = props => {
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
const handleAddAnnotation = () => {
|
|
48
|
-
const svgContainer = document.querySelector('.chart-container
|
|
51
|
+
const svgContainer = document.querySelector('.chart-container svg')?.getBoundingClientRect()
|
|
49
52
|
const newSvgDims = [svgContainer.width, svgContainer.height]
|
|
50
53
|
|
|
51
54
|
const newAnnotation = {
|
|
@@ -77,7 +80,12 @@ const PanelAnnotate: React.FC<PanelProps> = props => {
|
|
|
77
80
|
seriesKey: '',
|
|
78
81
|
x: 50,
|
|
79
82
|
y: Number(newSvgDims?.[1] / 2),
|
|
80
|
-
xKey:
|
|
83
|
+
xKey:
|
|
84
|
+
config.xAxis.type === 'date'
|
|
85
|
+
? new Date(config?.data?.[0]?.[config.xAxis.dataKey]).getTime()
|
|
86
|
+
: config.xAxis.type === 'categorical'
|
|
87
|
+
? '1/15/2016'
|
|
88
|
+
: '',
|
|
81
89
|
yKey: '',
|
|
82
90
|
dx: 20,
|
|
83
91
|
dy: -20,
|
|
@@ -144,11 +152,17 @@ const PanelAnnotate: React.FC<PanelProps> = props => {
|
|
|
144
152
|
{config?.annotations &&
|
|
145
153
|
config?.annotations.map((annotation, index) => (
|
|
146
154
|
<Accordion key={index}>
|
|
147
|
-
<Accordion.Section
|
|
155
|
+
<Accordion.Section
|
|
156
|
+
title={annotation.text ? annotation.text.substring(0, 15) + '...' : `Annotation ${index + 1}`}
|
|
157
|
+
>
|
|
148
158
|
<div className='annotation-group'>
|
|
149
159
|
<label>
|
|
150
160
|
Annotation Text:
|
|
151
|
-
<textarea
|
|
161
|
+
<textarea
|
|
162
|
+
rows={5}
|
|
163
|
+
value={annotation.text}
|
|
164
|
+
onChange={e => handleAnnotationUpdate(e.target.value, 'text', index)}
|
|
165
|
+
/>
|
|
152
166
|
</label>
|
|
153
167
|
<label>
|
|
154
168
|
Opacity
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { useContext, FC } from 'react'
|
|
2
2
|
|
|
3
3
|
// external libraries
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
AccordionItem,
|
|
6
|
+
AccordionItemHeading,
|
|
7
|
+
AccordionItemPanel,
|
|
8
|
+
AccordionItemButton
|
|
9
|
+
} from 'react-accessible-accordion'
|
|
5
10
|
import { approvedCurveTypes } from '@cdc/core/helpers/lineChartHelpers'
|
|
6
11
|
|
|
7
12
|
// core
|
|
@@ -18,11 +23,24 @@ import { PanelProps } from '../PanelProps'
|
|
|
18
23
|
const PanelGeneral: FC<PanelProps> = props => {
|
|
19
24
|
const { config } = useContext(ConfigContext)
|
|
20
25
|
const { updateField } = useEditorPanelContext()
|
|
21
|
-
const {
|
|
26
|
+
const {
|
|
27
|
+
enabledChartTypes,
|
|
28
|
+
visHasNumbersOnBars,
|
|
29
|
+
visHasaAdditionalLabelsOnBars,
|
|
30
|
+
visHasLabelOnData,
|
|
31
|
+
visSupportsChartHeight,
|
|
32
|
+
visSupportsMobileChartHeight,
|
|
33
|
+
visSupportsSuperTitle,
|
|
34
|
+
visSupportsFootnotes
|
|
35
|
+
} = useEditorPermissions()
|
|
22
36
|
const { visualizationType, visualizationSubType, barStyle } = config
|
|
23
37
|
|
|
24
38
|
const showBarStyleOptions = () => {
|
|
25
|
-
if (
|
|
39
|
+
if (
|
|
40
|
+
(visualizationType === 'Bar' || visualizationType === 'Deviation Bar') &&
|
|
41
|
+
visualizationSubType !== 'stacked' &&
|
|
42
|
+
(config.orientation === 'horizontal' || config.orientation === 'vertical')
|
|
43
|
+
) {
|
|
26
44
|
return ['flat', 'rounded', 'lollipop']
|
|
27
45
|
} else {
|
|
28
46
|
return ['flat', 'rounded']
|
|
@@ -37,30 +55,91 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
37
55
|
<AccordionItemButton>General</AccordionItemButton>
|
|
38
56
|
</AccordionItemHeading>
|
|
39
57
|
<AccordionItemPanel>
|
|
40
|
-
{config?.visualizationType !== 'Sankey' &&
|
|
58
|
+
{config?.visualizationType !== 'Sankey' && (
|
|
59
|
+
<Select
|
|
60
|
+
value={visualizationType}
|
|
61
|
+
fieldName='visualizationType'
|
|
62
|
+
label='Chart Type'
|
|
63
|
+
updateField={updateField}
|
|
64
|
+
options={enabledChartTypes}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
41
67
|
{visSupportsChartHeight() && config.orientation === 'vertical' && (
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
<div className={visSupportsMobileChartHeight() ? 'two-col-inputs' : ''}>
|
|
69
|
+
<TextField
|
|
70
|
+
type='number'
|
|
71
|
+
value={config.heights.vertical}
|
|
72
|
+
section='heights'
|
|
73
|
+
fieldName='vertical'
|
|
74
|
+
label='Chart Height'
|
|
75
|
+
updateField={updateField}
|
|
76
|
+
tooltip={
|
|
77
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
78
|
+
<Tooltip.Target>
|
|
79
|
+
˝
|
|
80
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
81
|
+
</Tooltip.Target>
|
|
82
|
+
<Tooltip.Content>
|
|
83
|
+
<p>
|
|
84
|
+
For some visualization types, such as the Sankey diagram, it may be necessary to adjust the chart
|
|
85
|
+
height for optimal display.
|
|
86
|
+
</p>
|
|
87
|
+
</Tooltip.Content>
|
|
88
|
+
</Tooltip>
|
|
89
|
+
}
|
|
90
|
+
/>
|
|
91
|
+
{visSupportsMobileChartHeight() && config.orientation === 'vertical' && (
|
|
92
|
+
<TextField
|
|
93
|
+
type='number'
|
|
94
|
+
value={config.heights.mobileVertical}
|
|
95
|
+
section='heights'
|
|
96
|
+
fieldName='mobileVertical'
|
|
97
|
+
label='Mobile Height'
|
|
98
|
+
updateField={updateField}
|
|
99
|
+
tooltip={
|
|
100
|
+
<Tooltip style={{ textTransform: 'none' }}>
|
|
101
|
+
<Tooltip.Target>
|
|
102
|
+
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
103
|
+
</Tooltip.Target>
|
|
104
|
+
<Tooltip.Content>
|
|
105
|
+
<p>
|
|
106
|
+
If the chart height is not optimized for mobile, you can adjust the height for better display.
|
|
107
|
+
Not setting a value will default to the chart height.
|
|
108
|
+
</p>
|
|
109
|
+
</Tooltip.Content>
|
|
110
|
+
</Tooltip>
|
|
111
|
+
}
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
116
|
+
{(visualizationType === 'Bar' || visualizationType === 'Combo' || visualizationType === 'Area Chart') && (
|
|
117
|
+
<Select
|
|
118
|
+
value={visualizationSubType || 'Regular'}
|
|
119
|
+
fieldName='visualizationSubType'
|
|
120
|
+
label='Chart Subtype'
|
|
48
121
|
updateField={updateField}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
122
|
+
options={['regular', 'stacked']}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
{visualizationType === 'Area Chart' && visualizationSubType === 'stacked' && (
|
|
126
|
+
<Select
|
|
127
|
+
value={config.stackedAreaChartLineType || 'Linear'}
|
|
128
|
+
fieldName='stackedAreaChartLineType'
|
|
129
|
+
label='Stacked Area Chart Line Type'
|
|
130
|
+
updateField={updateField}
|
|
131
|
+
options={Object.keys(approvedCurveTypes)}
|
|
132
|
+
/>
|
|
133
|
+
)}
|
|
134
|
+
{visualizationType === 'Bar' && (
|
|
135
|
+
<Select
|
|
136
|
+
value={config.orientation || 'vertical'}
|
|
137
|
+
fieldName='orientation'
|
|
138
|
+
label='Orientation'
|
|
139
|
+
updateField={updateField}
|
|
140
|
+
options={['vertical', 'horizontal']}
|
|
59
141
|
/>
|
|
60
142
|
)}
|
|
61
|
-
{(visualizationType === 'Bar' || visualizationType === 'Combo' || visualizationType === 'Area Chart') && <Select value={visualizationSubType || 'Regular'} fieldName='visualizationSubType' label='Chart Subtype' updateField={updateField} options={['regular', 'stacked']} />}
|
|
62
|
-
{visualizationType === 'Area Chart' && visualizationSubType === 'stacked' && <Select value={config.stackedAreaChartLineType || 'Linear'} fieldName='stackedAreaChartLineType' label='Stacked Area Chart Line Type' updateField={updateField} options={Object.keys(approvedCurveTypes)} />}
|
|
63
|
-
{visualizationType === 'Bar' && <Select value={config.orientation || 'vertical'} fieldName='orientation' label='Orientation' updateField={updateField} options={['vertical', 'horizontal']} />}
|
|
64
143
|
{visualizationType === 'Deviation Bar' && <Select label='Orientation' options={['horizontal']} />}
|
|
65
144
|
{(visualizationType === 'Bar' || visualizationType === 'Deviation Bar') && (
|
|
66
145
|
<Select
|
|
@@ -81,11 +160,42 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
81
160
|
}
|
|
82
161
|
/>
|
|
83
162
|
)}
|
|
84
|
-
{(visualizationType === 'Bar' || visualizationType === 'Deviation Bar') && barStyle === 'rounded' &&
|
|
85
|
-
|
|
86
|
-
|
|
163
|
+
{(visualizationType === 'Bar' || visualizationType === 'Deviation Bar') && barStyle === 'rounded' && (
|
|
164
|
+
<Select
|
|
165
|
+
value={config.tipRounding || 'top'}
|
|
166
|
+
fieldName='tipRounding'
|
|
167
|
+
label='tip rounding'
|
|
168
|
+
updateField={updateField}
|
|
169
|
+
options={['top', 'full']}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
{(visualizationType === 'Bar' || visualizationType === 'Deviation Bar') && barStyle === 'rounded' && (
|
|
173
|
+
<Select
|
|
174
|
+
value={config.roundingStyle || 'standard'}
|
|
175
|
+
fieldName='roundingStyle'
|
|
176
|
+
label='rounding style'
|
|
177
|
+
updateField={updateField}
|
|
178
|
+
options={['standard', 'shallow', 'finger']}
|
|
179
|
+
/>
|
|
180
|
+
)}
|
|
181
|
+
{visualizationType === 'Bar' && config.orientation === 'horizontal' && (
|
|
182
|
+
<Select
|
|
183
|
+
value={config.yAxis.labelPlacement || 'Below Bar'}
|
|
184
|
+
section='yAxis'
|
|
185
|
+
fieldName='labelPlacement'
|
|
186
|
+
label='Label Placement'
|
|
187
|
+
updateField={updateField}
|
|
188
|
+
options={['Below Bar', 'On Date/Category Axis']}
|
|
189
|
+
/>
|
|
190
|
+
)}
|
|
87
191
|
{visHasNumbersOnBars() ? (
|
|
88
|
-
<CheckBox
|
|
192
|
+
<CheckBox
|
|
193
|
+
value={config.yAxis.displayNumbersOnBar}
|
|
194
|
+
section='yAxis'
|
|
195
|
+
fieldName='displayNumbersOnBar'
|
|
196
|
+
label={config.isLollipopChart ? 'Display Numbers after Bar' : 'Display Numbers on Bar'}
|
|
197
|
+
updateField={updateField}
|
|
198
|
+
/>
|
|
89
199
|
) : (
|
|
90
200
|
visHasLabelOnData() && (
|
|
91
201
|
<CheckBox
|
|
@@ -99,7 +209,10 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
99
209
|
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
100
210
|
</Tooltip.Target>
|
|
101
211
|
<Tooltip.Content>
|
|
102
|
-
<p>
|
|
212
|
+
<p>
|
|
213
|
+
Selecting this option will <i> not </i> hide the display of "zero value", "suppressed data", or
|
|
214
|
+
"missing data" indicators on the chart (if applicable).
|
|
215
|
+
</p>
|
|
103
216
|
</Tooltip.Content>
|
|
104
217
|
</Tooltip>
|
|
105
218
|
}
|
|
@@ -115,7 +228,19 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
115
228
|
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
116
229
|
</Tooltip.Target>
|
|
117
230
|
<Tooltip.Content>
|
|
118
|
-
|
|
231
|
+
{config.visualizationSubType === 'stacked' && (
|
|
232
|
+
<p>
|
|
233
|
+
We do not recommend using stacked vertical/horizontal bar charts for missing data. If you choose
|
|
234
|
+
to proceed, selecting this option will display 'N/A' in the tooltip hover and data table (e.g.
|
|
235
|
+
nothing will display in chart).
|
|
236
|
+
</p>
|
|
237
|
+
)}
|
|
238
|
+
{config.visualizationSubType !== 'stacked' && (
|
|
239
|
+
<p>
|
|
240
|
+
Selecting this option will display 'N/A' on the Date/Category Axis, in the tooltip hover, and in
|
|
241
|
+
the data table to indicate missing or undefined data values.
|
|
242
|
+
</p>
|
|
243
|
+
)}
|
|
119
244
|
</Tooltip.Content>
|
|
120
245
|
</Tooltip>
|
|
121
246
|
}
|
|
@@ -126,20 +251,27 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
126
251
|
updateField={updateField}
|
|
127
252
|
/>
|
|
128
253
|
<CheckBox
|
|
254
|
+
display={
|
|
255
|
+
config.visualizationSubType === 'stacked' &&
|
|
256
|
+
(config.visualizationType === 'Bar' || config.visualizationType === 'Combo')
|
|
257
|
+
}
|
|
129
258
|
tooltip={
|
|
130
259
|
<Tooltip style={{ textTransform: 'none' }}>
|
|
131
260
|
<Tooltip.Target>
|
|
132
261
|
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
133
262
|
</Tooltip.Target>
|
|
134
263
|
<Tooltip.Content>
|
|
135
|
-
<p>
|
|
264
|
+
<p>
|
|
265
|
+
Selecting 'Remove Null Values' will hide the 'N/A' (no data indicator) when you hover over the
|
|
266
|
+
chart.
|
|
267
|
+
</p>
|
|
136
268
|
</Tooltip.Content>
|
|
137
269
|
</Tooltip>
|
|
138
270
|
}
|
|
139
|
-
value={config.general.
|
|
271
|
+
value={config.general.hideNullValue}
|
|
140
272
|
section='general'
|
|
141
|
-
fieldName='
|
|
142
|
-
label=
|
|
273
|
+
fieldName='hideNullValue'
|
|
274
|
+
label={`Remove "Null" Values From Hover`}
|
|
143
275
|
updateField={updateField}
|
|
144
276
|
/>
|
|
145
277
|
|
|
@@ -150,7 +282,20 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
150
282
|
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
151
283
|
</Tooltip.Target>
|
|
152
284
|
<Tooltip.Content>
|
|
153
|
-
|
|
285
|
+
{config.visualizationSubType !== 'stacked' && (
|
|
286
|
+
<p>
|
|
287
|
+
Selecting this option will show the <i>suppression indicator </i> on the Date/Category axis,
|
|
288
|
+
within tooltips, and in the data table where suppressed data values appear in the Data Series.
|
|
289
|
+
</p>
|
|
290
|
+
)}
|
|
291
|
+
|
|
292
|
+
{config.visualizationSubType === 'stacked' && (
|
|
293
|
+
<p>
|
|
294
|
+
We do not recommend using stacked vertical/horizontal bar charts for suppressed data. If you
|
|
295
|
+
choose to proceed, selecting this option will display the 'suppressed data symbol' in the
|
|
296
|
+
tooltip hover and data table (e.g., nothing will display in the chart).
|
|
297
|
+
</p>
|
|
298
|
+
)}
|
|
154
299
|
</Tooltip.Content>
|
|
155
300
|
</Tooltip>
|
|
156
301
|
}
|
|
@@ -163,7 +308,9 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
163
308
|
</>
|
|
164
309
|
)}
|
|
165
310
|
|
|
166
|
-
{visualizationType === 'Pie' &&
|
|
311
|
+
{visualizationType === 'Pie' && (
|
|
312
|
+
<Select fieldName='pieType' label='Pie Chart Type' updateField={updateField} options={['Regular', 'Donut']} />
|
|
313
|
+
)}
|
|
167
314
|
{visualizationType === 'Line' && (
|
|
168
315
|
<CheckBox
|
|
169
316
|
value={config.allowLineToBarGraph}
|
|
@@ -255,7 +402,10 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
255
402
|
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
256
403
|
</Tooltip.Target>
|
|
257
404
|
<Tooltip.Content>
|
|
258
|
-
<p>
|
|
405
|
+
<p>
|
|
406
|
+
Enter supporting text to display below the data visualization, if applicable. The following HTML tags
|
|
407
|
+
are supported: strong, em, sup, and sub.
|
|
408
|
+
</p>
|
|
259
409
|
</Tooltip.Content>
|
|
260
410
|
</Tooltip>
|
|
261
411
|
}
|
|
@@ -274,7 +424,10 @@ const PanelGeneral: FC<PanelProps> = props => {
|
|
|
274
424
|
<Icon display='question' style={{ marginLeft: '0.5rem' }} />
|
|
275
425
|
</Tooltip.Target>
|
|
276
426
|
<Tooltip.Content>
|
|
277
|
-
<p>
|
|
427
|
+
<p>
|
|
428
|
+
Consider adding footnotes when displaying 'suppressed,' 'no data,' and 'zero values' to ensure
|
|
429
|
+
accurate interpretation of the data.
|
|
430
|
+
</p>
|
|
278
431
|
</Tooltip.Content>
|
|
279
432
|
</Tooltip>
|
|
280
433
|
}
|
|
@@ -3,7 +3,12 @@ import ConfigContext from '../../../../ConfigContext'
|
|
|
3
3
|
import { CheckBox, TextField } from '@cdc/core/components/EditorPanel/Inputs'
|
|
4
4
|
import Button from '@cdc/core/components/elements/Button'
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
AccordionItem,
|
|
8
|
+
AccordionItemHeading,
|
|
9
|
+
AccordionItemPanel,
|
|
10
|
+
AccordionItemButton
|
|
11
|
+
} from 'react-accessible-accordion'
|
|
7
12
|
import EditorPanelContext, { type EditorPanelContext as EPContext } from '../../EditorPanelContext'
|
|
8
13
|
|
|
9
14
|
const SankeySettings = () => {
|
|
@@ -64,21 +69,45 @@ const SankeySettings = () => {
|
|
|
64
69
|
<AccordionItemButton>Sankey Settings</AccordionItemButton>
|
|
65
70
|
</AccordionItemHeading>
|
|
66
71
|
<AccordionItemPanel>
|
|
67
|
-
<p>
|
|
72
|
+
<p>
|
|
73
|
+
Node stories can provide additional details to support public health messaging. COVE can display a maximum of
|
|
74
|
+
3 node stories.
|
|
75
|
+
</p>
|
|
68
76
|
{data?.storyNodeText &&
|
|
69
77
|
data?.storyNodeText.map(({ StoryNode, segmentTextBefore, segmentTextAfter }, i) => (
|
|
70
|
-
<div
|
|
78
|
+
<div
|
|
79
|
+
key={i}
|
|
80
|
+
style={{ border: '1px solid black', margin: '15px auto', padding: '15px', borderRadius: '10px' }}
|
|
81
|
+
>
|
|
71
82
|
<label>
|
|
72
83
|
Story Node Text
|
|
73
|
-
<input
|
|
84
|
+
<input
|
|
85
|
+
type='text'
|
|
86
|
+
value={StoryNode}
|
|
87
|
+
fieldName='StoryNode'
|
|
88
|
+
label='StoryNode'
|
|
89
|
+
onChange={e => updateStoryNode('StoryNode', e.target.value, i)}
|
|
90
|
+
/>
|
|
74
91
|
</label>
|
|
75
92
|
<label>
|
|
76
93
|
Story Text Before
|
|
77
|
-
<input
|
|
94
|
+
<input
|
|
95
|
+
type='text'
|
|
96
|
+
value={segmentTextBefore}
|
|
97
|
+
fieldName='segmentTextBefore'
|
|
98
|
+
label='Segment Text Before'
|
|
99
|
+
onChange={e => updateStoryNode('segmentTextBefore', e.target.value, i)}
|
|
100
|
+
/>
|
|
78
101
|
</label>
|
|
79
102
|
<label>
|
|
80
103
|
Story Text After
|
|
81
|
-
<input
|
|
104
|
+
<input
|
|
105
|
+
type='text'
|
|
106
|
+
value={segmentTextAfter}
|
|
107
|
+
fieldName='segmentTextAfter'
|
|
108
|
+
label='Segment Text After'
|
|
109
|
+
onChange={e => updateStoryNode('segmentTextAfter', e.target.value, i)}
|
|
110
|
+
/>
|
|
82
111
|
</label>
|
|
83
112
|
<Button onClick={e => removeStoryNode(i)} className='btn' style={{ background: 'tomato' }}>
|
|
84
113
|
Remove Story Node
|
|
@@ -97,7 +126,14 @@ const SankeySettings = () => {
|
|
|
97
126
|
Add StoryNode
|
|
98
127
|
</button>
|
|
99
128
|
)}
|
|
100
|
-
{config.
|
|
129
|
+
{config.data?.[0]?.tooltips?.length > 0 && (
|
|
130
|
+
<CheckBox
|
|
131
|
+
value={config.enableTooltips}
|
|
132
|
+
fieldName='enableTooltips'
|
|
133
|
+
label='Enable Tooltips'
|
|
134
|
+
updateField={updateField}
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
101
137
|
</AccordionItemPanel>
|
|
102
138
|
</AccordionItem>
|
|
103
139
|
)
|
|
@@ -59,7 +59,7 @@ const SeriesDropdownLineType = props => {
|
|
|
59
59
|
const supportsLineType = () => {
|
|
60
60
|
let supported = false
|
|
61
61
|
if (config.visualizationSubType === 'stacked') return supported
|
|
62
|
-
const supportedCharts = ['Line', 'dashed-sm', 'dashed-md', 'dashed-lg', 'Area Chart']
|
|
62
|
+
const supportedCharts = ['Line', 'dashed-sm', 'dashed-md', 'dashed-lg', 'Area Chart', 'Bump Chart']
|
|
63
63
|
if (supportedCharts.some(item => item.includes(series.type))) {
|
|
64
64
|
supported = true
|
|
65
65
|
}
|
|
@@ -111,7 +111,7 @@ const SeriesDropdownSeriesType = props => {
|
|
|
111
111
|
Forecasting: 'Forecasting'
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
if (config.visualizationType === 'Line') {
|
|
114
|
+
if (config.visualizationType === 'Line' || config.visualizationType === 'Bump Chart') {
|
|
115
115
|
return {
|
|
116
116
|
Line: 'Line',
|
|
117
117
|
'dashed-sm': 'Small Dashed',
|
|
@@ -122,7 +122,7 @@ const SeriesDropdownSeriesType = props => {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
// Allowable changes
|
|
125
|
-
if (!['Line', 'Combo'].includes(config.visualizationType)) return
|
|
125
|
+
if (!['Line', 'Combo', 'Bump Chart'].includes(config.visualizationType)) return
|
|
126
126
|
return (
|
|
127
127
|
<InputSelect
|
|
128
128
|
initial='Select an option'
|
|
@@ -468,7 +468,7 @@ const SeriesInputWeight = props => {
|
|
|
468
468
|
const SeriesInputName = props => {
|
|
469
469
|
const { series, index: i } = props
|
|
470
470
|
const { config, updateConfig } = useContext(ConfigContext)
|
|
471
|
-
const adjustableNameSeriesTypes = ['Bar', 'Line', 'Area Chart', 'Combo', 'Deviation
|
|
471
|
+
const adjustableNameSeriesTypes = ['Bump Chart', 'Bar', 'Line', 'Area Chart', 'Combo', 'Deviation', 'Paired', 'Scatter', 'dashed-sm', 'dashed-md', 'dashed-lg']
|
|
472
472
|
|
|
473
473
|
if (!adjustableNameSeriesTypes.includes(series.type)) return
|
|
474
474
|
|
|
@@ -57,7 +57,7 @@ const PanelVisual: FC<PanelProps> = props => {
|
|
|
57
57
|
<AccordionItemButton>Visual</AccordionItemButton>
|
|
58
58
|
</AccordionItemHeading>
|
|
59
59
|
<AccordionItemPanel>
|
|
60
|
-
{config.isLollipopChart && (
|
|
60
|
+
{(config.barStyle === 'lollipop' || config.isLollipopChart) && (
|
|
61
61
|
<>
|
|
62
62
|
<fieldset className='header'>
|
|
63
63
|
<legend className='edit-label'>Lollipop Shape</legend>
|
|
@@ -80,7 +80,6 @@ const PanelVisual: FC<PanelProps> = props => {
|
|
|
80
80
|
<Select value={config.lollipopSize ? config.lollipopSize : 'small'} fieldName='lollipopSize' label='Lollipop Size' updateField={updateField} options={['small', 'medium', 'large']} />
|
|
81
81
|
</>
|
|
82
82
|
)}
|
|
83
|
-
|
|
84
83
|
{config.visualizationType === 'Box Plot' && (
|
|
85
84
|
<fieldset className='fieldset fieldset--boxplot'>
|
|
86
85
|
<legend className=''>Box Plot Settings</legend>
|
|
@@ -89,20 +88,16 @@ const PanelVisual: FC<PanelProps> = props => {
|
|
|
89
88
|
<CheckBox value={config.boxplot.plotNonOutlierValues} fieldName='plotNonOutlierValues' section='boxplot' label='Plot non-outlier values' updateField={updateField} />
|
|
90
89
|
</fieldset>
|
|
91
90
|
)}
|
|
92
|
-
|
|
93
91
|
<Select value={config.fontSize} fieldName='fontSize' label='Font Size' updateField={updateField} options={['small', 'medium', 'large']} />
|
|
94
92
|
{visHasBarBorders() && <Select value={config.barHasBorder} fieldName='barHasBorder' label='Bar Borders' updateField={updateField} options={['true', 'false']} />}
|
|
95
93
|
{visCanAnimate() && <CheckBox value={config.animate} fieldName='animate' label='Animate Visualization' updateField={updateField} />}
|
|
96
|
-
|
|
97
94
|
{/*<CheckBox value={config.animateReplay} fieldName="animateReplay" label="Replay Animation When Filters Are Changed" updateField={updateField} />*/}
|
|
98
|
-
|
|
99
95
|
{((config.series?.some(series => series.type === 'Line' || series.type === 'dashed-lg' || series.type === 'dashed-sm' || series.type === 'dashed-md') && config.visualizationType === 'Combo') || config.visualizationType === 'Line') && (
|
|
100
96
|
<>
|
|
101
97
|
<Select value={config.lineDatapointStyle} fieldName='lineDatapointStyle' label='Line Datapoint Style' updateField={updateField} options={['hidden', 'hover', 'always show']} />
|
|
102
98
|
<Select value={config.lineDatapointColor} fieldName='lineDatapointColor' label='Line Datapoint Color' updateField={updateField} options={['Same as Line', 'Lighter than Line']} />
|
|
103
99
|
</>
|
|
104
100
|
)}
|
|
105
|
-
|
|
106
101
|
{/* eslint-disable */}
|
|
107
102
|
<label className='header'>
|
|
108
103
|
<span className='edit-label'>Header Theme</span>
|
|
@@ -248,7 +243,6 @@ const PanelVisual: FC<PanelProps> = props => {
|
|
|
248
243
|
</ul>
|
|
249
244
|
</>
|
|
250
245
|
)}
|
|
251
|
-
|
|
252
246
|
{visHasDataCutoff() && (
|
|
253
247
|
<>
|
|
254
248
|
<TextField
|
|
@@ -275,7 +269,6 @@ const PanelVisual: FC<PanelProps> = props => {
|
|
|
275
269
|
{((config.visualizationType === 'Bar' && config.orientation !== 'horizontal') || config.visualizationType === 'Combo') && <TextField value={config.barThickness} type='number' fieldName='barThickness' label='Bar Thickness' updateField={updateField} />}
|
|
276
270
|
{visSupportsBarSpace() && <TextField type='number' value={config.barSpace || '15'} fieldName='barSpace' label='Bar Space' updateField={updateField} min={0} />}
|
|
277
271
|
{(config.visualizationType === 'Bar' || config.visualizationType === 'Line' || config.visualizationType === 'Combo') && <CheckBox value={config.topAxis.hasLine} section='topAxis' fieldName='hasLine' label='Add Top Axis Line' updateField={updateField} />}
|
|
278
|
-
|
|
279
272
|
{config.visualizationType === 'Spark Line' && (
|
|
280
273
|
<div className='cove-accordion__panel-section checkbox-group'>
|
|
281
274
|
<CheckBox value={visual?.border} section='visual' fieldName='border' label='Show Border' updateField={updateField} />
|
|
@@ -285,10 +278,8 @@ const PanelVisual: FC<PanelProps> = props => {
|
|
|
285
278
|
<CheckBox value={visual?.hideBackgroundColor} section='visual' fieldName='hideBackgroundColor' label='Hide Background Color' updateField={updateField} />
|
|
286
279
|
</div>
|
|
287
280
|
)}
|
|
288
|
-
|
|
289
281
|
{(config.visualizationType === 'Line' || config.visualizationType === 'Combo') && <CheckBox value={config.showLineSeriesLabels} fieldName='showLineSeriesLabels' label='Append Series Name to End of Line Charts' updateField={updateField} />}
|
|
290
282
|
{(config.visualizationType === 'Line' || config.visualizationType === 'Combo') && config.showLineSeriesLabels && <CheckBox value={config.colorMatchLineSeriesLabels} fieldName='colorMatchLineSeriesLabels' label='Match Series Color to Name at End of Line Charts' updateField={updateField} />}
|
|
291
|
-
|
|
292
283
|
{visSupportsTooltipLines() && (
|
|
293
284
|
<>
|
|
294
285
|
<CheckBox value={visual.verticalHoverLine} fieldName='verticalHoverLine' section='visual' label='Vertical Hover Line' updateField={updateField} />
|
|
@@ -314,7 +305,6 @@ const PanelVisual: FC<PanelProps> = props => {
|
|
|
314
305
|
</label>
|
|
315
306
|
)}
|
|
316
307
|
{visHasSingleSeriesTooltip() && <CheckBox value={config.tooltips.singleSeries} fieldName='singleSeries' section='tooltips' label='SHOW HOVER FOR SINGLE DATA SERIES' updateField={updateField} />}
|
|
317
|
-
|
|
318
308
|
<label>
|
|
319
309
|
<span className='edit-label column-heading'>No Data Message</span>
|
|
320
310
|
<input
|
|
@@ -7,9 +7,22 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.cdc-open-viz-module.type-chart {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
.viewport-overrides {
|
|
11
|
+
button {
|
|
12
|
+
width: 100%;
|
|
13
|
+
padding: 1em;
|
|
14
|
+
margin-top: 1em;
|
|
15
|
+
text-align: left;
|
|
16
|
+
|
|
17
|
+
span {
|
|
18
|
+
display: inline-block;
|
|
19
|
+
float: right;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.edit-block {
|
|
24
|
+
margin-top: 0;
|
|
25
|
+
padding: 1em;
|
|
13
26
|
}
|
|
14
27
|
}
|
|
15
28
|
|