@cdc/waffle-chart 1.0.2 → 4.22.11

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.
@@ -1,34 +1,34 @@
1
1
  export default {
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": false,
29
- "accent": false,
30
- "background": false,
31
- "hideBackgroundColor": false,
32
- "borderColorTheme": false
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,11 +1,30 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="utf-8"/>
5
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
6
- </head>
7
- <body>
8
- <div class="react-container" data-config="/examples/example-config.json"></div>
9
- <noscript>You need to enable JavaScript to run this app.</noscript>
10
- </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
+ }
14
+
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>
23
+
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> -->
27
+
28
+ <noscript>You need to enable JavaScript to run this app.</noscript>
29
+ </body>
11
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((domContainer) => {
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
+ })
@@ -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,6 +19,12 @@
19
19
  //}
20
20
 
21
21
  .cove {
22
+ &-editor__panel {
23
+ ul.color-palette {
24
+ margin: 0;
25
+ }
26
+ }
27
+
22
28
  .cove-waffle-chart {
23
29
  display: flex;
24
30
  flex-wrap: wrap;
@@ -32,13 +38,6 @@
32
38
  .cove-waffle-chart__chart {
33
39
  padding-right: 0;
34
40
  }
35
-
36
- .cove-waffle-chart__data {
37
- text-align: center;
38
- // display: flex;
39
- // flex-wrap: wrap;
40
- // align-content: space-between;
41
- }
42
41
  }
43
42
  }
44
43
 
@@ -56,32 +55,16 @@
56
55
 
57
56
  .cove-waffle-chart__subtext {
58
57
  font-style: italic;
59
- font-weight: bold;
60
58
  font-size: 0.75em;
61
- padding: 0 1em 1em;
62
59
  }
63
60
 
64
61
  .cove-waffle-chart__data {
62
+ display: flex;
63
+ flex-wrap: wrap;
64
+ align-content: space-between;
65
65
 
66
66
  font-size: 14px;
67
67
 
68
- @at-root {
69
- .cove-waffle-chart.font-small #{&} {
70
- .cove-waffle-chart__data--primary { font-size: 35px; }
71
- .cove-waffle-chart__data--text { font-size: 14px; }
72
- }
73
-
74
- .cove-waffle-chart.font-medium #{&} {
75
- .cove-waffle-chart__data--primary { font-size: 50px; }
76
- .cove-waffle-chart__data--text { font-size: 18px; }
77
- }
78
-
79
- .cove-waffle-chart.font-large #{&} {
80
- .cove-waffle-chart__data--primary { font-size: 80px; }
81
- .cove-waffle-chart__data--text { font-size: 20px; }
82
- }
83
- }
84
-
85
68
  .cove-waffle-chart__data--primary {
86
69
  font-size: 70px;
87
70
  font-weight: 400;
@@ -90,6 +73,7 @@
90
73
 
91
74
  .cove-waffle-chart__data--text {
92
75
  line-height: 1.25em;
76
+ width: 100%;
93
77
  }
94
78
  }
95
79
 
@@ -97,4 +81,41 @@
97
81
  transition: all 300ms cubic-bezier(0.16, 1, 0.3, 1);
98
82
  }
99
83
 
84
+ .reverse-labels div {
85
+ float: left;
86
+ margin-right: 5px;
87
+ }
88
+
89
+ .reverse-labels {
90
+ overflow: auto;
91
+ }
92
+ }
93
+
94
+ @at-root {
95
+ .cove-waffle-chart.font-small #{&} {
96
+ .cove-waffle-chart__data--primary {
97
+ font-size: 35px;
98
+ }
99
+ .cove-waffle-chart__data--text {
100
+ font-size: 14px;
101
+ }
102
+ }
103
+
104
+ .cove-waffle-chart.font-medium #{&} {
105
+ .cove-waffle-chart__data--primary {
106
+ font-size: 50px;
107
+ }
108
+ .cove-waffle-chart__data--text {
109
+ font-size: 18px;
110
+ }
111
+ }
112
+
113
+ .cove-waffle-chart.font-large #{&} {
114
+ .cove-waffle-chart__data--primary {
115
+ font-size: 80px;
116
+ }
117
+ .cove-waffle-chart__data--text {
118
+ font-size: 20px;
119
+ }
120
+ }
100
121
  }