@cdc/waffle-chart 4.23.6 → 4.23.8
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/cdcwafflechart.js +1866 -1881
- package/examples/example-config.json +2 -2
- package/examples/gauge.json +134 -0
- package/package.json +3 -3
- package/src/components/EditorPanel.jsx +7 -14
- package/src/data/initial-state.js +1 -1
- package/src/scss/waffle-chart.scss +0 -7
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"type": "waffle-chart",
|
|
3
3
|
"dataUrl": "/examples/example-data.json",
|
|
4
4
|
"filters": [],
|
|
5
|
-
"title": "
|
|
5
|
+
"title": "Chart Title",
|
|
6
6
|
"content": "of cases occurred in the home",
|
|
7
|
-
"subtext": "
|
|
7
|
+
"subtext": "Chart subtext or citation",
|
|
8
8
|
"theme": "theme-blue",
|
|
9
9
|
"suffix": "%"
|
|
10
10
|
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Chart Title",
|
|
3
|
+
"visualizationType": "Gauge",
|
|
4
|
+
"visualizationSubType": "linear",
|
|
5
|
+
"showPercent": true,
|
|
6
|
+
"showDenominator": true,
|
|
7
|
+
"valueDescription": "out of",
|
|
8
|
+
"content": "of cases occurred in the home",
|
|
9
|
+
"subtext": "Chart subtext or citation",
|
|
10
|
+
"orientation": "horizontal",
|
|
11
|
+
"data": [
|
|
12
|
+
{
|
|
13
|
+
"Insured Rate": "43",
|
|
14
|
+
"Coverage Status": "Insured",
|
|
15
|
+
"state": "Alabama",
|
|
16
|
+
"Year (Good filter option)": "2010",
|
|
17
|
+
"link": "",
|
|
18
|
+
"Verified": true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"Insured Rate": "0",
|
|
22
|
+
"Coverage Status": "Uninsured",
|
|
23
|
+
"state": "Alaska",
|
|
24
|
+
"Year (Good filter option)": "2006",
|
|
25
|
+
"link": "",
|
|
26
|
+
"Verified": false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"Insured Rate": "72.7",
|
|
30
|
+
"Coverage Status": "Insured",
|
|
31
|
+
"state": "Arizona",
|
|
32
|
+
"Year (Good filter option)": "2008",
|
|
33
|
+
"link": "#lorem",
|
|
34
|
+
"Verified": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"Insured Rate": "78.7",
|
|
38
|
+
"Coverage Status": "Insured",
|
|
39
|
+
"state": "Arkansas",
|
|
40
|
+
"Year (Good filter option)": "2010",
|
|
41
|
+
"link": "",
|
|
42
|
+
"Verified": true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"Insured Rate": "37.2",
|
|
46
|
+
"Coverage Status": "Insured",
|
|
47
|
+
"state": "California",
|
|
48
|
+
"Year (Good filter option)": "2018",
|
|
49
|
+
"link": "https://search.cdc.gov/search/?query=California&utf8=%E2%9C%93&affiliate=cdc-main",
|
|
50
|
+
"Verified": true
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"Insured Rate": "50.6",
|
|
54
|
+
"Coverage Status": "Insured",
|
|
55
|
+
"state": "Colorado",
|
|
56
|
+
"Year (Good filter option)": "2014",
|
|
57
|
+
"link": "",
|
|
58
|
+
"Verified": false
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"Insured Rate": "83.2",
|
|
62
|
+
"Coverage Status": "Insured",
|
|
63
|
+
"state": "Connecticut",
|
|
64
|
+
"Year (Good filter option)": "2019",
|
|
65
|
+
"link": "",
|
|
66
|
+
"Verified": true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"Insured Rate": "90",
|
|
70
|
+
"Coverage Status": "Insured",
|
|
71
|
+
"state": "Delaware",
|
|
72
|
+
"Year (Good filter option)": "2020",
|
|
73
|
+
"link": "",
|
|
74
|
+
"Verified": true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"Insured Rate": "77.1",
|
|
78
|
+
"Coverage Status": "Insured",
|
|
79
|
+
"state": "District of Columbia",
|
|
80
|
+
"Year (Good filter option)": "2019",
|
|
81
|
+
"link": "https://search.cdc.gov/search/index.html?query=Washington+D.C.&sitelimit=&utf8=%E2%9C%93&affiliate=cdc-main",
|
|
82
|
+
"Verified": false
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"Insured Rate": "83",
|
|
86
|
+
"Coverage Status": "Insured",
|
|
87
|
+
"state": "Florida",
|
|
88
|
+
"Year (Good filter option)": "2016",
|
|
89
|
+
"link": "",
|
|
90
|
+
"Verified": true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"Insured Rate": "67.4",
|
|
94
|
+
"Coverage Status": "Insured",
|
|
95
|
+
"state": "Georgia",
|
|
96
|
+
"Year (Good filter option)": "2013",
|
|
97
|
+
"link": "",
|
|
98
|
+
"Verified": false
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"filters": [],
|
|
102
|
+
"fontSize": "",
|
|
103
|
+
"overallFontSize": "medium",
|
|
104
|
+
"dataColumn": "Insured Rate",
|
|
105
|
+
"dataFunction": "Count",
|
|
106
|
+
"dataConditionalColumn": "",
|
|
107
|
+
"dataConditionalOperator": "",
|
|
108
|
+
"dataConditionalComparate": "",
|
|
109
|
+
"invalidComparate": false,
|
|
110
|
+
"customDenom": false,
|
|
111
|
+
"dataDenom": "100",
|
|
112
|
+
"dataDenomColumn": "",
|
|
113
|
+
"dataDenomFunction": "",
|
|
114
|
+
"suffix": "%",
|
|
115
|
+
"roundToPlace": "0",
|
|
116
|
+
"shape": "circle",
|
|
117
|
+
"nodeWidth": "10",
|
|
118
|
+
"nodeSpacer": "2",
|
|
119
|
+
"theme": "theme-blue",
|
|
120
|
+
"type": "waffle-chart",
|
|
121
|
+
"visual": {
|
|
122
|
+
"border": true,
|
|
123
|
+
"accent": false,
|
|
124
|
+
"background": false,
|
|
125
|
+
"hideBackgroundColor": false,
|
|
126
|
+
"borderColorTheme": false
|
|
127
|
+
},
|
|
128
|
+
"dataUrl": "/examples/example-data.json",
|
|
129
|
+
"validated": 4.23,
|
|
130
|
+
"runtime": {
|
|
131
|
+
"uniqueId": 1690862969105,
|
|
132
|
+
"editorErrorMessage": ""
|
|
133
|
+
}
|
|
134
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdc/waffle-chart",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.8",
|
|
4
4
|
"description": "React component for displaying a single piece of data in a card module",
|
|
5
5
|
"moduleName": "CdcWaffleChart",
|
|
6
6
|
"main": "dist/cdcwafflechart",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"homepage": "https://github.com/CDCgov/cdc-open-viz#readme",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@cdc/core": "^4.23.
|
|
29
|
+
"@cdc/core": "^4.23.8",
|
|
30
30
|
"@visx/group": "^3.0.0",
|
|
31
31
|
"@visx/scale": "^3.0.0",
|
|
32
32
|
"@visx/shape": "^3.0.0",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"react": "^18.2.0",
|
|
42
42
|
"react-dom": "^18.2.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "ba0a072a40c430baf121ad5ece0165f52a414b86"
|
|
45
45
|
}
|
|
@@ -40,6 +40,7 @@ const EditorPanel = memo(props => {
|
|
|
40
40
|
|
|
41
41
|
const [displayPanel, setDisplayPanel] = useState(true)
|
|
42
42
|
const [showConfigConfirm, setShowConfigConfirm] = useState(false)
|
|
43
|
+
const inputSelectStyle = condition => (condition ? { backgroundColor: '#ffd2d2', color: '#d8000c' } : {})
|
|
43
44
|
|
|
44
45
|
const updateField = (section, subsection, fieldName, newValue) => {
|
|
45
46
|
// Top level
|
|
@@ -197,10 +198,7 @@ const EditorPanel = memo(props => {
|
|
|
197
198
|
}
|
|
198
199
|
//visualizationType
|
|
199
200
|
|
|
200
|
-
const approvedWaffleChartOptions = [
|
|
201
|
-
'Waffle'
|
|
202
|
-
// 'Gauge'
|
|
203
|
-
]
|
|
201
|
+
const approvedWaffleChartOptions = ['Waffle', 'Gauge']
|
|
204
202
|
|
|
205
203
|
const editorContent = (
|
|
206
204
|
<Accordion>
|
|
@@ -211,7 +209,7 @@ const EditorPanel = memo(props => {
|
|
|
211
209
|
{config.visualizationType === 'Gauge' && <InputSelect value={config.visualizationSubType} fieldName='visualizationSubType' label='Chart Subtype' updateField={updateField} options={['Linear']} className='cove-input' />}
|
|
212
210
|
</div>
|
|
213
211
|
</div>
|
|
214
|
-
<InputText value={config.title} fieldName='title' label='Title' placeholder='
|
|
212
|
+
<InputText value={config.title} fieldName='title' label='Title' placeholder='Chart Title' updateField={updateField} />
|
|
215
213
|
<InputText
|
|
216
214
|
type='textarea'
|
|
217
215
|
value={config.content}
|
|
@@ -234,7 +232,7 @@ const EditorPanel = memo(props => {
|
|
|
234
232
|
value={config.subtext}
|
|
235
233
|
fieldName='subtext'
|
|
236
234
|
label='Subtext/Citation'
|
|
237
|
-
placeholder='
|
|
235
|
+
placeholder='Chart Subtext or Citation'
|
|
238
236
|
updateField={updateField}
|
|
239
237
|
tooltip={
|
|
240
238
|
<Tooltip style={{ textTransform: 'none' }}>
|
|
@@ -250,19 +248,14 @@ const EditorPanel = memo(props => {
|
|
|
250
248
|
</Accordion.Section>
|
|
251
249
|
|
|
252
250
|
<Accordion.Section icon={!config.dataColumn || !config.dataFunction ? <WarningImage width='15' className='warning-icon' /> : ''} title='Data'>
|
|
253
|
-
{(!config.dataColumn || !config.dataFunction) && (
|
|
254
|
-
<div className='cove-accordion__panel-section'>
|
|
255
|
-
<p className='warning-text'>Please select numerator</p>
|
|
256
|
-
</div>
|
|
257
|
-
)}
|
|
258
251
|
<h4 style={{ fontWeight: '600' }}>Numerator</h4>
|
|
259
252
|
<div className='cove-accordion__panel-section'>
|
|
260
253
|
<div className='cove-input-group'>
|
|
261
|
-
<InputSelect value={config.dataColumn || ''} fieldName='dataColumn' label='Data Column' updateField={updateField} initial='Select' options={getColumns()} className='cove-input' />
|
|
254
|
+
<InputSelect style={inputSelectStyle(!config.dataColumn)} value={config.dataColumn || ''} fieldName='dataColumn' label='Data Column' updateField={updateField} initial='Select' options={getColumns()} className='cove-input' />
|
|
262
255
|
</div>
|
|
263
256
|
|
|
264
257
|
<div className='cove-input-group'>
|
|
265
|
-
<InputSelect value={config.dataFunction || ''} fieldName='dataFunction' label='Data Function' updateField={updateField} initial='Select' options={DATA_FUNCTIONS} className='cove-input' />
|
|
258
|
+
<InputSelect style={inputSelectStyle(!config.dataFunction)} value={config.dataFunction || ''} fieldName='dataFunction' label='Data Function' updateField={updateField} initial='Select' options={DATA_FUNCTIONS} className='cove-input' />
|
|
266
259
|
</div>
|
|
267
260
|
|
|
268
261
|
<div className='cove-input-group'>
|
|
@@ -326,7 +319,7 @@ const EditorPanel = memo(props => {
|
|
|
326
319
|
</div>
|
|
327
320
|
</li>
|
|
328
321
|
</ul>
|
|
329
|
-
{
|
|
322
|
+
{config.visualizationType === 'Gauge' && (
|
|
330
323
|
<>
|
|
331
324
|
<hr className='cove-accordion__divider' />
|
|
332
325
|
<div className='cove-accordion__panel-section reverse-labels'>
|