# Arithmetic Operations (Beta)

The basic arithmetic operations that you can perform on sensor data while plotting the graph is -

- Addition (Can also be used for subtraction)
- Multiplication (Can also be used for division)

## Addition

You can add any value to the sensor data by the using the function *add()* and this function must be called before the plotChart function. The function takes an integer value as input. You can use the function to also subtract values by passing a negative integer as input to the function. The function internally performs the operation on the hardware input value that has been defined in your plotChart function.

## Sample Code

```
setChartLibrary('google-chart');
setChartTitle('Your Graph Title');
setChartType('lineGraph');
setAxisName('X-Axis Name','Y-axis Name');
add(Integer Value);
plotChart('time_stamp','your_variable_name');
```

**Note: This function will not work in the stepped and multiple graph. *

## Multiplication

You can multiply any integer value to sensor data by the using the function *mul()* and this function must be called before the plotChart function. The function takes an integer value as input. You can use the function to also divide values by passing a decimal value as input to the function. e.g. to divide your sensor value by 20, pass the decimal value of (1/20) i.e. 0.05 as input to the function. The function internally performs the operation on the hardware input value that has been defined in your plotChart function.

## Sample Code

```
setChartLibrary('google-chart');
setChartTitle('Your Graph Title');
setChartType('lineGraph');
setAxisName('X-Axis Name','Y-axis Name');
mul(Integer Value);
plotChart('time_stamp','your_variable_name');
```

**Note: This function will not work in the stepped and multiple graph**

Updated over 5 years ago