[9062] | 1 | /** |
---|
| 2 | * jqPlot |
---|
| 3 | * Pure JavaScript plotting plugin using jQuery |
---|
| 4 | * |
---|
| 5 | * Version: @VERSION |
---|
| 6 | * |
---|
| 7 | * Copyright (c) 2009-2011 Chris Leonello |
---|
| 8 | * jqPlot is currently available for use in all personal or commercial projects |
---|
| 9 | * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL |
---|
| 10 | * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can |
---|
| 11 | * choose the license that best suits your project and use it accordingly. |
---|
| 12 | * |
---|
| 13 | * Although not required, the author would appreciate an email letting him |
---|
| 14 | * know of any substantial use of jqPlot. You can reach the author at: |
---|
| 15 | * chris at jqplot dot com or see http://www.jqplot.com/info.php . |
---|
| 16 | * |
---|
| 17 | * If you are feeling kind and generous, consider supporting the project by |
---|
| 18 | * making a donation at: http://www.jqplot.com/donate.php . |
---|
| 19 | * |
---|
| 20 | * sprintf functions contained in jqplot.sprintf.js by Ash Searle: |
---|
| 21 | * |
---|
| 22 | * version 2007.04.27 |
---|
| 23 | * author Ash Searle |
---|
| 24 | * http://hexmen.com/blog/2007/03/printf-sprintf/ |
---|
| 25 | * http://hexmen.com/js/sprintf.js |
---|
| 26 | * The author (Ash Searle) has placed this code in the public domain: |
---|
| 27 | * "This code is unrestricted: you are free to use it however you like." |
---|
| 28 | * |
---|
| 29 | */ |
---|
| 30 | (function($) { |
---|
| 31 | // Class: $.jqplot.DivTitleRenderer |
---|
| 32 | // The default title renderer for jqPlot. This class has no options beyond the <Title> class. |
---|
| 33 | $.jqplot.DivTitleRenderer = function() { |
---|
| 34 | }; |
---|
| 35 | |
---|
| 36 | $.jqplot.DivTitleRenderer.prototype.init = function(options) { |
---|
| 37 | $.extend(true, this, options); |
---|
| 38 | }; |
---|
| 39 | |
---|
| 40 | $.jqplot.DivTitleRenderer.prototype.draw = function() { |
---|
| 41 | // Memory Leaks patch |
---|
| 42 | if (this._elem) { |
---|
| 43 | this._elem.emptyForce(); |
---|
| 44 | this._elem = null; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | var r = this.renderer; |
---|
| 48 | var elem = document.createElement('div'); |
---|
| 49 | this._elem = $(elem); |
---|
| 50 | this._elem.addClass('jqplot-title'); |
---|
| 51 | |
---|
| 52 | if (!this.text) { |
---|
| 53 | this.show = false; |
---|
| 54 | this._elem.height(0); |
---|
| 55 | this._elem.width(0); |
---|
| 56 | } |
---|
| 57 | else if (this.text) { |
---|
| 58 | var color; |
---|
| 59 | if (this.color) { |
---|
| 60 | color = this.color; |
---|
| 61 | } |
---|
| 62 | else if (this.textColor) { |
---|
| 63 | color = this.textColor; |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | // don't trust that a stylesheet is present, set the position. |
---|
| 67 | var styles = {position:'absolute', top:'0px', left:'0px'}; |
---|
| 68 | |
---|
| 69 | if (this._plotWidth) { |
---|
| 70 | styles['width'] = this._plotWidth+'px'; |
---|
| 71 | } |
---|
| 72 | if (this.fontSize) { |
---|
| 73 | styles['fontSize'] = this.fontSize; |
---|
| 74 | } |
---|
| 75 | if (this.textAlign) { |
---|
| 76 | styles['textAlign'] = this.textAlign; |
---|
| 77 | } |
---|
| 78 | else { |
---|
| 79 | styles['textAlign'] = 'center'; |
---|
| 80 | } |
---|
| 81 | if (color) { |
---|
| 82 | styles['color'] = color; |
---|
| 83 | } |
---|
| 84 | if (this.paddingBottom) { |
---|
| 85 | styles['paddingBottom'] = this.paddingBottom; |
---|
| 86 | } |
---|
| 87 | if (this.fontFamily) { |
---|
| 88 | styles['fontFamily'] = this.fontFamily; |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | this._elem.css(styles); |
---|
| 92 | this._elem.text(this.text); |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | // styletext += (this._plotWidth) ? 'width:'+this._plotWidth+'px;' : ''; |
---|
| 96 | // styletext += (this.fontSize) ? 'font-size:'+this.fontSize+';' : ''; |
---|
| 97 | // styletext += (this.textAlign) ? 'text-align:'+this.textAlign+';' : 'text-align:center;'; |
---|
| 98 | // styletext += (color) ? 'color:'+color+';' : ''; |
---|
| 99 | // styletext += (this.paddingBottom) ? 'padding-bottom:'+this.paddingBottom+';' : ''; |
---|
| 100 | // this._elem = $('<div class="jqplot-title" style="'+styletext+'">'+this.text+'</div>'); |
---|
| 101 | // if (this.fontFamily) { |
---|
| 102 | // this._elem.css('font-family', this.fontFamily); |
---|
| 103 | // } |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | elem = null; |
---|
| 107 | |
---|
| 108 | return this._elem; |
---|
| 109 | }; |
---|
| 110 | |
---|
| 111 | $.jqplot.DivTitleRenderer.prototype.pack = function() { |
---|
| 112 | // nothing to do here |
---|
| 113 | }; |
---|
| 114 | })(jQuery); |
---|