⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jgchartpainter.js

📁 睡衣网部分源代码 一次偶然机会 被我下载了下来
💻 JS
字号:
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)};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -