Giter Club home page Giter Club logo

giojs's Introduction

Gio logo

Gio.js

English | δΈ­ζ–‡

React Version: react-giojs

npm version license badge dependencies badge build coverage

Gio.js is an open source library for web 3D globe data visualization built with Three.js. What makes Gio.js different is that it is simple to use Gio.js to customize a 3D data visualization model in a declarative way, add your own data, and integrate it into your own modern web application.

Content

Motivation

Gio.js is an open source library for web 3D globe data visualization built with Three.js. What makes Gio.js different is that it is simple to use Gio.js to customize a 3D data visualization model in a declarative way, add your own data, and integrate it into your own modern web application.

This library is inspired by the Arms Trade Visualization project developed by Michael Chang and presented during Google Ideas INFO 2012. See original post. With Gio.js, it is easy to reproduce this fantastic data visualization model, and integrate it into web application.

  • Simplicity -- Create a 3D global data visualization model with your own data in just four lines of javascript code
  • Customization -- Design your own globe style with easy to use APIs in Gio.js
  • Modernization -- Build a responsible, fully interactive, rich 3D frontend application using Gio.js

Getting Started

Installation

  • Option 1: <script> tag

Include Three.js dependency:

<script src="three.min.js"></script>

Include local Gio.js library

<script src="gio.min.js"></script>

or through CDN

<script src="https://threejs.org/build/three.min.js"></script>
<script src="https://raw.githack.com/syt123450/giojs/master/build/gio.min.js"></script>
  • Option 2: npm
npm install giojs --save
  • Option 3: yarn
yarn add giojs

Usage

After including "three.min.js" and "gio.min.js" in your html, create a div to render the 3D Gio globe:

<!DOCTYPE HTML>
<html>
<head>

  <!-- include three.min.js library-->
  <script src="three.min.js"></script>

  <!-- include gio.min.js library-->
  <script src="gio.min.js"></script>

</head>
<body>

  <!-- container to draw 3D Gio globe-->
  <div id="globalArea"></div>

</body>
</html>

To initialize and render the 3D Gio globe:

<script>

    // get the container to hold the IO globe
    var container = document.getElementById( "globalArea" );

    // create controller for the IO globe, input the container as the parameter
    var controller = new GIO.Controller( container );

    // use addData() API to add the the data to the controller, know more about data format check out documentation about data: http://giojs.org/html/docs/dataIntro.html
    controller.addData( data );

    // call the init() API to show the IO globe in the browser
    controller.init();

</script>

If everything goes well, you shall see this. For more fancier usage of Gio.js, check out Gio.js API document

Click the codepen logo to try it in Codepen: Β Β 

Examples

Gio.js has many representative demos to show how to work with Gio.js, there are mainly three example resources:

  • Resource 1: Gio.js Playground

There is a Playground ( playground link ) for developers to play with Gio.js and export Gio.js parameter.

  • Resource 2: Github "examples" folder

Gio.js has many API demos, and these demos are gathered in examples folder. clone the Gio.js repo, try them in your own environment ~

  • Resource 3: Live demos on Codepen

Gio.js has a Codepen collection which contains many live demos about Gio.js, click the codepen logo and try to edit them!

API List

➑ configure(json)

Configure the controller.

➑ setInitCountry(ISOCode, default: 'CN')

Set the country initially selected.

➑ lightenMentioned(boolean, default: 'false')

Makes the mentioned country brighter than those not mentioned in the input dataset.

➑ disableUnmentioned(boolean, default: 'false')

Disables an unmentioned country and makes it unselectable.

➑ showInOnly(boolean, default: 'false')

Displays only the line with data flowing into the selected country.

➑ showOutOnly(boolean, default: 'false')

Displays only the line with data flowing out of the selected country.

➑ addHalo(string)

Enables the halo around the earth. When enabling halo, the color of halo also can be specified.

➑ removeHalo()

Disables the halo around the earth.

➑ enableStats()

Displays stats on the upper-left corner of the scene.

➑ disableStats()

Hides stats on the upper-left corner of the scene.

➑ setStyle(string)

Sets the color scheme of the 3D globe by name.

➑ setSurfaceColor(string, default: '#ffffff')

Sets the color of the surface the 3D globe.

➑ setSelectedColor(string, default: '#ffffff')

Sets color of the country in selected state.

➑ setExportColor(string, default: '#DD380C')

Sets the color of out line.

➑ setImportColor(string, default: '#154492')

Sets the color of in line.

➑ setHaloColor(string, default: '#ffffff')

Sets the color of the Halo.

➑ setBackgroundColor(string, default: '#000000')

Sets the color of the background.

➑ adjustOceanBrightness(float, default: 0.5)

Sets the brightness of the ocean.

➑ adjustRelatedBrightness(float, default: 0.5)

Sets the brightness of the related country.

➑ adjustMentionedBrightness(float, default: 0.5)

Sets the brightness of the mentioned country.

➑ addData(json)

Loads data to the controller of Gio and overrides previous data synchronously.

➑ addDataAsync(url, callback)

Loads data to the controller of Gio and overrides previous data asynchronously.

➑ liveLoad(url, callback, duration)

Loads data to the controller periodically.

➑ onCountryPicked(callback)

Fired when selected country changes.

➑ switchCountry(IsoCode)

Change currently selected country.

Documentation

Contributors

Thanks goes to these wonderful people (emoji key):


syt123450

πŸ’» πŸ“– πŸ’‘ ⚠️

Botime

πŸ’» πŸ“– ⚠️ πŸš‡

Mutian Wang

πŸ’» πŸ“¦ 🎨 πŸ‘€

Chenhua Zhu

πŸ’» πŸš‡ πŸ€” πŸ‘€

Qi(Nora)

πŸ’» 🎨 πŸ“– βœ…

bouyuc

πŸ“– βœ…

Xiaoran Lin

πŸ’» 🎨 πŸ’‘ πŸ‘€

Leon

πŸ’» 🎨 πŸ’‘

Alexis

πŸ’» πŸ›

This project follows the all-contributors specification. Contributions of any kind welcome!

License

Apache-2.0

giojs's People

Contributors

syt123450 avatar manymeeting avatar botime avatar zchholmes avatar siriustom avatar alexisanzieu avatar bouyuc avatar leonsaber avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.