compass-jquery-plugin 0.3.0.beta.21 → 0.3.0.beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.textile +212 -211
- data/VERSION.yml +5 -5
- data/compass-jquery-plugin.gemspec +25 -2
- data/gem_tasks/jqtouch.rake +221 -201
- data/gem_tasks/jrails.rake +322 -311
- data/lib/compiler.jar +0 -0
- data/lib/jquery/flash_messages.rb +45 -45
- data/lib/jquery/gridify/grid.rb +147 -147
- data/lib/jquery/gridify/grid_column.rb +134 -134
- data/lib/jquery/gridify/grid_finder.rb +223 -211
- data/lib/jquery/gridify/grid_options.rb +279 -279
- data/lib/jquery/gridify/grid_view.rb +435 -436
- data/lib/jquery/gridify.rb +42 -42
- data/templates/dynatree/jquery.dynatree.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-bg.min.js +6 -15
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.min.js +6 -15
- data/templates/jqgrid/i18n/jqgrid/locale-cat.min.js +5 -6
- data/templates/jqgrid/i18n/jqgrid/locale-cn.min.js +5 -8
- data/templates/jqgrid/i18n/jqgrid/locale-cs.min.js +6 -8
- data/templates/jqgrid/i18n/jqgrid/locale-da.min.js +6 -6
- data/templates/jqgrid/i18n/jqgrid/locale-de.min.js +7 -7
- data/templates/jqgrid/i18n/jqgrid/locale-el.min.js +7 -13
- data/templates/jqgrid/i18n/jqgrid/locale-es.min.js +7 -7
- data/templates/jqgrid/i18n/jqgrid/locale-fa.min.js +6 -12
- data/templates/jqgrid/i18n/jqgrid/locale-fr.min.js +7 -7
- data/templates/jqgrid/i18n/jqgrid/locale-gl.min.js +7 -7
- data/templates/jqgrid/i18n/jqgrid/locale-he.min.js +6 -13
- data/templates/jqgrid/i18n/jqgrid/locale-hu.min.js +6 -8
- data/templates/jqgrid/i18n/jqgrid/locale-is.min.js +6 -7
- data/templates/jqgrid/i18n/jqgrid/locale-it.min.js +4 -4
- data/templates/jqgrid/i18n/jqgrid/locale-ja.min.js +5 -10
- data/templates/jqgrid/i18n/jqgrid/locale-no.min.js +6 -6
- data/templates/jqgrid/i18n/jqgrid/locale-pl.min.js +6 -7
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.min.js +6 -7
- data/templates/jqgrid/i18n/jqgrid/locale-pt.min.js +4 -5
- data/templates/jqgrid/i18n/jqgrid/locale-ro.min.js +7 -8
- data/templates/jqgrid/i18n/jqgrid/locale-ru.min.js +7 -16
- data/templates/jqgrid/i18n/jqgrid/locale-sk.min.js +6 -8
- data/templates/jqgrid/i18n/jqgrid/locale-sv.min.js +6 -7
- data/templates/jqgrid/i18n/jqgrid/locale-tr.min.js +6 -7
- data/templates/jqgrid/i18n/jqgrid/locale-ua.min.js +7 -16
- data/templates/jqgrid/jquery.jqGrid.js +11567 -11565
- data/templates/jqgrid/jquery.jqGrid.min.js +472 -472
- data/templates/jqical/jquery.jqical.js +5 -9
- data/templates/jqical/jquery.jqical.min.js +44 -44
- data/templates/jqical/jquery.ui/jqical.scss +1 -1
- data/templates/jqtouch/config/initializers/jqtouch.rb +5 -4
- data/templates/jqtouch/jqtouch/apple/activeButton.png +0 -0
- data/templates/jqtouch/jqtouch/default/backButton.png +0 -0
- data/templates/jqtouch/jqtouch/default/backButtonActive.png +0 -0
- data/templates/jqtouch/jqtouch/default/bigButton.png +0 -0
- data/templates/jqtouch/jqtouch/default/bigButtonActive.png +0 -0
- data/templates/jqtouch/jqtouch/default/button.png +0 -0
- data/templates/jqtouch/jqtouch/default/buttonActive.png +0 -0
- data/templates/jqtouch/jqtouch/default/chevron.png +0 -0
- data/templates/jqtouch/jqtouch/default/chevronActive.png +0 -0
- data/templates/jqtouch/jqtouch/default/chevronCircle.png +0 -0
- data/templates/jqtouch/jqtouch/default/chevronCircleActive.png +0 -0
- data/templates/jqtouch/jqtouch/default/loading.gif +0 -0
- data/templates/jqtouch/jqtouch/default/toggleSwitch.png +0 -0
- data/templates/jqtouch/jqtouch/default/toolbarBackground.png +0 -0
- data/templates/jqtouch/jqtouch/jqt/back_button_clicked.png +0 -0
- data/templates/jqtouch/jqtouch/jqt.apple.scss +24 -11
- data/templates/jqtouch/jqtouch/jqt.default.scss +537 -0
- data/templates/jqtouch/jqtouch/jqt.jqt.scss +20 -6
- data/templates/jqtouch/jqtouch/jqtouch.scss +173 -1
- data/templates/jqtouch/jqtouch/photo/btnBack.png +0 -0
- data/templates/jqtouch/jqtouch/photo/loading.gif +0 -0
- data/templates/jqtouch/jqtouch/photo/navNext.png +0 -0
- data/templates/jqtouch/jqtouch/photo/navPause.png +0 -0
- data/templates/jqtouch/jqtouch/photo/navPlay.png +0 -0
- data/templates/jqtouch/jqtouch/photo/navPrev.png +0 -0
- data/templates/jqtouch/jqtouch/photo/toolbar.png +0 -0
- data/templates/jqtouch/jquery.jqtouch.js +8219 -632
- data/templates/jqtouch/jquery.jqtouch.min.js +60 -1
- data/templates/jqtouch/manifest.rb +21 -0
- data/templates/jrails/config/initializers/jrails.rb +1 -0
- data/templates/jrails/haml.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-ar.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-az.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-bg.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-bs.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-cs.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-da.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-de.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-el.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-eo.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-et.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-fa.min.js +2 -3
- data/templates/jrails/i18n/jquery.ui/datepicker-fo.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-fr-CH.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-fr.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-he.min.js +2 -3
- data/templates/jrails/i18n/jquery.ui/datepicker-hr.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-hu.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-hy.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-ja.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-ko.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-kz.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-lt.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-lv.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-nl.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-no.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-pl.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-ro.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-ru.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-sk.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-sq.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-sr-SR.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-sr.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-sv.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-ta.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-th.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-tr.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-uk.min.js +2 -4
- data/templates/jrails/i18n/jquery.ui/datepicker-vi.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-zh-CN.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-zh-HK.min.js +2 -2
- data/templates/jrails/i18n/jquery.ui/datepicker-zh-TW.min.js +2 -2
- data/templates/jrails/jquery-1.4.2.min.js +156 -156
- data/templates/jrails/jquery-ui-1.8.5.js +23753 -23341
- data/templates/jrails/jquery-ui-1.8.5.min.js +823 -808
- data/templates/jrails/jquery.contextMenu.min.js +1 -1
- data/templates/jrails/jquery.sparkline.js +1050 -0
- data/templates/jrails/jquery.sparkline.min.js +31 -0
- data/templates/jrails/jquery.ui/_theme.scss +1699 -1634
- data/templates/jrails/manifest.rb +13 -11
- data/templates/jstree/jquery.jstree.min.js +10 -10
- data/templates/ribbon/jquery.ribbon.min.js +6 -6
- metadata +27 -4
|
@@ -0,0 +1,1050 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* jquery.sparkline.js
|
|
4
|
+
*
|
|
5
|
+
* v1.5.1
|
|
6
|
+
* (c) Splunk, Inc
|
|
7
|
+
* Contact: Gareth Watts (gareth@splunk.com)
|
|
8
|
+
* http://omnipotent.net/jquery.sparkline/
|
|
9
|
+
*
|
|
10
|
+
* Generates inline sparkline charts from data supplied either to the method
|
|
11
|
+
* or inline in HTML
|
|
12
|
+
*
|
|
13
|
+
* Compatible with Internet Explorer 6.0+ and modern browsers equipped with the canvas tag
|
|
14
|
+
* (Firefox 2.0+, Safari, Opera, etc)
|
|
15
|
+
*
|
|
16
|
+
* License: New BSD License
|
|
17
|
+
*
|
|
18
|
+
* Copyright (c) 2010, Splunk Inc.
|
|
19
|
+
* All rights reserved.
|
|
20
|
+
*
|
|
21
|
+
* Redistribution and use in source and binary forms, with or without modification,
|
|
22
|
+
* are permitted provided that the following conditions are met:
|
|
23
|
+
*
|
|
24
|
+
* * Redistributions of source code must retain the above copyright notice,
|
|
25
|
+
* this list of conditions and the following disclaimer.
|
|
26
|
+
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
27
|
+
* this list of conditions and the following disclaimer in the documentation
|
|
28
|
+
* and/or other materials provided with the distribution.
|
|
29
|
+
* * Neither the name of Splunk Inc nor the names of its contributors may
|
|
30
|
+
* be used to endorse or promote products derived from this software without
|
|
31
|
+
* specific prior written permission.
|
|
32
|
+
*
|
|
33
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
34
|
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
35
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
|
36
|
+
* SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
37
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
|
38
|
+
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
39
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
40
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
41
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
42
|
+
*
|
|
43
|
+
*
|
|
44
|
+
* Usage:
|
|
45
|
+
* $(selector).sparkline(values, options)
|
|
46
|
+
*
|
|
47
|
+
* If values is undefined or set to 'html' then the data values are read from the specified tag:
|
|
48
|
+
* <p>Sparkline: <span class="sparkline">1,4,6,6,8,5,3,5</span></p>
|
|
49
|
+
* $('.sparkline').sparkline();
|
|
50
|
+
* There must be no spaces in the enclosed data set
|
|
51
|
+
*
|
|
52
|
+
* Otherwise values must be an array of numbers or null values
|
|
53
|
+
* <p>Sparkline: <span id="sparkline1">This text replaced if the browser is compatible</span></p>
|
|
54
|
+
* $('#sparkline1').sparkline([1,4,6,6,8,5,3,5])
|
|
55
|
+
* $('#sparkline2').sparkline([1,4,6,null,null,5,3,5])
|
|
56
|
+
*
|
|
57
|
+
* For line charts, x values can also be specified:
|
|
58
|
+
* <p>Sparkline: <span class="sparkline">1:1,2.7:4,3.4:6,5:6,6:8,8.7:5,9:3,10:5</span></p>
|
|
59
|
+
* $('#sparkline1').sparkline([ [1,1], [2.7,4], [3.4,6], [5,6], [6,8], [8.7,5], [9,3], [10,5] ])
|
|
60
|
+
*
|
|
61
|
+
* Supported options:
|
|
62
|
+
* lineColor - Color of the line used for the chart
|
|
63
|
+
* fillColor - Color used to fill in the chart - Set to '' or false for a transparent chart
|
|
64
|
+
* width - Width of the chart - Defaults to 3 times the number of values in pixels
|
|
65
|
+
* height - Height of the chart - Defaults to the height of the containing element
|
|
66
|
+
* chartRangeMin - Specify the minimum value to use for the Y range of the chart - Defaults to the minimum value supplied
|
|
67
|
+
* chartRangeMax - Specify the maximum value to use for the Y range of the chart - Defaults to the maximum value supplied
|
|
68
|
+
* chartRangeClip - Clip out of range values to the max/min specified by chartRangeMin and chartRangeMax
|
|
69
|
+
* chartRangeMinX - Specify the minimum value to use for the X range of the chart - Defaults to the minimum value supplied
|
|
70
|
+
* chartRangeMaxX - Specify the maximum value to use for the X range of the chart - Defaults to the maximum value supplied
|
|
71
|
+
* composite - If true then don't erase any existing chart attached to the tag, but draw
|
|
72
|
+
* another chart over the top - Note that width and height are ignored if an
|
|
73
|
+
* existing chart is detected.
|
|
74
|
+
*
|
|
75
|
+
* There are 7 types of sparkline, selected by supplying a "type" option of 'line' (default),
|
|
76
|
+
* 'bar', 'tristate', 'bullet', 'discrete', 'pie' or 'box'
|
|
77
|
+
* line - Line chart. Options:
|
|
78
|
+
* spotColor - Set to '' to not end each line in a circular spot
|
|
79
|
+
* minSpotColor - If set, color of spot at minimum value
|
|
80
|
+
* maxSpotColor - If set, color of spot at maximum value
|
|
81
|
+
* spotRadius - Radius in pixels
|
|
82
|
+
* lineWidth - Width of line in pixels
|
|
83
|
+
* normalRangeMin
|
|
84
|
+
* normalRangeMax - If set draws a filled horizontal bar between these two values marking the "normal"
|
|
85
|
+
* or expected range of values
|
|
86
|
+
* normalRangeColor - Color to use for the above bar
|
|
87
|
+
* defaultPixelsPerValue - Defaults to 3 pixels of width for each value in the chart
|
|
88
|
+
*
|
|
89
|
+
* bar - Bar chart. Options:
|
|
90
|
+
* barColor - Color of bars for postive values
|
|
91
|
+
* negBarColor - Color of bars for negative values
|
|
92
|
+
* zeroColor - Color of bars with zero values
|
|
93
|
+
* nullColor - Color of bars with null values - Defaults to omitting the bar entirely
|
|
94
|
+
* barWidth - Width of bars in pixels
|
|
95
|
+
* colorMap - Optional mappnig of values to colors to override the *BarColor values above
|
|
96
|
+
* can be an Array of values to control the color of individual bars
|
|
97
|
+
* barSpacing - Gap between bars in pixels
|
|
98
|
+
* zeroAxis - Centers the y-axis around zero if true
|
|
99
|
+
*
|
|
100
|
+
* tristate - Charts values of win (>0), lose (<0) or draw (=0)
|
|
101
|
+
* posBarColor - Color of win values
|
|
102
|
+
* negBarColor - Color of lose values
|
|
103
|
+
* zeroBarColor - Color of draw values
|
|
104
|
+
* barWidth - Width of bars in pixels
|
|
105
|
+
* barSpacing - Gap between bars in pixels
|
|
106
|
+
* colorMap - Optional mappnig of values to colors to override the *BarColor values above
|
|
107
|
+
* can be an Array of values to control the color of individual bars
|
|
108
|
+
*
|
|
109
|
+
* discrete - Options:
|
|
110
|
+
* lineHeight - Height of each line in pixels - Defaults to 30% of the graph height
|
|
111
|
+
* thesholdValue - Values less than this value will be drawn using thresholdColor instead of lineColor
|
|
112
|
+
* thresholdColor
|
|
113
|
+
*
|
|
114
|
+
* bullet - Values for bullet graphs msut be in the order: target, performance, range1, range2, range3, ...
|
|
115
|
+
* options:
|
|
116
|
+
* targetColor - The color of the vertical target marker
|
|
117
|
+
* targetWidth - The width of the target marker in pixels
|
|
118
|
+
* performanceColor - The color of the performance measure horizontal bar
|
|
119
|
+
* rangeColors - Colors to use for each qualitative range background color
|
|
120
|
+
*
|
|
121
|
+
* pie - Pie chart. Options:
|
|
122
|
+
* sliceColors - An array of colors to use for pie slices
|
|
123
|
+
* offset - Angle in degrees to offset the first slice - Try -90 or +90
|
|
124
|
+
*
|
|
125
|
+
* box - Box plot. Options:
|
|
126
|
+
* raw - Set to true to supply pre-computed plot points as values
|
|
127
|
+
* values should be: low_outlier, low_whisker, q1, median, q3, high_whisker, high_outlier
|
|
128
|
+
* When set to false you can supply any number of values and the box plot will
|
|
129
|
+
* be computed for you. Default is false.
|
|
130
|
+
* showOutliers - Set to true (default) to display outliers as circles
|
|
131
|
+
* outlierIRQ - Interquartile range used to determine outliers. Default 1.5
|
|
132
|
+
* boxLineColor - Outline color of the box
|
|
133
|
+
* boxFillColor - Fill color for the box
|
|
134
|
+
* whiskerColor - Line color used for whiskers
|
|
135
|
+
* outlierLineColor - Outline color of outlier circles
|
|
136
|
+
* outlierFillColor - Fill color of the outlier circles
|
|
137
|
+
* spotRadius - Radius of outlier circles
|
|
138
|
+
* medianColor - Line color of the median line
|
|
139
|
+
* target - Draw a target cross hair at the supplied value (default undefined)
|
|
140
|
+
*
|
|
141
|
+
*
|
|
142
|
+
*
|
|
143
|
+
* Examples:
|
|
144
|
+
* $('#sparkline1').sparkline(myvalues, { lineColor: '#f00', fillColor: false });
|
|
145
|
+
* $('.barsparks').sparkline('html', { type:'bar', height:'40px', barWidth:5 });
|
|
146
|
+
* $('#tristate').sparkline([1,1,-1,1,0,0,-1], { type:'tristate' }):
|
|
147
|
+
* $('#discrete').sparkline([1,3,4,5,5,3,4,5], { type:'discrete' });
|
|
148
|
+
* $('#bullet').sparkline([10,12,12,9,7], { type:'bullet' });
|
|
149
|
+
* $('#pie').sparkline([1,1,2], { type:'pie' });
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
(function($) {
|
|
154
|
+
|
|
155
|
+
// Provide a cross-browser interface to a few simple drawing primitives
|
|
156
|
+
$.fn.simpledraw = function(width, height, use_existing) {
|
|
157
|
+
if (use_existing && this[0].vcanvas) return this[0].vcanvas;
|
|
158
|
+
if (width==undefined) width=$(this).innerWidth();
|
|
159
|
+
if (height==undefined) height=$(this).innerHeight();
|
|
160
|
+
if ($.browser.hasCanvas) {
|
|
161
|
+
return new vcanvas_canvas(width, height, this);
|
|
162
|
+
} else if ($.browser.msie) {
|
|
163
|
+
return new vcanvas_vml(width, height, this);
|
|
164
|
+
} else {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
var pending = [];
|
|
170
|
+
|
|
171
|
+
$.fn.sparkline = function(uservalues, options) {
|
|
172
|
+
var options = $.extend({
|
|
173
|
+
type : 'line',
|
|
174
|
+
lineColor : '#00f',
|
|
175
|
+
fillColor : '#cdf',
|
|
176
|
+
defaultPixelsPerValue : 3,
|
|
177
|
+
width : 'auto',
|
|
178
|
+
height : 'auto',
|
|
179
|
+
composite : false
|
|
180
|
+
}, options ? options : {});
|
|
181
|
+
|
|
182
|
+
return this.each(function() {
|
|
183
|
+
var render = function() {
|
|
184
|
+
var values = (uservalues=='html' || uservalues==undefined) ? $(this).text().split(',') : uservalues;
|
|
185
|
+
|
|
186
|
+
var width = options.width=='auto' ? values.length*options.defaultPixelsPerValue : options.width;
|
|
187
|
+
if (options.height == 'auto') {
|
|
188
|
+
if (!options.composite || !this.vcanvas) {
|
|
189
|
+
// must be a better way to get the line height
|
|
190
|
+
var tmp = document.createElement('span');
|
|
191
|
+
tmp.innerHTML = 'a';
|
|
192
|
+
$(this).html(tmp);
|
|
193
|
+
height = $(tmp).innerHeight();
|
|
194
|
+
$(tmp).remove();
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
height = options.height;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
$.fn.sparkline[options.type].call(this, values, options, width, height);
|
|
201
|
+
}
|
|
202
|
+
// jQuery 1.3.0 completely changed the meaning of :hidden :-/
|
|
203
|
+
if (($(this).html() && $(this).is(':hidden')) || ($.fn.jquery < "1.3.0" && $(this).parents().is(':hidden'))) {
|
|
204
|
+
pending.push([this, render]);
|
|
205
|
+
} else {
|
|
206
|
+
render.call(this);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
$.sparkline_display_visible = function() {
|
|
213
|
+
for (var i=pending.length-1; i>=0; i--) {
|
|
214
|
+
var el = pending[i][0];
|
|
215
|
+
if ($(el).is(':visible') && !$(el).parents().is(':hidden')) {
|
|
216
|
+
pending[i][1].call(el);
|
|
217
|
+
pending.splice(i, 1);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
$.fn.sparkline.line = function(values, options, width, height) {
|
|
223
|
+
var options = $.extend({
|
|
224
|
+
spotColor : '#f80',
|
|
225
|
+
spotRadius : 1.5,
|
|
226
|
+
minSpotColor : '#f80',
|
|
227
|
+
maxSpotColor : '#f80',
|
|
228
|
+
lineWidth: 1,
|
|
229
|
+
normalRangeMin : undefined,
|
|
230
|
+
normalRangeMax : undefined,
|
|
231
|
+
normalRangeColor : '#ccc',
|
|
232
|
+
chartRangeMin : undefined,
|
|
233
|
+
chartRangeMax : undefined,
|
|
234
|
+
chartRangeMinX : undefined,
|
|
235
|
+
chartRangeMaxX : undefined
|
|
236
|
+
}, options ? options : {});
|
|
237
|
+
|
|
238
|
+
var xvalues = [], yvalues = [], yminmax = [];
|
|
239
|
+
for (i=0; i<values.length; i++) {
|
|
240
|
+
var v = values[i];
|
|
241
|
+
var isstr = typeof(values[i])=='string';
|
|
242
|
+
var isarray = typeof(values[i])=='object' && values[i] instanceof Array;
|
|
243
|
+
var sp = isstr && values[i].split(':');
|
|
244
|
+
if (isstr && sp.length == 2) { // x:y
|
|
245
|
+
xvalues.push(Number(sp[0]));
|
|
246
|
+
yvalues.push(Number(sp[1]));
|
|
247
|
+
yminmax.push(Number(sp[1]));
|
|
248
|
+
} else if (isarray) {
|
|
249
|
+
xvalues.push(values[i][0]);
|
|
250
|
+
yvalues.push(values[i][1]);
|
|
251
|
+
yminmax.push(values[i][1]);
|
|
252
|
+
} else {
|
|
253
|
+
xvalues.push(i);
|
|
254
|
+
if (values[i]===null || values[i]=='null') {
|
|
255
|
+
yvalues.push(null);
|
|
256
|
+
} else {
|
|
257
|
+
yvalues.push(Number(values[i]));
|
|
258
|
+
yminmax.push(Number(values[i]));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (options.xvalues) {
|
|
263
|
+
xvalues = options.xvalues;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
var maxy = Math.max.apply(Math, yminmax);
|
|
267
|
+
var maxyval = maxy;
|
|
268
|
+
var miny = Math.min.apply(Math, yminmax);
|
|
269
|
+
var minyval = miny;
|
|
270
|
+
|
|
271
|
+
var maxx = Math.max.apply(Math, xvalues);
|
|
272
|
+
var maxxval = maxx;
|
|
273
|
+
var minx = Math.min.apply(Math, xvalues);
|
|
274
|
+
var minxval = minx;
|
|
275
|
+
|
|
276
|
+
if (options.normalRangeMin!=undefined) {
|
|
277
|
+
if (options.normalRangeMin<miny)
|
|
278
|
+
miny = options.normalRangeMin;
|
|
279
|
+
if (options.normalRangeMax>maxy)
|
|
280
|
+
maxy = options.normalRangeMax;
|
|
281
|
+
}
|
|
282
|
+
if (options.chartRangeMin!=undefined && (options.chartRangeClip || options.chartRangeMin<miny)) {
|
|
283
|
+
miny = options.chartRangeMin;
|
|
284
|
+
}
|
|
285
|
+
if (options.chartRangeMax!=undefined && (options.chartRangeClip || options.chartRangeMax>maxy)) {
|
|
286
|
+
maxy = options.chartRangeMax;
|
|
287
|
+
}
|
|
288
|
+
if (options.chartRangeMinX!=undefined && (options.chartRangeClipX || options.chartRangeMinX<minx)) {
|
|
289
|
+
minx = options.chartRangeMinX;
|
|
290
|
+
}
|
|
291
|
+
if (options.chartRangeMaxX!=undefined && (options.chartRangeClipX || options.chartRangeMaxX>maxx)) {
|
|
292
|
+
maxx = options.chartRangeMaxX;
|
|
293
|
+
}
|
|
294
|
+
var rangex = maxx-minx == 0 ? 1 : maxx-minx;
|
|
295
|
+
var rangey = maxy-miny == 0 ? 1 : maxy-miny;
|
|
296
|
+
var vl = yvalues.length-1;
|
|
297
|
+
|
|
298
|
+
if (vl<1) {
|
|
299
|
+
this.innerHTML = '';
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
var target = $(this).simpledraw(width, height, options.composite);
|
|
304
|
+
if (target) {
|
|
305
|
+
var canvas_width = target.pixel_width;
|
|
306
|
+
var canvas_height = target.pixel_height;
|
|
307
|
+
var canvas_top = 0;
|
|
308
|
+
var canvas_left = 0;
|
|
309
|
+
|
|
310
|
+
if (options.spotRadius && (canvas_width < (options.spotRadius*4) || canvas_height < (options.spotRadius*4))) {
|
|
311
|
+
options.spotRadius = 0;
|
|
312
|
+
}
|
|
313
|
+
if (options.spotRadius) {
|
|
314
|
+
// adjust the canvas size as required so that spots will fit
|
|
315
|
+
if (options.minSpotColor || (options.spotColor && yvalues[vl]==miny))
|
|
316
|
+
canvas_height -= Math.ceil(options.spotRadius);
|
|
317
|
+
if (options.maxSpotColor || (options.spotColor && yvalues[vl]==maxy)) {
|
|
318
|
+
canvas_height -= Math.ceil(options.spotRadius);
|
|
319
|
+
canvas_top += Math.ceil(options.spotRadius);
|
|
320
|
+
}
|
|
321
|
+
if (options.minSpotColor || options.maxSpotColor && (yvalues[0]==miny || yvalues[0]==maxy)) {
|
|
322
|
+
canvas_left += Math.ceil(options.spotRadius);
|
|
323
|
+
canvas_width -= Math.ceil(options.spotRadius);
|
|
324
|
+
}
|
|
325
|
+
if (options.spotColor || (options.minSpotColor || options.maxSpotColor && (yvalues[vl]==miny||yvalues[vl]==maxy)))
|
|
326
|
+
canvas_width -= Math.ceil(options.spotRadius);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
canvas_height--;
|
|
331
|
+
if (options.normalRangeMin!=undefined) {
|
|
332
|
+
var ytop = canvas_top+Math.round(canvas_height-(canvas_height*((options.normalRangeMax-miny)/rangey)));
|
|
333
|
+
var height = Math.round((canvas_height*(options.normalRangeMax-options.normalRangeMin))/rangey);
|
|
334
|
+
target.drawRect(canvas_left, ytop, canvas_width, height, undefined, options.normalRangeColor);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
var path = [];
|
|
338
|
+
var paths = [path];
|
|
339
|
+
for(var i=0, vlen=yvalues.length; i<vlen; i++) {
|
|
340
|
+
var x=xvalues[i], y=yvalues[i];
|
|
341
|
+
if (y===null) {
|
|
342
|
+
if (i) {
|
|
343
|
+
if (yvalues[i-1]!==null) {
|
|
344
|
+
path = [];
|
|
345
|
+
paths.push(path);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
if (y < miny) y=miny;
|
|
350
|
+
if (y > maxy) y=maxy;
|
|
351
|
+
if (!path.length) {
|
|
352
|
+
// previous value was null
|
|
353
|
+
path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+canvas_height]);
|
|
354
|
+
}
|
|
355
|
+
path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((y-miny)/rangey)))]);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
for(var i=0, plen=paths.length; i<plen; i++) {
|
|
359
|
+
path = paths[i];
|
|
360
|
+
if (!path.length)
|
|
361
|
+
continue; // last value was null
|
|
362
|
+
if (options.fillColor) {
|
|
363
|
+
path.push([path[path.length-1][0], canvas_top+canvas_height-1]);
|
|
364
|
+
target.drawShape(path, undefined, options.fillColor);
|
|
365
|
+
path.pop();
|
|
366
|
+
}
|
|
367
|
+
// if there's only a single point in this path, then we want to display it as a vertical line
|
|
368
|
+
// which means we keep path[0] as is
|
|
369
|
+
if (path.length>2) {
|
|
370
|
+
// else we want the first value
|
|
371
|
+
path[0] = [ path[0][0], path[1][1] ];
|
|
372
|
+
}
|
|
373
|
+
target.drawShape(path, options.lineColor, undefined, options.lineWidth);
|
|
374
|
+
}
|
|
375
|
+
if (options.spotRadius && options.spotColor) {
|
|
376
|
+
target.drawCircle(canvas_left+Math.round(xvalues[xvalues.length-1]*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((yvalues[vl]-miny)/rangey))), options.spotRadius, undefined, options.spotColor);
|
|
377
|
+
}
|
|
378
|
+
if (maxy!=minyval) {
|
|
379
|
+
if (options.spotRadius && options.minSpotColor) {
|
|
380
|
+
var x = xvalues[yvalues.indexOf(minyval)];
|
|
381
|
+
target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((minyval-miny)/rangey))), options.spotRadius, undefined, options.minSpotColor);
|
|
382
|
+
}
|
|
383
|
+
if (options.spotRadius && options.maxSpotColor) {
|
|
384
|
+
var x = xvalues[yvalues.indexOf(maxyval)];
|
|
385
|
+
target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((maxyval-miny)/rangey))), options.spotRadius, undefined, options.maxSpotColor);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
} else {
|
|
389
|
+
// Remove the tag contents if sparklines aren't supported
|
|
390
|
+
this.innerHTML = '';
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
$.fn.sparkline.bar = function(values, options, width, height) {
|
|
395
|
+
var options = $.extend({
|
|
396
|
+
type : 'bar',
|
|
397
|
+
barColor : '#00f',
|
|
398
|
+
negBarColor : '#f44',
|
|
399
|
+
zeroColor: undefined,
|
|
400
|
+
nullColor: undefined,
|
|
401
|
+
zeroAxis : undefined,
|
|
402
|
+
barWidth : 4,
|
|
403
|
+
barSpacing : 1,
|
|
404
|
+
chartRangeMax: undefined,
|
|
405
|
+
chartRangeMin: undefined,
|
|
406
|
+
chartRangeClip: false,
|
|
407
|
+
colorMap : undefined
|
|
408
|
+
}, options ? options : {});
|
|
409
|
+
|
|
410
|
+
var width = (values.length * options.barWidth) + ((values.length-1) * options.barSpacing);
|
|
411
|
+
var num_values = [];
|
|
412
|
+
for(var i=0, vlen=values.length; i<vlen; i++) {
|
|
413
|
+
if (values[i]=='null' || values[i]===null) {
|
|
414
|
+
values[i] = null;
|
|
415
|
+
} else {
|
|
416
|
+
values[i] = Number(values[i]);
|
|
417
|
+
num_values.push(Number(values[i]));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
var max = Math.max.apply(Math, num_values);
|
|
421
|
+
var min = Math.min.apply(Math, num_values);
|
|
422
|
+
if (options.chartRangeMin!=undefined && (options.chartRangeClip || options.chartRangeMin<min)) {
|
|
423
|
+
min = options.chartRangeMin;
|
|
424
|
+
}
|
|
425
|
+
if (options.chartRangeMax!=undefined && (options.chartRangeClip || options.chartRangeMax>max)) {
|
|
426
|
+
max = options.chartRangeMax;
|
|
427
|
+
}
|
|
428
|
+
if (options.zeroAxis == undefined) options.zeroAxis = min<0;
|
|
429
|
+
var range = max-min == 0 ? 1 : max-min;
|
|
430
|
+
|
|
431
|
+
if ($.isArray(options.colorMap)) {
|
|
432
|
+
var colorMapByIndex = options.colorMap;
|
|
433
|
+
var colorMapByValue = null;
|
|
434
|
+
} else {
|
|
435
|
+
var colorMapByIndex = null;
|
|
436
|
+
var colorMapByValue = options.colorMap;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
var target = $(this).simpledraw(width, height, options.composite);
|
|
440
|
+
if (target) {
|
|
441
|
+
var canvas_width = target.pixel_width;
|
|
442
|
+
var canvas_height = target.pixel_height;
|
|
443
|
+
var yzero = min<0 && options.zeroAxis ? canvas_height-Math.round(canvas_height * (Math.abs(min)/range))-1 : canvas_height-1;
|
|
444
|
+
|
|
445
|
+
for(var i=0, vlen=values.length; i<vlen; i++) {
|
|
446
|
+
var x = i*(options.barWidth+options.barSpacing);
|
|
447
|
+
var val = values[i];
|
|
448
|
+
if (val===null) {
|
|
449
|
+
if (options.nullColor) {
|
|
450
|
+
color = options.nullColor;
|
|
451
|
+
val = (options.zeroAxis && min<0) ? 0 : min;
|
|
452
|
+
var height = 1;
|
|
453
|
+
var y = (options.zeroAxis && min<0) ? yzero : canvas_height - height;
|
|
454
|
+
} else {
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
} else {
|
|
458
|
+
if (val < min) val=min;
|
|
459
|
+
if (val > max) val=max;
|
|
460
|
+
var color = (val < 0) ? options.negBarColor : options.barColor;
|
|
461
|
+
if (options.zeroAxis && min<0) {
|
|
462
|
+
var height = Math.round(canvas_height*((Math.abs(val)/range)))+1;
|
|
463
|
+
var y = (val < 0) ? yzero : yzero-height;
|
|
464
|
+
} else {
|
|
465
|
+
var height = Math.round(canvas_height*((val-min)/range))+1;
|
|
466
|
+
var y = canvas_height-height;
|
|
467
|
+
}
|
|
468
|
+
if (val==0 && options.zeroColor!=undefined) {
|
|
469
|
+
color = options.zeroColor;
|
|
470
|
+
}
|
|
471
|
+
if (colorMapByValue && colorMapByValue[val]) {
|
|
472
|
+
color = colorMapByValue[val];
|
|
473
|
+
} else if (colorMapByIndex && colorMapByIndex.length>i) {
|
|
474
|
+
color = colorMapByIndex[i];
|
|
475
|
+
}
|
|
476
|
+
if (color===null) {
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
target.drawRect(x, y, options.barWidth-1, height-1, color, color);
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
// Remove the tag contents if sparklines aren't supported
|
|
484
|
+
this.innerHTML = '';
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
$.fn.sparkline.tristate = function(values, options, width, height) {
|
|
489
|
+
values = $.map(values, Number);
|
|
490
|
+
var options = $.extend({
|
|
491
|
+
barWidth : 4,
|
|
492
|
+
barSpacing : 1,
|
|
493
|
+
posBarColor: '#6f6',
|
|
494
|
+
negBarColor : '#f44',
|
|
495
|
+
zeroBarColor : '#999',
|
|
496
|
+
colorMap : {}
|
|
497
|
+
}, options);
|
|
498
|
+
|
|
499
|
+
var width = (values.length * options.barWidth) + ((values.length-1) * options.barSpacing);
|
|
500
|
+
|
|
501
|
+
if ($.isArray(options.colorMap)) {
|
|
502
|
+
var colorMapByIndex = options.colorMap;
|
|
503
|
+
var colorMapByValue = null;
|
|
504
|
+
} else {
|
|
505
|
+
var colorMapByIndex = null;
|
|
506
|
+
var colorMapByValue = options.colorMap;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
var target = $(this).simpledraw(width, height, options.composite);
|
|
510
|
+
if (target) {
|
|
511
|
+
var canvas_width = target.pixel_width;
|
|
512
|
+
var canvas_height = target.pixel_height;
|
|
513
|
+
var half_height = Math.round(canvas_height/2);
|
|
514
|
+
|
|
515
|
+
for(var i=0, vlen=values.length; i<vlen; i++) {
|
|
516
|
+
var x = i*(options.barWidth+options.barSpacing);
|
|
517
|
+
if (values[i] < 0) {
|
|
518
|
+
var y = half_height;
|
|
519
|
+
var height = half_height-1;
|
|
520
|
+
var color = options.negBarColor;
|
|
521
|
+
} else if (values[i] > 0) {
|
|
522
|
+
var y = 0;
|
|
523
|
+
var height = half_height-1;
|
|
524
|
+
var color = options.posBarColor;
|
|
525
|
+
} else {
|
|
526
|
+
var y = half_height-1;
|
|
527
|
+
var height = 2;
|
|
528
|
+
var color = options.zeroBarColor;
|
|
529
|
+
}
|
|
530
|
+
if (colorMapByValue && colorMapByValue[values[i]]) {
|
|
531
|
+
color = colorMapByValue[values[i]];
|
|
532
|
+
} else if (colorMapByIndex && colorMapByIndex.length>i) {
|
|
533
|
+
color = colorMapByIndex[i];
|
|
534
|
+
}
|
|
535
|
+
if (color===null) {
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
target.drawRect(x, y, options.barWidth-1, height-1, color, color);
|
|
539
|
+
}
|
|
540
|
+
} else {
|
|
541
|
+
// Remove the tag contents if sparklines aren't supported
|
|
542
|
+
this.innerHTML = '';
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
$.fn.sparkline.discrete = function(values, options, width, height) {
|
|
547
|
+
values = $.map(values, Number);
|
|
548
|
+
var options = $.extend({
|
|
549
|
+
lineHeight: 'auto',
|
|
550
|
+
thresholdColor: undefined,
|
|
551
|
+
thresholdValue : 0,
|
|
552
|
+
chartRangeMax: undefined,
|
|
553
|
+
chartRangeMin: undefined,
|
|
554
|
+
chartRangeClip: false
|
|
555
|
+
}, options);
|
|
556
|
+
|
|
557
|
+
width = options.width=='auto' ? values.length*2 : width;
|
|
558
|
+
var interval = Math.floor(width / values.length);
|
|
559
|
+
|
|
560
|
+
var target = $(this).simpledraw(width, height, options.composite);
|
|
561
|
+
if (target) {
|
|
562
|
+
var canvas_width = target.pixel_width;
|
|
563
|
+
var canvas_height = target.pixel_height;
|
|
564
|
+
var line_height = options.lineHeight == 'auto' ? Math.round(canvas_height * 0.3) : options.lineHeight;
|
|
565
|
+
var pheight = canvas_height - line_height;
|
|
566
|
+
var min = Math.min.apply(Math, values);
|
|
567
|
+
var max = Math.max.apply(Math, values);
|
|
568
|
+
if (options.chartRangeMin!=undefined && (options.chartRangeClip || options.chartRangeMin<min)) {
|
|
569
|
+
min = options.chartRangeMin;
|
|
570
|
+
}
|
|
571
|
+
if (options.chartRangeMax!=undefined && (options.chartRangeClip || options.chartRangeMax>max)) {
|
|
572
|
+
max = options.chartRangeMax;
|
|
573
|
+
}
|
|
574
|
+
var range = max-min;
|
|
575
|
+
|
|
576
|
+
for(var i=0, vlen=values.length; i<vlen; i++) {
|
|
577
|
+
var val = values[i];
|
|
578
|
+
if (val < min) val=min;
|
|
579
|
+
if (val > max) val=max;
|
|
580
|
+
var x = (i*interval);
|
|
581
|
+
var ytop = Math.round(pheight-pheight*((val-min)/range));
|
|
582
|
+
target.drawLine(x, ytop, x, ytop+line_height, (options.thresholdColor && val < options.thresholdValue) ? options.thresholdColor : options.lineColor);
|
|
583
|
+
}
|
|
584
|
+
} else {
|
|
585
|
+
// Remove the tag contents if sparklines aren't supported
|
|
586
|
+
this.innerHTML = '';
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
$.fn.sparkline.bullet = function(values, options, width, height) {
|
|
592
|
+
values = $.map(values, Number);
|
|
593
|
+
// target, performance, range1, range2, range3
|
|
594
|
+
var options = $.extend({
|
|
595
|
+
targetColor : 'red',
|
|
596
|
+
targetWidth : 3, // width of the target bar in pixels
|
|
597
|
+
performanceColor : 'blue',
|
|
598
|
+
rangeColors : ['#D3DAFE', '#A8B6FF', '#7F94FF' ],
|
|
599
|
+
base : undefined // set this to a number to change the base start number
|
|
600
|
+
}, options);
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
width = options.width=='auto' ? '4.0em' : width;
|
|
604
|
+
|
|
605
|
+
var target = $(this).simpledraw(width, height, options.composite);
|
|
606
|
+
if (target && values.length>1) {
|
|
607
|
+
var canvas_width = target.pixel_width-Math.ceil(options.targetWidth/2);
|
|
608
|
+
var canvas_height = target.pixel_height;
|
|
609
|
+
|
|
610
|
+
var min = Math.min.apply(Math, values);
|
|
611
|
+
var max = Math.max.apply(Math, values);
|
|
612
|
+
if (options.base == undefined) {
|
|
613
|
+
var min = min < 0 ? min : 0;
|
|
614
|
+
} else {
|
|
615
|
+
min = options.base;
|
|
616
|
+
}
|
|
617
|
+
var range = max-min;
|
|
618
|
+
|
|
619
|
+
// draw range values
|
|
620
|
+
for(i=2, vlen=values.length; i<vlen; i++) {
|
|
621
|
+
var rangeval = parseInt(values[i]);
|
|
622
|
+
var rangewidth = Math.round(canvas_width*((rangeval-min)/range));
|
|
623
|
+
target.drawRect(0, 0, rangewidth-1, canvas_height-1, options.rangeColors[i-2], options.rangeColors[i-2]);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// draw the performance bar
|
|
627
|
+
var perfval = parseInt(values[1]);
|
|
628
|
+
var perfwidth = Math.round(canvas_width*((perfval-min)/range));
|
|
629
|
+
target.drawRect(0, Math.round(canvas_height*0.3), perfwidth-1, Math.round(canvas_height*0.4)-1, options.performanceColor, options.performanceColor);
|
|
630
|
+
|
|
631
|
+
// draw the target linej
|
|
632
|
+
var targetval = parseInt(values[0]);
|
|
633
|
+
var x = Math.round(canvas_width*((targetval-min)/range)-(options.targetWidth/2));
|
|
634
|
+
var targettop = Math.round(canvas_height*0.10);
|
|
635
|
+
var targetheight = canvas_height-(targettop*2);
|
|
636
|
+
target.drawRect(x, targettop, options.targetWidth-1, targetheight-1, options.targetColor, options.targetColor);
|
|
637
|
+
} else {
|
|
638
|
+
// Remove the tag contents if sparklines aren't supported
|
|
639
|
+
this.innerHTML = '';
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
$.fn.sparkline.pie = function(values, options, width, height) {
|
|
644
|
+
values = $.map(values, Number);
|
|
645
|
+
var options = $.extend({
|
|
646
|
+
sliceColors : ['#f00', '#0f0', '#00f']
|
|
647
|
+
}, options);
|
|
648
|
+
|
|
649
|
+
width = options.width=='auto' ? height : width;
|
|
650
|
+
|
|
651
|
+
var target = $(this).simpledraw(width, height, options.composite);
|
|
652
|
+
if (target && values.length>1) {
|
|
653
|
+
var canvas_width = target.pixel_width;
|
|
654
|
+
var canvas_height = target.pixel_height;
|
|
655
|
+
|
|
656
|
+
var radius = Math.floor(Math.min(canvas_width, canvas_height)/2);
|
|
657
|
+
var total = 0;
|
|
658
|
+
for(var i=0, vlen=values.length; i<vlen; i++)
|
|
659
|
+
total += values[i];
|
|
660
|
+
var next = 0;
|
|
661
|
+
if (options.offset) {
|
|
662
|
+
next += (2*Math.PI)*(options.offset/360);
|
|
663
|
+
}
|
|
664
|
+
var circle = 2*Math.PI;
|
|
665
|
+
for(var i=0, vlen=values.length; i<vlen; i++) {
|
|
666
|
+
var start = next;
|
|
667
|
+
var end = next;
|
|
668
|
+
if (total > 0) { // avoid divide by zero
|
|
669
|
+
end = next + (circle*(values[i]/total));
|
|
670
|
+
}
|
|
671
|
+
target.drawPieSlice(radius, radius, radius, start, end, undefined, options.sliceColors[i % options.sliceColors.length]);
|
|
672
|
+
next = end;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
function quartile(values, q) {
|
|
678
|
+
if (q==2) {
|
|
679
|
+
var vl2 = Math.floor(values.length/2);
|
|
680
|
+
return values.length % 2 ? values[vl2] : (values[vl2]+values[vl2+1])/2;
|
|
681
|
+
} else {
|
|
682
|
+
var vl4 = Math.floor(values.length/4);
|
|
683
|
+
return values.length % 2 ? (values[vl4*q]+values[vl4*q+1])/2 : values[vl4*q];
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
$.fn.sparkline.box = function(values, options, width, height) {
|
|
688
|
+
values = $.map(values, Number);
|
|
689
|
+
var options = $.extend({
|
|
690
|
+
raw: false,
|
|
691
|
+
boxLineColor: 'black',
|
|
692
|
+
boxFillColor: '#cdf',
|
|
693
|
+
whiskerColor: 'black',
|
|
694
|
+
outlierLineColor: '#333',
|
|
695
|
+
outlierFillColor: 'white',
|
|
696
|
+
medianColor: 'red',
|
|
697
|
+
showOutliers: true,
|
|
698
|
+
outlierIQR: 1.5,
|
|
699
|
+
spotRadius: 1.5,
|
|
700
|
+
target: undefined,
|
|
701
|
+
targetColor: '#4a2',
|
|
702
|
+
chartRangeMax: undefined,
|
|
703
|
+
chartRangeMin: undefined
|
|
704
|
+
}, options);
|
|
705
|
+
|
|
706
|
+
width = options.width=='auto' ? '4.0em' : width;
|
|
707
|
+
|
|
708
|
+
minvalue = options.chartRangeMin==undefined ? Math.min.apply(Math, values) : options.chartRangeMin;
|
|
709
|
+
maxvalue = options.chartRangeMax==undefined ? Math.max.apply(Math, values) : options.chartRangeMax;
|
|
710
|
+
var target = $(this).simpledraw(width, height, options.composite);
|
|
711
|
+
if (target && values.length>1) {
|
|
712
|
+
var canvas_width = target.pixel_width;
|
|
713
|
+
var canvas_height = target.pixel_height;
|
|
714
|
+
if (options.raw) {
|
|
715
|
+
if (options.showOutliers && values.length>5) {
|
|
716
|
+
var loutlier=values[0], lwhisker=values[1], q1=values[2], q2=values[3], q3=values[4], rwhisker=values[5], routlier=values[6];
|
|
717
|
+
} else {
|
|
718
|
+
var lwhisker=values[0], q1=values[1], q2=values[2], q3=values[3], rwhisker=values[4];
|
|
719
|
+
}
|
|
720
|
+
} else {
|
|
721
|
+
values.sort(function(a, b) { return a-b; });
|
|
722
|
+
var q1 = quartile(values, 1);
|
|
723
|
+
var q2 = quartile(values, 2);
|
|
724
|
+
var q3 = quartile(values, 3);
|
|
725
|
+
var iqr = q3-q1;
|
|
726
|
+
if (options.showOutliers) {
|
|
727
|
+
var lwhisker=undefined, rwhisker=undefined;
|
|
728
|
+
for(var i=0, vlen=values.length; i<vlen; i++) {
|
|
729
|
+
if (lwhisker==undefined && values[i] > q1-(iqr*options.outlierIQR))
|
|
730
|
+
lwhisker = values[i];
|
|
731
|
+
if (values[i] < q3+(iqr*options.outlierIQR))
|
|
732
|
+
rwhisker = values[i];
|
|
733
|
+
}
|
|
734
|
+
var loutlier = values[0];
|
|
735
|
+
var routlier = values[values.length-1];
|
|
736
|
+
} else {
|
|
737
|
+
var lwhisker = values[0];
|
|
738
|
+
var rwhisker = values[values.length-1];
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
var unitsize = canvas_width / (maxvalue-minvalue+1);
|
|
743
|
+
var canvas_left = 0;
|
|
744
|
+
if (options.showOutliers) {
|
|
745
|
+
canvas_left = Math.ceil(options.spotRadius);
|
|
746
|
+
canvas_width -= 2*Math.ceil(options.spotRadius);
|
|
747
|
+
var unitsize = canvas_width / (maxvalue-minvalue+1);
|
|
748
|
+
if (loutlier < lwhisker)
|
|
749
|
+
target.drawCircle((loutlier-minvalue)*unitsize+canvas_left, canvas_height/2, options.spotRadius, options.outlierLineColor, options.outlierFillColor);
|
|
750
|
+
if (routlier > rwhisker)
|
|
751
|
+
target.drawCircle((routlier-minvalue)*unitsize+canvas_left, canvas_height/2, options.spotRadius, options.outlierLineColor, options.outlierFillColor);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// box
|
|
755
|
+
target.drawRect(
|
|
756
|
+
Math.round((q1-minvalue)*unitsize+canvas_left),
|
|
757
|
+
Math.round(canvas_height*0.1),
|
|
758
|
+
Math.round((q3-q1)*unitsize),
|
|
759
|
+
Math.round(canvas_height*0.8),
|
|
760
|
+
options.boxLineColor,
|
|
761
|
+
options.boxFillColor);
|
|
762
|
+
// left whisker
|
|
763
|
+
target.drawLine(
|
|
764
|
+
Math.round((lwhisker-minvalue)*unitsize+canvas_left),
|
|
765
|
+
Math.round(canvas_height/2),
|
|
766
|
+
Math.round((q1-minvalue)*unitsize+canvas_left),
|
|
767
|
+
Math.round(canvas_height/2),
|
|
768
|
+
options.lineColor);
|
|
769
|
+
target.drawLine(
|
|
770
|
+
Math.round((lwhisker-minvalue)*unitsize+canvas_left),
|
|
771
|
+
Math.round(canvas_height/4),
|
|
772
|
+
Math.round((lwhisker-minvalue)*unitsize+canvas_left),
|
|
773
|
+
Math.round(canvas_height-canvas_height/4),
|
|
774
|
+
options.whiskerColor);
|
|
775
|
+
// right whisker
|
|
776
|
+
target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),
|
|
777
|
+
Math.round(canvas_height/2),
|
|
778
|
+
Math.round((q3-minvalue)*unitsize+canvas_left),
|
|
779
|
+
Math.round(canvas_height/2),
|
|
780
|
+
options.lineColor);
|
|
781
|
+
target.drawLine(
|
|
782
|
+
Math.round((rwhisker-minvalue)*unitsize+canvas_left),
|
|
783
|
+
Math.round(canvas_height/4),
|
|
784
|
+
Math.round((rwhisker-minvalue)*unitsize+canvas_left),
|
|
785
|
+
Math.round(canvas_height-canvas_height/4),
|
|
786
|
+
options.whiskerColor);
|
|
787
|
+
// median line
|
|
788
|
+
target.drawLine(
|
|
789
|
+
Math.round((q2-minvalue)*unitsize+canvas_left),
|
|
790
|
+
Math.round(canvas_height*0.1),
|
|
791
|
+
Math.round((q2-minvalue)*unitsize+canvas_left),
|
|
792
|
+
Math.round(canvas_height*0.9),
|
|
793
|
+
options.medianColor);
|
|
794
|
+
if (options.target) {
|
|
795
|
+
var size = Math.ceil(options.spotRadius);
|
|
796
|
+
target.drawLine(
|
|
797
|
+
Math.round((options.target-minvalue)*unitsize+canvas_left),
|
|
798
|
+
Math.round((canvas_height/2)-size),
|
|
799
|
+
Math.round((options.target-minvalue)*unitsize+canvas_left),
|
|
800
|
+
Math.round((canvas_height/2)+size),
|
|
801
|
+
options.targetColor);
|
|
802
|
+
target.drawLine(
|
|
803
|
+
Math.round((options.target-minvalue)*unitsize+canvas_left-size),
|
|
804
|
+
Math.round(canvas_height/2),
|
|
805
|
+
Math.round((options.target-minvalue)*unitsize+canvas_left+size),
|
|
806
|
+
Math.round(canvas_height/2),
|
|
807
|
+
options.targetColor);
|
|
808
|
+
}
|
|
809
|
+
} else {
|
|
810
|
+
// Remove the tag contents if sparklines aren't supported
|
|
811
|
+
this.innerHTML = '';
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
// IE doesn't provide an indexOf method for arrays :-(
|
|
817
|
+
if (!Array.prototype.indexOf) {
|
|
818
|
+
Array.prototype.indexOf = function(entry) {
|
|
819
|
+
for(var i=0, vlen=this.length; i<vlen; i++) {
|
|
820
|
+
if (this[i] == entry)
|
|
821
|
+
return i;
|
|
822
|
+
}
|
|
823
|
+
return -1;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
// Setup a very simple "virtual canvas" to make drawing the few shapes we need easier
|
|
828
|
+
// This is accessible as $(foo).simpledraw()
|
|
829
|
+
|
|
830
|
+
if ($.browser.msie && !document.namespaces['v']) {
|
|
831
|
+
document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML');
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
if ($.browser.hasCanvas == undefined) {
|
|
835
|
+
var t = document.createElement('canvas');
|
|
836
|
+
$.browser.hasCanvas = t.getContext!=undefined;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
var vcanvas_base = function(width, height, target) {
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
vcanvas_base.prototype = {
|
|
843
|
+
init : function(width, height, target) {
|
|
844
|
+
this.width = width;
|
|
845
|
+
this.height = height;
|
|
846
|
+
this.target = target;
|
|
847
|
+
if (target[0]) target=target[0];
|
|
848
|
+
target.vcanvas = this;
|
|
849
|
+
},
|
|
850
|
+
|
|
851
|
+
drawShape : function(path, lineColor, fillColor, lineWidth) {
|
|
852
|
+
alert('drawShape not implemented');
|
|
853
|
+
},
|
|
854
|
+
|
|
855
|
+
drawLine : function(x1, y1, x2, y2, lineColor, lineWidth) {
|
|
856
|
+
return this.drawShape([ [x1,y1], [x2,y2] ], lineColor, lineWidth);
|
|
857
|
+
},
|
|
858
|
+
|
|
859
|
+
drawCircle : function(x, y, radius, lineColor, fillColor) {
|
|
860
|
+
alert('drawCircle not implemented');
|
|
861
|
+
},
|
|
862
|
+
|
|
863
|
+
drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
|
|
864
|
+
alert('drawPieSlice not implemented');
|
|
865
|
+
},
|
|
866
|
+
|
|
867
|
+
drawRect : function(x, y, width, height, lineColor, fillColor) {
|
|
868
|
+
alert('drawRect not implemented');
|
|
869
|
+
},
|
|
870
|
+
|
|
871
|
+
getElement : function() {
|
|
872
|
+
return this.canvas;
|
|
873
|
+
},
|
|
874
|
+
|
|
875
|
+
_insert : function(el, target) {
|
|
876
|
+
$(target).html(el);
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
var vcanvas_canvas = function(width, height, target) {
|
|
881
|
+
return this.init(width, height, target);
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
vcanvas_canvas.prototype = $.extend(new vcanvas_base, {
|
|
885
|
+
_super : vcanvas_base.prototype,
|
|
886
|
+
|
|
887
|
+
init : function(width, height, target) {
|
|
888
|
+
this._super.init(width, height, target);
|
|
889
|
+
this.canvas = document.createElement('canvas');
|
|
890
|
+
if (target[0]) target=target[0];
|
|
891
|
+
target.vcanvas = this;
|
|
892
|
+
$(this.canvas).css({ display:'inline-block', width:width, height:height, verticalAlign:'top' });
|
|
893
|
+
this._insert(this.canvas, target);
|
|
894
|
+
this.pixel_height = $(this.canvas).height();
|
|
895
|
+
this.pixel_width = $(this.canvas).width();
|
|
896
|
+
this.canvas.width = this.pixel_width;
|
|
897
|
+
this.canvas.height = this.pixel_height;
|
|
898
|
+
$(this.canvas).css({width: this.pixel_width, height: this.pixel_height});
|
|
899
|
+
},
|
|
900
|
+
|
|
901
|
+
_getContext : function(lineColor, fillColor, lineWidth) {
|
|
902
|
+
var context = this.canvas.getContext('2d');
|
|
903
|
+
if (lineColor != undefined)
|
|
904
|
+
context.strokeStyle = lineColor;
|
|
905
|
+
context.lineWidth = lineWidth==undefined ? 1 : lineWidth;
|
|
906
|
+
if (fillColor != undefined)
|
|
907
|
+
context.fillStyle = fillColor;
|
|
908
|
+
return context;
|
|
909
|
+
},
|
|
910
|
+
|
|
911
|
+
drawShape : function(path, lineColor, fillColor, lineWidth) {
|
|
912
|
+
var context = this._getContext(lineColor, fillColor, lineWidth);
|
|
913
|
+
context.beginPath();
|
|
914
|
+
context.moveTo(path[0][0]+0.5, path[0][1]+0.5);
|
|
915
|
+
for(var i=1, plen=path.length; i<plen; i++) {
|
|
916
|
+
context.lineTo(path[i][0]+0.5, path[i][1]+0.5); // the 0.5 offset gives us crisp pixel-width lines
|
|
917
|
+
}
|
|
918
|
+
if (lineColor != undefined) {
|
|
919
|
+
context.stroke();
|
|
920
|
+
}
|
|
921
|
+
if (fillColor != undefined) {
|
|
922
|
+
context.fill();
|
|
923
|
+
}
|
|
924
|
+
},
|
|
925
|
+
|
|
926
|
+
drawCircle : function(x, y, radius, lineColor, fillColor) {
|
|
927
|
+
var context = this._getContext(lineColor, fillColor);
|
|
928
|
+
context.beginPath();
|
|
929
|
+
context.arc(x, y, radius, 0, 2*Math.PI, false);
|
|
930
|
+
if (lineColor != undefined) {
|
|
931
|
+
context.stroke();
|
|
932
|
+
}
|
|
933
|
+
if (fillColor != undefined) {
|
|
934
|
+
context.fill();
|
|
935
|
+
}
|
|
936
|
+
},
|
|
937
|
+
|
|
938
|
+
drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
|
|
939
|
+
var context = this._getContext(lineColor, fillColor);
|
|
940
|
+
context.beginPath();
|
|
941
|
+
context.moveTo(x, y);
|
|
942
|
+
context.arc(x, y, radius, startAngle, endAngle, false);
|
|
943
|
+
context.lineTo(x, y);
|
|
944
|
+
context.closePath();
|
|
945
|
+
if (lineColor != undefined) {
|
|
946
|
+
context.stroke();
|
|
947
|
+
}
|
|
948
|
+
if (fillColor) {
|
|
949
|
+
context.fill();
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
|
|
953
|
+
drawRect : function(x, y, width, height, lineColor, fillColor) {
|
|
954
|
+
return this.drawShape([ [x,y], [x+width, y], [x+width, y+height], [x, y+height], [x, y] ], lineColor, fillColor);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
var vcanvas_vml = function(width, height, target) {
|
|
960
|
+
return this.init(width, height, target);
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
vcanvas_vml.prototype = $.extend(new vcanvas_base, {
|
|
964
|
+
_super : vcanvas_base.prototype,
|
|
965
|
+
|
|
966
|
+
init : function(width, height, target) {
|
|
967
|
+
this._super.init(width, height, target);
|
|
968
|
+
if (target[0]) target=target[0];
|
|
969
|
+
target.vcanvas = this;
|
|
970
|
+
this.canvas = document.createElement('span');
|
|
971
|
+
$(this.canvas).css({ display:'inline-block', position: 'relative', overflow:'hidden', width:width, height:height, margin:'0px', padding:'0px', verticalAlign: 'top'});
|
|
972
|
+
this._insert(this.canvas, target);
|
|
973
|
+
this.pixel_height = $(this.canvas).height();
|
|
974
|
+
this.pixel_width = $(this.canvas).width();
|
|
975
|
+
this.canvas.width = this.pixel_width;
|
|
976
|
+
this.canvas.height = this.pixel_height;;
|
|
977
|
+
var groupel = '<v:group coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'"'
|
|
978
|
+
+' style="position:absolute;top:0;left:0;width:'+this.pixel_width+'px;height='+this.pixel_height+'px;"></v:group>';
|
|
979
|
+
this.canvas.insertAdjacentHTML('beforeEnd', groupel);
|
|
980
|
+
this.group = $(this.canvas).children()[0];
|
|
981
|
+
},
|
|
982
|
+
|
|
983
|
+
drawShape : function(path, lineColor, fillColor, lineWidth) {
|
|
984
|
+
var vpath = [];
|
|
985
|
+
for(var i=0, plen=path.length; i<plen; i++) {
|
|
986
|
+
vpath[i] = ''+(path[i][0])+','+(path[i][1]);
|
|
987
|
+
}
|
|
988
|
+
var initial = vpath.splice(0,1);
|
|
989
|
+
lineWidth = lineWidth == undefined ? 1 : lineWidth;
|
|
990
|
+
var stroke = lineColor == undefined ? ' stroked="false" ' : ' strokeWeight="'+lineWidth+'" strokeColor="'+lineColor+'" ';
|
|
991
|
+
var fill = fillColor == undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
|
|
992
|
+
var closed = vpath[0] == vpath[vpath.length-1] ? 'x ' : '';
|
|
993
|
+
var vel = '<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" '
|
|
994
|
+
+ stroke
|
|
995
|
+
+ fill
|
|
996
|
+
+' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" '
|
|
997
|
+
+' path="m '+initial+' l '+vpath.join(', ')+' '+closed+'e">'
|
|
998
|
+
+' </v:shape>';
|
|
999
|
+
this.group.insertAdjacentHTML('beforeEnd', vel);
|
|
1000
|
+
},
|
|
1001
|
+
|
|
1002
|
+
drawCircle : function(x, y, radius, lineColor, fillColor) {
|
|
1003
|
+
x -= radius+1;
|
|
1004
|
+
y -= radius+1;
|
|
1005
|
+
var stroke = lineColor == undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="'+lineColor+'" ';
|
|
1006
|
+
var fill = fillColor == undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
|
|
1007
|
+
var vel = '<v:oval '
|
|
1008
|
+
+ stroke
|
|
1009
|
+
+ fill
|
|
1010
|
+
+' style="position:absolute;top:'+y+'px; left:'+x+'px; width:'+(radius*2)+'px; height:'+(radius*2)+'px"></v:oval>';
|
|
1011
|
+
this.group.insertAdjacentHTML('beforeEnd', vel);
|
|
1012
|
+
|
|
1013
|
+
},
|
|
1014
|
+
|
|
1015
|
+
drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
|
|
1016
|
+
if (startAngle == endAngle) {
|
|
1017
|
+
return; // VML seems to have problem when start angle equals end angle.
|
|
1018
|
+
}
|
|
1019
|
+
if ((endAngle - startAngle) == (2*Math.PI)) {
|
|
1020
|
+
startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0
|
|
1021
|
+
endAngle = (2*Math.PI);
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
var startx = x + Math.round(Math.cos(startAngle) * radius);
|
|
1025
|
+
var starty = y + Math.round(Math.sin(startAngle) * radius);
|
|
1026
|
+
var endx = x + Math.round(Math.cos(endAngle) * radius);
|
|
1027
|
+
var endy = y + Math.round(Math.sin(endAngle) * radius);
|
|
1028
|
+
|
|
1029
|
+
// Prevent very small slices from being mistaken as a whole pie
|
|
1030
|
+
if (startx==endx && starty==endy && (endAngle-startAngle) < Math.PI)
|
|
1031
|
+
return;
|
|
1032
|
+
|
|
1033
|
+
var vpath = [ x-radius, y-radius, x+radius, y+radius, startx, starty, endx, endy ];
|
|
1034
|
+
var stroke = lineColor == undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="'+lineColor+'" ';
|
|
1035
|
+
var fill = fillColor == undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
|
|
1036
|
+
var vel = '<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" '
|
|
1037
|
+
+ stroke
|
|
1038
|
+
+ fill
|
|
1039
|
+
+' style="position:absolute;left:0px;top:0px;height:'+this.pixel_height+'px;width:'+this.pixel_width+'px;padding:0px;margin:0px;" '
|
|
1040
|
+
+' path="m '+x+','+y+' wa '+vpath.join(', ')+' x e">'
|
|
1041
|
+
+' </v:shape>';
|
|
1042
|
+
this.group.insertAdjacentHTML('beforeEnd', vel);
|
|
1043
|
+
},
|
|
1044
|
+
|
|
1045
|
+
drawRect : function(x, y, width, height, lineColor, fillColor) {
|
|
1046
|
+
return this.drawShape( [ [x, y], [x, y+height], [x+width, y+height], [x+width, y], [x, y] ], lineColor, fillColor);
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
})(jQuery);
|