Socket
Book a DemoInstallSign in
Socket

aframe-scatterplot

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aframe-scatterplot

AFrame JSON data scatterplot component

Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

AFrame - Scatterplot

Introduction

An all-purpose data visualization component for the AFrame WebVR Framework.

Check out the example drag and drop application: https://zcanter.github.io/vr-scatterplot/

A-Frame Scatterplot

Browser Installation

Install and use by directly including the browser file:

You must also include a link the D3 JavaScript data visualization framework.

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.4.0/aframe.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.4.1/d3.min.js"></script>
  <script src="https://cdn.rawgit.com/zcanter/aframe-scatterplot/master/dist/a-scatterplot.min.js"></script>
</head>

<body>
  <a-scene>
    <a-scatterplot src="url(example.json)" x="field1" y="field2" z="field3" val="field4"></a-scatterplot>
  </a-scene>
</body>

NPM Installation

Install via NPM:

npm install aframe
npm install d3
npm install aframe-scatterplot

Then register and use.

require('aframe');
require('d3');
require('aframe-scatterplot');

Data Formatting

Datasets should be formatted as follows:

[
 {
   // Data Point 
   "Field1": 13.90738679789567,
   "Field2": 11.77935227940546,
   "Field3": 12.02052097080796,
   "Field4": 11.31274091176219,
   "Field5": 14.13415151546462,
 },
 {
   // Data Point 
   "Field1": 12.29829187876160,
   "Field2": 10.12398967761787,
   "Field3": 16.81298749861520,
   "Field4": 13.92371645984898,
   "Field5": 11.35138647618786,
 },
 {...},
 {...},
 ]

Example (Sea Surface Temperature 1km resolution):

[
 {
   "lat":-80,
   "lon":-180,
   "val":-108
 },
 {
   "lat":-80,
   "lon":-179,
   "val":-103
 },
 {...},
 {...},
 ]

How can I format my data in this way?

The easiest way to do this is to get a CSV of your dataset and use the online CSV to JSON conversion tool convertcsv. If you are a programmer you can use your favorite language to do so as well. Most popular programming languages have JSON writing capabilities of some sort.

How can I get a CSV export of my data?

The easiest way to get a CSV export is to open your data in Excel or Google Sheets and export as it a CSV file. You can also do this programmatically in your favorite language.

Can I only use geospacial data?

No, you can use non-geospacial data as long as it is formatted in the style shown above. It is important to note though that if two spacial dimensions share a unit of measurement (i.e. x and y dimensions are both in kelvin) you should specify this in the relationship option (detailed in API below).

How many fields can I have?

You may have as many fields as you like, but note you can only visualize three spacial dimensions and one color mapped dimension at any given time.

How many points can my dataset have?

We have experimented with over 5 million data points with no problems.

Do I need to normalize or scale my values?

No, the a-scatterplot component will do that for you programmatically. It is totally fine for you to leave the values at their original readings.

Where can I find example data?

Example datasets can be found here.

API

PropertyExampleDescriptionDefault Value
srcurl(data.json)The path to the data setnone
titleSea Surface TemperatureTitle of the datasetundefined
xlatX dimension from field nameundefined
yvalY dimension from field nameundefined
zlonZ dimension from field nameundefined
valvalColor mapped dimension from field nameundefined
colorpresetjetName of the color map presetjet
fillval-32768, 4506Number (or numbers) representing fill values/ignored values separated by commanone
relationshipxzDimensions that share units of measurementsnone
pointSize3.5Size of the rendered data point1
raw[{lat: -79, lon: 180, val: 103},...]The raw data in a JS object arraynone
xfill-45, 63Fill or ignored values in X dimensionnone
yfill-78Fill or ignored values in Y dimensionnone
zfill12Fill or ignored values in Z dimensionnone
xLimit0.7Limit of relative X dimension width in 3D space1
yLimit0.5Limit of relative Y dimension width in 3D space1
zLimit0.2Limit of relative Z dimension width in 3D space1
xFliptrueInvert the X shapefalse
yFliptrueInvert the Y shapefalse
zFliptrueInvert the Z shapefalse

Questions or Issues?

Feel free to open a GitHub Issue or to contact me directly at zrcanter [-at-] gmail

Keywords

aframe

FAQs

Package last updated on 24 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts