New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ngx-math-function-plotter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-math-function-plotter

An angular library that has a component for plotting math functions with built in math expressions and single variable computation.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

MathFunctionPlotter Build Status

This project was generated with Angular CLI version 7.0.2.

An angular library that has a component for plotting math functions with built in math expressions & single variable computation.

Table of supported math operations:

OperationSyntax# of operands
Addition+2
Subtractionsub2
Multiplication*2
Division/2
L.Parantheses(>=1
R.Parantheses)>=1
sinsin1
coscos1
tantan1
seqseq1
csccsc1
cotcot1
power^2
square rootsqr1
minus-1

Usage

Plotter

Inside your module import it as:

import {NgxMathFunctionPlotterModule} from 'ngx-math-function-plotter';

Then inside your component .html add the plotter component tag:

<ngx-math-function-plotter [functionInput]="'sin(x)'" [maxDisplayValue]="10" [width]="600" [height]="600">
</ngx-math-function-plotter>

Result will be as follow:

image not found

Math Expression parser

For parsing mathmatical expressions service NgxSingleVariableFunctionParserService can be used inside needed component .ts:

First import the service as follows:

import { NgxSingleVariableFunctionParserService } from 'ngx-math-function-plotter';

Then inside the class will be as:

export class AppComponent {
  title = 'PlotterTest';

  mathExpressionParser: NgxSingleVariableFunctionParserService;

  constructor(mathExpressionParser: NgxSingleVariableFunctionParserService) {
    this.mathExpressionParser = mathExpressionParser;
    this.mathExpressionParser.setMathFunctionText('x+1'); // single variable expression
    const number = this.mathExpressionParser.computeFunctionAtValue(1); // 2 is displayed
    alert(number);
    this.mathExpressionParser.setMathFunctionText('sqr(4*4)'); // constant expression
     // input in following statement has no effect since expression is constant
    const constantExpressionResult = this.mathExpressionParser.computeFunctionAtValue(0);
    alert(constantExpressionResult); // 4 is displayed
  }

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test --project NgxMathFunctionPlotter to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Keywords

angular

FAQs

Package last updated on 29 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts