@cdc/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.
Files changed (80) hide show
  1. package/README.md +5 -5
  2. package/dist/495.js +3 -0
  3. package/dist/703.js +1 -0
  4. package/dist/cdcchart.js +723 -6
  5. package/examples/age-adjusted-rates.json +1486 -1218
  6. package/examples/box-plot-data.json +71 -0
  7. package/examples/box-plot.csv +5 -0
  8. package/examples/{private/yaxis-test.json → box-plot.json} +46 -54
  9. package/examples/case-rate-example-config.json +1 -1
  10. package/examples/covid-confidence-example-config.json +33 -33
  11. package/examples/covid-example-config.json +34 -34
  12. package/examples/covid-example-data-confidence.json +30 -30
  13. package/examples/covid-example-data.json +20 -20
  14. package/examples/cutoff-example-config.json +36 -36
  15. package/examples/cutoff-example-data.json +36 -36
  16. package/examples/date-exclusions-config.json +1 -1
  17. package/examples/dynamic-legends.json +124 -124
  18. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +191 -197
  19. package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +230 -240
  20. package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +239 -247
  21. package/examples/gallery/bar-chart-vertical/combo-line-chart.json +138 -136
  22. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +79 -79
  23. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +80 -80
  24. package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +67 -67
  25. package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +179 -110
  26. package/examples/gallery/lollipop/lollipop-style-horizontal.json +215 -219
  27. package/examples/gallery/paired-bar/paired-bar-chart.json +195 -195
  28. package/examples/horizontal-chart.json +35 -35
  29. package/examples/horizontal-stacked-bar-chart.json +34 -34
  30. package/examples/line-chart.json +75 -75
  31. package/examples/new-data.csv +17 -0
  32. package/examples/newdata.json +90 -0
  33. package/examples/paired-bar-data.json +16 -14
  34. package/examples/paired-bar-example.json +48 -48
  35. package/examples/paired-bar-formatted.json +36 -36
  36. package/examples/planet-chart-horizontal-example-config.json +33 -33
  37. package/examples/planet-combo-example-config.json +34 -31
  38. package/examples/planet-example-config.json +35 -33
  39. package/examples/planet-example-data.json +56 -56
  40. package/examples/planet-pie-example-config.json +28 -28
  41. package/examples/stacked-vertical-bar-example.json +1 -1
  42. package/examples/temp-example-config.json +61 -54
  43. package/examples/temp-example-data.json +1 -1
  44. package/package.json +3 -2
  45. package/src/CdcChart.tsx +449 -434
  46. package/src/components/BarChart.tsx +383 -497
  47. package/src/components/BoxPlot.js +92 -0
  48. package/src/components/DataTable.tsx +182 -197
  49. package/src/components/EditorPanel.js +1068 -722
  50. package/src/components/Filters.js +131 -0
  51. package/src/components/Legend.js +286 -329
  52. package/src/components/LineChart.tsx +143 -81
  53. package/src/components/LinearChart.tsx +432 -451
  54. package/src/components/PairedBarChart.tsx +197 -213
  55. package/src/components/PieChart.tsx +105 -151
  56. package/src/components/SparkLine.js +179 -201
  57. package/src/components/useIntersectionObserver.tsx +19 -20
  58. package/src/context.tsx +3 -3
  59. package/src/data/initial-state.js +44 -17
  60. package/src/hooks/useActiveElement.js +13 -13
  61. package/src/hooks/useChartClasses.js +34 -28
  62. package/src/hooks/useColorPalette.ts +56 -63
  63. package/src/hooks/useLegendClasses.js +18 -10
  64. package/src/hooks/useReduceData.ts +64 -77
  65. package/src/hooks/useRightAxis.js +25 -0
  66. package/src/hooks/useTopAxis.js +6 -0
  67. package/src/index.html +19 -19
  68. package/src/index.tsx +13 -16
  69. package/src/scss/DataTable.scss +6 -5
  70. package/src/scss/editor-panel.scss +71 -69
  71. package/src/scss/main.scss +188 -114
  72. package/src/scss/variables.scss +1 -1
  73. package/examples/private/line-test-data.json +0 -22
  74. package/examples/private/line-test-two.json +0 -216
  75. package/examples/private/line-test.json +0 -102
  76. package/examples/private/newtest.csv +0 -101
  77. package/examples/private/shawn.json +0 -1296
  78. package/examples/private/test.json +0 -10124
  79. package/examples/private/yaxis-testing.csv +0 -27
  80. package/examples/private/yaxis.json +0 -28
@@ -1,76 +1,76 @@
1
1
  {
2
- "type": "chart",
3
- "title": "Example Spark Line",
4
- "theme": "theme-blue",
5
- "fontSize": "medium",
6
- "height": "375",
7
- "compact": true,
8
- "padding": {
9
- "left": 5,
10
- "right": 5
11
- },
12
- "yAxis": {
13
- "size": "75",
14
- "gridLines": false,
15
- "label": "Y-Axis Example Label",
16
- "numTicks": "9"
17
- },
18
- "barThickness": 0.35,
19
- "xAxis": {
20
- "size": "77",
21
- "tickRotation": "25",
22
- "dataKey": "Date",
23
- "label": "X-Axis Example Label",
24
- "type": "date",
25
- "dateParseFormat": "%d/%m/%Y",
26
- "dateDisplayFormat": "%d/%m/%Y"
27
- },
28
- "table": {
29
- "label": "Data Table",
30
- "expanded": true,
31
- "download": true
32
- },
33
- "legend": {
34
- "behavior": "isolate",
35
- "position": "right",
36
- "label": "Type of Data"
37
- },
38
- "palette": "qualitative-bold",
39
- "labels": false,
40
- "dataFormat": {},
41
- "confidenceKeys": {},
42
- "data": [
43
- {
44
- "Date": "1/15/2016",
45
- "Data 1": "0"
46
- },
47
- {
48
- "Date": "2/15/2016",
49
- "Data 1": "25"
50
- },
51
- {
52
- "Date": "3/15/2016",
53
- "Data 1": "50"
54
- },
55
- {
56
- "Date": "4/15/2016",
57
- "Data 1": "75"
58
- },
59
- {
60
- "Date": "5/15/2016",
61
- "Data 1": "100"
62
- },
63
- {
64
- "Date": "6/15/2016",
65
- "Data 1": "50"
66
- }
67
- ],
68
- "visualizationType": "Spark Line",
69
- "series": [
70
- {
71
- "dataKey": "Data 1",
72
- "type": "Bar"
73
- }
74
- ],
75
- "description": "Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups."
76
- }
2
+ "type": "chart",
3
+ "title": "Example Spark Line",
4
+ "theme": "theme-blue",
5
+ "fontSize": "medium",
6
+ "height": "375",
7
+ "compact": true,
8
+ "padding": {
9
+ "left": 5,
10
+ "right": 5
11
+ },
12
+ "yAxis": {
13
+ "size": "75",
14
+ "gridLines": false,
15
+ "label": "Y-Axis Example Label",
16
+ "numTicks": "9"
17
+ },
18
+ "barThickness": 0.35,
19
+ "xAxis": {
20
+ "size": "77",
21
+ "tickRotation": "25",
22
+ "dataKey": "Date",
23
+ "label": "X-Axis Example Label",
24
+ "type": "date",
25
+ "dateParseFormat": "%d/%m/%Y",
26
+ "dateDisplayFormat": "%d/%m/%Y"
27
+ },
28
+ "table": {
29
+ "label": "Data Table",
30
+ "expanded": true,
31
+ "download": true
32
+ },
33
+ "legend": {
34
+ "behavior": "isolate",
35
+ "position": "right",
36
+ "label": "Type of Data"
37
+ },
38
+ "palette": "qualitative-bold",
39
+ "labels": false,
40
+ "dataFormat": {},
41
+ "confidenceKeys": {},
42
+ "data": [
43
+ {
44
+ "Date": "1/15/2016",
45
+ "Data 1": "0"
46
+ },
47
+ {
48
+ "Date": "2/15/2016",
49
+ "Data 1": "25"
50
+ },
51
+ {
52
+ "Date": "3/15/2016",
53
+ "Data 1": "50"
54
+ },
55
+ {
56
+ "Date": "4/15/2016",
57
+ "Data 1": "75"
58
+ },
59
+ {
60
+ "Date": "5/15/2016",
61
+ "Data 1": "100"
62
+ },
63
+ {
64
+ "Date": "6/15/2016",
65
+ "Data 1": "50"
66
+ }
67
+ ],
68
+ "visualizationType": "Spark Line",
69
+ "series": [
70
+ {
71
+ "dataKey": "Data 1",
72
+ "type": "Bar"
73
+ }
74
+ ],
75
+ "description": "Lorem ipsum is placeholder text commonly used in the graphic, print, and publishing industries for previewing layouts and visual mockups."
76
+ }
@@ -0,0 +1,17 @@
1
+ Group_Category,Value
2
+ category one,21
3
+ category one,19
4
+ category one,23
5
+ category one,24
6
+ category two,18
7
+ category two,10
8
+ category two,12
9
+ category two,19
10
+ category three,30
11
+ category three,35
12
+ category three,36
13
+ category three,40
14
+ category four,50
15
+ category four,54
16
+ category four,42
17
+ category four,159
@@ -0,0 +1,90 @@
1
+ [
2
+ {
3
+ "Group_Category": "category one",
4
+ "Value": "21"
5
+ },
6
+ {
7
+ "Group_Category": "category one",
8
+ "Value": "19"
9
+ },
10
+ {
11
+ "Group_Category": "category one",
12
+ "Value": "23"
13
+ },
14
+ {
15
+ "Group_Category": "category one",
16
+ "Value": "24"
17
+ },
18
+ {
19
+ "Group_Category": "category two",
20
+ "Value": "18"
21
+ },
22
+ {
23
+ "Group_Category": "category two",
24
+ "Value": "10"
25
+ },
26
+ {
27
+ "Group_Category": "category two",
28
+ "Value": "12"
29
+ },
30
+ {
31
+ "Group_Category": "category two",
32
+ "Value": "19"
33
+ },
34
+ {
35
+ "Group_Category": "category three",
36
+ "Value": "30"
37
+ },
38
+ {
39
+ "Group_Category": "category three",
40
+ "Value": "35"
41
+ },
42
+ {
43
+ "Group_Category": "category three",
44
+ "Value": "36"
45
+ },
46
+ {
47
+ "Group_Category": "category three",
48
+ "Value": "40"
49
+ },
50
+ {
51
+ "Group_Category": "category four",
52
+ "Value": "30"
53
+ },
54
+ {
55
+ "Group_Category": "category four",
56
+ "Value": "40"
57
+ },
58
+ {
59
+ "Group_Category": "category four",
60
+ "Value": "50"
61
+ },
62
+ {
63
+ "Group_Category": "category four",
64
+ "Value": "50"
65
+ },
66
+ {
67
+ "Group_Category": "category four",
68
+ "Value": "85"
69
+ },
70
+ {
71
+ "Group_Category": "category four",
72
+ "Value": "82"
73
+ },
74
+ {
75
+ "Group_Category": "category four",
76
+ "Value": "43"
77
+ },
78
+ {
79
+ "Group_Category": "category four",
80
+ "Value": "42"
81
+ },
82
+ {
83
+ "Group_Category": "category four",
84
+ "Value": "41"
85
+ },
86
+ {
87
+ "Group_Category": "category four",
88
+ "Value": "21"
89
+ }
90
+ ]
@@ -1,14 +1,16 @@
1
- [{"Sex":"Male","Age Group":"<15","Cases per 100K":"7428"},
2
- {"Sex":"Male","Age Group":"15-24","Cases per 100K":"5176"},
3
- {"Sex":"Male","Age Group":"25-34","Cases per 100K":"5624"},
4
- {"Sex":"Male","Age Group":"35-44","Cases per 100K":"10756.75"},
5
- {"Sex":"Male","Age Group":"45-54","Cases per 100K":"8259"},
6
- {"Sex":"Male","Age Group":"55-64","Cases per 100K":"1235"},
7
- {"Sex":"Male","Age Group":"65","Cases per 100K":"730"},
8
- {"Sex":"Female","Age Group":"<15","Cases per 100K":"5714"},
9
- {"Sex":"Female","Age Group":"15-24","Cases per 100K":"3588"},
10
- {"Sex":"Female","Age Group":"25-34","Cases per 100K":"3410"},
11
- {"Sex":"Female","Age Group":"35-44","Cases per 100K":"7478"},
12
- {"Sex":"Female","Age Group":"45-54","Cases per 100K":"5633"},
13
- {"Sex":"Female","Age Group":"55-64","Cases per 100K":"810"},
14
- {"Sex":"Female","Age Group":"65","Cases per 100K":"402"}]
1
+ [
2
+ { "Sex": "Male", "Age Group": "<15", "Cases per 100K": "7428" },
3
+ { "Sex": "Male", "Age Group": "15-24", "Cases per 100K": "5176" },
4
+ { "Sex": "Male", "Age Group": "25-34", "Cases per 100K": "5624" },
5
+ { "Sex": "Male", "Age Group": "35-44", "Cases per 100K": "10756.75" },
6
+ { "Sex": "Male", "Age Group": "45-54", "Cases per 100K": "8259" },
7
+ { "Sex": "Male", "Age Group": "55-64", "Cases per 100K": "1235" },
8
+ { "Sex": "Male", "Age Group": "65", "Cases per 100K": "730" },
9
+ { "Sex": "Female", "Age Group": "<15", "Cases per 100K": "5714" },
10
+ { "Sex": "Female", "Age Group": "15-24", "Cases per 100K": "3588" },
11
+ { "Sex": "Female", "Age Group": "25-34", "Cases per 100K": "3410" },
12
+ { "Sex": "Female", "Age Group": "35-44", "Cases per 100K": "7478" },
13
+ { "Sex": "Female", "Age Group": "45-54", "Cases per 100K": "5633" },
14
+ { "Sex": "Female", "Age Group": "55-64", "Cases per 100K": "810" },
15
+ { "Sex": "Female", "Age Group": "65", "Cases per 100K": "402" }
16
+ ]
@@ -1,50 +1,50 @@
1
1
  {
2
- "title": "Paired Bar Chart Example",
3
- "dataUrl": "/examples/paired-bar-data.json",
4
- "animate": true,
5
- "animateReplay": true,
6
- "visualizationType": "Paired Bar",
7
- "series": [
8
- {"dataKey": "Male","type": "Paired Bar"},
9
- {"dataKey": "Female","type": "Paired Bar"}
10
- ],
11
- "dataFormat": {
12
- "roundTo": 1,
13
- "commas": false,
14
- "prefix": "",
15
- "suffix": "km"
16
- },
17
- "padding": {
18
- "left": 0,
19
- "right": 0
20
- },
21
- "yAxis": {
22
- "label": "Cases per 100K",
23
- "tickRotation": 30,
24
- "hideAxis": true
25
- },
26
- "xAxis": {
27
- "label": "Age Group",
28
- "dataKey": "Age Group",
29
- "tickRotation": 30,
30
- "hideAxis": true
31
- },
32
- "legend": {
33
- "hideAxis": false
34
- },
35
- "table": {
36
- "label": "Data Table",
37
- "expanded": false
38
- },
39
- "dataDescription": {
40
- "horizontal": false,
41
- "series": true,
42
- "seriesKey": "Sex",
43
- "singleRow": false,
44
- "xKey": "Age Group",
45
- "valueKey": "Cases per 100K"
46
- },
47
- "runtime": {
48
- "horizontal": true
49
- }
2
+ "title": "Paired Bar Chart Example",
3
+ "dataUrl": "/examples/paired-bar-data.json",
4
+ "animate": true,
5
+ "animateReplay": true,
6
+ "visualizationType": "Paired Bar",
7
+ "series": [
8
+ { "dataKey": "Male", "type": "Paired Bar" },
9
+ { "dataKey": "Female", "type": "Paired Bar" }
10
+ ],
11
+ "dataFormat": {
12
+ "roundTo": 1,
13
+ "commas": false,
14
+ "prefix": "",
15
+ "suffix": "km"
16
+ },
17
+ "padding": {
18
+ "left": 0,
19
+ "right": 0
20
+ },
21
+ "yAxis": {
22
+ "label": "Cases per 100K",
23
+ "tickRotation": 30,
24
+ "hideAxis": true
25
+ },
26
+ "xAxis": {
27
+ "label": "Age Group",
28
+ "dataKey": "Age Group",
29
+ "tickRotation": 30,
30
+ "hideAxis": true
31
+ },
32
+ "legend": {
33
+ "hideAxis": false
34
+ },
35
+ "table": {
36
+ "label": "Data Table",
37
+ "expanded": false
38
+ },
39
+ "dataDescription": {
40
+ "horizontal": false,
41
+ "series": true,
42
+ "seriesKey": "Sex",
43
+ "singleRow": false,
44
+ "xKey": "Age Group",
45
+ "valueKey": "Cases per 100K"
46
+ },
47
+ "runtime": {
48
+ "horizontal": true
49
+ }
50
50
  }
@@ -1,37 +1,37 @@
1
1
  [
2
- {
3
- "Age Group": "65",
4
- "Male": "730",
5
- "Female": "402"
6
- },
7
- {
8
- "Age Group": "<15",
9
- "Male": "7428",
10
- "Female": "5714"
11
- },
12
- {
13
- "Age Group": "15-24",
14
- "Male": "5176",
15
- "Female": "3588"
16
- },
17
- {
18
- "Age Group": "25-34",
19
- "Male": "5624",
20
- "Female": "3410"
21
- },
22
- {
23
- "Age Group": "35-44",
24
- "Male": "10756",
25
- "Female": "7478"
26
- },
27
- {
28
- "Age Group": "45-54",
29
- "Male": "8259",
30
- "Female": "5633"
31
- },
32
- {
33
- "Age Group": "55-64",
34
- "Male": "1235",
35
- "Female": "810"
36
- }
37
- ]
2
+ {
3
+ "Age Group": "65",
4
+ "Male": "730",
5
+ "Female": "402"
6
+ },
7
+ {
8
+ "Age Group": "<15",
9
+ "Male": "7428",
10
+ "Female": "5714"
11
+ },
12
+ {
13
+ "Age Group": "15-24",
14
+ "Male": "5176",
15
+ "Female": "3588"
16
+ },
17
+ {
18
+ "Age Group": "25-34",
19
+ "Male": "5624",
20
+ "Female": "3410"
21
+ },
22
+ {
23
+ "Age Group": "35-44",
24
+ "Male": "10756",
25
+ "Female": "7478"
26
+ },
27
+ {
28
+ "Age Group": "45-54",
29
+ "Male": "8259",
30
+ "Female": "5633"
31
+ },
32
+ {
33
+ "Age Group": "55-64",
34
+ "Male": "1235",
35
+ "Female": "810"
36
+ }
37
+ ]
@@ -1,35 +1,35 @@
1
1
  {
2
- "title": "Planet Radius (Combo Example)",
3
- "dataUrl": "/examples/planet-example-data.json",
4
- "visualizationType": "Bar",
5
- "visualizationSubType": "regular",
6
- "isLollipopChart": true,
7
- "barHasBorder": "true",
8
- "series": [{"dataKey":"Radius", "type":"Line"}],
9
- "fontSize": "small",
10
- "dataFormat": {
11
- "roundTo": 1,
12
- "commas": false,
13
- "prefix": "",
14
- "suffix": "km"
15
- },
16
- "padding": {
17
- "left": 0,
18
- "right": 0
19
- },
20
- "yAxis": {
21
- "label": "Measurement (1000km)",
22
- "displayNumbersOnBar": false,
23
- "labelPlacement": "On Date/Category Axis"
24
- },
25
- "xAxis": {
26
- "label": "Planet",
27
- "dataKey": "name",
28
- "size": 75
29
- },
30
- "table": {
31
- "label": "Data Table",
32
- "expanded": false
33
- },
34
- "lollipopShape": "circle"
2
+ "title": "Planet Radius (Combo Example)",
3
+ "dataUrl": "/examples/planet-example-data.json",
4
+ "visualizationType": "Bar",
5
+ "visualizationSubType": "regular",
6
+ "isLollipopChart": true,
7
+ "barHasBorder": "true",
8
+ "series": [{ "dataKey": "Radius", "type": "Line" }],
9
+ "fontSize": "small",
10
+ "dataFormat": {
11
+ "roundTo": 1,
12
+ "commas": false,
13
+ "prefix": "",
14
+ "suffix": "km"
15
+ },
16
+ "padding": {
17
+ "left": 0,
18
+ "right": 0
19
+ },
20
+ "yAxis": {
21
+ "label": "Measurement (1000km)",
22
+ "displayNumbersOnBar": false,
23
+ "labelPlacement": "On Date/Category Axis"
24
+ },
25
+ "xAxis": {
26
+ "label": "Planet",
27
+ "dataKey": "name",
28
+ "size": 75
29
+ },
30
+ "table": {
31
+ "label": "Data Table",
32
+ "expanded": false
33
+ },
34
+ "lollipopShape": "circle"
35
35
  }
@@ -1,33 +1,36 @@
1
1
  {
2
- "title": "Planet Radius (Combo Example)",
3
- "dataUrl": "/examples/planet-example-data.json",
4
- "animate": true,
5
- "animateReplay": true,
6
- "visualizationType": "Combo",
7
- "series": [{"dataKey":"Radius", "type":"Line"}, {"dataKey":"Diameter", "type":"Bar"}],
8
- "dataFormat": {
9
- "roundTo": 1,
10
- "commas": false,
11
- "prefix": "",
12
- "suffix": "km"
13
- },
14
- "padding": {
15
- "left": 0,
16
- "right": 0
17
- },
18
- "yAxis": {
19
- "label": "Measurement (1000km)"
20
- },
21
- "xAxis": {
22
- "label": "Planet",
23
- "dataKey": "name",
24
- "tickRotation": 30
25
- },
26
- "legend": {
27
- "hide": false
28
- },
29
- "table": {
30
- "label": "Data Table",
31
- "expanded": false
32
- }
2
+ "title": "Planet Radius (Combo Example)",
3
+ "dataUrl": "/examples/planet-example-data.json",
4
+ "animate": true,
5
+ "animateReplay": true,
6
+ "visualizationType": "Combo",
7
+ "series": [
8
+ { "dataKey": "Radius", "type": "Line" },
9
+ { "dataKey": "Diameter", "type": "Bar" }
10
+ ],
11
+ "dataFormat": {
12
+ "roundTo": 1,
13
+ "commas": false,
14
+ "prefix": "",
15
+ "suffix": "km"
16
+ },
17
+ "padding": {
18
+ "left": 0,
19
+ "right": 0
20
+ },
21
+ "yAxis": {
22
+ "label": "Measurement (1000km)"
23
+ },
24
+ "xAxis": {
25
+ "label": "Planet",
26
+ "dataKey": "name",
27
+ "tickRotation": 30
28
+ },
29
+ "legend": {
30
+ "hide": false
31
+ },
32
+ "table": {
33
+ "label": "Data Table",
34
+ "expanded": false
35
+ }
33
36
  }