-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
183 lines (147 loc) · 5.55 KB
/
index.html
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chart frame for D3</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://www.ft.com/__origami/service/build/v3/bundles/css?components=o-fonts@^5.3.3&system_code=ig-content&brand=internal" />
<style type="text/css">
body{font-family:sans-serif;}
h1{
font-size: xx-large;
}
figcaption{
background-color: #000;
color: #FFF;
padding: 3px;
margin-bottom: 20px;
display: block;
width: 50%;
}
</style>
<script src="//d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script type="text/javascript" src="build/g-chartframe.js" charset="utf-8"></script>
<style type="text/css">
</style>
</head>
<body>
<article>
<h1>g-chartframe: FT styled frames for D3 graphics</h1>
<a href="https://github.com/ft-interactive/g-chartframe">Code and documentation on GitHub</a>
<hr>
<figure class="web-s-example">
<figcaption>Web small example</figcaption>
<svg width="550" height="500"></svg>
</figure>
<figure class="web-m-example">
<figcaption>Web medium example</figcaption>
<svg width="550" height="500"></svg>
</figure>
<figure class="web-l-example">
<figcaption>Web large example</figcaption>
<svg width="550" height="500"></svg>
</figure>
<figure class="web-m-default-example">
<figcaption>Web medium non-responsive example</figcaption>
<svg width="550" height="500"></svg>
</figure>
<figure class="print-example">
<figcaption>Print example</figcaption>
<svg></svg>
</figure>
<figure class="social-example">
<figcaption>Social example</figcaption>
<svg></svg>
</figure>
<figure class="video-example">
<figcaption>Video example</figcaption>
<svg></svg>
</figure>
<hr>
<section>
Tom Pearson – Feb 2017
</section>
</article>
</body>
<script type="text/javascript">
// console.log('gChartframe ' + gChartframe.version);
//first, create and configure the frames...
var webframeS = gChartframe.webFrameS()
.title('Web customise <i>the</i> title')
.source('Note: use the <a href="https://en.wikipedia.org/wiki/Vertical_bar">“vertical bar”</a> (aka “pipe”) character|to add linebreaks.'); //add a `|` character to insert a line break
var webframeM = gChartframe.webFrameM()
.title('Web customise <i>the</i> title')
.source('Note: use the <a href="https://en.wikipedia.org/wiki/Vertical_bar">“vertical bar”</a> (aka “pipe”) character|to add linebreaks.'); //add a `|` character to insert a line break
var webframeL = gChartframe.webFrameL()
.title('Web customise <i>the</i> title')
.source('Note: use the <a href="https://en.wikipedia.org/wiki/Vertical_bar">“vertical bar”</a> (aka “pipe”) character|to add linebreaks.'); //add a `|` character to insert a line break
var webframeMDefault = gChartframe.webFrameMDefault()
.title('Web customise <i>the</i> title')
.source('Note: use the <a href="https://en.wikipedia.org/wiki/Vertical_bar">“vertical bar”</a> (aka “pipe”) character|to add linebreaks.'); //add a `|` character to insert a line break
var printframe = gChartframe.printFrame()
.title('A print frame')
.subtitle('allows for width and height specified in mm'); //note! print frame allows you to specify width and height in mm which will be converted to 'px'
var socialframe = gChartframe.socialFrame()
.title('Social customise the title')
.subtitle('typically shorter subtitle');
var videoframe = gChartframe.videoFrame();
d3.select('.web-s-example svg')
.call(webframeS);
d3.select('.web-m-example svg')
.call(webframeM);
d3.select('.web-l-example svg')
.call(webframeL);
d3.select('.web-m-default-example svg')
.call(webframeMDefault);
d3.select('.print-example svg')
.call(printframe);
d3.select('.social-example svg')
.call(socialframe);
d3.select('.video-example svg')
.call(videoframe);
// then add the visualisations to the plot area (in this case some place-holder rectangles)
printframe.plot()
.append('rect') //a rectangle to illustrate the plot area
.attr('width',printframe.dimension().width)
.attr('height',printframe.dimension().height)
.attr('fill','#000')
.attr('fill-opacity',0.2);
webframeS.plot()
.append('rect') //a rectangle to illustrate the plot area
.attr('width',webframeS.dimension().width)
.attr('height',webframeS.dimension().height)
.attr('fill','#000')
.attr('fill-opacity',0.2);
webframeM.plot()
.append('rect') //a rectangle to illustrate the plot area
.attr('width',webframeM.dimension().width)
.attr('height',webframeM.dimension().height)
.attr('fill','#000')
.attr('fill-opacity',0.2);
webframeL.plot()
.append('rect') //a rectangle to illustrate the plot area
.attr('width',webframeL.dimension().width)
.attr('height',webframeL.dimension().height)
.attr('fill','#000')
.attr('fill-opacity',0.2);
webframeMDefault.plot()
.append('rect') //a rectangle to illustrate the plot area
.attr('width',webframeMDefault.dimension().width)
.attr('height',webframeMDefault.dimension().height)
.attr('fill','#000')
.attr('fill-opacity',0.2);
socialframe.plot()
.append('rect') //a rectangle to illustratet he plot area
.attr('width',socialframe.dimension().width)
.attr('height',socialframe.dimension().height)
.attr('fill','#FFF')
.attr('fill-opacity',0.2);
videoframe.plot()
.append('rect') //a rectangle to illustratet he plot area
.attr('width',videoframe.dimension().width)
.attr('height',videoframe.dimension().height)
.attr('fill','#FFF')
.attr('fill-opacity',0.2);
</script>
</html>