The Statistics::LineFit module can be used to calculate your trend line.
In reply to Re: simple html trend line by hdb in thread simple html trend line by artperl