# Custom Functions

Learn how to add custom analytical functions using Wijmo's Chart Analytics module in this documentation topic

## Content

The __wijmo.chart.analytics__ module contains two classes that allow you to plot arbitrary functions without explicitly generating data points:

* __YFunctionSeries__: Series based on a function that provides Y values as a function of X values within a given range.
* __ParametricFunctionSeries__: Series based on functions that provides X and Y values as a function of domain values within a given range.

Example:

```JavaScript
import * as chart from '@mescius/wijmo.chart';
import * as analytics from '@mescius/wijmo.chart.analytics';

// create a YFunctionSeries and add it to the chart
var yFun = new analytics.YFunctionSeries();
yFun.name = 'y = f(x)';
yFun.min = -10;
yFun.max = 10;
yFun.sampleCount = 300;
yFun.func = function (x) {
    return Math.sin(4 * x) * Math.cos(3 * x);
	};
myChart.series.push(yFun);
  
// create a ParametricFunctionSeries and add it to the chart
var pFun = new analytics.ParametricFunctionSeries();
pFun.name = 'x = f(t); y = g(t)'
pFun.min = 0;
pFun.max = 2 * Math.PI;
pFun.sampleCount = 1000;
pFun.xFunc = function (t) {
    return 10 * Math.cos(5 * t);
	};
pFun.yFunc = function (t) {
    return Math.sin(6 * t);
	};
myChart.series.push(pFun);
}
```
![Custom Functions](https://cdn.mescius.io/document-site-files/images/3c7113e2-10b3-45ed-8f3b-9fb1e0af2b74/chart/chart-custom-functions.png)