
function JsGraphicsChartPainterFactory() {
	return new JsGraphicsChartPainter();
}
function JsGraphicsChartPainter() {
	this.base = AbstractChartPainter;
}
JsGraphicsChartPainter.prototype = new AbstractChartPainter;
JsGraphicsChartPainter.prototype.create = function (el) {
	while (el.firstChild) {
		el.removeChild(el.lastChild);
	}
	this.el = el;
	this.w = el.clientWidth;
	this.h = el.clientHeight;
	this.canvas = document.createElement("div");
	this.canvas.width = this.w;
	this.canvas.height = this.h;
	this.canvas.style.width = this.w + "px";
	this.canvas.style.height = this.h + "px";
	this.canvas.style.position = "relative";
	this.canvas.id = "canvas_" + el.id;
	this.canvas.onselectstart = function () {
		return false;
	};
	el.appendChild(this.canvas);
	this.ctx = new jsGraphics(this.canvas.id);
};
JsGraphicsChartPainter.prototype.getWidth = function () {
	return this.w;
};
JsGraphicsChartPainter.prototype.getHeight = function () {
	return this.h;
};
JsGraphicsChartPainter.prototype.fillArea = function (color, points) {
	var i, XPoints, YPoints;
	XPoints = [];
	YPoints = [];
	if (points.length <= 0) {
		return;
	}
	for (i = 0; i < points.length; i++) {
		XPoints[i] = points[i].x;
		YPoints[i] = points[i].y;
	}
	this.ctx.setColor(color);
	this.ctx.fillPolygon(XPoints, YPoints);
};
JsGraphicsChartPainter.prototype.polyLine = function (color, lineWidth, points) {
	if (points.length <= 0) {
		return;
	}
	this.ctx.setStroke(lineWidth);
	this.ctx.setColor(color);
	for (i = 1; i < points.length; i++) {
		this.ctx.drawLine(points[i - 1].x, points[i - 1].y, points[i].x, points[i].y);
	}
	this.ctx.paint();
};
JsGraphicsChartPainter.prototype.fillRect = function (color, x, y, width, height) {
	this.ctx.setColor(color);
	this.ctx.fillRect(x, y, width, height);
};
JsGraphicsChartPainter.prototype.line = function (color, lineWidth, x1, y1, x2, y2) {
	this.ctx.setStroke(lineWidth);
	this.ctx.setColor(color);
	this.ctx.drawLine(x1, y1, x2, y2);
	this.ctx.paint();
};
JsGraphicsChartPainter.prototype.fillArc = function (color, centerx, centery, radius, startAngle, endAngle) {
	this.ctx.setColor(color);
	this.ctx.fillArc(centerx, centery, radius, radius, startAngle, endAngle);
};

