-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstepFunctionsUpward.js
87 lines (72 loc) · 1.88 KB
/
stepFunctionsUpward.js
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import {
drawAxes,
drawSecondaryAxes,
drawBar,
removeBar,
stackedBarChart,
fadeBarsOut,
fadeBarsIn,
drawAllBars,
cleanupZeroBars,
fillMissingBars,
middleBarsDown,
middleBarsDownFinalState,
forceChart,
middleBarsDownReverse,
forceChartReverse,
drawAxesFade,
createSVG,
} from "./graphFunctions.js";
import { totalMdVolume } from "./data/dataPrep.js";
import textStory from "./textStory.js";
import cra from "./data/craData.js";
export const changeEventsUpward = {
intro: drawAxes,
year2006: removeBar,
year2007: removeBar,
year2008: removeBar,
year2009: removeBar,
year2010: removeBar,
year2011: removeBar,
year2012: removeBar,
year2013: removeBar,
year2014: removeBar,
year2015: removeBar,
year2016: removeBar,
year2017: removeBar,
year2018: removeBar,
year2019: removeBar,
year2020: removeBar,
classBreakdown: fromStackedToReg,
firstAndLast: firstAndLastFunctions,
productLevel: forceChartReverseAll,
};
function fromStackedToReg() {
d3.select("svg").remove();
createSVG();
drawAxes();
drawAllBars(totalMdVolume);
d3.selectAll(".reg").style("opacity", 0);
d3.selectAll(".reg").transition().duration(1500).style("opacity", 1);
stackedBarChart(cra, "allYears");
d3.selectAll(".stacked").style("opacity", 1);
d3.selectAll(".stacked").transition().duration(1500).style("opacity", 0);
}
function firstAndLastFunctions() {
d3.select("svg").remove();
createSVG();
drawAxes();
stackedBarChart(cra, "outsideYears");
d3.selectAll(".bar").style("opacity", 1);
// stacked bar chart middle years only
// stackedBarChart(cra, "middleYears");
// d3.selectAll(".middle").attr("height", 0);
// d3.selectAll(".middle").transition().duration(1000)
//initialize with height 0
// then middlebardown reverse
middleBarsDownReverse();
}
function forceChartReverseAll() {
forceChartReverse();
drawAxesFade();
}