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.AxisLabelRenderer |
---|
32 | // Renderer to place labels on the axes. |
---|
33 | $.jqplot.AxisLabelRenderer = function(options) { |
---|
34 | // Group: Properties |
---|
35 | $.jqplot.ElemContainer.call(this); |
---|
36 | // name of the axis associated with this tick |
---|
37 | this.axis; |
---|
38 | // prop: show |
---|
39 | // wether or not to show the tick (mark and label). |
---|
40 | this.show = true; |
---|
41 | // prop: label |
---|
42 | // The text or html for the label. |
---|
43 | this.label = ''; |
---|
44 | this.fontFamily = null; |
---|
45 | this.fontSize = null; |
---|
46 | this.textColor = null; |
---|
47 | this._elem; |
---|
48 | // prop: escapeHTML |
---|
49 | // true to escape HTML entities in the label. |
---|
50 | this.escapeHTML = false; |
---|
51 | |
---|
52 | $.extend(true, this, options); |
---|
53 | }; |
---|
54 | |
---|
55 | $.jqplot.AxisLabelRenderer.prototype = new $.jqplot.ElemContainer(); |
---|
56 | $.jqplot.AxisLabelRenderer.prototype.constructor = $.jqplot.AxisLabelRenderer; |
---|
57 | |
---|
58 | $.jqplot.AxisLabelRenderer.prototype.init = function(options) { |
---|
59 | $.extend(true, this, options); |
---|
60 | }; |
---|
61 | |
---|
62 | $.jqplot.AxisLabelRenderer.prototype.draw = function(ctx, plot) { |
---|
63 | // Memory Leaks patch |
---|
64 | if (this._elem) { |
---|
65 | this._elem.emptyForce(); |
---|
66 | this._elem = null; |
---|
67 | } |
---|
68 | |
---|
69 | this._elem = $('<div style="position:absolute;" class="jqplot-'+this.axis+'-label"></div>'); |
---|
70 | |
---|
71 | if (Number(this.label)) { |
---|
72 | this._elem.css('white-space', 'nowrap'); |
---|
73 | } |
---|
74 | |
---|
75 | if (!this.escapeHTML) { |
---|
76 | this._elem.html(this.label); |
---|
77 | } |
---|
78 | else { |
---|
79 | this._elem.text(this.label); |
---|
80 | } |
---|
81 | if (this.fontFamily) { |
---|
82 | this._elem.css('font-family', this.fontFamily); |
---|
83 | } |
---|
84 | if (this.fontSize) { |
---|
85 | this._elem.css('font-size', this.fontSize); |
---|
86 | } |
---|
87 | if (this.textColor) { |
---|
88 | this._elem.css('color', this.textColor); |
---|
89 | } |
---|
90 | |
---|
91 | return this._elem; |
---|
92 | }; |
---|
93 | |
---|
94 | $.jqplot.AxisLabelRenderer.prototype.pack = function() { |
---|
95 | }; |
---|
96 | })(jQuery); |
---|