Skip to content

Commit a437360

Browse files
committed
Added a lot to the rCharts lecture, all plots are embedded in slidify
1 parent e5b3950 commit a437360

10 files changed

Lines changed: 6446 additions & 8 deletions

File tree

4.46 KB
Loading

09_DevelopingDataProducts/rCharts/fig/unnamed-chunk-10.html

Lines changed: 1278 additions & 0 deletions
Large diffs are not rendered by default.

09_DevelopingDataProducts/rCharts/fig/unnamed-chunk-6.html

Lines changed: 3871 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<!doctype HTML>
2+
<meta charset = 'utf-8'>
3+
<html>
4+
<head>
5+
<link rel='stylesheet' href='http://tenxer.github.io/xcharts/css/master.css'>
6+
7+
<script src='http://d3js.org/d3.v2.min.js' type='text/javascript'></script>
8+
<script src='http://tenxer.github.io/xcharts/js/xcharts.min.js' type='text/javascript'></script>
9+
10+
<style>
11+
.rChart {
12+
display: block;
13+
margin-left: auto;
14+
margin-right: auto;
15+
width: 800px;
16+
height: 400px;
17+
}
18+
</style>
19+
20+
</head>
21+
<body>
22+
<figure id='chart16c57d6e1b94' class='rChart xcharts'></figure>
23+
24+
<script type='text/javascript'>
25+
var data = {
26+
"dom": "chart16c57d6e1b94",
27+
"width": 800,
28+
"height": 400,
29+
"xScale": "linear",
30+
"yScale": "linear",
31+
"main": [
32+
{
33+
"data": [
34+
{
35+
"x": 1940,
36+
"y": 22.2
37+
},
38+
{
39+
"x": 1945,
40+
"y": 44.5
41+
},
42+
{
43+
"x": 1950,
44+
"y": 59.6
45+
},
46+
{
47+
"x": 1955,
48+
"y": 73.2
49+
},
50+
{
51+
"x": 1960,
52+
"y": 86.8
53+
}
54+
]
55+
},
56+
{
57+
"data": [
58+
{
59+
"x": 1940,
60+
"y": 10.5
61+
},
62+
{
63+
"x": 1945,
64+
"y": 15.5
65+
},
66+
{
67+
"x": 1950,
68+
"y": 29
69+
},
70+
{
71+
"x": 1955,
72+
"y": 36.5
73+
},
74+
{
75+
"x": 1960,
76+
"y": 46.2
77+
}
78+
]
79+
},
80+
{
81+
"data": [
82+
{
83+
"x": 1940,
84+
"y": 3.53
85+
},
86+
{
87+
"x": 1945,
88+
"y": 5.76
89+
},
90+
{
91+
"x": 1950,
92+
"y": 9.71
93+
},
94+
{
95+
"x": 1955,
96+
"y": 14
97+
},
98+
{
99+
"x": 1960,
100+
"y": 21.1
101+
}
102+
]
103+
},
104+
{
105+
"data": [
106+
{
107+
"x": 1940,
108+
"y": 1.04
109+
},
110+
{
111+
"x": 1945,
112+
"y": 1.98
113+
},
114+
{
115+
"x": 1950,
116+
"y": 2.45
117+
},
118+
{
119+
"x": 1955,
120+
"y": 3.4
121+
},
122+
{
123+
"x": 1960,
124+
"y": 5.4
125+
}
126+
]
127+
},
128+
{
129+
"data": [
130+
{
131+
"x": 1940,
132+
"y": 0.341
133+
},
134+
{
135+
"x": 1945,
136+
"y": 0.974
137+
},
138+
{
139+
"x": 1950,
140+
"y": 1.8
141+
},
142+
{
143+
"x": 1955,
144+
"y": 2.6
145+
},
146+
{
147+
"x": 1960,
148+
"y": 3.64
149+
}
150+
]
151+
}
152+
],
153+
"id": "chart16c57d6e1b94"
154+
},
155+
chartType = "line-dotted",
156+
myChart = new xChart(chartType, data, '#chart16c57d6e1b94');
157+
</script>
158+
<style>figure.rChart {height: 400px;}</style>
159+
160+
</body>
161+
</html>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<!doctype HTML>
2+
<meta charset = 'utf-8'>
3+
<html>
4+
<head>
5+
<link rel='stylesheet' href='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
6+
7+
<script src='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
8+
<script src='https://rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
9+
<script src='http://harrywood.co.uk/maps/examples/leaflet/leaflet-plugins/layer/vector/KML.js' type='text/javascript'></script>
10+
11+
<style>
12+
.rChart {
13+
display: block;
14+
margin-left: auto;
15+
margin-right: auto;
16+
width: 800px;
17+
height: 400px;
18+
}
19+
</style>
20+
21+
</head>
22+
<body>
23+
<div id='chart16c577763a3f' class='rChart leaflet'></div>
24+
25+
<script>
26+
var spec = {
27+
"dom": "chart16c577763a3f",
28+
"width": 800,
29+
"height": 400,
30+
"urlTemplate": "http://{s}.tile.osm.org/{z}/{x}/{y}.png",
31+
"layerOpts": {
32+
"attribution": "Map data<a href=\"http://openstreetmap.org\">OpenStreetMap</a>\n contributors, Imagery<a href=\"http://mapbox.com\">MapBox</a>"
33+
},
34+
"center": [ 51.505, -0.09 ],
35+
"zoom": 13,
36+
"id": "chart16c577763a3f"
37+
}
38+
39+
var map = L.map(spec.dom, spec.mapOpts)
40+
41+
map.setView(spec.center, spec.zoom);
42+
43+
if (spec.provider){
44+
L.tileLayer.provider(spec.provider).addTo(map)
45+
} else {
46+
L.tileLayer(spec.urlTemplate, spec.layerOpts).addTo(map)
47+
}
48+
49+
L
50+
.marker([
51+
51.5,
52+
-0.09
53+
])
54+
.addTo( map )
55+
.bindPopup("<p> Hi. I am a popup </p>")
56+
L
57+
.marker([
58+
51.495,
59+
-0.083
60+
])
61+
.addTo( map )
62+
.bindPopup("<p> Hi. I am another popup </p>")
63+
64+
65+
66+
67+
if (spec.circle2){
68+
for (var c in spec.circle2){
69+
var circle = L.circle(c.center, c.radius, c.opts)
70+
.addTo(map);
71+
}
72+
}
73+
74+
75+
76+
77+
78+
79+
80+
81+
</script>
82+
83+
</body>
84+
</html>

0 commit comments

Comments
 (0)