176 lines
7.7 KiB
HTML
176 lines
7.7 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>Planetary.js: Awesome interactive globes for the web</title>
|
|
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:300italic,400,300,700' rel='stylesheet' type='text/css'>
|
|
<link type="text/css" rel="stylesheet" href="/semantic/css/semantic.min.css">
|
|
<link type="text/css" rel="stylesheet" href="/css/planetaryjs.css">
|
|
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
|
<meta property="og:image" content="http://planetaryjs.com/images/ex-rotating.png">
|
|
<meta property="og:site_name" content="Planetary.js">
|
|
|
|
<link href="/css/prism.css" rel="stylesheet">
|
|
</head>
|
|
<body>
|
|
<div class='ui fixed inverted large menu main-menu'>
|
|
<div class='items'>
|
|
<a class='item title' href='/'>
|
|
<i class='globe icon'></i>Planetary.js
|
|
</a>
|
|
<span class='spacer hide-on-mobile'></span>
|
|
<a class='item minor ' href='/download/'>
|
|
<i class='download icon'></i><span class='hide-on-mobile'>Download</span>
|
|
</a>
|
|
<a class='item minor ' href='/examples/'>
|
|
<i class='laptop icon'></i><span class='hide-on-mobile'>Examples</span>
|
|
</a>
|
|
<a class='item minor active' href='/documentation/'>
|
|
<i class='book icon'></i><span class='hide-on-mobile'>Documentation</span>
|
|
</a>
|
|
<a class='item minor' href='https://github.com/BinaryMuse/planetary.js'
|
|
onclick="_gaq.push(['_trackPageview', '/redirect-to-github-project-page']);">
|
|
<i class='github alternate icon'></i><span class='hide-on-mobile'>Fork on GitHub</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class='content container'>
|
|
<div class='page ui slim stackable grid'>
|
|
<div class='four wide column'>
|
|
<div class='ui fluid vertical menu'>
|
|
<a class='red item ' href='/documentation/index.html'>
|
|
Introduction
|
|
<i class='icon home'></i>
|
|
</a>
|
|
<a class='purple item active' href='/documentation/installation.html'>
|
|
Installation
|
|
<i class='icon download'></i>
|
|
</a>
|
|
<a class='blue item ' href='/documentation/core.html'>
|
|
Core API
|
|
<i class='icon setting'></i>
|
|
</a>
|
|
<a class='orange item ' href='/documentation/planet.html'>
|
|
Planet API
|
|
<i class='icon globe'></i>
|
|
</a>
|
|
<a class='teal item ' href='/documentation/plugins.html'>
|
|
Plugins
|
|
<i class='icon edit'></i>
|
|
</a>
|
|
<a class='purple item with-subitems ' href='/documentation/builtin.html'>
|
|
Built-In Plugins
|
|
<i class='icon bolt'></i>
|
|
</a>
|
|
<div class='item contains-subitems'>
|
|
<div class='menu'>
|
|
<a class='item ' href='/documentation/builtin_earth.html'>Earth</a>
|
|
<a class='item ' href='/documentation/builtin_topojson.html'>TopoJSON</a>
|
|
<a class='item ' href='/documentation/builtin_oceans.html'>Oceans</a>
|
|
<a class='item ' href='/documentation/builtin_land.html'>Land</a>
|
|
<a class='item ' href='/documentation/builtin_borders.html'>Borders</a>
|
|
<a class='item ' href='/documentation/builtin_pings.html'>Pings</a>
|
|
<a class='item ' href='/documentation/builtin_zoom.html'>Zoom</a>
|
|
<a class='item ' href='/documentation/builtin_drag.html'>Drag</a>
|
|
</div>
|
|
</div>
|
|
<a class='red item ' href='/documentation/faq.html'>
|
|
FAQ
|
|
<i class='icon help'></i>
|
|
</a>
|
|
<a class='green item ' href='/documentation/help.html'>
|
|
Getting Help
|
|
<i class='icon phone'></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class='twelve wide column'>
|
|
<h1>Installation</h1>
|
|
<p>Once you've <a href="/download/">downloaded Planetary.js</a>, you can include it via a <code>script</code> tag on your page <em>after</em> the inclusion of D3 and TopoJSON. This example uses the CDN URLs for those libraries:</p>
|
|
<div class='ui raised segment'>
|
|
<div class='ui blue ribbon label'>HTML</div>
|
|
|
|
<pre><code class="language-html"><html>
|
|
<head>
|
|
<script type='text/javascript' src='http://d3js.org/d3.v3.min.js'></script>
|
|
<script type='text/javascript' src='http://d3js.org/topojson.v1.min.js'></script>
|
|
<script type='text/javascript' src='path/to/planetaryjs.min.js'></script>
|
|
</head>
|
|
<body>
|
|
...</code></pre>
|
|
<p></div></p>
|
|
<p>If you use the default <code>topojson</code> plugin (most people will), you'll also need to make sure <code>world-110m.json</code> (or some other TopoJSON data file) is available on your server. This file is also available from <a href="/download/">the download page</a>. See the <a href="/documentation/builtin_topojson.html">TopoJSON Plugin documentation</a> for more information.</p>
|
|
<p>Planetary.js also supports installation via AMD and CommonJS loaders.</p>
|
|
<h2>AMD</h2>
|
|
<p>This example uses <a href="http://requirejs.org/">RequireJS</a>. Since neither D3 nor TopoJSON support AMD, we will use RequireJS's <a href="http://requirejs.org/docs/api.html#config-shim">shim configuration</a>.</p>
|
|
<div class='ui raised segment'>
|
|
<div class='ui blue ribbon label'>HTML</div>
|
|
|
|
<pre><code class="language-html"><body>
|
|
<canvas id='globe' width='500' height='500'></canavs>
|
|
<script src='//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.9/require.min.js'
|
|
data-main='/app.js'></script>
|
|
</body></code></pre>
|
|
<div class='ui red ribbon label'>JavaScript</div>
|
|
|
|
<pre><code class="language-javascript">requirejs.config({
|
|
// Tell RequireJS to use `window.d3` and `window.topojson`
|
|
// for those libraries, respectively
|
|
shim: {
|
|
d3: { exports: 'd3' },
|
|
topojson: { exports: 'topojson' }
|
|
},
|
|
paths: {
|
|
'd3': 'path/to/d3.v3.min',
|
|
'topojson': 'path/to/topojson.v1.min'
|
|
}
|
|
});
|
|
|
|
requirejs(['planetaryjs'], function(planetaryjs) {
|
|
// Use Planetary.js here
|
|
});</code></pre>
|
|
<p></div></p>
|
|
<h2>CommonJS</h2>
|
|
<p>First, install <code>browserify</code> from npm (as well as <code>planetary.js</code> v1.0.2+, if you haven't already). Then, create your application (here referred to as <code>app.js</code>) and bundle it with browserify.</p>
|
|
<div class='ui raised segment'>
|
|
<div class='ui red ribbon label'>JavaScript</div>
|
|
|
|
<pre><code class="language-javascript">var planetaryjs = require('planetary.js');
|
|
|
|
var planet = planetaryjs.planet();
|
|
var canvas = document.getElementById('canvas');
|
|
planet.draw(canvas);</code></pre>
|
|
<div class='ui purple ribbon label'>Shell</div>
|
|
|
|
<pre><code class="language-shell">$ npm install browserify
|
|
$ ./node_modules/.bin/browserify app.js > bundle.js</code></pre>
|
|
<p></div></p>
|
|
<p><code>bundle.js</code> is now ready to use! You may need to set the <code>charset</code> option on your script tag:</p>
|
|
<div class='ui raised segment'>
|
|
<div class='ui blue ribbon label'>HTML</div>
|
|
|
|
<pre><code class="language-html"><script type='text/javascript' src='bundle.js' charset='utf-8'></script></code></pre>
|
|
<p></div></p>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type='text/javascript' src='/js/prism.js'></script>
|
|
<script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-46705270-1', 'planetaryjs.com');
|
|
ga('send', 'pageview');
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|