2D 圖表庫:Function Plot
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' } }] });
本文由用戶 pdkie1 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!