123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- (function($) {
-
-
- $.jqplot.ShadowRenderer = function(options){
-
-
-
-
- this.angle = 45;
-
-
- this.offset = 1;
-
-
- this.alpha = 0.07;
-
-
- this.lineWidth = 1.5;
-
-
- this.lineJoin = 'miter';
-
-
- this.lineCap = 'round';
-
-
- this.closePath = false;
-
-
- this.fill = false;
-
-
- this.depth = 3;
- this.strokeStyle = 'rgba(0,0,0,0.1)';
-
-
- this.isarc = false;
-
- $.extend(true, this, options);
- };
-
- $.jqplot.ShadowRenderer.prototype.init = function(options) {
- $.extend(true, this, options);
- };
-
-
-
-
-
-
- $.jqplot.ShadowRenderer.prototype.draw = function(ctx, points, options) {
- ctx.save();
- var opts = (options != null) ? options : {};
- var fill = (opts.fill != null) ? opts.fill : this.fill;
- var fillRect = (opts.fillRect != null) ? opts.fillRect : this.fillRect;
- var closePath = (opts.closePath != null) ? opts.closePath : this.closePath;
- var offset = (opts.offset != null) ? opts.offset : this.offset;
- var alpha = (opts.alpha != null) ? opts.alpha : this.alpha;
- var depth = (opts.depth != null) ? opts.depth : this.depth;
- var isarc = (opts.isarc != null) ? opts.isarc : this.isarc;
- var linePattern = (opts.linePattern != null) ? opts.linePattern : this.linePattern;
- ctx.lineWidth = (opts.lineWidth != null) ? opts.lineWidth : this.lineWidth;
- ctx.lineJoin = (opts.lineJoin != null) ? opts.lineJoin : this.lineJoin;
- ctx.lineCap = (opts.lineCap != null) ? opts.lineCap : this.lineCap;
- ctx.strokeStyle = opts.strokeStyle || this.strokeStyle || 'rgba(0,0,0,'+alpha+')';
- ctx.fillStyle = opts.fillStyle || this.fillStyle || 'rgba(0,0,0,'+alpha+')';
- for (var j=0; j<depth; j++) {
- var ctxPattern = $.jqplot.LinePattern(ctx, linePattern);
- ctx.translate(Math.cos(this.angle*Math.PI/180)*offset, Math.sin(this.angle*Math.PI/180)*offset);
- ctxPattern.beginPath();
- if (isarc) {
- ctx.arc(points[0], points[1], points[2], points[3], points[4], true);
- }
- else if (fillRect) {
- if (fillRect) {
- ctx.fillRect(points[0], points[1], points[2], points[3]);
- }
- }
- else if (points && points.length){
- var move = true;
- for (var i=0; i<points.length; i++) {
-
- if (points[i][0] != null && points[i][1] != null) {
- if (move) {
- ctxPattern.moveTo(points[i][0], points[i][1]);
- move = false;
- }
- else {
- ctxPattern.lineTo(points[i][0], points[i][1]);
- }
- }
- else {
- move = true;
- }
- }
-
- }
- if (closePath) {
- ctxPattern.closePath();
- }
- if (fill) {
- ctx.fill();
- }
- else {
- ctx.stroke();
- }
- }
- ctx.restore();
- };
- })(jQuery);
|