@cdc/chart 1.3.4 → 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.
- package/LICENSE +201 -0
- package/README.md +5 -5
- package/dist/cdcchart.js +6 -6
- package/examples/age-adjusted-rates.json +1486 -1218
- package/examples/case-rate-example-config.json +1 -1
- package/examples/covid-confidence-example-config.json +33 -33
- package/examples/covid-example-config.json +34 -34
- package/examples/covid-example-data-confidence.json +30 -30
- package/examples/covid-example-data.json +20 -20
- package/examples/cutoff-example-config.json +36 -34
- package/examples/cutoff-example-data.json +36 -36
- package/examples/date-exclusions-config.json +1 -1
- package/examples/dynamic-legends.json +125 -0
- package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +192 -0
- package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +231 -0
- package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +240 -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 +216 -0
- package/examples/gallery/paired-bar/paired-bar-chart.json +196 -0
- package/examples/horizontal-chart.json +36 -33
- package/examples/horizontal-stacked-bar-chart.json +34 -34
- package/examples/line-chart.json +75 -75
- package/examples/paired-bar-data.json +16 -14
- package/examples/paired-bar-example.json +48 -46
- package/examples/paired-bar-formatted.json +36 -36
- package/examples/planet-chart-horizontal-example-config.json +33 -33
- package/examples/planet-combo-example-config.json +34 -29
- package/examples/planet-example-config.json +35 -33
- package/examples/planet-example-data.json +56 -56
- package/examples/planet-pie-example-config.json +28 -26
- package/examples/private/filters.json +170 -0
- package/examples/private/line-test-data.json +22 -0
- package/examples/private/line-test-two.json +210 -0
- package/examples/private/line-test.json +102 -0
- package/examples/private/new.json +48800 -0
- package/examples/private/shawn.json +1106 -0
- package/examples/private/test.json +10123 -10123
- package/examples/private/yaxis-test.json +133 -0
- package/examples/private/yaxis-testing.csv +27 -0
- package/examples/private/yaxis.json +28 -0
- package/examples/stacked-vertical-bar-example.json +228 -0
- package/examples/temp-example-config.json +61 -54
- package/examples/temp-example-data.json +1 -1
- package/package.json +2 -2
- package/src/CdcChart.tsx +370 -458
- package/src/components/BarChart.tsx +449 -441
- package/src/components/DataTable.tsx +164 -180
- package/src/components/EditorPanel.js +1066 -663
- package/src/components/Legend.js +284 -0
- package/src/components/LineChart.tsx +114 -63
- package/src/components/LinearChart.tsx +394 -358
- package/src/components/PairedBarChart.tsx +216 -135
- package/src/components/PieChart.tsx +106 -135
- package/src/components/SparkLine.js +184 -205
- package/src/components/useIntersectionObserver.tsx +27 -0
- package/src/context.tsx +3 -3
- package/src/data/initial-state.js +44 -7
- package/src/hooks/useActiveElement.js +13 -13
- package/src/hooks/useChartClasses.js +41 -0
- package/src/hooks/useColorPalette.ts +56 -63
- package/src/hooks/useLegendClasses.js +28 -0
- package/src/hooks/useReduceData.ts +69 -37
- package/src/hooks/useRightAxis.js +25 -0
- package/src/hooks/useTopAxis.js +6 -0
- package/src/index.html +54 -55
- package/src/index.tsx +13 -16
- package/src/scss/DataTable.scss +5 -4
- package/src/scss/editor-panel.scss +103 -71
- package/src/scss/main.scss +277 -38
- package/src/scss/variables.scss +1 -1
- package/src/components/BarStackVertical.js +0 -0
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
{
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
"title": "Confidence Age-adjusted COVID-19-associated hospitalization rates by race and ethnicity — COVID-NET, March 1–December 26, 2020",
|
|
3
|
+
"dataUrl": "/examples/covid-example-data-confidence.json",
|
|
4
|
+
"visualizationType": "Bar",
|
|
5
|
+
"fontSize": "small",
|
|
6
|
+
"series": [{ "dataKey": "Age-adjusted rate", "label": "Rate" }],
|
|
7
|
+
"confidenceKeys": {
|
|
8
|
+
"lower": "Lower",
|
|
9
|
+
"upper": "Upper"
|
|
10
|
+
},
|
|
11
|
+
"dataFormat": {
|
|
12
|
+
"commas": false,
|
|
13
|
+
"prefix": "Lorem",
|
|
14
|
+
"suffix": "Suffix"
|
|
15
|
+
},
|
|
16
|
+
"padding": {
|
|
17
|
+
"left": 10,
|
|
18
|
+
"right": 10
|
|
19
|
+
},
|
|
20
|
+
"yAxis": {
|
|
21
|
+
"dataKey": "Age-adjusted rate",
|
|
22
|
+
"gridLines": true,
|
|
23
|
+
"numTicks": 3,
|
|
24
|
+
"size": 80
|
|
25
|
+
},
|
|
26
|
+
"xAxis": {
|
|
27
|
+
"dataKey": "Race",
|
|
28
|
+
"tickRotation": 20,
|
|
29
|
+
"size": 130
|
|
30
|
+
},
|
|
31
|
+
"table": {
|
|
32
|
+
"label": "Age-adjusted COVID-19-associated hospitalization rates by race and ethnicity",
|
|
33
|
+
"expanded": true
|
|
34
|
+
}
|
|
35
35
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
"title": "Non Configdence Age-adjusted COVID-19-associated hospitalization rates by race and ethnicity — COVID-NET, March 1–December 26, 2020",
|
|
3
|
+
"theme": "theme-brown",
|
|
4
|
+
"dataUrl": "/examples/covid-example-data.json",
|
|
5
|
+
"visualizationType": "Bar",
|
|
6
|
+
"visualizationSubType": "horizontal",
|
|
7
|
+
"series": [{ "dataKey": "Age-adjusted rate" }],
|
|
8
|
+
"barThickness": 0.3,
|
|
9
|
+
"height": 300,
|
|
10
|
+
"dataFormat": {
|
|
11
|
+
"commas": false,
|
|
12
|
+
"prefix": "",
|
|
13
|
+
"suffix": ""
|
|
14
|
+
},
|
|
15
|
+
"padding": {
|
|
16
|
+
"left": 10,
|
|
17
|
+
"right": 10
|
|
18
|
+
},
|
|
19
|
+
"yAxis": {
|
|
20
|
+
"gridLines": false,
|
|
21
|
+
"numTicks": 3
|
|
22
|
+
},
|
|
23
|
+
"xAxis": {
|
|
24
|
+
"dataKey": "Race",
|
|
25
|
+
"size": 20,
|
|
26
|
+
"wrap": true
|
|
27
|
+
},
|
|
28
|
+
"legend": {
|
|
29
|
+
"hide": true
|
|
30
|
+
},
|
|
31
|
+
"table": {
|
|
32
|
+
"label": "Age-adjusted COVID-19-associated hospitalization rates by race and ethnicity",
|
|
33
|
+
"expanded": true,
|
|
34
|
+
"download": true
|
|
35
|
+
}
|
|
36
36
|
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
[
|
|
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
|
-
|
|
2
|
+
{
|
|
3
|
+
"Race": "Hispanic or Latino",
|
|
4
|
+
"Age-adjusted rate": "644000.2",
|
|
5
|
+
"Lower": "640000.2",
|
|
6
|
+
"Upper": "650000.2"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"Race": "Non-Hispanic Black",
|
|
10
|
+
"Age-adjusted rate": "563000.7",
|
|
11
|
+
"Lower": "560000.2",
|
|
12
|
+
"Upper": "570000.2"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"Race": "Non-Hispanic Asian or Pacific Islander",
|
|
16
|
+
"Age-adjusted rate": "202000.5",
|
|
17
|
+
"Lower": "200000.2",
|
|
18
|
+
"Upper": "210000.2"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"Race": "Non-Hispanic American Indian or Alaska Native",
|
|
22
|
+
"Age-adjusted rate": "636000.1",
|
|
23
|
+
"Lower": "630000.2",
|
|
24
|
+
"Upper": "740000.2"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"Race": "Non-Hispanic White",
|
|
28
|
+
"Age-adjusted rate": "183000.6",
|
|
29
|
+
"Lower": "180000.2",
|
|
30
|
+
"Upper": "190000.2"
|
|
31
|
+
}
|
|
32
32
|
]
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
[
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
{
|
|
3
|
+
"Race": "Hispanic or Latino",
|
|
4
|
+
"Age-adjusted rate": "644.2"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"Race": "Non-Hispanic American Indian",
|
|
8
|
+
"Age-adjusted rate": "636.1"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"Race": "Non-Hispanic Black",
|
|
12
|
+
"Age-adjusted rate": "563.7"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"Race": "Non-Hispanic Asian or Pacific Islander",
|
|
16
|
+
"Age-adjusted rate": "202.5"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"Race": "Non-Hispanic White",
|
|
20
|
+
"Age-adjusted rate": "183.6"
|
|
21
|
+
}
|
|
22
22
|
]
|
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
{
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
2
|
+
"title": "Data Cutoff Example (< 0.1)",
|
|
3
|
+
"theme": "theme-blue",
|
|
4
|
+
"dataUrl": "/examples/cutoff-example-data.json",
|
|
5
|
+
"animate": true,
|
|
6
|
+
"animateReplay": true,
|
|
7
|
+
"visualizationType": "Line",
|
|
8
|
+
"series": [{ "dataKey": "Value" }],
|
|
9
|
+
"barThickness": 0.3,
|
|
10
|
+
"height": 300,
|
|
11
|
+
"dataCutoff": "0.1",
|
|
12
|
+
"dataFormat": {
|
|
13
|
+
"commas": false,
|
|
14
|
+
"prefix": "",
|
|
15
|
+
"suffix": ""
|
|
16
|
+
},
|
|
17
|
+
"padding": {
|
|
18
|
+
"left": 10,
|
|
19
|
+
"right": 10
|
|
20
|
+
},
|
|
21
|
+
"yAxis": {
|
|
22
|
+
"label": "Value",
|
|
23
|
+
"gridLines": false,
|
|
24
|
+
"size": 70
|
|
25
|
+
},
|
|
26
|
+
"xAxis": {
|
|
27
|
+
"label": "Category",
|
|
28
|
+
"dataKey": "Category"
|
|
29
|
+
},
|
|
30
|
+
"legend": {
|
|
31
|
+
"hide": true
|
|
32
|
+
},
|
|
33
|
+
"table": {
|
|
34
|
+
"label": "Data Table",
|
|
35
|
+
"expanded": true,
|
|
36
|
+
"download": true
|
|
37
|
+
}
|
|
36
38
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
[
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
2
|
+
{
|
|
3
|
+
"Category": "Category 1",
|
|
4
|
+
"Value": "0.05"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"Category": "Category 2",
|
|
8
|
+
"Value": "0.1"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"Category": "Category 3",
|
|
12
|
+
"Value": "0.2"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"Category": "Category 4",
|
|
16
|
+
"Value": "0.4"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"Category": "Category 5",
|
|
20
|
+
"Value": "0.3"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"Category": "Category 6",
|
|
24
|
+
"Value": null
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"Category": "Category 7",
|
|
28
|
+
"Value": "0.5"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"Category": "Category 8",
|
|
32
|
+
"Value": "0.5"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"Category": "Category 9",
|
|
36
|
+
"Value": "0.08"
|
|
37
|
+
}
|
|
38
38
|
]
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "chart",
|
|
3
|
+
"title": "Example Line Chart",
|
|
4
|
+
"theme": "theme-green",
|
|
5
|
+
"fontSize": "medium",
|
|
6
|
+
"height": "375",
|
|
7
|
+
"padding": {
|
|
8
|
+
"left": 5,
|
|
9
|
+
"right": 5
|
|
10
|
+
},
|
|
11
|
+
"yAxis": {
|
|
12
|
+
"size": "75",
|
|
13
|
+
"gridLines": false,
|
|
14
|
+
"label": "Y-Axis Example Label",
|
|
15
|
+
"numTicks": "9"
|
|
16
|
+
},
|
|
17
|
+
"barThickness": 0.35,
|
|
18
|
+
"xAxis": {
|
|
19
|
+
"size": "77",
|
|
20
|
+
"tickRotation": "25",
|
|
21
|
+
"dataKey": "Date",
|
|
22
|
+
"label": "X-Axis Example Label",
|
|
23
|
+
"type": "date",
|
|
24
|
+
"dateParseFormat": "%d/%m/%Y",
|
|
25
|
+
"dateDisplayFormat": "%d/%m/%Y"
|
|
26
|
+
},
|
|
27
|
+
"table": {
|
|
28
|
+
"label": "Data Table",
|
|
29
|
+
"expanded": true,
|
|
30
|
+
"download": true
|
|
31
|
+
},
|
|
32
|
+
"legend": {
|
|
33
|
+
"behavior": "isolate",
|
|
34
|
+
"position": "right",
|
|
35
|
+
"label": "Type of Data",
|
|
36
|
+
"dynamicLegend": true
|
|
37
|
+
},
|
|
38
|
+
"palette": "qualitative-bold",
|
|
39
|
+
"labels": false,
|
|
40
|
+
"dataFormat": {},
|
|
41
|
+
"confidenceKeys": {},
|
|
42
|
+
"data": [
|
|
43
|
+
{
|
|
44
|
+
"Date": "1/15/2016",
|
|
45
|
+
"Alabama": "90",
|
|
46
|
+
"Alaska": "135",
|
|
47
|
+
"Arizona": "300",
|
|
48
|
+
"Arkansas": "95",
|
|
49
|
+
"California": "120",
|
|
50
|
+
"Colorado": "310"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"Date": "2/15/2016",
|
|
54
|
+
"Alabama": "40",
|
|
55
|
+
"Alaska": "90",
|
|
56
|
+
"Arizona": "240",
|
|
57
|
+
"Arkansas": "60",
|
|
58
|
+
"California": "160",
|
|
59
|
+
"Colorado": "200"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"Date": "3/15/2016",
|
|
63
|
+
"Alabama": "50",
|
|
64
|
+
"Alaska": "300",
|
|
65
|
+
"Arizona": "290",
|
|
66
|
+
"Arkansas": "100",
|
|
67
|
+
"California": "200",
|
|
68
|
+
"Colorado": "250"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"Date": "4/15/2016",
|
|
72
|
+
"Alabama": "120",
|
|
73
|
+
"Alaska": "160",
|
|
74
|
+
"Arizona": "230",
|
|
75
|
+
"Arkansas": "180",
|
|
76
|
+
"California": "160",
|
|
77
|
+
"Colorado": "220"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"Date": "5/15/2016",
|
|
81
|
+
"Alabama": "80",
|
|
82
|
+
"Alaska": "350",
|
|
83
|
+
"Arizona": "300",
|
|
84
|
+
"Arkansas": "150",
|
|
85
|
+
"California": "130",
|
|
86
|
+
"Colorado": "100"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"Date": "6/15/2016",
|
|
90
|
+
"Alabama": "90",
|
|
91
|
+
"Alaska": "220",
|
|
92
|
+
"Arizona": "320",
|
|
93
|
+
"Arkansas": "100",
|
|
94
|
+
"California": "220",
|
|
95
|
+
"Colorado": "300"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"visualizationType": "Line",
|
|
99
|
+
"series": [
|
|
100
|
+
{
|
|
101
|
+
"dataKey": "Alabama",
|
|
102
|
+
"type": "Bar"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"dataKey": "Alaska",
|
|
106
|
+
"type": "Bar"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"dataKey": "Arizona",
|
|
110
|
+
"type": "Bar"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"dataKey": "Arkansas",
|
|
114
|
+
"type": "Bar"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"dataKey": "California",
|
|
118
|
+
"type": "Bar"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"dataKey": "Colorado",
|
|
122
|
+
"type": "Bar"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|