@cdc/chart 1.3.4 → 9.22.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 +6 -6
- package/examples/cutoff-example-config.json +2 -0
- package/examples/cutoff-example-data.json +1 -1
- package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +198 -0
- package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +241 -0
- package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +248 -0
- package/examples/gallery/bar-chart-vertical/combo-line-chart.json +137 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +80 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +81 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +68 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +111 -0
- package/examples/gallery/lollipop/lollipop-style-horizontal.json +220 -0
- package/examples/gallery/paired-bar/paired-bar-chart.json +196 -0
- package/examples/horizontal-chart.json +3 -0
- package/examples/paired-bar-data.json +1 -1
- package/examples/paired-bar-example.json +2 -0
- package/examples/planet-combo-example-config.json +2 -0
- package/examples/planet-example-config.json +2 -2
- package/examples/planet-example-data.json +1 -1
- package/examples/planet-pie-example-config.json +2 -0
- package/examples/private/line-test-data.json +22 -0
- package/examples/private/line-test-two.json +216 -0
- package/examples/private/line-test.json +102 -0
- package/examples/stacked-vertical-bar-example.json +228 -0
- package/package.json +3 -3
- package/src/CdcChart.tsx +79 -47
- package/src/components/BarChart.tsx +82 -39
- package/src/components/DataTable.tsx +17 -10
- package/src/components/EditorPanel.js +233 -169
- package/src/components/LineChart.tsx +3 -0
- package/src/components/LinearChart.tsx +171 -77
- package/src/components/PairedBarChart.tsx +139 -42
- package/src/components/PieChart.tsx +31 -6
- package/src/components/SparkLine.js +4 -1
- package/src/components/useIntersectionObserver.tsx +32 -0
- package/src/data/initial-state.js +17 -7
- package/src/hooks/useReduceData.ts +50 -23
- package/src/index.html +5 -9
- package/src/scss/editor-panel.scss +34 -4
- package/src/scss/main.scss +165 -5
- package/src/components/BarStackVertical.js +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Example Stacked Vertical",
|
|
3
|
+
"visualizationType": "Bar",
|
|
4
|
+
"visualizationSubType": "stacked",
|
|
5
|
+
"orientation": "vertical",
|
|
6
|
+
"animate": true,
|
|
7
|
+
"animateReplay": true,
|
|
8
|
+
"yAxis": {
|
|
9
|
+
"hideAxis": false,
|
|
10
|
+
"hideLabel": false,
|
|
11
|
+
"hideTicks": false,
|
|
12
|
+
"size": 50,
|
|
13
|
+
"gridLines": false
|
|
14
|
+
},
|
|
15
|
+
"barThickness": 0.35,
|
|
16
|
+
"height": 300,
|
|
17
|
+
"xAxis": {
|
|
18
|
+
"type": "categorical",
|
|
19
|
+
"hideAxis": false,
|
|
20
|
+
"hideLabel": false,
|
|
21
|
+
"hideTicks": false,
|
|
22
|
+
"size": 75,
|
|
23
|
+
"tickRotation": 0,
|
|
24
|
+
"dataKey": "Date"
|
|
25
|
+
},
|
|
26
|
+
"table": {
|
|
27
|
+
"label": "Data Table",
|
|
28
|
+
"expanded": true,
|
|
29
|
+
"show": true
|
|
30
|
+
},
|
|
31
|
+
"legend": {
|
|
32
|
+
"behavior": "isolate",
|
|
33
|
+
"position": "right",
|
|
34
|
+
"reverseLabelOrder": false
|
|
35
|
+
},
|
|
36
|
+
"series": [
|
|
37
|
+
{
|
|
38
|
+
"dataKey": "Data 1",
|
|
39
|
+
"type": "Bar"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"dataKey": "Data 2",
|
|
43
|
+
"type": "Bar"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"data": [
|
|
47
|
+
{
|
|
48
|
+
"Date": "1/15/2016",
|
|
49
|
+
"Data 1": "90",
|
|
50
|
+
"Data 2": "135",
|
|
51
|
+
"Data 3": "300",
|
|
52
|
+
"Data 4": "95",
|
|
53
|
+
"Data 5": "120",
|
|
54
|
+
"Data 6": "310",
|
|
55
|
+
"Data 7": "40",
|
|
56
|
+
"Data 8": "90",
|
|
57
|
+
"Data 9": "240",
|
|
58
|
+
"Data 10": "60",
|
|
59
|
+
"Data 11": "160",
|
|
60
|
+
"Data 12": "200"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"Date": "2/15/2016",
|
|
64
|
+
"Data 1": "40",
|
|
65
|
+
"Data 2": "90",
|
|
66
|
+
"Data 3": "240",
|
|
67
|
+
"Data 4": "60",
|
|
68
|
+
"Data 5": "160",
|
|
69
|
+
"Data 6": "200",
|
|
70
|
+
"Data 7": "40",
|
|
71
|
+
"Data 8": "90",
|
|
72
|
+
"Data 9": "240",
|
|
73
|
+
"Data 10": "60",
|
|
74
|
+
"Data 11": "160",
|
|
75
|
+
"Data 12": "200"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"Date": "3/15/2016",
|
|
79
|
+
"Data 1": "50",
|
|
80
|
+
"Data 2": "300",
|
|
81
|
+
"Data 3": "290",
|
|
82
|
+
"Data 4": "100",
|
|
83
|
+
"Data 5": "200",
|
|
84
|
+
"Data 6": "250",
|
|
85
|
+
"Data 7": "80",
|
|
86
|
+
"Data 8": "350",
|
|
87
|
+
"Data 9": "300",
|
|
88
|
+
"Data 10": "150",
|
|
89
|
+
"Data 11": "130",
|
|
90
|
+
"Data 12": "100"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"Date": "4/15/2016",
|
|
94
|
+
"Data 1": "120",
|
|
95
|
+
"Data 2": "160",
|
|
96
|
+
"Data 3": "230",
|
|
97
|
+
"Data 4": "180",
|
|
98
|
+
"Data 5": "160",
|
|
99
|
+
"Data 6": "220",
|
|
100
|
+
"Data 7": "40",
|
|
101
|
+
"Data 8": "90",
|
|
102
|
+
"Data 9": "240",
|
|
103
|
+
"Data 10": "60",
|
|
104
|
+
"Data 11": "160",
|
|
105
|
+
"Data 12": "200"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"Date": "5/15/2016",
|
|
109
|
+
"Data 1": "80",
|
|
110
|
+
"Data 2": "350",
|
|
111
|
+
"Data 3": "300",
|
|
112
|
+
"Data 4": "150",
|
|
113
|
+
"Data 5": "130",
|
|
114
|
+
"Data 6": "100",
|
|
115
|
+
"Data 7": "120",
|
|
116
|
+
"Data 8": "160",
|
|
117
|
+
"Data 9": "230",
|
|
118
|
+
"Data 10": "180",
|
|
119
|
+
"Data 11": "160",
|
|
120
|
+
"Data 12": "220"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"Date": "6/15/2016",
|
|
124
|
+
"Data 1": "90",
|
|
125
|
+
"Data 2": "220",
|
|
126
|
+
"Data 3": "320",
|
|
127
|
+
"Data 4": "100",
|
|
128
|
+
"Data 5": "220",
|
|
129
|
+
"Data 6": "300",
|
|
130
|
+
"Data 7": "40",
|
|
131
|
+
"Data 8": "90",
|
|
132
|
+
"Data 9": "240",
|
|
133
|
+
"Data 10": "60",
|
|
134
|
+
"Data 11": "160",
|
|
135
|
+
"Data 12": "200"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"Date": "7/15/2016",
|
|
139
|
+
"Data 1": "120",
|
|
140
|
+
"Data 2": "160",
|
|
141
|
+
"Data 3": "230",
|
|
142
|
+
"Data 4": "180",
|
|
143
|
+
"Data 5": "160",
|
|
144
|
+
"Data 6": "220",
|
|
145
|
+
"Data 7": "80",
|
|
146
|
+
"Data 8": "350",
|
|
147
|
+
"Data 9": "300",
|
|
148
|
+
"Data 10": "150",
|
|
149
|
+
"Data 11": "130",
|
|
150
|
+
"Data 12": "100"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"Date": "8/15/2016",
|
|
154
|
+
"Data 1": "40",
|
|
155
|
+
"Data 2": "90",
|
|
156
|
+
"Data 3": "240",
|
|
157
|
+
"Data 4": "60",
|
|
158
|
+
"Data 5": "160",
|
|
159
|
+
"Data 6": "200",
|
|
160
|
+
"Data 7": "90",
|
|
161
|
+
"Data 8": "135",
|
|
162
|
+
"Data 9": "300",
|
|
163
|
+
"Data 10": "95",
|
|
164
|
+
"Data 11": "120",
|
|
165
|
+
"Data 12": "310"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"Date": "9/15/2016",
|
|
169
|
+
"Data 1": "80",
|
|
170
|
+
"Data 2": "350",
|
|
171
|
+
"Data 3": "300",
|
|
172
|
+
"Data 4": "150",
|
|
173
|
+
"Data 5": "130",
|
|
174
|
+
"Data 6": "100",
|
|
175
|
+
"Data 7": "40",
|
|
176
|
+
"Data 8": "90",
|
|
177
|
+
"Data 9": "240",
|
|
178
|
+
"Data 10": "60",
|
|
179
|
+
"Data 11": "160",
|
|
180
|
+
"Data 12": "200"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"Date": "10/15/2016",
|
|
184
|
+
"Data 1": "80",
|
|
185
|
+
"Data 2": "350",
|
|
186
|
+
"Data 3": "300",
|
|
187
|
+
"Data 4": "150",
|
|
188
|
+
"Data 5": "130",
|
|
189
|
+
"Data 6": "100",
|
|
190
|
+
"Data 7": "90",
|
|
191
|
+
"Data 8": "135",
|
|
192
|
+
"Data 9": "300",
|
|
193
|
+
"Data 10": "95",
|
|
194
|
+
"Data 11": "120",
|
|
195
|
+
"Data 12": "310"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"Date": "11/15/2016",
|
|
199
|
+
"Data 1": "90",
|
|
200
|
+
"Data 2": "135",
|
|
201
|
+
"Data 3": "300",
|
|
202
|
+
"Data 4": "95",
|
|
203
|
+
"Data 5": "120",
|
|
204
|
+
"Data 6": "310",
|
|
205
|
+
"Data 7": "120",
|
|
206
|
+
"Data 8": "160",
|
|
207
|
+
"Data 9": "230",
|
|
208
|
+
"Data 10": "180",
|
|
209
|
+
"Data 11": "160",
|
|
210
|
+
"Data 12": "120"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"Date": "12/15/2016",
|
|
214
|
+
"Data 1": "120",
|
|
215
|
+
"Data 2": "160",
|
|
216
|
+
"Data 3": "230",
|
|
217
|
+
"Data 4": "180",
|
|
218
|
+
"Data 5": "160",
|
|
219
|
+
"Data 6": "220",
|
|
220
|
+
"Data 7": "40",
|
|
221
|
+
"Data 8": "90",
|
|
222
|
+
"Data 9": "240",
|
|
223
|
+
"Data 10": "60",
|
|
224
|
+
"Data 11": "160",
|
|
225
|
+
"Data 12": "200"
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/chart",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.22.9",
|
|
4
4
|
"description": "React component for visualizing tabular data in various types of charts",
|
|
5
5
|
"main": "dist/cdcchart",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@cdc/core": "^
|
|
22
|
+
"@cdc/core": "^9.22.9",
|
|
23
23
|
"@visx/axis": "^1.0.0",
|
|
24
24
|
"@visx/curve": "^1.0.0",
|
|
25
25
|
"@visx/gradient": "^1.0.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"resolutions": {
|
|
51
51
|
"@types/react": "17.x"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "90faf22c91ca0062432607e4599598f9e67c848a"
|
|
54
54
|
}
|
package/src/CdcChart.tsx
CHANGED
|
@@ -14,8 +14,9 @@ import Papa from 'papaparse';
|
|
|
14
14
|
import parse from 'html-react-parser';
|
|
15
15
|
|
|
16
16
|
import Loading from '@cdc/core/components/Loading';
|
|
17
|
-
import DataTransform from '@cdc/core/
|
|
17
|
+
import { DataTransform } from '@cdc/core/helpers/DataTransform';
|
|
18
18
|
import getViewport from '@cdc/core/helpers/getViewport';
|
|
19
|
+
import fetchRemoteData from '@cdc/core/helpers/fetchRemoteData';
|
|
19
20
|
|
|
20
21
|
import PieChart from './components/PieChart';
|
|
21
22
|
import LinearChart from './components/LinearChart';
|
|
@@ -35,8 +36,8 @@ import SparkLine from './components/SparkLine';
|
|
|
35
36
|
import './scss/main.scss';
|
|
36
37
|
|
|
37
38
|
export default function CdcChart(
|
|
38
|
-
{ configUrl, config: configObj, isEditor = false, isDashboard = false, setConfig: setParentConfig, setEditing, hostname} :
|
|
39
|
-
{ configUrl?: string, config?: any, isEditor?: boolean, isDashboard?: boolean, setConfig?, setEditing?, hostname
|
|
39
|
+
{ configUrl, config: configObj, isEditor = false, isDashboard = false, setConfig: setParentConfig, setEditing, hostname,link} :
|
|
40
|
+
{ configUrl?: string, config?: any, isEditor?: boolean, isDashboard?: boolean, setConfig?, setEditing?, hostname?,link?:any }
|
|
40
41
|
) {
|
|
41
42
|
|
|
42
43
|
const transform = new DataTransform();
|
|
@@ -53,7 +54,7 @@ export default function CdcChart(
|
|
|
53
54
|
const [currentViewport, setCurrentViewport] = useState<String>('lg');
|
|
54
55
|
const [dimensions, setDimensions] = useState<Array<Number>>([]);
|
|
55
56
|
const [parentElement, setParentElement] = useState(false)
|
|
56
|
-
const [externalFilters, setExternalFilters] = useState(
|
|
57
|
+
const [externalFilters, setExternalFilters] = useState(null);
|
|
57
58
|
const [container, setContainer] = useState()
|
|
58
59
|
const [coveLoadedEventRan, setCoveLoadedEventRan] = useState(false)
|
|
59
60
|
|
|
@@ -67,6 +68,27 @@ export default function CdcChart(
|
|
|
67
68
|
const date = new Date();
|
|
68
69
|
return new Date(date.getTime() - (date.getTime() % round)).toISOString();
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
const handleChartAriaLabels = (state, testing = false) => {
|
|
73
|
+
if(testing) console.log(`handleChartAriaLabels Testing On:`, state);
|
|
74
|
+
try {
|
|
75
|
+
if(!state.visualizationType) throw Error('handleChartAriaLabels: no visualization type found in state');
|
|
76
|
+
let ariaLabel = '';
|
|
77
|
+
|
|
78
|
+
if(state.visualizationType) {
|
|
79
|
+
ariaLabel += `${state.visualizationType} chart`
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if(state.title && state.visualizationType) {
|
|
83
|
+
ariaLabel += ` with the title: ${state.title}`
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return ariaLabel;
|
|
87
|
+
} catch(e) {
|
|
88
|
+
console.error(e.message)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
70
92
|
const loadConfig = async () => {
|
|
71
93
|
let response = configObj || await (await fetch(configUrl)).json();
|
|
72
94
|
|
|
@@ -232,20 +254,7 @@ export default function CdcChart(
|
|
|
232
254
|
newConfig.runtime.uniqueId = Date.now();
|
|
233
255
|
newConfig.runtime.editorErrorMessage = newConfig.visualizationType === 'Pie' && !newConfig.yAxis.dataKey ? 'Data Key property in Y Axis section must be set for pie charts.' : '';
|
|
234
256
|
|
|
235
|
-
//
|
|
236
|
-
if(!currentData) currentData = newExcludedData;
|
|
237
|
-
|
|
238
|
-
let uniqueXValues = {};
|
|
239
|
-
|
|
240
|
-
if(newConfig.visualizationType !== 'Paired Bar') {
|
|
241
|
-
for(let i = 0; i < currentData.length; i++) {
|
|
242
|
-
if(uniqueXValues[currentData[i][newConfig.xAxis.dataKey]]){
|
|
243
|
-
newConfig.runtime.editorErrorMessage = 'Duplicate keys in data. Try adding a filter.';
|
|
244
|
-
} else {
|
|
245
|
-
uniqueXValues[currentData[i][newConfig.xAxis.dataKey]] = true;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
257
|
+
// if (newConfig.length) newConfig.reverse();
|
|
249
258
|
setConfig(newConfig);
|
|
250
259
|
};
|
|
251
260
|
|
|
@@ -259,6 +268,7 @@ export default function CdcChart(
|
|
|
259
268
|
add = false;
|
|
260
269
|
}
|
|
261
270
|
});
|
|
271
|
+
|
|
262
272
|
if(add) filteredData.push(row);
|
|
263
273
|
});
|
|
264
274
|
return filteredData;
|
|
@@ -375,7 +385,7 @@ export default function CdcChart(
|
|
|
375
385
|
*/
|
|
376
386
|
useEffect(() => {
|
|
377
387
|
|
|
378
|
-
if(externalFilters[0]) {
|
|
388
|
+
if(externalFilters && externalFilters[0]) {
|
|
379
389
|
const hasActiveProperty = externalFilters[0].hasOwnProperty('active')
|
|
380
390
|
|
|
381
391
|
if(!hasActiveProperty) {
|
|
@@ -386,7 +396,7 @@ export default function CdcChart(
|
|
|
386
396
|
}
|
|
387
397
|
}
|
|
388
398
|
|
|
389
|
-
if(externalFilters.length > 0 && externalFilters.length > 0 && externalFilters[0].hasOwnProperty('active')) {
|
|
399
|
+
if(externalFilters && externalFilters.length > 0 && externalFilters.length > 0 && externalFilters[0].hasOwnProperty('active')) {
|
|
390
400
|
let newConfigHere = {...config, filters: externalFilters }
|
|
391
401
|
setConfig(newConfigHere)
|
|
392
402
|
setFilteredData(filterData(externalFilters, excludedData));
|
|
@@ -484,11 +494,10 @@ export default function CdcChart(
|
|
|
484
494
|
|
|
485
495
|
// Format numeric data based on settings in config
|
|
486
496
|
const formatNumber = (num) => {
|
|
487
|
-
if(num === undefined || num ===null) return "";
|
|
488
497
|
// check if value contains comma and remove it. later will add comma below.
|
|
489
498
|
if(String(num).indexOf(',') !== -1) num = num.replaceAll(',', '');
|
|
490
499
|
// if num is NaN return num
|
|
491
|
-
if(isNaN(num)) return num ;
|
|
500
|
+
if(isNaN(num)|| !num) return num ;
|
|
492
501
|
|
|
493
502
|
let original = num;
|
|
494
503
|
let prefix = config.dataFormat.prefix;
|
|
@@ -500,8 +509,8 @@ export default function CdcChart(
|
|
|
500
509
|
};
|
|
501
510
|
|
|
502
511
|
num = numberFromString(num);
|
|
503
|
-
|
|
504
|
-
if(isNaN(num)) {
|
|
512
|
+
|
|
513
|
+
if (isNaN(num)) {
|
|
505
514
|
config.runtime.editorErrorMessage = `Unable to parse number from data ${original}. Try reviewing your data and selections in the Data Series section.`;
|
|
506
515
|
return original
|
|
507
516
|
}
|
|
@@ -510,8 +519,7 @@ export default function CdcChart(
|
|
|
510
519
|
if (config.dataCutoff){
|
|
511
520
|
let cutoff = numberFromString(config.dataCutoff)
|
|
512
521
|
|
|
513
|
-
if(num < cutoff) {
|
|
514
|
-
prefix = '< ' + (prefix || '');
|
|
522
|
+
if(num < cutoff) {
|
|
515
523
|
num = cutoff;
|
|
516
524
|
}
|
|
517
525
|
}
|
|
@@ -560,7 +568,8 @@ export default function CdcChart(
|
|
|
560
568
|
|
|
561
569
|
return (
|
|
562
570
|
<aside id="legend" className={containerClasses.join(' ')} role="region" aria-label="legend" tabIndex={0}>
|
|
563
|
-
{legend.label && <h2>{legend.label}</h2>}
|
|
571
|
+
{legend.label && <h2>{parse(legend.label)}</h2>}
|
|
572
|
+
{legend.description && <p>{parse(legend.description)}</p>}
|
|
564
573
|
<LegendOrdinal
|
|
565
574
|
scale={colorScale}
|
|
566
575
|
itemDirection="row"
|
|
@@ -608,7 +617,7 @@ export default function CdcChart(
|
|
|
608
617
|
</LegendItem>
|
|
609
618
|
)
|
|
610
619
|
})}
|
|
611
|
-
{seriesHighlight.length > 0 && <button className={`legend-reset ${config.theme}`} onClick={highlightReset}>Reset</button>}
|
|
620
|
+
{seriesHighlight.length > 0 && <button className={`legend-reset ${config.theme}`} onClick={highlightReset} tabIndex={0}>Reset</button>}
|
|
612
621
|
</div>
|
|
613
622
|
)}
|
|
614
623
|
</LegendOrdinal>
|
|
@@ -737,18 +746,38 @@ export default function CdcChart(
|
|
|
737
746
|
body = (
|
|
738
747
|
<>
|
|
739
748
|
{isEditor && <EditorPanel />}
|
|
740
|
-
{!missingRequiredSections() && !config.newViz &&
|
|
741
|
-
|
|
749
|
+
{!missingRequiredSections() && !config.newViz && (
|
|
750
|
+
<div className="cdc-chart-inner-container">
|
|
742
751
|
{/* Title */}
|
|
743
|
-
|
|
744
|
-
|
|
752
|
+
|
|
753
|
+
{title && (
|
|
754
|
+
<div
|
|
755
|
+
role="heading"
|
|
756
|
+
className={`chart-title ${config.theme} cove-component__header`}
|
|
757
|
+
aria-level={2}
|
|
758
|
+
>
|
|
759
|
+
{config && (
|
|
760
|
+
<sup className="superTitle">{parse(config.superTitle || '')}</sup>
|
|
761
|
+
)}
|
|
762
|
+
<div>{parse(title)}</div>
|
|
763
|
+
</div>
|
|
764
|
+
)}
|
|
765
|
+
<a
|
|
766
|
+
id="skip-chart-container"
|
|
767
|
+
className="cdcdataviz-sr-only-focusable"
|
|
768
|
+
href={handleChartTabbing}
|
|
769
|
+
>
|
|
745
770
|
Skip Over Chart Container
|
|
746
771
|
</a>
|
|
747
772
|
{/* Filters */}
|
|
748
|
-
{
|
|
773
|
+
{config.filters && !externalFilters && <Filters />}
|
|
749
774
|
{/* Visualization */}
|
|
750
|
-
<
|
|
751
|
-
|
|
775
|
+
{config?.introText && <section className="introText">{parse(config.introText)}</section>}
|
|
776
|
+
<div
|
|
777
|
+
className={`chart-container${
|
|
778
|
+
config.legend.hide ? " legend-hidden" : ""
|
|
779
|
+
}${lineDatapointClass}${barBorderClass} ${contentClasses.join(' ')}`}
|
|
780
|
+
>
|
|
752
781
|
{/* All charts except sparkline */}
|
|
753
782
|
{config.visualizationType !== "Spark Line" &&
|
|
754
783
|
chartComponents[visualizationType]
|
|
@@ -770,20 +799,22 @@ export default function CdcChart(
|
|
|
770
799
|
</>
|
|
771
800
|
)
|
|
772
801
|
}
|
|
773
|
-
|
|
774
802
|
{/* Legend */}
|
|
775
|
-
|
|
776
|
-
|
|
803
|
+
|
|
804
|
+
{!config.legend.hide && config.visualizationType !== "Spark Line" && <Legend />}
|
|
777
805
|
</div>
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
806
|
+
{/* Link */}
|
|
807
|
+
{link && link}
|
|
808
|
+
{/* Description */}
|
|
809
|
+
{description && config.visualizationType !== "Spark Line" && <div className="subtext">{parse(description)}</div>}
|
|
810
|
+
{/* Data Table */}
|
|
811
|
+
|
|
812
|
+
{config.xAxis.dataKey && config.table.show && config.visualizationType !== "Spark Line" && <DataTable />}
|
|
813
|
+
{config?.footnotes && <section className="footnotes">{parse(config.footnotes)}</section>}
|
|
814
|
+
</div>
|
|
815
|
+
)}
|
|
785
816
|
</>
|
|
786
|
-
)
|
|
817
|
+
);
|
|
787
818
|
}
|
|
788
819
|
|
|
789
820
|
const getXAxisData = (d: any) => config.runtime.xAxis.type === 'date' ? (parseDate(d[config.runtime.originalXAxis.dataKey])).getTime() : d[config.runtime.originalXAxis.dataKey];
|
|
@@ -812,6 +843,7 @@ export default function CdcChart(
|
|
|
812
843
|
missingRequiredSections,
|
|
813
844
|
setEditing,
|
|
814
845
|
setFilteredData,
|
|
846
|
+
handleChartAriaLabels
|
|
815
847
|
}
|
|
816
848
|
|
|
817
849
|
const classes = [
|
|
@@ -833,4 +865,4 @@ export default function CdcChart(
|
|
|
833
865
|
</div>
|
|
834
866
|
</Context.Provider>
|
|
835
867
|
);
|
|
836
|
-
}
|
|
868
|
+
}
|