# 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 version **1.0.0** (published 2019-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngx-math-function-plotter
pnpm add ngx-math-function-plotter
yarn add ngx-math-function-plotter
bun add ngx-math-function-plotter
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-10-29 |
| First published | 2019-10-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 478.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ALIEZZAT ODEH |
| Maintainers | aliezzat |
| Keywords | angular, typescript, javascript |

## Links

- npm: https://www.npmjs.com/package/ngx-math-function-plotter
- Repository: https://github.com/AliEzzatOdeh/MathFunctionPlotter
- Homepage: https://github.com/AliEzzatOdeh/MathFunctionPlotter/tree/master/projects/ngx-math-function-plotter
- Issues: https://github.com/AliEzzatOdeh/MathFunctionPlotter/issues
- npm.io page: https://npm.io/package/ngx-math-function-plotter

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-10-29
- 0.0.2 — 2019-10-29
- 0.0.1 — 2019-10-28

## README

# MathFunctionPlotter [![Build Status](https://travis-ci.com/AliEzzatOdeh/MathFunctionPlotter.svg?branch=master)](https://travis-ci.com/AliEzzatOdeh/MathFunctionPlotter)

This project was generated with [Angular CLI](https://github.com/angular/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:

| Operation      | Syntax        | # of operands   |
| -------------  |:-------------:| ---------------:|
| Addition       |     +         |       2         |
| Subtraction    |     sub       |       2         |
| Multiplication |     *         |       2         |
| Division       |     /         |       2         |
| L.Parantheses  |     (         |       >=1       |
| R.Parantheses  |     )         |       >=1       |
| sin            |     sin       |       1         |
| cos            |     cos       |       1         |
| tan            |     tan       |       1         |
| seq            |     seq       |       1         |
| csc            |     csc       |       1         |
| cot            |     cot       |       1         |
| power          |     ^         |       2         |
| square root    |     sqr       |       1         |
| 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](/projects/ngx-math-function-plotter/plotterSampleResult.PNG)

### 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](https://karma-runner.github.io).


## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

---
_Source: https://npm.io/package/ngx-math-function-plotter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
