@cdc/waffle-chart 4.22.10 → 4.23.1
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/README.md +4 -4
- package/dist/cdcwafflechart.js +1 -1
- package/examples/example-data.json +90 -90
- package/examples/gallery/avg-to-max.json +3161 -3161
- package/examples/gallery/count.json +3161 -3161
- package/package.json +3 -3
- package/src/CdcWaffleChart.tsx +130 -198
- package/src/ConfigContext.js +3 -3
- package/src/components/EditorPanel.js +149 -310
- package/src/data/initial-state.js +31 -31
- package/src/index.html +24 -26
- package/src/index.js +7 -7
- package/src/scss/main.scss +3 -4
- package/src/scss/waffle-chart.scss +21 -11
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
title: 'Waffle Chart',
|
|
3
|
+
content: '',
|
|
4
|
+
subtext: '',
|
|
5
|
+
orientation: 'horizontal',
|
|
6
|
+
data: '',
|
|
7
|
+
filters: [],
|
|
8
|
+
fontSize: '',
|
|
9
|
+
overallFontSize: 'medium',
|
|
10
|
+
dataColumn: '',
|
|
11
|
+
dataFunction: '',
|
|
12
|
+
dataConditionalColumn: '',
|
|
13
|
+
dataConditionalOperator: '',
|
|
14
|
+
dataConditionalComparate: '',
|
|
15
|
+
invalidComparate: false,
|
|
16
|
+
customDenom: false,
|
|
17
|
+
dataDenom: '100',
|
|
18
|
+
dataDenomColumn: '',
|
|
19
|
+
dataDenomFunction: '',
|
|
20
|
+
suffix: '%',
|
|
21
|
+
roundToPlace: '0',
|
|
22
|
+
shape: 'circle',
|
|
23
|
+
nodeWidth: '10',
|
|
24
|
+
nodeSpacer: '2',
|
|
25
|
+
theme: 'theme-blue',
|
|
26
|
+
type: 'waffle-chart',
|
|
27
|
+
visual: {
|
|
28
|
+
border: true,
|
|
29
|
+
accent: false,
|
|
30
|
+
background: false,
|
|
31
|
+
hideBackgroundColor: false,
|
|
32
|
+
borderColorTheme: false
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/index.html
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.react-container+.react-container {
|
|
16
|
-
margin-top: 3rem;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
/* max-width: 1000px; */
|
|
9
|
+
margin: 0 auto !important;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
}
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
.react-container + .react-container {
|
|
16
|
+
margin-top: 3rem;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<!-- Original -->
|
|
22
|
+
<div class="react-container" data-config="/examples/example-config.json"></div>
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
<!-- DATA PRESENTATION GALLERY: https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/waffle-chart.html#examples -->
|
|
25
|
+
<!-- <div class="react-container" data-config="/examples/gallery/avg-to-max.json"></div> -->
|
|
26
|
+
<!-- <div class="react-container" data-config="/examples/gallery/count.json"></div> -->
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</body>
|
|
28
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
29
|
+
</body>
|
|
32
30
|
</html>
|
package/src/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { render } from 'react-dom'
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from 'react-dom'
|
|
3
3
|
import CdcWaffleChart from './CdcWaffleChart'
|
|
4
4
|
|
|
5
|
-
const domContainers = document.querySelectorAll('.react-container')
|
|
5
|
+
const domContainers = document.querySelectorAll('.react-container')
|
|
6
6
|
|
|
7
|
-
let isEditor = window.location.href.includes('editor=true')
|
|
7
|
+
let isEditor = window.location.href.includes('editor=true')
|
|
8
8
|
|
|
9
|
-
domContainers.forEach(
|
|
9
|
+
domContainers.forEach(domContainer => {
|
|
10
10
|
render(
|
|
11
11
|
<React.StrictMode>
|
|
12
12
|
<CdcWaffleChart configUrl={domContainer.attributes['data-config'].value} isEditor={isEditor} />
|
|
13
13
|
</React.StrictMode>,
|
|
14
14
|
domContainer
|
|
15
|
-
)
|
|
16
|
-
})
|
|
15
|
+
)
|
|
16
|
+
})
|
package/src/scss/main.scss
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@import 'waffle-chart';
|
|
3
3
|
|
|
4
4
|
.cdc-open-viz-module.type-waffle-chart {
|
|
5
|
-
|
|
6
5
|
.loader {
|
|
7
6
|
width: 100%;
|
|
8
7
|
text-align: center;
|
|
@@ -16,10 +15,10 @@
|
|
|
16
15
|
|
|
17
16
|
@include breakpointClass(xs) {
|
|
18
17
|
&.font-small {
|
|
19
|
-
font-size: .8em;
|
|
18
|
+
font-size: 0.8em;
|
|
20
19
|
}
|
|
21
20
|
&.font-medium {
|
|
22
|
-
font-size: .9em;
|
|
21
|
+
font-size: 0.9em;
|
|
23
22
|
}
|
|
24
23
|
&.font-large {
|
|
25
24
|
font-size: 1em;
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
|
|
29
28
|
@include breakpointClass(md) {
|
|
30
29
|
&.font-small {
|
|
31
|
-
font-size: .9em;
|
|
30
|
+
font-size: 0.9em;
|
|
32
31
|
}
|
|
33
32
|
&.font-large {
|
|
34
33
|
font-size: 1.1em;
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
//}
|
|
20
20
|
|
|
21
21
|
.cove {
|
|
22
|
-
|
|
23
22
|
&-editor__panel {
|
|
24
|
-
ul.color-palette {
|
|
23
|
+
ul.color-palette {
|
|
24
|
+
margin: 0;
|
|
25
|
+
}
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
.cove-waffle-chart {
|
|
@@ -38,7 +39,6 @@
|
|
|
38
39
|
padding-right: 0;
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.cove-waffle-chart__chart {
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
|
|
66
66
|
font-size: 14px;
|
|
67
67
|
|
|
68
|
-
|
|
69
68
|
.cove-waffle-chart__data--primary {
|
|
70
69
|
font-size: 70px;
|
|
71
70
|
font-weight: 400;
|
|
@@ -90,22 +89,33 @@
|
|
|
90
89
|
.reverse-labels {
|
|
91
90
|
overflow: auto;
|
|
92
91
|
}
|
|
93
|
-
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
@at-root {
|
|
97
95
|
.cove-waffle-chart.font-small #{&} {
|
|
98
|
-
.cove-waffle-chart__data--primary {
|
|
99
|
-
|
|
96
|
+
.cove-waffle-chart__data--primary {
|
|
97
|
+
font-size: 35px;
|
|
98
|
+
}
|
|
99
|
+
.cove-waffle-chart__data--text {
|
|
100
|
+
font-size: 14px;
|
|
101
|
+
}
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
.cove-waffle-chart.font-medium #{&} {
|
|
103
|
-
.cove-waffle-chart__data--primary {
|
|
104
|
-
|
|
105
|
+
.cove-waffle-chart__data--primary {
|
|
106
|
+
font-size: 50px;
|
|
107
|
+
}
|
|
108
|
+
.cove-waffle-chart__data--text {
|
|
109
|
+
font-size: 18px;
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
.cove-waffle-chart.font-large #{&} {
|
|
108
|
-
.cove-waffle-chart__data--primary {
|
|
109
|
-
|
|
114
|
+
.cove-waffle-chart__data--primary {
|
|
115
|
+
font-size: 80px;
|
|
116
|
+
}
|
|
117
|
+
.cove-waffle-chart__data--text {
|
|
118
|
+
font-size: 20px;
|
|
119
|
+
}
|
|
110
120
|
}
|
|
111
121
|
}
|