Van,
I have had a good search for bar charts already but only found php examples so far
http://www.fpdf.de/downloads/addons/28/ php example
The only chart extention i have found is a pie chart, shown below:
pie_chart.asp
Code:
<%@language=javascript%>
<!--#include file="fpdf.asp"-->
<%
var pdf=new FPDF();
pdf.CreatePDF();
pdf.SetPath("fpdf/");
pdf.LoadExtension("sectors")
pdf.Open();
pdf.SetFont('Arial','',12);
pdf.Open();
pdf.AddPage();
xc=105;
yc=55;
r=40;
pdf.SetFillColor(120,120,255);
pdf.Sector(xc,yc,r,20,120);
pdf.SetFillColor(120,255,120);
pdf.Sector(xc,yc,r,120,250);
pdf.SetFillColor(255,120,120);
pdf.Sector(xc,yc,r,250,20);
pdf.Output();
%>
sectors.ext
this.Sector=function Sector(xxc , xyc , xr , xa , xb , xstyle , xcw , xo)
{
if (arguments.length<6) {xstyle="FD"};
if (arguments.length<7) {xcw=true};
if (arguments.length<8) {xo=90};
if(xcw)
{
xd=xb;
xb=xo-xa;
xa=xo-xd;
}
else
{
xb+=xo;
xa+=xo;
}
xa=(xa%360)+360;
xb=(xb%360)+360;
if(xa>xb)xb+=360;
xb=xb/360*2*Math.PI;
xa=xa/360*2*Math.PI;
xd=xb-xa;
if(xd==0)xd=2*Math.PI;
xk=this.k;
xhp=this.h;
if(xstyle=="F")xop="f";
else if(xstyle=="FD" || xstyle=="DF")xop="b";
else {xop="s";}
if(Math.sin(xd/2))xMyArc=4/3*(1-Math.cos(xd/2))/Math.sin(xd/2)*xr;
this._out(lib.sprintf("%.2f %.2f m",(xxc)*xk,(xhp-xyc)*xk));
this._out(lib.sprintf("%.2f %.2f l",(xxc+xr*Math.cos(xa))*xk,((xhp-(xyc-xr*Math.sin(xa)))*xk)));
if(xd<Math.PI/2)
{
this._Arc(xxc+xr*Math.cos(xa)+xMyArc*Math.cos(Math .PI/2+xa),xyc-xr*Math.sin(xa)-xMyArc*Math.sin(Math.PI/2+xa),xxc+xr*Math.cos(xb)+xMyArc*Math.cos(xb-Math.PI/2),xyc-xr*Math.sin(xb)-xMyArc*Math.sin(xb-Math.PI/2),xxc+xr*Math.cos(xb),xyc-xr*Math.sin(xb));
}
else
{
xb=xa+xd/4;
xMyArc=4/3*(1-Math.cos(xd/8))/Math.sin(xd/8)*xr;
this._Arc(xxc+xr*Math.cos(xa)+xMyArc*Math.cos(Math .PI/2+xa),xyc-xr*Math.sin(xa)-xMyArc*Math.sin(Math.PI/2+xa),xxc+xr*Math.cos(xb)+xMyArc*Math.cos(xb-Math.PI/2),xyc-xr*Math.sin(xb)-xMyArc*Math.sin(xb-Math.PI/2),xxc+xr*Math.cos(xb),xyc-xr*Math.sin(xb));
xa=xb;
xb=xa+xd/4;
this._Arc(xxc+xr*Math.cos(xa)+xMyArc*Math.cos(Math .PI/2+xa),xyc-xr*Math.sin(xa)-xMyArc*Math.sin(Math.PI/2+xa),xxc+xr*Math.cos(xb)+xMyArc*Math.cos(xb-Math.PI/2),xyc-xr*Math.sin(xb)-xMyArc*Math.sin(xb-Math.PI/2),xxc+xr*Math.cos(xb),xyc-xr*Math.sin(xb));
xa=xb;
xb=xa+xd/4;
this._Arc(xxc+xr*Math.cos(xa)+xMyArc*Math.cos(Math .PI/2+xa),xyc-xr*Math.sin(xa)-xMyArc*Math.sin(Math.PI/2+xa),xxc+xr*Math.cos(xb)+xMyArc*Math.cos(xb-Math.PI/2),xyc-xr*Math.sin(xb)-xMyArc*Math.sin(xb-Math.PI/2),xxc+xr*Math.cos(xb),xyc-xr*Math.sin(xb));
xa=xb;
xb=xa+xd/4;
this._Arc(xxc+xr*Math.cos(xa)+xMyArc*Math.cos(Math .PI/2+xa),xyc-xr*Math.sin(xa)-xMyArc*Math.sin(Math.PI/2+xa),xxc+xr*Math.cos(xb)+xMyArc*Math.cos(xb-Math.PI/2),xyc-xr*Math.sin(xb)-xMyArc*Math.sin(xb-Math.PI/2),xxc+xr*Math.cos(xb),xyc-xr*Math.sin(xb));
}
this._out(xop);
}
this._Arc=function _Arc(xx1 , xy1 , xx2 , xy2 , xx3 , xy3)
{
xh=this.h;
this._out(lib.sprintf("%.2f %.2f %.2f %.2f %.2f %.2f c",xx1*this.k,(xh-xy1)*this.k,xx2*this.k,(xh-xy2)*this.k,xx3*this.k,(xh-xy3)*this.k));
}
Cheers Aspless