All Projects → ecomfe → grapher.js

ecomfe / grapher.js

Licence: BSD-3-Clause license
JavaScript 3D Plot Library

Programming Languages

javascript
184084 projects - #8 most used programming language

Grapher.js

Grapher.js is a library built on top of qtek for 3d plotting. It is relatively small (44kb after gzipped), easy to use and mobile friendly. Currently only surface graph is available.

Download v0.1

Documentation

Quick Start

Including Grapher.js

You can including Grapher.js by script tag and get a grapher global namespace.

<script src="grapher.js"></script>
<script>
    // Print version of Grapher.js
    console.log(grapher.version);
</script>

If you have an AMD environment.

var grapher = require('grapher');
// Print version of Grapher.js
console.log(grapher.version);


// Or require grapher asynchronously
require(['grapher'], function (grapher) {
    // Create a surface graph    
});

First Example

After including Grapher.js. You can use the Surface class in grapher namespace to create a basic surface graph.

var surface = new grapher.Surface(canvas, {
    color: ['green', 'red'],
    xAxis: {
        data: new grapher.generator.Sequence(-1, 1, 0.1)
    },
    yAxis: {
        data: new grapher.generator.Sequence(-1, 1, 0.1)
    },
    zAxis: {
        range: [-2, 2],
        data: function (x, y) {
            return Math.sin(x * Math.PI) * Math.sin(y * Math.PI);
        }
    },
    autoRotate: false
});
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].