All Projects → Niekes → D3 3d

Niekes / D3 3d

Licence: bsd-3-clause
D3.js plugin for 3d visualization

Programming Languages

javascript
184084 projects - #8 most used programming language
js
455 projects

Projects that are alternatives of or similar to D3 3d

Sunburst Chart
A sunburst interactive chart web component for visualizing hierarchical data
Stars: ✭ 140 (-31.03%)
Mutual labels:  d3js
D3 Geo Voronoi
Voronoi / Delaunay tessellations on the sphere
Stars: ✭ 155 (-23.65%)
Mutual labels:  d3js
Weather App React Native
The source code of react-native weather app
Stars: ✭ 176 (-13.3%)
Mutual labels:  d3js
Androidutillib
🔥 旨在打造一款属于Android开发的强大工具库:内置各种开发必备工具类、Dialog封装、组件重写等
Stars: ✭ 143 (-29.56%)
Mutual labels:  shape
Tracks
Programming with shapes
Stars: ✭ 151 (-25.62%)
Mutual labels:  shape
Plotly
An interactive graphing library for R
Stars: ✭ 2,096 (+932.51%)
Mutual labels:  d3js
Scatterd3
R scatter plot htmlwidget based on D3.js
Stars: ✭ 135 (-33.5%)
Mutual labels:  d3js
V Chart Plugin
Easily bind a chart to the data stored in your Vue.js components.
Stars: ✭ 188 (-7.39%)
Mutual labels:  d3js
D3 Es6
D3 力导向图 增删改动态更新数据 点击生成节点 拖拽生成连线...
Stars: ✭ 155 (-23.65%)
Mutual labels:  d3js
D3 Layout Narrative
A d3 layout for creating XKCD style narrative charts
Stars: ✭ 168 (-17.24%)
Mutual labels:  d3js
3d Force Graph
3D force-directed graph component using ThreeJS/WebGL
Stars: ✭ 2,386 (+1075.37%)
Mutual labels:  d3js
Json Schema Viewer
JavaScript tool for visualizing json-schemas
Stars: ✭ 147 (-27.59%)
Mutual labels:  d3js
D3tutorial
📊📈 A D3 v6 tutorial - interactive bar chart and multiple coordinated views (MCV)
Stars: ✭ 163 (-19.7%)
Mutual labels:  d3js
Escher
Build, share, and embed visualizations of metabolic pathways.
Stars: ✭ 141 (-30.54%)
Mutual labels:  d3js
Data Visualization
数据可视化
Stars: ✭ 184 (-9.36%)
Mutual labels:  d3js
Objc Dependency Visualizer
Objective-C and Swift dependency visualizer. It's tool that helps to visualize current state of your project. It's really easy to see how tight your classes are coupled.
Stars: ✭ 1,738 (+756.16%)
Mutual labels:  d3js
Devshapeutils
一行代码设置Shape样式、Selector触摸反馈效果开源库
Stars: ✭ 161 (-20.69%)
Mutual labels:  shape
Coronavirus Simulation
An experiment with SIR
Stars: ✭ 198 (-2.46%)
Mutual labels:  d3js
Cal Heatmap
Cal-Heatmap is a javascript module to create calendar heatmap to visualize time series data
Stars: ✭ 2,190 (+978.82%)
Mutual labels:  d3js
Bandersnatch
💻 Interactive Black Mirror: Bandersnatch Paths Website 🎥
Stars: ✭ 169 (-16.75%)
Mutual labels:  d3js

d3-3d

d3-3d is meant for 3d visualizations. d3-3d allows the projection of 3d data onto the screen in the webbrowser. It is specially designed to work with d3.js.

Buy Me A Coffee

License npm version

INFO: PLEASE DO NOT WRITE ME ON LINKEDIN, FACEBOOK OR TO MY PRIVATE E-MAIL. USE STACK OVERFLOW OR CREATE AN ISSUE ON GITHUB.

See more examples.

Installing

If you use npm, npm install d3-3d. You can also download the latest release. Otherwise use unpkg to get the latest release. For example:

<script src="https://unpkg.com/d3-3d/build/d3-3d.js"></script>

For a specific version:

<script src="https://unpkg.com/[email protected]/build/d3-3d.js"></script>

For the minified version:

<script src="https://unpkg.com/[email protected]/build/d3-3d.min.js"></script>

Import

ES6:

import { _3d } from 'd3-3d' ;

API Reference

Overview

d3-3d uses the browser's coordinate system and orthographic projection to display your data on the screen. It will calculate the centroid for all elements and the orientation for your polygons. Due to the fact that SVG isn't very 3d compatible d3-3d adds 3d transformations to SVG.

With d3-3d you can easily visualize your 3d data.

var data3D = [ [[0,-1,0],[-1,1,0],[1,1,0]] ];

var triangles3D = d3._3d()
    .scale(100)
    .origin([480, 250])
    .shape('TRIANGLE');

var projectedData = triangles3D(data3D);

init(projectedData);

function init(data){

    var triangles = svg.selectAll('path').data(data);

    // add your logic here...

}

# d3._3d() <>

Constructs a new function object with the default settings.

Shapes

Depending on the shape the input data array has to be accordingly to the shape.

  • POINT A point is represented by the <circle> element. It does not have a draw function because it can be represented as a <circle>. The input data array has to be an array of points where each point has three coordinates which can be accessed via the x, y and z accessors.
  • LINE A line is represented by the <line> element. It does not have a draw function because it can be represented as a <line>. The input data array has to be an array of lines where each line is defined by a start- and an endpoint.
  • LINE_STRIP A continuous line is represented by the <path> element. The input data array has to be an array of points. Every point will be connected to the next point in the input data array.
  • TRIANGLE A triangle represented by the <path> element. The input data array has to be an array of triangles where each triangle is defined by three points in counter-clockwise order.
  • PLANE A plane is represented by the <path> element. The input data array has to be an array of planes where each plane is defined by four points in counter-clockwise order.
  • GRID A grid is represented by x planes. The input data array has to be an array of points. The shape function aspects the amount of points per row as a second argument. d3-3d will construct planes out of the passed data. NOTE: A grid has to have always the same number of points per row. Otherwise the code will break.
  • SURFACE equivalent to GRID
  • CUBE A grid is represented by 4 planes. The input data array has to be an array of cubes where each cube is defined by 8 vertices. To get the orientation and centroid calculation right you should pass in the data like so:

cube

# _3d.shape(shape) <>

Default: 'POINT'

Sets the shape to shape. If shape is not specified the current shape will be returned.

If shape is specified, sets the shape to the specified shape and returns the d3-3d function object. If shape is not specified, returns the current shape.

var triangles3D = d3._3d().shape('TRIANGLE');

# _3d.x([x]) <>

If x is specified, sets the x accessor to the specified function or number and returns the d3-3d function object. If x is not specified, returns the current x accessor, which defaults to:

function x(p) {
    return p[0];
}

This function will be invoked for each point in the input data array.

# _3d.y([y]) <>

If y is specified, sets the y accessor to the specified function or number and returns the d3-3d function object. If y is not specified, returns the current y accessor, which defaults to:

function y(p) {
    return p[1];
}

This function will be invoked for each point in the input data array.

# _3d.z([z]) <>

If z is specified, sets the z accessor to the specified function or number and returns the d3-3d function object. If z is not specified, returns the current z accessor, which defaults to:

function z(p) {
    return p[2];
}

This function will be invoked for each point in the input data array.

# _3d.scale(scale) <>

Default: 1

If scale is specified, sets the scale to the specified number and returns the d3-3d function object. If scale is not specified, returns the current scale.

# _3d.rotateX(angle) <>

Default: 0

If angle is specified, sets rotateX to the specified number and returns the d3-3d function object. If angle is not specified, returns the current angle.

# _3d.rotateY(angle) <>

Default: 0

If angle is specified, sets rotateY to the specified number and returns the d3-3d function object. If angle is not specified, returns the current angle.

# _3d.rotateZ(angle) <>

Default: 0

If angle is specified, sets rotateZ to the specified number and returns the d3-3d function object. If angle is not specified, returns the current angle.

# _3d.rotateCenter(point) <>

Default: [0, 0, 0]

If point is specified, sets rotateCenter to the specified point and returns the d3-3d function object. If rotateCenter is not specified, returns the current rotateCenter.

# _3d.sort(a,b) <>

Sorts the elements accordingly to the z coordinate of the calculated centroid.

# _3d.draw(shape) <>

Constructs a string for the SVG <path> element. Depending on the shape this function will take care how the elements get drawn. For instance, if you choose 'TRIANGLE' d3-3d aspects that you want to draw a triangle with three points and each point has three coordinates. The _3d.draw method will draw a triangle with these three points. If you want to draw a plane, you have to pass in four points and so on.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].