-
Notifications
You must be signed in to change notification settings - Fork 1
Add Trend Line
Linda Mejia edited this page Sep 13, 2020
·
7 revisions
To create a trend line we have used a linear regression javascript library.
- Add the following to scripts.html file inside the _includes folder:
<script src="https://cdn.jsdelivr.net/npm/regression@2.0.1/dist/regression.min.js"></script>
- Add the following code to this file (open-sdg-site-starter/_includes/assets/js/indicatorView.js), which can also be found here:
- Then, call the linear regression function by adding
linearRegression(chartInfo);
inside of this.createPlot function & this.updatePlot function.
If you have any suggestions for this material, please feel free to raise an issue; or if you have any additional questions that are not covered, please feel free to contact us.