2D 图表库:Function Plot

pdkie1 9年前

Function Plot 是一个基于 D3.js 开发的 2D 图表库,用来绘制各种函数图。

Install

$ npm install --save function-plot

Usage

var d3 = window.d3 var functionPlot = require('function-plot');  functionPlot({ // options below })

Example

See site/js/index.js

'use strict'; var d3 = window.d3; var functionPlot = window.functionPlot;  functionPlot({    target: '#canvas',    data: [{      title: 'f(x)', fn: function (x) { return -x * x;      }    }, { fn: function (x) { return Math.sqrt(x);      },      graphOptions: {        type: 'scatter' }    }, { fn: function (x) { return 1 / x;      },      graphOptions: {        limits: [0],        interpolate: 'linear' }    }]  });

2D 图表库:Function Plot

项目主页:http://www.open-open.com/lib/view/home/1428905171111