Skip to content
/ PlotJs Public

A lightweight JavaScript function plotter Plugin

License

Notifications You must be signed in to change notification settings

maroxtn/PlotJs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PlotJs - Lightweight functions plotter

Version

@version 1.00
@since 2016/2/16
@author Abdessalem Boukil
@authorEmail boukil98@gmail.com

Usage

In your html file

    <script src="plotjs.js"></script>

For the minimal usage:

<div id="container"></div>
var plane = new Plot({
    container: document.getElementById('container')
});

plane.plot('4x+3');

The container must be a div or it would not be accepted

Full usage

This are the default value of the plane's settings:

var setting = {

            container: '', //Required
            max: 21,    //Integer
            min: -21,	 //Integer     
            strokeThickness: 3, //Integer 
            strokeColor: 'black',  //String
            lineColor1: "#AAAAAA", //String             Thick guidelines 
            lineColor2: "#DDDDDD",  //String             Secondary guidelines
            backgroundColor: 'white', //String
            zoom: true, //Boolean
            navigation: true, //Boolean
            height: '400px', //String
            width: '400px',  //String
            errorReporting: true, //Boolean
            foregroundColor: '#EEEEEE', //String
            guidelines: true,
            tickThickness: 2, //Integer
            tickColor: 'black', //String
            tickHeight: 16,  //Integer
            keyNavSpeed: 1, //Double
            fontSize: 10, //Integer (in px)
            fontColor: 'black',//String
            dispCallback: function(disp){	return true;	},  //Function
            zommCallback: function(){	return true;	}  //Function

}

var plane = new Plot(setting);

This is the default setting of the function plot:

	var plotDefault = { 

		borderColor: 'green', //String
		borderThickness: 3,  //Integer
		equation: (typeof fn.equation === 'function') ? function(){ return; } : '',  //Depends on the type of the equation variable
		resolution: iteration 

	};

To see the full documentation open: http://abdesaslem.github.io/PlotJs/

Other methods:

  1. Destroy: Delete the plane
    plane.destroy();
  1. destroyFunction: remove a function from the plane
    var fn = plane.function('4x+23');
    plane.destroyFunction(fn)
  1. Clear: clear the plane
    plane.clear();

Licence

The GNU General Public License v3.0

About

A lightweight JavaScript function plotter Plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages