@cdc/chart 4.23.3 → 4.23.4
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/cdcchart.js +24397 -24193
- package/examples/feature/__data__/area-chart.json +56 -0
- package/examples/{planet-example-data.json → feature/__data__/planet-example-data.json} +16 -4
- package/examples/{area-chart.json → feature/area/area-chart.json} +70 -13
- package/examples/{horizontal-chart-max-increase.json → feature/bar/horizontal-chart-max-increase.json} +10 -4
- package/examples/{horizontal-chart.json → feature/bar/horizontal-chart.json} +10 -4
- package/examples/{horizontal-stacked-bar-chart.json → feature/bar/horizontal-stacked-bar-chart.json} +7 -3
- package/examples/{planet-chart-horizontal-example-config.json → feature/bar/planet-chart-horizontal-example-config.json} +8 -3
- package/examples/{planet-example-config.json → feature/bar/planet-example-config.json} +2 -2
- package/examples/{box-plot.json → feature/boxplot/boxplot.json} +7 -7
- package/examples/feature/boxplot/testing.csv +38 -0
- package/examples/feature/combo/combochart-categories_are_numbers .json +18 -0
- package/examples/{planet-combo-example-config.json → feature/combo/planet-combo-example-config.json} +1 -1
- package/examples/{planet-deviation-config.json → feature/deviation/planet-deviation-config.json} +2 -2
- package/examples/{planet-deviation-data.json → feature/deviation/planet-deviation-data.json} +9 -9
- package/examples/feature/filters/filter-testing.json +178 -0
- package/examples/feature/forecasting/case_date_example.csv +130 -0
- package/examples/feature/forecasting/effective_reproduction.json +202 -0
- package/examples/feature/forecasting/r_data.csv +130 -0
- package/examples/feature/line/line-chart.json +124 -0
- package/examples/{paired-bar-example.json → feature/paired-bar/paired-bar-example.json} +10 -4
- package/examples/{planet-pie-example-config.json → feature/pie/planet-pie-example-config.json} +2 -2
- package/examples/{scatterplot.json → feature/scatterplot/scatterplot.json} +1 -1
- package/examples/{case-rate-example-config.json → feature/tests-case-rate/case-rate-example-config.json} +2 -2
- package/examples/{covid-confidence-example-config.json → feature/tests-covid/covid-confidence-example-config.json} +8 -3
- package/examples/{covid-example-config.json → feature/tests-covid/covid-example-config.json} +7 -3
- package/examples/{cutoff-example-config.json → feature/tests-cutoff/cutoff-example-config.json} +7 -3
- package/examples/{date-exclusions-config.json → feature/tests-date-exclusions/date-exclusions-config.json} +2 -2
- package/examples/{example-bar-chart-nonnumeric.json → feature/tests-non-numerics/example-bar-chart-nonnumeric.json} +1 -1
- package/examples/{planet-pie-example-config-nonnumeric.json → feature/tests-non-numerics/planet-pie-example-config-nonnumeric.json} +2 -2
- package/examples/{sparkline-chart-nonnumeric.json → feature/tests-non-numerics/sparkline-chart-nonnumeric.json} +1 -1
- package/examples/gallery/bar-chart-vertical/combo-line-chart.json +145 -7
- package/examples/gallery/paired-bar/paired-bar-chart.json +1 -0
- package/index.html +73 -49
- package/package.json +2 -2
- package/src/CdcChart.jsx +111 -26
- package/src/components/AreaChart.jsx +105 -70
- package/src/components/BarChart.jsx +45 -28
- package/src/components/BoxPlot.jsx +28 -20
- package/src/components/DataTable.jsx +7 -6
- package/src/components/DeviationBar.jsx +2 -2
- package/src/components/EditorPanel.jsx +252 -193
- package/src/components/Legend.jsx +1 -1
- package/src/components/LineChart.jsx +10 -16
- package/src/components/LinearChart.jsx +30 -34
- package/src/components/PairedBarChart.jsx +6 -6
- package/src/components/PieChart.jsx +2 -4
- package/src/components/SparkLine.jsx +6 -42
- package/src/data/initial-state.js +7 -3
- package/src/index.jsx +2 -1
- package/src/scss/editor-panel.scss +15 -0
- package/src/scss/main.scss +8 -6
- package/examples/box-plot.csv +0 -5
- package/examples/dynamic-legends.json +0 -125
- package/examples/line-chart.json +0 -34
- package/examples/temp-example-config.json +0 -64
- package/examples/temp-example-data.json +0 -130
- package/src/components/Filters.jsx +0 -126
- /package/examples/{age-adjusted-rates.json → feature/__data__/age-adjusted-rates.json} +0 -0
- /package/examples/{new-data.csv → feature/__data__/new-data.csv} +0 -0
- /package/examples/{planet-example-data-max-increase.json → feature/__data__/planet-example-data-max-increase.json} +0 -0
- /package/examples/{Barchart_with_negative.json → feature/bar/Barchart_with_negative.json} +0 -0
- /package/examples/{example-bar-chart.json → feature/bar/example-bar-chart.json} +0 -0
- /package/examples/{stacked-vertical-bar-example-negative.json → feature/bar/stacked-vertical-bar-example-negative.json} +0 -0
- /package/examples/{stacked-vertical-bar-example.json → feature/bar/stacked-vertical-bar-example.json} +0 -0
- /package/examples/{box-plot-data.json → feature/boxplot/box-plot-data.json} +0 -0
- /package/examples/{newdata.json → feature/boxplot/boxplot-data.json} +0 -0
- /package/examples/{line-chart-max-increase.json → feature/line/line-chart-max-increase.json} +0 -0
- /package/examples/{paired-bar-data.json → feature/paired-bar/paired-bar-data.json} +0 -0
- /package/examples/{paired-bar-formatted.json → feature/paired-bar/paired-bar-formatted.json} +0 -0
- /package/examples/{scatterplot-continuous.csv → feature/scatterplot/scatterplot-continuous.csv} +0 -0
- /package/examples/{example-sparkline.json → feature/sparkline/example-sparkline.json} +0 -0
- /package/examples/{big-small-test-bar.json → feature/tests-big-small/big-small-test-bar.json} +0 -0
- /package/examples/{big-small-test-line.json → feature/tests-big-small/big-small-test-line.json} +0 -0
- /package/examples/{big-small-test-negative.json → feature/tests-big-small/big-small-test-negative.json} +0 -0
- /package/examples/{case-rate-example-data.json → feature/tests-case-rate/case-rate-example-data.json} +0 -0
- /package/examples/{covid-example-data-confidence.json → feature/tests-covid/covid-example-data-confidence.json} +0 -0
- /package/examples/{covid-example-data.json → feature/tests-covid/covid-example-data.json} +0 -0
- /package/examples/{cutoff-example-data.json → feature/tests-cutoff/cutoff-example-data.json} +0 -0
- /package/examples/{date-exclusions-data.json → feature/tests-date-exclusions/date-exclusions-data.json} +0 -0
- /package/examples/{example-combo-bar-nonnumeric.json → feature/tests-non-numerics/example-combo-bar-nonnumeric.json} +0 -0
- /package/examples/{line-chart-nonnumeric.json → feature/tests-non-numerics/line-chart-nonnumeric.json} +0 -0
- /package/examples/{planet-example-data-nonnumeric.json → feature/tests-non-numerics/planet-example-data-nonnumeric.json} +0 -0
- /package/examples/{stacked-vertical-bar-example-nonnumerics.json → feature/tests-non-numerics/stacked-vertical-bar-example-nonnumerics.json} +0 -0
|
@@ -1,125 +0,0 @@
|
|
|
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": false
|
|
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
|
-
}
|
package/examples/line-chart.json
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "chart",
|
|
3
|
-
"title": "Example Line Chart",
|
|
4
|
-
"theme": "theme-green",
|
|
5
|
-
"fontSize": "medium",
|
|
6
|
-
"height": "375",
|
|
7
|
-
"padding": { "left": 5, "right": 5 },
|
|
8
|
-
"yAxis": { "size": "75", "gridLines": false, "label": "Y-Axis Example Label", "numTicks": "9" },
|
|
9
|
-
"barThickness": 0.35,
|
|
10
|
-
"xAxis": { "size": "77", "tickRotation": "25", "dataKey": "Date", "label": "X-Axis Example Label", "type": "date", "dateParseFormat": "%d/%m/%Y", "dateDisplayFormat": "%d/%m/%Y" },
|
|
11
|
-
"table": { "label": "Data Table", "expanded": true, "download": true },
|
|
12
|
-
"legend": { "behavior": "isolate", "position": "right", "label": "Type of Data" },
|
|
13
|
-
"palette": "qualitative-bold",
|
|
14
|
-
"labels": false,
|
|
15
|
-
"dataFormat": {},
|
|
16
|
-
"confidenceKeys": {},
|
|
17
|
-
"data": [
|
|
18
|
-
{ "Date": "1/15/2016", "Data 1": "90", "Data 2": "135", "Data 3": "300", "Data 4": "95", "Data 5": "120", "Data 6": "310" },
|
|
19
|
-
{ "Date": "2/15/2016", "Data 1": "40", "Data 2": "90", "Data 3": "240", "Data 4": "60", "Data 5": "160", "Data 6": "200" },
|
|
20
|
-
{ "Date": "3/15/2016", "Data 1": "50", "Data 2": "300", "Data 3": "290", "Data 4": "100", "Data 5": "200", "Data 6": "250" },
|
|
21
|
-
{ "Date": "4/15/2016", "Data 1": "120", "Data 2": "160", "Data 3": "230", "Data 4": "180", "Data 5": "160", "Data 6": "220" },
|
|
22
|
-
{ "Date": "5/15/2016", "Data 1": "80", "Data 2": "350", "Data 3": "300", "Data 4": "150", "Data 5": "130", "Data 6": "100" },
|
|
23
|
-
{ "Date": "6/15/2016", "Data 1": "90", "Data 2": "220", "Data 3": "320", "Data 4": "100", "Data 5": "220", "Data 6": "300" }
|
|
24
|
-
],
|
|
25
|
-
"visualizationType": "Line",
|
|
26
|
-
"series": [
|
|
27
|
-
{ "dataKey": "Data 1", "type": "Line" },
|
|
28
|
-
{ "dataKey": "Data 2", "type": "Line" },
|
|
29
|
-
{ "dataKey": "Data 3", "type": "Line" },
|
|
30
|
-
{ "dataKey": "Data 4", "type": "Line" },
|
|
31
|
-
{ "dataKey": "Data 5", "type": "Line" },
|
|
32
|
-
{ "dataKey": "Data 6", "type": "Line" }
|
|
33
|
-
]
|
|
34
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "Average Temperature By City (Line Example)",
|
|
3
|
-
"description": "<p>Average temperature from October 1st through August 29th in:</p><ul><li>New York</li><li>San Francisco</li><li>Austin</li></ul>",
|
|
4
|
-
"dataUrl": "/examples/temp-example-data.json",
|
|
5
|
-
"visualizationType": "Line",
|
|
6
|
-
"series": [
|
|
7
|
-
{ "dataKey": "New York", "label": "NY" },
|
|
8
|
-
{ "dataKey": "San Francisco", "label": "SF" },
|
|
9
|
-
{ "dataKey": "Austin", "label": "AU" }
|
|
10
|
-
],
|
|
11
|
-
"filters": [
|
|
12
|
-
{
|
|
13
|
-
"label": "Wind",
|
|
14
|
-
"columnName": "wind"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"label": "Humidity",
|
|
18
|
-
"columnName": "humidity"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"seriesLabel": "City",
|
|
22
|
-
"fontSize": "large",
|
|
23
|
-
"dataFormat": {
|
|
24
|
-
"commas": false,
|
|
25
|
-
"prefix": "",
|
|
26
|
-
"suffix": "°"
|
|
27
|
-
},
|
|
28
|
-
"padding": {
|
|
29
|
-
"left": 15,
|
|
30
|
-
"right": 15
|
|
31
|
-
},
|
|
32
|
-
"yAxis": {
|
|
33
|
-
"label": "Temperature",
|
|
34
|
-
"paddingPercent": 0.15
|
|
35
|
-
},
|
|
36
|
-
"xAxis": {
|
|
37
|
-
"label": "Date",
|
|
38
|
-
"dataKey": "date",
|
|
39
|
-
"type": "date",
|
|
40
|
-
"dateParseFormat": "%Y-%m-%d",
|
|
41
|
-
"dateDisplayFormat": "%b %d",
|
|
42
|
-
"numTicks": 8,
|
|
43
|
-
"tickRotation": 50
|
|
44
|
-
},
|
|
45
|
-
"legend": {
|
|
46
|
-
"label": "Legend",
|
|
47
|
-
"above": true,
|
|
48
|
-
"left": true
|
|
49
|
-
},
|
|
50
|
-
"table": {
|
|
51
|
-
"label": "Data Table",
|
|
52
|
-
"expanded": false,
|
|
53
|
-
"download": true
|
|
54
|
-
},
|
|
55
|
-
"regions": [
|
|
56
|
-
{
|
|
57
|
-
"label": "Region",
|
|
58
|
-
"color": "black",
|
|
59
|
-
"background": "green",
|
|
60
|
-
"from": "2011-10-02",
|
|
61
|
-
"to": "2011-10-03"
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"date": "2011-10-01",
|
|
4
|
-
"New York": "89.4",
|
|
5
|
-
"San Francisco": "26.7",
|
|
6
|
-
"Austin": "34.2",
|
|
7
|
-
"wind": "Include Wind",
|
|
8
|
-
"humidity": "Include Humidiy"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"date": "2011-10-02",
|
|
12
|
-
"New York": "54.0",
|
|
13
|
-
"San Francisco": "59.9",
|
|
14
|
-
"Austin": "68.7",
|
|
15
|
-
"wind": "Include Wind",
|
|
16
|
-
"humidity": "Include Humidiy"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"date": "2011-10-03",
|
|
20
|
-
"New York": "51.3",
|
|
21
|
-
"San Francisco": "53.1",
|
|
22
|
-
"Austin": "64.4",
|
|
23
|
-
"wind": "Include Wind",
|
|
24
|
-
"humidity": "Include Humidiy"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"date": "2011-10-04",
|
|
28
|
-
"New York": "34.7",
|
|
29
|
-
"San Francisco": "56.8",
|
|
30
|
-
"Austin": "98.0",
|
|
31
|
-
"wind": "Include Wind",
|
|
32
|
-
"humidity": "Include Humidiy"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"date": "2011-10-01",
|
|
36
|
-
"New York": "32.4",
|
|
37
|
-
"San Francisco": "43.7",
|
|
38
|
-
"Austin": "54.2",
|
|
39
|
-
"wind": "Don't Include Wind",
|
|
40
|
-
"humidity": "Include Humidiy"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"date": "2011-10-02",
|
|
44
|
-
"New York": "65.0",
|
|
45
|
-
"San Francisco": "76.9",
|
|
46
|
-
"Austin": "87.7",
|
|
47
|
-
"wind": "Don't Include Wind",
|
|
48
|
-
"humidity": "Include Humidiy"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"date": "2011-10-03",
|
|
52
|
-
"New York": "53.3",
|
|
53
|
-
"San Francisco": "59.1",
|
|
54
|
-
"Austin": "69.4",
|
|
55
|
-
"wind": "Don't Include Wind",
|
|
56
|
-
"humidity": "Include Humidiy"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"date": "2011-10-04",
|
|
60
|
-
"New York": "55.7",
|
|
61
|
-
"San Francisco": "58.8",
|
|
62
|
-
"Austin": "68.0",
|
|
63
|
-
"wind": "Don't Include Wind",
|
|
64
|
-
"humidity": "Include Humidiy"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"date": "2011-10-01",
|
|
68
|
-
"New York": "63.4",
|
|
69
|
-
"San Francisco": "62.7",
|
|
70
|
-
"Austin": "72.2",
|
|
71
|
-
"wind": "Include Wind",
|
|
72
|
-
"humidity": "Don't Include Humidiy"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"date": "2011-10-02",
|
|
76
|
-
"New York": "58.0",
|
|
77
|
-
"San Francisco": "59.9",
|
|
78
|
-
"Austin": "67.7",
|
|
79
|
-
"wind": "Include Wind",
|
|
80
|
-
"humidity": "Don't Include Humidiy"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"date": "2011-10-03",
|
|
84
|
-
"New York": "53.3",
|
|
85
|
-
"San Francisco": "59.1",
|
|
86
|
-
"Austin": "69.4",
|
|
87
|
-
"wind": "Include Wind",
|
|
88
|
-
"humidity": "Don't Include Humidiy"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"date": "2011-10-04",
|
|
92
|
-
"New York": "55.7",
|
|
93
|
-
"San Francisco": "58.8",
|
|
94
|
-
"Austin": "68.0",
|
|
95
|
-
"wind": "Include Wind",
|
|
96
|
-
"humidity": "Don't Include Humidiy"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"date": "2011-10-01",
|
|
100
|
-
"New York": "63.4",
|
|
101
|
-
"San Francisco": "62.7",
|
|
102
|
-
"Austin": "87.2",
|
|
103
|
-
"wind": "Don't Include Wind",
|
|
104
|
-
"humidity": "Don't Include Humidiy"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"date": "2011-10-02",
|
|
108
|
-
"New York": "98.0",
|
|
109
|
-
"San Francisco": "59.9",
|
|
110
|
-
"Austin": "67.7",
|
|
111
|
-
"wind": "Don't Include Wind",
|
|
112
|
-
"humidity": "Don't Include Humidiy"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"date": "2011-10-03",
|
|
116
|
-
"New York": "53.3",
|
|
117
|
-
"San Francisco": "59.1",
|
|
118
|
-
"Austin": "69.4",
|
|
119
|
-
"wind": "Don't Include Wind",
|
|
120
|
-
"humidity": "Don't Include Humidiy"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"date": "2011-10-04",
|
|
124
|
-
"New York": "55.7",
|
|
125
|
-
"San Francisco": "54.8",
|
|
126
|
-
"Austin": "68.0",
|
|
127
|
-
"wind": "Don't Include Wind",
|
|
128
|
-
"humidity": "Don't Include Humidiy"
|
|
129
|
-
}
|
|
130
|
-
]
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React, { useState, useContext } from 'react'
|
|
2
|
-
import ConfigContext from './../ConfigContext'
|
|
3
|
-
import Button from '@cdc/core/components/elements/Button'
|
|
4
|
-
|
|
5
|
-
const useFilters = () => {
|
|
6
|
-
const { config, setConfig, setFilteredData, excludedData, filterData } = useContext(ConfigContext)
|
|
7
|
-
const [showApplyButton, setShowApplyButton] = useState(false)
|
|
8
|
-
|
|
9
|
-
const sortAsc = (a, b) => {
|
|
10
|
-
return a.toString().localeCompare(b.toString(), 'en', { numeric: true })
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const sortDesc = (a, b) => {
|
|
14
|
-
return b.toString().localeCompare(a.toString(), 'en', { numeric: true })
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const announceChange = text => {}
|
|
18
|
-
|
|
19
|
-
const changeFilterActive = (index, value) => {
|
|
20
|
-
let newFilters = config.filters
|
|
21
|
-
newFilters[index].active = value
|
|
22
|
-
setConfig({
|
|
23
|
-
...config,
|
|
24
|
-
filters: newFilters
|
|
25
|
-
})
|
|
26
|
-
setShowApplyButton(true)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const handleApplyButton = newFilters => {
|
|
30
|
-
setConfig({ ...config, filters: newFilters })
|
|
31
|
-
setFilteredData(filterData(newFilters, excludedData))
|
|
32
|
-
setShowApplyButton(false)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const handleReset = () => {
|
|
36
|
-
let newFilters = config.filters
|
|
37
|
-
|
|
38
|
-
// reset to first item in values array.
|
|
39
|
-
newFilters.map(filter => {
|
|
40
|
-
filter.active = filter.values[0]
|
|
41
|
-
return null
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
setFilteredData(filterData(newFilters, excludedData))
|
|
45
|
-
setConfig({ ...config, filters: newFilters })
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return { handleApplyButton, changeFilterActive, announceChange, sortAsc, sortDesc, showApplyButton, handleReset }
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const Filters = () => {
|
|
52
|
-
const { config } = useContext(ConfigContext)
|
|
53
|
-
const { handleApplyButton, changeFilterActive, announceChange, sortAsc, sortDesc, showApplyButton, handleReset } = useFilters()
|
|
54
|
-
const { filters } = config
|
|
55
|
-
const buttonText = 'Apply Filters'
|
|
56
|
-
const resetText = 'Reset All'
|
|
57
|
-
|
|
58
|
-
// A List of Dropdowns
|
|
59
|
-
const FilterList = () => {
|
|
60
|
-
if (config.filters) {
|
|
61
|
-
return config.filters.map((singleFilter, index) => {
|
|
62
|
-
const values = []
|
|
63
|
-
|
|
64
|
-
if (!singleFilter.order || singleFilter.order === '') {
|
|
65
|
-
singleFilter.order = 'asc'
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (singleFilter.order === 'desc') {
|
|
69
|
-
singleFilter.values = singleFilter.values.sort(sortDesc)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (singleFilter.order === 'asc') {
|
|
73
|
-
singleFilter.values = singleFilter.values.sort(sortAsc)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
singleFilter.values.forEach((filterOption, index) => {
|
|
77
|
-
values.push(
|
|
78
|
-
<option key={index} value={filterOption}>
|
|
79
|
-
{filterOption}
|
|
80
|
-
</option>
|
|
81
|
-
)
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<div className='single-filter' key={index}>
|
|
86
|
-
<label htmlFor={`filter-${index}`}>{singleFilter.label}</label>
|
|
87
|
-
<select
|
|
88
|
-
id={`filter-${index}`}
|
|
89
|
-
className='filter-select'
|
|
90
|
-
data-index='0'
|
|
91
|
-
value={singleFilter.active}
|
|
92
|
-
onChange={e => {
|
|
93
|
-
changeFilterActive(index, e.target.value)
|
|
94
|
-
announceChange(`Filter ${singleFilter.label} value has been changed to ${e.target.value}, please reference the data table to see updated values.`)
|
|
95
|
-
}}
|
|
96
|
-
>
|
|
97
|
-
{values}
|
|
98
|
-
</select>
|
|
99
|
-
</div>
|
|
100
|
-
)
|
|
101
|
-
})
|
|
102
|
-
} else {
|
|
103
|
-
return null
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<section className={`filters-section`} style={{ display: 'block', width: '100%' }}>
|
|
109
|
-
<div className='filters-section__wrapper' style={{ flexWrap: 'wrap', display: 'flex', gap: '7px 15px', marginTop: '15px' }}>
|
|
110
|
-
<FilterList />
|
|
111
|
-
{config.filters.length > 0 && (
|
|
112
|
-
<div className='filter-section__buttons' style={{ width: '100%' }}>
|
|
113
|
-
<Button onClick={() => handleApplyButton(filters)} disabled={!showApplyButton} style={{ marginRight: '10px' }}>
|
|
114
|
-
{buttonText}
|
|
115
|
-
</Button>
|
|
116
|
-
<a href='#!' role='button' onClick={handleReset}>
|
|
117
|
-
{resetText}
|
|
118
|
-
</a>
|
|
119
|
-
</div>
|
|
120
|
-
)}
|
|
121
|
-
</div>
|
|
122
|
-
</section>
|
|
123
|
-
)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export default Filters
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/examples/{line-chart-max-increase.json → feature/line/line-chart-max-increase.json}
RENAMED
|
File without changes
|
|
File without changes
|
/package/examples/{paired-bar-formatted.json → feature/paired-bar/paired-bar-formatted.json}
RENAMED
|
File without changes
|
/package/examples/{scatterplot-continuous.csv → feature/scatterplot/scatterplot-continuous.csv}
RENAMED
|
File without changes
|
|
File without changes
|
/package/examples/{big-small-test-bar.json → feature/tests-big-small/big-small-test-bar.json}
RENAMED
|
File without changes
|
/package/examples/{big-small-test-line.json → feature/tests-big-small/big-small-test-line.json}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/examples/{cutoff-example-data.json → feature/tests-cutoff/cutoff-example-data.json}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|