-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphDimensions.js
64 lines (57 loc) · 1.33 KB
/
graphDimensions.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
// set the dimensions and margins of the graph\
import { totalMdVolume } from "./data/dataPrep.js";
export const margin = { top: 50, right: 80, bottom: 30, left: 70, barTop: 20 };
export const width = 550 - margin.left - margin.right;
export const height = 450 - margin.top - margin.bottom;
export const barWidth = 10;
export const forceWidth = 20;
export const xScale = d3
.scaleLinear()
.range([0, width])
.domain([
d3.min(totalMdVolume, (d) => {
return d.date;
}),
d3.max(totalMdVolume, function (d) {
return d.date;
}),
]);
export const yScaleReverse = d3
.scaleLinear()
.range([height, 0])
.domain([
0,
d3.max(totalMdVolume, function (d) {
return d.value;
}),
]);
export const yScale = d3
.scaleLinear()
.range([0, height])
.domain([
// d3.min(totalMdVolume, function (d) {
// return d.value;
// }),
0,
d3.max(totalMdVolume, function (d) {
return d.value;
}),
]);
export const xScaleInd = d3
.scaleLinear()
.range([0, 380])
.domain([
d3.min(totalMdVolume, (d, i) => {
return i;
}),
d3.max(totalMdVolume, (d, i) => {
return i;
}),
]);
export const changeEvents = {
// intro: drawAxes(totalMdVolume),
// year2006: drawBar(),
// year2007: drawBar(),
// year2008: drawBar(),
// year2009: drawBar(),
};