Add optional weighting to the calculation of the trendline

You can supply an extra value in data that are the weights of certain points.