compass-jquery-plugin 0.3.2.3 → 0.3.2.4
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.md +54 -37
- data/VERSION.yml +1 -1
- data/lib/handle_attributes.rb +4 -4
- data/lib/handle_js_files.rb +5 -5
- data/lib/jqtouch_theme.rb +2 -2
- data/lib/jquery/dynatree.rb +2 -2
- data/lib/jquery/emulators.rb +1 -1
- data/lib/jquery/flash_messages.rb +6 -6
- data/lib/jquery/graphics.rb +5 -0
- data/lib/jquery/gridify/assertions.rb +1 -1
- data/lib/jquery/gridify/grid.rb +76 -59
- data/lib/jquery/gridify/grid_column.rb +73 -67
- data/lib/jquery/gridify/grid_finder.rb +79 -79
- data/lib/jquery/gridify/grid_options.rb +154 -149
- data/lib/jquery/gridify/grid_view.rb +143 -143
- data/lib/jquery/gridify.rb +25 -25
- data/lib/jquery/ical/calendar.rb +2 -2
- data/lib/jquery/ical/event.rb +48 -44
- data/lib/jquery/ical/helpers/ui_event_helper.rb +3 -3
- data/lib/jquery/jqgrid/jqgrid.rb +58 -58
- data/lib/jquery/jqgrid.rb +1 -1
- data/lib/jquery/jqtouch.rb +1 -1
- data/lib/jquery/jquery.rb +117 -117
- data/lib/jquery/jquery_auto_complete.rb +9 -9
- data/lib/jquery/jquery_json_response.rb +12 -12
- data/lib/jquery/jquery_selector_assertions.rb +55 -53
- data/lib/jquery/jstree.rb +2 -2
- data/lib/jquery/mobile.rb +1 -1
- data/lib/jquery/ribbon.rb +2 -2
- data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +5 -5
- data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +5 -5
- data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +1 -1
- data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +39 -39
- data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +74 -74
- data/lib/jquery/secret_sauce/model/find_for_grid.rb +21 -21
- data/lib/jquery/secret_sauce.rb +1 -1
- data/lib/jquery/tools.rb +1 -1
- data/lib/jquery_mobile_theme.rb +2 -2
- data/lib/jquery_ui_theme.rb +12 -12
- data/templates/dynatree/config/initializers/dynatree.rb +3 -3
- data/templates/dynatree/jquery/dynatree/aero.scss +16 -16
- data/templates/dynatree/jquery/dynatree/aqua.scss +16 -16
- data/templates/dynatree/jquery/dynatree/crystal.scss +16 -16
- data/templates/dynatree/jquery/dynatree/xp.scss +17 -17
- data/templates/dynatree/jquery.dynatree.js +2926 -2912
- data/templates/emulators/config/initializers/emulators.rb +6 -6
- data/templates/graphics/config/initializers/graphics.rb +5 -0
- data/templates/graphics/jquery/ganttView.scss +89 -0
- data/templates/graphics/jquery.ganttView.js +1669 -0
- data/templates/graphics/jquery.ganttView.min.js +70 -0
- data/templates/{jquery → graphics}/jquery.sparkline.js +466 -438
- data/templates/{jquery → graphics}/jquery.sparkline.min.js +0 -0
- data/templates/graphics/manifest.rb +9 -0
- data/templates/jqgrid/config/initializers/jqgrid.rb +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ar.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-bg.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cat.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-cn.js +137 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cs.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-da.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-de.js +138 -132
- data/templates/jqgrid/i18n/jqgrid/locale-el.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-en.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-es.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-fa.js +19 -16
- data/templates/jqgrid/i18n/jqgrid/locale-fi.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-fr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-gl.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-he.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-hu.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-is.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-it.js +8 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ja.js +139 -136
- data/templates/jqgrid/i18n/jqgrid/locale-nl.js +4 -1
- data/templates/jqgrid/i18n/jqgrid/locale-no.js +14 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pl.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt.js +130 -124
- data/templates/jqgrid/i18n/jqgrid/locale-ro.js +144 -138
- data/templates/jqgrid/i18n/jqgrid/locale-ru.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sk.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sr.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-sv.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-tr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-ua.js +132 -126
- data/templates/jqgrid/jquery.jqGrid.js +12735 -10444
- data/templates/jqgrid/jquery.jqGrid.min.js +477 -469
- data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +12 -10
- data/templates/jqtouch/config/initializers/jqtouch.rb +3 -3
- data/templates/jqtouch/jquery/touch/jqtouch.scss +1 -1
- data/templates/jqtouch/jquery.jqtouch.js +10025 -10043
- data/templates/jquery/config/initializers/jquery.rb +2 -4
- data/templates/jquery/history.adapter.jquery.js +71 -0
- data/templates/jquery/history.adapter.jquery.min.js +4 -0
- data/templates/jquery/history.html4.js +690 -0
- data/templates/jquery/history.html4.min.js +21 -0
- data/templates/jquery/history.js +1297 -0
- data/templates/jquery/history.min.js +29 -0
- data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-az.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +8 -8
- data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-da.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-es.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +15 -15
- data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +22 -22
- data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-id.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-is.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-it.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-no.js +16 -16
- data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +2 -2
- data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
- data/templates/jquery/{partials → jquery/ui}/_flash_messages.scss +0 -0
- data/templates/jquery/jquery/ui/_theme.scss +14 -13
- data/templates/jquery/jquery/ui/contextMenu/configure.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/cut.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/exit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/paste.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/rename.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/show.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/trash.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu.scss +16 -10
- data/templates/jquery/jquery-ui.js +11839 -23066
- data/templates/jquery/jquery-ui.min.js +401 -795
- data/templates/jquery/jquery.bgiframe.js +27 -25
- data/templates/jquery/jquery.contextMenu.js +209 -196
- data/templates/jquery/jquery.cookie.js +3 -1
- data/templates/jquery/jquery.dotimeout.js +236 -228
- data/templates/jquery/jquery.dst.js +154 -151
- data/templates/jquery/jquery.farbtastic.js +293 -293
- data/templates/jquery/jquery.flashMessages.js +26 -0
- data/templates/jquery/jquery.flashMessages.min.js +1 -0
- data/templates/jquery/jquery.form.js +803 -786
- data/templates/jquery/jquery.haml.js +248 -247
- data/templates/jquery/jquery.hotkeys.js +89 -89
- data/templates/jquery/jquery.js +8141 -8106
- data/templates/jquery/jquery.layout.js +2451 -2415
- data/templates/jquery/jquery.min.js +167 -166
- data/templates/jquery/jquery.mousewheel.js +62 -54
- data/templates/jquery/jquery.offline.js +171 -171
- data/templates/jquery/jquery.pngFix.js +76 -76
- data/templates/jquery/jquery.replacetext.js +83 -83
- data/templates/jquery/jquery.themeswitchertool.js +202 -177
- data/templates/jquery/jquery.tmpl.js +478 -473
- data/templates/jquery/jquery.tmplPlus.js +82 -81
- data/templates/jquery/jrails.js +178 -175
- data/templates/jquery/json.js +77 -7
- data/templates/jquery/json2.js +480 -0
- data/templates/jquery/json2.min.js +7 -0
- data/templates/jquery/lib/tasks/haml.rake +2 -2
- data/templates/jquery/manifest.rb +21 -17
- data/templates/jstree/jquery.jstree.js +5967 -4536
- data/templates/mobile/config/initializers/mobile.rb +1 -1
- data/templates/mobile/jquery/mobile/_base.scss +944 -927
- data/templates/mobile/jquery/mobile/default.scss +61 -48
- data/templates/mobile/jquery/mobile/valencia.scss +56 -42
- data/templates/mobile/jquery.mobile.js +4461 -4347
- data/templates/mobile/jquery.mobile.min.js +11 -2
- data/templates/mobile/lib/tasks/jquery.mobile.rake +12 -12
- data/templates/ribbon/config/initializers/ribbon.rb +2 -2
- data/templates/ribbon/jquery.ribbon.js +50 -29
- data/templates/secret_sauce/secret_sauce.js +8 -8
- data/templates/tools/flowplayer.js +945 -1
- data/templates/tools/jquery.tools.js +4645 -4335
- data/templates/tools/jquery.tools.min.js +37 -37
- data/templates/tools/lib/tasks/jquery.tools.rake +4 -4
- data/templates/tools/swfobject.js +813 -773
- metadata +33 -21
- data/templates/jquery/haml.js +0 -506
- data/templates/jquery/haml.min.js +0 -5
- data/templates/jquery/jquery/ui/contextMenu/door.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_paste.png +0 -0
- data/templates/jquery/jquery.compat-1.3.js +0 -291
- data/templates/jquery/jquery.compat-1.3.min.js +0 -6
- data/templates/jquery/jquery.flash_messages.js +0 -5
- data/templates/jquery/jquery.flash_messages.min.js +0 -1
- data/templates/jquery/jquery.history.js +0 -194
- data/templates/jquery/jquery.history.min.js +0 -5
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
|
|
3
|
+
@website: http://www.datejs.com/
|
|
4
|
+
*/
|
|
5
|
+
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan",
|
|
6
|
+
"Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,
|
|
7
|
+
feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|aft(er)?|from|hence)/i,subtract:/^(\-|bef(ore)?|ago)/i,yesterday:/^yes(terday)?/i,
|
|
8
|
+
today:/^t(od(ay)?)?/i,tomorrow:/^tom(orrow)?/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^mn|min(ute)?s?/i,hour:/^h(our)?s?/i,week:/^w(eek)?s?/i,month:/^m(onth)?s?/i,day:/^d(ay)?s?/i,year:/^y(ear)?s?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt|utc)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a(?!u|p)|p)/i},timezones:[{name:"UTC",offset:"-000"},
|
|
9
|
+
{name:"GMT",offset:"-000"},{name:"EST",offset:"-0500"},{name:"EDT",offset:"-0400"},{name:"CST",offset:"-0600"},{name:"CDT",offset:"-0500"},{name:"MST",offset:"-0700"},{name:"MDT",offset:"-0600"},{name:"PST",offset:"-0800"},{name:"PDT",offset:"-0700"}]};
|
|
10
|
+
(function(){var f=Date,l=f.prototype,q=f.CultureInfo,e=function(a,c){c||(c=2);return("000"+a).slice(c*-1)};l.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};l.setTimeToNow=function(){var a=new Date;this.setHours(a.getHours());this.setMinutes(a.getMinutes());this.setSeconds(a.getSeconds());this.setMilliseconds(a.getMilliseconds());return this};f.today=function(){return(new Date).clearTime()};f.compare=function(a,c){if(isNaN(a)||isNaN(c))throw Error(a+
|
|
11
|
+
" - "+c);else if(a instanceof Date&&c instanceof Date)return a<c?-1:a>c?1:0;else throw new TypeError(a+" - "+c);};f.equals=function(a,c){return a.compareTo(c)===0};f.getDayNumberFromName=function(a){var c=q.dayNames,b=q.abbreviatedDayNames,g=q.shortestDayNames;a=a.toLowerCase();for(var k=0;k<c.length;k++)if(c[k].toLowerCase()==a||b[k].toLowerCase()==a||g[k].toLowerCase()==a)return k;return-1};f.getMonthNumberFromName=function(a){var c=q.monthNames,b=q.abbreviatedMonthNames;a=a.toLowerCase();for(var g=
|
|
12
|
+
0;g<c.length;g++)if(c[g].toLowerCase()==a||b[g].toLowerCase()==a)return g;return-1};f.isLeapYear=function(a){return a%4===0&&a%100!==0||a%400===0};f.getDaysInMonth=function(a,c){return[31,f.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][c]};f.getTimezoneAbbreviation=function(a){for(var c=q.timezones,b=0;b<c.length;b++)if(c[b].offset===a)return c[b].name;return null};f.getTimezoneOffset=function(a){for(var c=q.timezones,b=0;b<c.length;b++)if(c[b].name===a.toUpperCase())return c[b].offset;return null};
|
|
13
|
+
l.clone=function(){return new Date(this.getTime())};l.compareTo=function(a){return Date.compare(this,a)};l.equals=function(a){return Date.equals(this,a||new Date)};l.between=function(a,c){return this.getTime()>=a.getTime()&&this.getTime()<=c.getTime()};l.isAfter=function(a){return this.compareTo(a||new Date)===1};l.isBefore=function(a){return this.compareTo(a||new Date)===-1};l.isToday=function(){return this.isSameDay(new Date)};l.isSameDay=function(a){return this.clone().clearTime().equals(a.clone().clearTime())};
|
|
14
|
+
l.addMilliseconds=function(a){this.setMilliseconds(this.getMilliseconds()+a);return this};l.addSeconds=function(a){return this.addMilliseconds(a*1E3)};l.addMinutes=function(a){return this.addMilliseconds(a*6E4)};l.addHours=function(a){return this.addMilliseconds(a*36E5)};l.addDays=function(a){this.setDate(this.getDate()+a);return this};l.addWeeks=function(a){return this.addDays(a*7)};l.addMonths=function(a){var c=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+a);this.setDate(Math.min(c,
|
|
15
|
+
f.getDaysInMonth(this.getFullYear(),this.getMonth())));return this};l.addYears=function(a){return this.addMonths(a*12)};l.add=function(a){if(typeof a=="number"){this._orient=a;return this}a.milliseconds&&this.addMilliseconds(a.milliseconds);a.seconds&&this.addSeconds(a.seconds);a.minutes&&this.addMinutes(a.minutes);a.hours&&this.addHours(a.hours);a.weeks&&this.addWeeks(a.weeks);a.months&&this.addMonths(a.months);a.years&&this.addYears(a.years);a.days&&this.addDays(a.days);return this};var d,i,j;l.getWeek=
|
|
16
|
+
function(){var a,c,b,g,k;d=!d?this.getFullYear():d;i=!i?this.getMonth()+1:i;j=!j?this.getDate():j;if(i<=2){a=d-1;c=(a/4|0)-(a/100|0)+(a/400|0);b=((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0);b=c-b;g=0;k=j-1+31*(i-1)}else{a=d;c=(a/4|0)-(a/100|0)+(a/400|0);b=((a-1)/4|0)-((a-1)/100|0)+((a-1)/400|0);b=c-b;g=b+1;k=j+(153*(i-3)+2)/5+58+b}a=(a+c)%7;c=k+3-(k+a-g)%7|0;b=c<0?53-((a-b)/5|0):c>364+b?1:(c/7|0)+1;d=i=j=null;return b};l.getISOWeek=function(){d=this.getUTCFullYear();i=this.getUTCMonth()+1;j=this.getUTCDate();
|
|
17
|
+
return e(this.getWeek())};l.setWeek=function(a){return this.moveToDayOfWeek(1).addWeeks(a-this.getWeek())};f._validate=function(a,c,b,g){if(typeof a=="undefined")return false;else if(typeof a!="number")throw new TypeError(a+" is not a Number.");else if(a<c||a>b)throw new RangeError(a+" is not a valid value for "+g+".");return true};f.validateMillisecond=function(a){return f._validate(a,0,999,"millisecond")};f.validateSecond=function(a){return f._validate(a,0,59,"second")};f.validateMinute=function(a){return f._validate(a,
|
|
18
|
+
0,59,"minute")};f.validateHour=function(a){return f._validate(a,0,23,"hour")};f.validateDay=function(a,c,b){return f._validate(a,1,f.getDaysInMonth(c,b),"day")};f.validateMonth=function(a){return f._validate(a,0,11,"month")};f.validateYear=function(a){return f._validate(a,0,9999,"year")};l.set=function(a){f.validateMillisecond(a.millisecond)&&this.addMilliseconds(a.millisecond-this.getMilliseconds());f.validateSecond(a.second)&&this.addSeconds(a.second-this.getSeconds());f.validateMinute(a.minute)&&
|
|
19
|
+
this.addMinutes(a.minute-this.getMinutes());f.validateHour(a.hour)&&this.addHours(a.hour-this.getHours());f.validateMonth(a.month)&&this.addMonths(a.month-this.getMonth());f.validateYear(a.year)&&this.addYears(a.year-this.getFullYear());f.validateDay(a.day,this.getFullYear(),this.getMonth())&&this.addDays(a.day-this.getDate());a.timezone&&this.setTimezone(a.timezone);a.timezoneOffset&&this.setTimezoneOffset(a.timezoneOffset);a.week&&f._validate(a.week,0,53,"week")&&this.setWeek(a.week);return this};
|
|
20
|
+
l.moveToFirstDayOfMonth=function(){return this.set({day:1})};l.moveToLastDayOfMonth=function(){return this.set({day:f.getDaysInMonth(this.getFullYear(),this.getMonth())})};l.moveToNthOccurrence=function(a,c){var b=0;if(c>0)b=c-1;else if(c===-1){this.moveToLastDayOfMonth();this.getDay()!==a&&this.moveToDayOfWeek(a,-1);return this}return this.moveToFirstDayOfMonth().addDays(-1).moveToDayOfWeek(a,+1).addWeeks(b)};l.moveToDayOfWeek=function(a,c){var b=(a-this.getDay()+7*(c||+1))%7;return this.addDays(b===
|
|
21
|
+
0?b+=7*(c||+1):b)};l.moveToMonth=function(a,c){var b=(a-this.getMonth()+12*(c||+1))%12;return this.addMonths(b===0?b+=12*(c||+1):b)};l.getOrdinalNumber=function(){return Math.ceil((this.clone().clearTime()-new Date(this.getFullYear(),0,1))/864E5)+1};l.getTimezone=function(){return f.getTimezoneAbbreviation(this.getUTCOffset())};l.setTimezoneOffset=function(a){var c=this.getTimezoneOffset();return this.addMinutes(Number(a)*-6/10-c)};l.setTimezone=function(a){return this.setTimezoneOffset(f.getTimezoneOffset(a))};
|
|
22
|
+
l.hasDaylightSavingTime=function(){return Date.today().set({month:0,day:1}).getTimezoneOffset()!==Date.today().set({month:6,day:1}).getTimezoneOffset()};l.isDaylightSavingTime=function(){return this.hasDaylightSavingTime()&&(new Date).getTimezoneOffset()===Date.today().set({month:6,day:1}).getTimezoneOffset()};l.getUTCOffset=function(){var a=this.getTimezoneOffset()*-10/6;if(a<0){a=(a-1E4).toString();return a.charAt(0)+a.substr(2)}else{a=(a+1E4).toString();return"+"+a.substr(1)}};l.getElapsed=function(a){return(a||
|
|
23
|
+
new Date)-this};if(!l.toISOString)l.toISOString=function(){function a(c){return c<10?"0"+c:c}return'"'+this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+'Z"'};l._toString=l.toString;l.toString=function(a){var c=this;if(a&&a.length==1){var b=q.formatPatterns;c.t=c.toString;switch(a){case "d":return c.t(b.shortDate);case "D":return c.t(b.longDate);case "F":return c.t(b.fullDateTime);case "m":return c.t(b.monthDay);
|
|
24
|
+
case "r":return c.t(b.rfc1123);case "s":return c.t(b.sortableDateTime);case "t":return c.t(b.shortTime);case "T":return c.t(b.longTime);case "u":return c.t(b.universalSortableDateTime);case "y":return c.t(b.yearMonth)}}var g=function(k){switch(k*1){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};return a?a.replace(/(\\)?(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|S)/g,function(k){if(k.charAt(0)==="\\")return k.replace("\\","");c.h=c.getHours;
|
|
25
|
+
switch(k){case "hh":return e(c.h()<13?c.h()===0?12:c.h():c.h()-12);case "h":return c.h()<13?c.h()===0?12:c.h():c.h()-12;case "HH":return e(c.h());case "H":return c.h();case "mm":return e(c.getMinutes());case "m":return c.getMinutes();case "ss":return e(c.getSeconds());case "s":return c.getSeconds();case "yyyy":return e(c.getFullYear(),4);case "yy":return e(c.getFullYear());case "dddd":return q.dayNames[c.getDay()];case "ddd":return q.abbreviatedDayNames[c.getDay()];case "dd":return e(c.getDate());
|
|
26
|
+
case "d":return c.getDate();case "MMMM":return q.monthNames[c.getMonth()];case "MMM":return q.abbreviatedMonthNames[c.getMonth()];case "MM":return e(c.getMonth()+1);case "M":return c.getMonth()+1;case "t":return c.h()<12?q.amDesignator.substring(0,1):q.pmDesignator.substring(0,1);case "tt":return c.h()<12?q.amDesignator:q.pmDesignator;case "S":return g(c.getDate());default:return k}}):this._toString()}})();
|
|
27
|
+
(function(){var f=Date,l=f.prototype,q=f.CultureInfo,e=Number.prototype;l._orient=+1;l._nth=null;l._is=false;l._same=false;l._isSecond=false;e._dateElement="day";l.next=function(){this._orient=+1;return this};f.next=function(){return f.today().next()};l.last=l.prev=l.previous=function(){this._orient=-1;return this};f.last=f.prev=f.previous=function(){return f.today().last()};l.is=function(){this._is=true;return this};l.same=function(){this._same=true;this._isSecond=false;return this};l.today=function(){return this.same().day()};
|
|
28
|
+
l.weekday=function(){if(this._is){this._is=false;return!this.is().sat()&&!this.is().sun()}return false};l.at=function(h){return typeof h==="string"?f.parse(this.toString("d")+" "+h):this.set(h)};e.fromNow=e.after=function(h){var m={};m[this._dateElement]=this;return(!h?new Date:h.clone()).add(m)};e.ago=e.before=function(h){var m={};m[this._dateElement]=this*-1;return(!h?new Date:h.clone()).add(m)};var d="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),i="january february march april may june july august september october november december".split(/\s/),
|
|
29
|
+
j="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),a="Milliseconds Seconds Minutes Hours Date Week Month FullYear".split(/\s/),c="final first second third fourth fifth".split(/\s/);l.toObject=function(){for(var h={},m=0;m<j.length;m++)h[j[m].toLowerCase()]=this["get"+a[m]]();return h};f.fromObject=function(h){h.week=null;return Date.today().set(h)};for(var b=function(h){return function(){if(this._is){this._is=false;return this.getDay()==h}if(this._nth!==null){this._isSecond&&this.addSeconds(this._orient*
|
|
30
|
+
-1);this._isSecond=false;var m=this._nth;this._nth=null;var n=this.clone().moveToLastDayOfMonth();this.moveToNthOccurrence(h,m);if(this>n)throw new RangeError(f.getDayName(h)+" does not occur "+m+" times in the month of "+f.getMonthName(n.getMonth())+" "+n.getFullYear()+".");return this}return this.moveToDayOfWeek(h,this._orient)}},g=function(h){return function(){var m=f.today(),n=h-m.getDay();if(h===0&&q.firstDayOfWeek===1&&m.getDay()!==0)n+=7;return m.addDays(n)}},k=0;k<d.length;k++){f[d[k].toUpperCase()]=
|
|
31
|
+
f[d[k].toUpperCase().substring(0,3)]=k;f[d[k]]=f[d[k].substring(0,3)]=g(k);l[d[k]]=l[d[k].substring(0,3)]=b(k)}d=function(h){return function(){if(this._is){this._is=false;return this.getMonth()===h}return this.moveToMonth(h,this._orient)}};b=function(h){return function(){return f.today().set({month:h,day:1})}};for(g=0;g<i.length;g++){f[i[g].toUpperCase()]=f[i[g].toUpperCase().substring(0,3)]=g;f[i[g]]=f[i[g].substring(0,3)]=b(g);l[i[g]]=l[i[g].substring(0,3)]=d(g)}d=function(h){return function(m){if(this._isSecond){this._isSecond=
|
|
32
|
+
false;return this}if(this._same){this._same=this._is=false;var n=this.toObject();m=(m||new Date).toObject();for(var o="",p=h.toLowerCase(),t=j.length-1;t>-1;t--){o=j[t].toLowerCase();if(n[o]!=m[o])return false;if(p==o)break}return true}if(h.substring(h.length-1)!="s")h+="s";return this["add"+h](this._orient)}};b=function(h){return function(){this._dateElement=h;return this}};for(g=0;g<j.length;g++){i=j[g].toLowerCase();l[i]=l[i+"s"]=d(j[g]);e[i]=e[i+"s"]=b(i)}l._ss=d("Second");e=function(h){return function(m){if(this._same)return this._ss(m);
|
|
33
|
+
if(m||m===0)return this.moveToNthOccurrence(m,h);this._nth=h;if(h===2&&(m===undefined||m===null)){this._isSecond=true;return this.addSeconds(this._orient)}return this}};for(i=0;i<c.length;i++)l[c[i]]=i===0?e(-1):e(i)})();
|
|
34
|
+
(function(){Date.Parsing={Exception:function(i){this.message="Parse error at '"+i.substring(0,10)+" ...'"}};for(var f=Date.Parsing,l=f.Operators={rtoken:function(i){return function(j){var a=j.match(i);if(a)return[a[0],j.substring(a[0].length)];else throw new f.Exception(j);}},token:function(){return function(i){return l.rtoken(RegExp("^s*"+i+"s*"))(i)}},stoken:function(i){return l.rtoken(RegExp("^"+i))},until:function(i){return function(j){for(var a=[],c=null;j.length;){try{c=i.call(this,j)}catch(b){a.push(c[0]);
|
|
35
|
+
j=c[1];continue}break}return[a,j]}},many:function(i){return function(j){for(var a=[],c=null;j.length;){try{c=i.call(this,j)}catch(b){break}a.push(c[0]);j=c[1]}return[a,j]}},optional:function(i){return function(j){var a=null;try{a=i.call(this,j)}catch(c){return[null,j]}return[a[0],a[1]]}},not:function(i){return function(j){try{i.call(this,j)}catch(a){return[null,j]}throw new f.Exception(j);}},ignore:function(i){return i?function(j){var a=null;a=i.call(this,j);return[null,a[1]]}:null},product:function(){for(var i=
|
|
36
|
+
arguments[0],j=Array.prototype.slice.call(arguments,1),a=[],c=0;c<i.length;c++)a.push(l.each(i[c],j));return a},cache:function(i){var j={},a=null;return function(c){try{a=j[c]=j[c]||i.call(this,c)}catch(b){a=j[c]=b}if(a instanceof f.Exception)throw a;else return a}},any:function(){var i=arguments;return function(j){for(var a=null,c=0;c<i.length;c++)if(i[c]!=null){try{a=i[c].call(this,j)}catch(b){a=null}if(a)return a}throw new f.Exception(j);}},each:function(){var i=arguments;return function(j){for(var a=
|
|
37
|
+
[],c=null,b=0;b<i.length;b++)if(i[b]!=null){try{c=i[b].call(this,j)}catch(g){throw new f.Exception(j);}a.push(c[0]);j=c[1]}return[a,j]}},all:function(){var i=i;return i.each(i.optional(arguments))},sequence:function(i,j,a){j=j||l.rtoken(/^\s*/);a=a||null;if(i.length==1)return i[0];return function(c){for(var b=null,g=null,k=[],h=0;h<i.length;h++){try{b=i[h].call(this,c)}catch(m){break}k.push(b[0]);try{g=j.call(this,b[1])}catch(n){g=null;break}c=g[1]}if(!b)throw new f.Exception(c);if(g)throw new f.Exception(g[1]);
|
|
38
|
+
if(a)try{b=a.call(this,b[1])}catch(o){throw new f.Exception(b[1]);}return[k,b?b[1]:c]}},between:function(i,j,a){a=a||i;var c=l.each(l.ignore(i),j,l.ignore(a));return function(b){b=c.call(this,b);return[[b[0][0],r[0][2]],b[1]]}},list:function(i,j,a){j=j||l.rtoken(/^\s*/);a=a||null;return i instanceof Array?l.each(l.product(i.slice(0,-1),l.ignore(j)),i.slice(-1),l.ignore(a)):l.each(l.many(l.each(i,l.ignore(j))),px,l.ignore(a))},set:function(i,j,a){j=j||l.rtoken(/^\s*/);a=a||null;return function(c){var b=
|
|
39
|
+
null;for(var g=b=null,k=null,h=[[],c],m=false,n=0;n<i.length;n++){b=g=null;m=i.length==1;try{b=i[n].call(this,c)}catch(o){continue}k=[[b[0]],b[1]];if(b[1].length>0&&!m)try{g=j.call(this,b[1])}catch(p){m=true}else m=true;if(!m&&g[1].length===0)m=true;if(!m){b=[];for(m=0;m<i.length;m++)n!=m&&b.push(i[m]);b=l.set(b,j).call(this,g[1]);if(b[0].length>0){k[0]=k[0].concat(b[0]);k[1]=b[1]}}if(k[1].length<h[1].length)h=k;if(h[1].length===0)break}if(h[0].length===0)return h;if(a){try{g=a.call(this,h[1])}catch(t){throw new f.Exception(h[1]);
|
|
40
|
+
}h[1]=g[1]}return h}},forward:function(i,j){return function(a){return i[j].call(this,a)}},replace:function(i,j){return function(a){a=i.call(this,a);return[j,a[1]]}},process:function(i,j){return function(a){a=i.call(this,a);return[j.call(this,a[0]),a[1]]}},min:function(i,j){return function(a){var c=j.call(this,a);if(c[0].length<i)throw new f.Exception(a);return c}}},q=function(i){return function(){var j=null,a=[];if(arguments.length>1)j=Array.prototype.slice.call(arguments);else if(arguments[0]instanceof
|
|
41
|
+
Array)j=arguments[0];if(j)for(var c=j.shift();0<c.length;){j.unshift(c[0]);a.push(i.apply(null,j));j.shift();return a}else return i.apply(null,arguments)}},e="optional not ignore cache".split(/\s/),d=0;d<e.length;d++)l[e[d]]=q(l[e[d]]);q=function(i){return function(){return arguments[0]instanceof Array?i.apply(null,arguments[0]):i.apply(null,arguments)}};e="each any all".split(/\s/);for(d=0;d<e.length;d++)l[e[d]]=q(l[e[d]])})();
|
|
42
|
+
(function(){var f=Date,l=f.CultureInfo,q=function(b){for(var g=[],k=0;k<b.length;k++)if(b[k]instanceof Array)g=g.concat(q(b[k]));else b[k]&&g.push(b[k]);return g};f.Grammar={};f.Translator={hour:function(b){return function(){this.hour=Number(b)}},minute:function(b){return function(){this.minute=Number(b)}},second:function(b){return function(){this.second=Number(b)}},meridian:function(b){return function(){this.meridian=b.slice(0,1).toLowerCase()}},timezone:function(b){return function(){var g=b.replace(/[^\d\+\-]/g,
|
|
43
|
+
"");if(g.length)this.timezoneOffset=Number(g);else this.timezone=b.toLowerCase()}},day:function(b){var g=b[0];return function(){this.day=Number(g.match(/\d+/)[0])}},month:function(b){return function(){this.month=b.length==3?"jan feb mar apr may jun jul aug sep oct nov dec".indexOf(b)/4:Number(b)-1}},year:function(b){return function(){var g=Number(b);this.year=b.length>2?g:g+(g+2E3<l.twoDigitYearMax?2E3:1900)}},rday:function(b){return function(){switch(b){case "yesterday":this.days=-1;break;case "tomorrow":this.days=
|
|
44
|
+
1;break;case "today":this.days=0;break;case "now":this.days=0;this.now=true}}},finishExact:function(b){b=b instanceof Array?b:[b];for(var g=0;g<b.length;g++)b[g]&&b[g].call(this);b=new Date;if((this.hour||this.minute)&&!this.month&&!this.year&&!this.day)this.day=b.getDate();if(!this.year)this.year=b.getFullYear();if(!this.month&&this.month!==0)this.month=b.getMonth();if(!this.day)this.day=1;if(!this.hour)this.hour=0;if(!this.minute)this.minute=0;if(!this.second)this.second=0;if(this.meridian&&this.hour)if(this.meridian==
|
|
45
|
+
"p"&&this.hour<12)this.hour+=12;else if(this.meridian=="a"&&this.hour==12)this.hour=0;if(this.day>f.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");b=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone)b.set({timezone:this.timezone});else this.timezoneOffset&&b.set({timezoneOffset:this.timezoneOffset});return b},finish:function(b){b=b instanceof Array?q(b):[b];if(b.length===0)return null;for(var g=0;g<b.length;g++)typeof b[g]==
|
|
46
|
+
"function"&&b[g].call(this);b=f.today();if(this.now&&!this.unit&&!this.operator)return new Date;else if(this.now)b=new Date;g=!!(this.days&&this.days!==null||this.orient||this.operator);var k,h,m;m=this.orient=="past"||this.operator=="subtract"?-1:1;!this.now&&"hour minute second".indexOf(this.unit)!=-1&&b.setTimeToNow();if(this.month||this.month===0)if("year day hour minute second".indexOf(this.unit)!=-1){this.value=this.month+1;this.month=null;g=true}if(!g&&this.weekday&&!this.day&&!this.days){k=
|
|
47
|
+
Date[this.weekday]();this.day=k.getDate();if(!this.month)this.month=k.getMonth();this.year=k.getFullYear()}if(g&&this.weekday&&this.unit!="month"){this.unit="day";k=f.getDayNumberFromName(this.weekday)-b.getDay();h=7;this.days=k?(k+m*h)%h:m*h}if(this.month&&this.unit=="day"&&this.operator){this.value=this.month+1;this.month=null}if(this.value!=null&&this.month!=null&&this.year!=null)this.day=this.value*1;if(this.month&&!this.day&&this.value){b.set({day:this.value*1});if(!g)this.day=this.value*1}if(!this.month&&
|
|
48
|
+
this.value&&this.unit=="month"&&!this.now){this.month=this.value;g=true}if(g&&(this.month||this.month===0)&&this.unit!="year"){this.unit="month";k=this.month-b.getMonth();h=12;this.months=k?(k+m*h)%h:m*h;this.month=null}if(!this.unit)this.unit="day";if(!this.value&&this.operator&&this.operator!==null&&this[this.unit+"s"]&&this[this.unit+"s"]!==null)this[this.unit+"s"]=this[this.unit+"s"]+(this.operator=="add"?1:-1)+(this.value||0)*m;else if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value)this.value=
|
|
49
|
+
1;this[this.unit+"s"]=this.value*m}if(this.meridian&&this.hour)if(this.meridian=="p"&&this.hour<12)this.hour+=12;else if(this.meridian=="a"&&this.hour==12)this.hour=0;if(this.weekday&&!this.day&&!this.days){k=Date[this.weekday]();this.day=k.getDate();if(k.getMonth()!==b.getMonth())this.month=k.getMonth()}if((this.month||this.month===0)&&!this.day)this.day=1;if(!this.orient&&!this.operator&&this.unit=="week"&&this.value&&!this.day&&!this.month)return Date.today().setWeek(this.value);if(g&&this.timezone&&
|
|
50
|
+
this.day&&this.days)this.day=this.days;return g?b.add(this):b.set(this)}};var e=f.Parsing.Operators,d=f.Grammar,i=f.Translator,j;d.datePartDelimiter=e.rtoken(/^([\s\-\.\,\/\x27]+)/);d.timePartDelimiter=e.stoken(":");d.whiteSpace=e.rtoken(/^\s*/);d.generalDelimiter=e.rtoken(/^(([\s\,]|at|@|on)+)/);var a={};d.ctoken=function(b){var g=a[b];if(!g){g=l.regexPatterns;for(var k=b.split(/\s+/),h=[],m=0;m<k.length;m++)h.push(e.replace(e.rtoken(g[k[m]]),k[m]));g=a[b]=e.any.apply(null,h)}return g};d.ctoken2=
|
|
51
|
+
function(b){return e.rtoken(l.regexPatterns[b])};d.h=e.cache(e.process(e.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),i.hour));d.hh=e.cache(e.process(e.rtoken(/^(0[0-9]|1[0-2])/),i.hour));d.H=e.cache(e.process(e.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),i.hour));d.HH=e.cache(e.process(e.rtoken(/^([0-1][0-9]|2[0-3])/),i.hour));d.m=e.cache(e.process(e.rtoken(/^([0-5][0-9]|[0-9])/),i.minute));d.mm=e.cache(e.process(e.rtoken(/^[0-5][0-9]/),i.minute));d.s=e.cache(e.process(e.rtoken(/^([0-5][0-9]|[0-9])/),i.second));d.ss=
|
|
52
|
+
e.cache(e.process(e.rtoken(/^[0-5][0-9]/),i.second));d.hms=e.cache(e.sequence([d.H,d.m,d.s],d.timePartDelimiter));d.t=e.cache(e.process(d.ctoken2("shortMeridian"),i.meridian));d.tt=e.cache(e.process(d.ctoken2("longMeridian"),i.meridian));d.z=e.cache(e.process(e.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),i.timezone));d.zz=e.cache(e.process(e.rtoken(/^((\+|\-)\s*\d\d\d\d)|((\+|\-)\d\d\:?\d\d)/),i.timezone));d.zzz=e.cache(e.process(d.ctoken2("timezone"),i.timezone));d.timeSuffix=e.each(e.ignore(d.whiteSpace),
|
|
53
|
+
e.set([d.tt,d.zzz]));d.time=e.each(e.optional(e.ignore(e.stoken("T"))),d.hms,d.timeSuffix);d.d=e.cache(e.process(e.each(e.rtoken(/^([0-2]\d|3[0-1]|\d)/),e.optional(d.ctoken2("ordinalSuffix"))),i.day));d.dd=e.cache(e.process(e.each(e.rtoken(/^([0-2]\d|3[0-1])/),e.optional(d.ctoken2("ordinalSuffix"))),i.day));d.ddd=d.dddd=e.cache(e.process(d.ctoken("sun mon tue wed thu fri sat"),function(b){return function(){this.weekday=b}}));d.M=e.cache(e.process(e.rtoken(/^(1[0-2]|0\d|\d)/),i.month));d.MM=e.cache(e.process(e.rtoken(/^(1[0-2]|0\d)/),
|
|
54
|
+
i.month));d.MMM=d.MMMM=e.cache(e.process(d.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),i.month));d.y=e.cache(e.process(e.rtoken(/^(\d\d?)/),i.year));d.yy=e.cache(e.process(e.rtoken(/^(\d\d)/),i.year));d.yyy=e.cache(e.process(e.rtoken(/^(\d\d?\d?\d?)/),i.year));d.yyyy=e.cache(e.process(e.rtoken(/^(\d\d\d\d)/),i.year));j=function(){return e.each(e.any.apply(null,arguments),e.not(d.ctoken2("timeContext")))};d.day=j(d.d,d.dd);d.month=j(d.M,d.MMM);d.year=j(d.yyyy,d.yy);d.orientation=e.process(d.ctoken("past future"),
|
|
55
|
+
function(b){return function(){this.orient=b}});d.operator=e.process(d.ctoken("add subtract"),function(b){return function(){this.operator=b}});d.rday=e.process(d.ctoken("yesterday tomorrow today now"),i.rday);d.unit=e.process(d.ctoken("second minute hour day week month year"),function(b){return function(){this.unit=b}});d.value=e.process(e.rtoken(/^\d\d?(st|nd|rd|th)?/),function(b){return function(){this.value=b.replace(/\D/g,"")}});d.expression=e.set([d.rday,d.operator,d.value,d.unit,d.orientation,
|
|
56
|
+
d.ddd,d.MMM]);j=function(){return e.set(arguments,d.datePartDelimiter)};d.mdy=j(d.ddd,d.month,d.day,d.year);d.ymd=j(d.ddd,d.year,d.month,d.day);d.dmy=j(d.ddd,d.day,d.month,d.year);d.date=function(b){return(d[l.dateElementOrder]||d.mdy).call(this,b)};d.format=e.process(e.many(e.any(e.process(e.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(b){if(d[b])return d[b];else throw f.Parsing.Exception(b);}),e.process(e.rtoken(/^[^dMyhHmstz]+/),function(b){return e.ignore(e.stoken(b))}))),
|
|
57
|
+
function(b){return e.process(e.each.apply(null,b),i.finishExact)});var c={};d.formats=function(b){if(b instanceof Array){for(var g=[],k=0;k<b.length;k++)g.push(c[b[k]]=c[b[k]]||d.format(b[k])[0]);return e.any.apply(null,g)}else return c[b]=c[b]||d.format(b)[0]};d._formats=d.formats(['"yyyy-MM-ddTHH:mm:ssZ"',"yyyy-MM-ddTHH:mm:ssZ","yyyy-MM-ddTHH:mm:ssz","yyyy-MM-ddTHH:mm:ss","yyyy-MM-ddTHH:mmZ","yyyy-MM-ddTHH:mmz","yyyy-MM-ddTHH:mm","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","MMddyyyy",
|
|
58
|
+
"ddMMyyyy","Mddyyyy","ddMyyyy","Mdyyyy","dMyyyy","yyyy","Mdyy","dMyy","d"]);d._start=e.process(e.set([d.date,d.time,d.expression],d.generalDelimiter,d.whiteSpace),i.finish);d.start=function(b){try{var g=d._formats.call({},b);if(g[1].length===0)return g}catch(k){}return d._start.call({},b)};f._parse=f.parse;f.parse=function(b){var g=null;if(!b)return null;if(b instanceof Date)return b;try{g=f.Grammar.start.call({},b.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1"))}catch(k){return null}return g[1].length===
|
|
59
|
+
0?g[0]:null};f.getParseFunction=function(b){var g=f.Grammar.formats(b);return function(k){var h=null;try{h=g.call({},k)}catch(m){return null}return h[1].length===0?h[0]:null}};f.parseExact=function(b,g){return f.getParseFunction(g)(b)}})();
|
|
60
|
+
(function(f){function l(j){function a(){var g=i.getBoundaryDatesFromData(b.data,Math.floor(b.slideWidth/b.cellWidth+5));b.start=g[0];b.end=g[1];c.each(function(){var k=f(this),h=f("<div>",{"class":"ganttview"});(new e(h,b)).render();k.append(h);h=f("div.ganttview-vtheader",k).outerWidth()+f("div.ganttview-slide-container",k).outerWidth();k.css("width",h+2+"px");(new d(k,b)).apply()})}var c=this,b=f.extend(true,{showWeekends:true,cellWidth:21,cellHeight:31,slideWidth:400,vHeaderWidth:100,behavior:{clickable:true,
|
|
61
|
+
draggable:true,resizable:true}},j);if(b.data)a();else b.dataUrl&&f.getJSON(b.dataUrl,function(g){b.data=g;a()})}function q(j,a){if(j=="setSlideWidth"){var c=$("div.ganttview",this);c.each(function(){var b=$("div.ganttview-vtheader",c).outerWidth();$(c).width(b+a+1);$("div.ganttview-slide-container",this).width(a)})}}f.fn.ganttView=function(){var j=Array.prototype.slice.call(arguments);j.length==1&&typeof j[0]=="object"&&l.call(this,j[0]);j.length==2&&typeof j[0]=="string"&&q.call(this,j[0],j[1])};
|
|
62
|
+
var e=function(j,a){var c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return{render:function(){for(var b=a.data,g=a.cellHeight,k=f("<div>",{"class":"ganttview-vtheader"}),h=0;h<b.length;h++){var m=f("<div>",{"class":"ganttview-vtheader-item"});m.append(f("<div>",{"class":"ganttview-vtheader-item-name",css:{height:b[h].series.length*g+"px"}}).append(b[h].name));for(var n=f("<div>",{"class":"ganttview-vtheader-series"}),o=0;o<b[h].series.length;o++)n.append(f("<div>",{"class":"ganttview-vtheader-series-name"}).append(b[h].series[o].name));
|
|
63
|
+
m.append(n);k.append(m)}j.append(k);b=f("<div>",{"class":"ganttview-slide-container",css:{width:a.slideWidth+"px"}});h=a.start;g=a.end;k=[];k[h.getFullYear()]=[];k[h.getFullYear()][h.getMonth()]=[h];for(h=h;h.compareTo(g)==-1;){h=h.clone().addDays(1);k[h.getFullYear()]||(k[h.getFullYear()]=[]);k[h.getFullYear()][h.getMonth()]||(k[h.getFullYear()][h.getMonth()]=[]);k[h.getFullYear()][h.getMonth()].push(h);h=h}g=dates=k;k=a.cellWidth;h=f("<div>",{"class":"ganttview-hzheader"});m=f("<div>",{"class":"ganttview-hzheader-months"});
|
|
64
|
+
n=f("<div>",{"class":"ganttview-hzheader-days"});o=0;for(var p in g)for(var t in g[p]){var x=g[p][t].length*k;o+=x;m.append(f("<div>",{"class":"ganttview-hzheader-month",css:{width:x-1+"px"}}).append(c[t]+"/"+p));for(var u in g[p][t])n.append(f("<div>",{"class":"ganttview-hzheader-day"}).append(g[p][t][u].getDate()))}m.css("width",o+"px");n.css("width",o+"px");h.append(m).append(n);b.append(h);p=a.data;g=dates;k=a.cellWidth;h=a.showWeekends;t=f("<div>",{"class":"ganttview-grid"});u=f("<div>",{"class":"ganttview-grid-row"});
|
|
65
|
+
for(var s in g)for(var v in g[s])for(var w in g[s][v]){m=f("<div>",{"class":"ganttview-grid-row-cell"});i.isWeekend(g[s][v][w])&&h&&m.addClass("ganttview-weekend");u.append(m)}s=f("div.ganttview-grid-row-cell",u).length*k;u.css("width",s+"px");t.css("width",s+"px");for(s=0;s<p.length;s++)for(v=0;v<p[s].series.length;v++)t.append(u.clone());b.append(t);s=a.data;v=f("<div>",{"class":"ganttview-blocks"});for(w=0;w<s.length;w++)for(p=0;p<s[w].series.length;p++)v.append(f("<div>",{"class":"ganttview-block-container"}));
|
|
66
|
+
b.append(v);s=a.data;v=a.cellWidth;w=a.start;p=f("div.ganttview-blocks div.ganttview-block-container",b);for(u=t=0;u<s.length;u++)for(g=0;g<s[u].series.length;g++){k=s[u].series[g];h=i.daysBetween(k.start,k.end)+1;m=i.daysBetween(w,k.start);n=m=f("<div>",{"class":"ganttview-block",title:k.name+", "+h+" days",css:{width:h*v-9+"px","margin-left":m*v+3+"px"}});o=s[u];o={id:o.id,name:o.name};f.extend(o,k);n.data("block-data",o);s[u].series[g].color&&m.css("background-color",s[u].series[g].color);m.append(f("<div>",
|
|
67
|
+
{"class":"ganttview-block-text"}).text(h));f(p[t]).append(m);t+=1}j.append(b);b=j.parent();f("div.ganttview-grid-row div.ganttview-grid-row-cell:last-child",b).addClass("last");f("div.ganttview-hzheader-days div.ganttview-hzheader-day:last-child",b).addClass("last");f("div.ganttview-hzheader-months div.ganttview-hzheader-month:last-child",b).addClass("last")}}},d=function(j,a){function c(h,m){f("div.ganttview-block",h).live("click",function(){m&&m(f(this).data("block-data"))})}function b(h,m,n,o){f("div.ganttview-block",
|
|
68
|
+
h).resizable({grid:m,handles:"e,w",stop:function(){var p=f(this);k(h,p,m,n);o&&o(p.data("block-data"))}})}function g(h,m,n,o){f("div.ganttview-block",h).draggable({axis:"x",grid:[m,m],stop:function(){var p=f(this);k(h,p,m,n);o&&o(p.data("block-data"))}})}function k(h,m,n,o){h=f("div.ganttview-slide-container",h);var p=h.scrollLeft();h=m.offset().left-h.offset().left-1+p;p=Math.round(h/n);o=o.clone().addDays(p);m.data("block-data").start=o;p=m.outerWidth();n=Math.round(p/n)-1;m.data("block-data").end=
|
|
69
|
+
o.clone().addDays(n);f("div.ganttview-block-text",m).text(n+1);m.css("top","").css("left","").css("position","relative").css("margin-left",h+"px")}return{apply:function(){a.behavior.clickable&&c(j,a.behavior.onClick);a.behavior.resizable&&b(j,a.cellWidth,a.start,a.behavior.onResize);a.behavior.draggable&&g(j,a.cellWidth,a.start,a.behavior.onDrag)}}},i={daysBetween:function(j,a){if(!j||!a)return 0;j=Date.parse(j);a=Date.parse(a);if(j.getYear()==1901||a.getYear()==8099)return 0;for(var c=0,b=j.clone();b.compareTo(a)==
|
|
70
|
+
-1;){c+=1;b.addDays(1)}return c},isWeekend:function(j){return j.getDay()%6==0},getBoundaryDatesFromData:function(j,a){var c=new Date;maxEnd=new Date;for(var b=0;b<j.length;b++)for(var g=0;g<j[b].series.length;g++){var k=Date.parse(j[b].series[g].start),h=Date.parse(j[b].series[g].end);if(b==0&&g==0){c=k;maxEnd=h}if(c.compareTo(k)==1)c=k;if(maxEnd.compareTo(h)==-1)maxEnd=h}if(i.daysBetween(c,maxEnd)<a)maxEnd=c.clone().addDays(a);return[c,maxEnd]}}})(jQuery);
|
|
@@ -1,171 +1,171 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* jquery.sparkline.js
|
|
4
|
-
*
|
|
5
|
-
* v1.6
|
|
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
|
-
* Values can also be specified in an HTML comment, or as a values attribute:
|
|
58
|
-
* <p>Sparkline: <span class="sparkline"><!--1,4,6,6,8,5,3,5 --></span></p>
|
|
59
|
-
* <p>Sparkline: <span class="sparkline" values="1,4,6,6,8,5,3,5"></span></p>
|
|
60
|
-
* $('.sparkline').sparkline();
|
|
61
|
-
*
|
|
62
|
-
* For line charts, x values can also be specified:
|
|
63
|
-
* <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>
|
|
64
|
-
* $('#sparkline1').sparkline([ [1,1], [2.7,4], [3.4,6], [5,6], [6,8], [8.7,5], [9,3], [10,5] ])
|
|
65
|
-
*
|
|
66
|
-
* By default, options should be passed in as teh second argument to the sparkline function:
|
|
67
|
-
* $('.sparkline').sparkline([1,2,3,4], {type: 'bar'})
|
|
68
|
-
*
|
|
69
|
-
* Options can also be set by passing them on the tag itself. This feature is disabled by default though
|
|
70
|
-
* as there's a slight performance overhead:
|
|
71
|
-
* $('.sparkline').sparkline([1,2,3,4], {enableTagOptions: true})
|
|
72
|
-
* <p>Sparkline: <span class="sparkline" sparkType="bar" sparkBarColor="red">loading</span></p>
|
|
73
|
-
* Prefix all options supplied as tag attribute with "spark" (configurable by setting tagOptionPrefix)
|
|
74
|
-
*
|
|
75
|
-
* Supported options:
|
|
76
|
-
* lineColor - Color of the line used for the chart
|
|
77
|
-
* fillColor - Color used to fill in the chart - Set to '' or false for a transparent chart
|
|
78
|
-
* width - Width of the chart - Defaults to 3 times the number of values in pixels
|
|
79
|
-
* height - Height of the chart - Defaults to the height of the containing element
|
|
80
|
-
* chartRangeMin - Specify the minimum value to use for the Y range of the chart - Defaults to the minimum value supplied
|
|
81
|
-
* chartRangeMax - Specify the maximum value to use for the Y range of the chart - Defaults to the maximum value supplied
|
|
82
|
-
* chartRangeClip - Clip out of range values to the max/min specified by chartRangeMin and chartRangeMax
|
|
83
|
-
* chartRangeMinX - Specify the minimum value to use for the X range of the chart - Defaults to the minimum value supplied
|
|
84
|
-
* chartRangeMaxX - Specify the maximum value to use for the X range of the chart - Defaults to the maximum value supplied
|
|
85
|
-
* composite - If true then don't erase any existing chart attached to the tag, but draw
|
|
86
|
-
* another chart over the top - Note that width and height are ignored if an
|
|
87
|
-
* existing chart is detected.
|
|
88
|
-
* tagValuesAttribute - Name of tag attribute to check for data values - Defaults to 'values'
|
|
89
|
-
* enableTagOptions - Whether to check tags for sparkline options
|
|
90
|
-
* tagOptionPrefix - Prefix used for options supplied as tag attributes - Defaults to 'spark'
|
|
91
|
-
*
|
|
92
|
-
* There are 7 types of sparkline, selected by supplying a "type" option of 'line' (default),
|
|
93
|
-
* 'bar', 'tristate', 'bullet', 'discrete', 'pie' or 'box'
|
|
94
|
-
* line - Line chart. Options:
|
|
95
|
-
* spotColor - Set to '' to not end each line in a circular spot
|
|
96
|
-
* minSpotColor - If set, color of spot at minimum value
|
|
97
|
-
* maxSpotColor - If set, color of spot at maximum value
|
|
98
|
-
* spotRadius - Radius in pixels
|
|
99
|
-
* lineWidth - Width of line in pixels
|
|
100
|
-
* normalRangeMin
|
|
101
|
-
* normalRangeMax - If set draws a filled horizontal bar between these two values marking the "normal"
|
|
102
|
-
* or expected range of values
|
|
103
|
-
* normalRangeColor - Color to use for the above bar
|
|
104
|
-
* drawNormalOnTop - Draw the normal range above the chart fill color if true
|
|
105
|
-
* defaultPixelsPerValue - Defaults to 3 pixels of width for each value in the chart
|
|
106
|
-
*
|
|
107
|
-
* bar - Bar chart. Options:
|
|
108
|
-
* barColor - Color of bars for postive values
|
|
109
|
-
* negBarColor - Color of bars for negative values
|
|
110
|
-
* zeroColor - Color of bars with zero values
|
|
111
|
-
* nullColor - Color of bars with null values - Defaults to omitting the bar entirely
|
|
112
|
-
* barWidth - Width of bars in pixels
|
|
113
|
-
* colorMap - Optional mappnig of values to colors to override the *BarColor values above
|
|
114
|
-
* can be an Array of values to control the color of individual bars
|
|
115
|
-
* barSpacing - Gap between bars in pixels
|
|
116
|
-
* zeroAxis - Centers the y-axis around zero if true
|
|
117
|
-
*
|
|
118
|
-
* tristate - Charts values of win (>0), lose (<0) or draw (=0)
|
|
119
|
-
* posBarColor - Color of win values
|
|
120
|
-
* negBarColor - Color of lose values
|
|
121
|
-
* zeroBarColor - Color of draw values
|
|
122
|
-
* barWidth - Width of bars in pixels
|
|
123
|
-
* barSpacing - Gap between bars in pixels
|
|
124
|
-
* colorMap - Optional mappnig of values to colors to override the *BarColor values above
|
|
125
|
-
* can be an Array of values to control the color of individual bars
|
|
126
|
-
*
|
|
127
|
-
* discrete - Options:
|
|
128
|
-
* lineHeight - Height of each line in pixels - Defaults to 30% of the graph height
|
|
129
|
-
* thesholdValue - Values less than this value will be drawn using thresholdColor instead of lineColor
|
|
130
|
-
* thresholdColor
|
|
131
|
-
*
|
|
132
|
-
* bullet - Values for bullet graphs msut be in the order: target, performance, range1, range2, range3, ...
|
|
133
|
-
* options:
|
|
134
|
-
* targetColor - The color of the vertical target marker
|
|
135
|
-
* targetWidth - The width of the target marker in pixels
|
|
136
|
-
* performanceColor - The color of the performance measure horizontal bar
|
|
137
|
-
* rangeColors - Colors to use for each qualitative range background color
|
|
138
|
-
*
|
|
139
|
-
* pie - Pie chart. Options:
|
|
140
|
-
* sliceColors - An array of colors to use for pie slices
|
|
141
|
-
* offset - Angle in degrees to offset the first slice - Try -90 or +90
|
|
142
|
-
*
|
|
143
|
-
* box - Box plot. Options:
|
|
144
|
-
* raw - Set to true to supply pre-computed plot points as values
|
|
145
|
-
* values should be: low_outlier, low_whisker, q1, median, q3, high_whisker, high_outlier
|
|
146
|
-
* When set to false you can supply any number of values and the box plot will
|
|
147
|
-
* be computed for you. Default is false.
|
|
148
|
-
* showOutliers - Set to true (default) to display outliers as circles
|
|
149
|
-
* outlierIRQ - Interquartile range used to determine outliers. Default 1.5
|
|
150
|
-
* boxLineColor - Outline color of the box
|
|
151
|
-
* boxFillColor - Fill color for the box
|
|
152
|
-
* whiskerColor - Line color used for whiskers
|
|
153
|
-
* outlierLineColor - Outline color of outlier circles
|
|
154
|
-
* outlierFillColor - Fill color of the outlier circles
|
|
155
|
-
* spotRadius - Radius of outlier circles
|
|
156
|
-
* medianColor - Line color of the median line
|
|
157
|
-
* target - Draw a target cross hair at the supplied value (default undefined)
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* Examples:
|
|
162
|
-
* $('#sparkline1').sparkline(myvalues, { lineColor: '#f00', fillColor: false });
|
|
163
|
-
* $('.barsparks').sparkline('html', { type:'bar', height:'40px', barWidth:5 });
|
|
164
|
-
* $('#tristate').sparkline([1,1,-1,1,0,0,-1], { type:'tristate' }):
|
|
165
|
-
* $('#discrete').sparkline([1,3,4,5,5,3,4,5], { type:'discrete' });
|
|
166
|
-
* $('#bullet').sparkline([10,12,12,9,7], { type:'bullet' });
|
|
167
|
-
* $('#pie').sparkline([1,1,2], { type:'pie' });
|
|
168
|
-
*/
|
|
2
|
+
*
|
|
3
|
+
* jquery.sparkline.js
|
|
4
|
+
*
|
|
5
|
+
* v1.6
|
|
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
|
+
* Values can also be specified in an HTML comment, or as a values attribute:
|
|
58
|
+
* <p>Sparkline: <span class="sparkline"><!--1,4,6,6,8,5,3,5 --></span></p>
|
|
59
|
+
* <p>Sparkline: <span class="sparkline" values="1,4,6,6,8,5,3,5"></span></p>
|
|
60
|
+
* $('.sparkline').sparkline();
|
|
61
|
+
*
|
|
62
|
+
* For line charts, x values can also be specified:
|
|
63
|
+
* <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>
|
|
64
|
+
* $('#sparkline1').sparkline([ [1,1], [2.7,4], [3.4,6], [5,6], [6,8], [8.7,5], [9,3], [10,5] ])
|
|
65
|
+
*
|
|
66
|
+
* By default, options should be passed in as teh second argument to the sparkline function:
|
|
67
|
+
* $('.sparkline').sparkline([1,2,3,4], {type: 'bar'})
|
|
68
|
+
*
|
|
69
|
+
* Options can also be set by passing them on the tag itself. This feature is disabled by default though
|
|
70
|
+
* as there's a slight performance overhead:
|
|
71
|
+
* $('.sparkline').sparkline([1,2,3,4], {enableTagOptions: true})
|
|
72
|
+
* <p>Sparkline: <span class="sparkline" sparkType="bar" sparkBarColor="red">loading</span></p>
|
|
73
|
+
* Prefix all options supplied as tag attribute with "spark" (configurable by setting tagOptionPrefix)
|
|
74
|
+
*
|
|
75
|
+
* Supported options:
|
|
76
|
+
* lineColor - Color of the line used for the chart
|
|
77
|
+
* fillColor - Color used to fill in the chart - Set to '' or false for a transparent chart
|
|
78
|
+
* width - Width of the chart - Defaults to 3 times the number of values in pixels
|
|
79
|
+
* height - Height of the chart - Defaults to the height of the containing element
|
|
80
|
+
* chartRangeMin - Specify the minimum value to use for the Y range of the chart - Defaults to the minimum value supplied
|
|
81
|
+
* chartRangeMax - Specify the maximum value to use for the Y range of the chart - Defaults to the maximum value supplied
|
|
82
|
+
* chartRangeClip - Clip out of range values to the max/min specified by chartRangeMin and chartRangeMax
|
|
83
|
+
* chartRangeMinX - Specify the minimum value to use for the X range of the chart - Defaults to the minimum value supplied
|
|
84
|
+
* chartRangeMaxX - Specify the maximum value to use for the X range of the chart - Defaults to the maximum value supplied
|
|
85
|
+
* composite - If true then don't erase any existing chart attached to the tag, but draw
|
|
86
|
+
* another chart over the top - Note that width and height are ignored if an
|
|
87
|
+
* existing chart is detected.
|
|
88
|
+
* tagValuesAttribute - Name of tag attribute to check for data values - Defaults to 'values'
|
|
89
|
+
* enableTagOptions - Whether to check tags for sparkline options
|
|
90
|
+
* tagOptionPrefix - Prefix used for options supplied as tag attributes - Defaults to 'spark'
|
|
91
|
+
*
|
|
92
|
+
* There are 7 types of sparkline, selected by supplying a "type" option of 'line' (default),
|
|
93
|
+
* 'bar', 'tristate', 'bullet', 'discrete', 'pie' or 'box'
|
|
94
|
+
* line - Line chart. Options:
|
|
95
|
+
* spotColor - Set to '' to not end each line in a circular spot
|
|
96
|
+
* minSpotColor - If set, color of spot at minimum value
|
|
97
|
+
* maxSpotColor - If set, color of spot at maximum value
|
|
98
|
+
* spotRadius - Radius in pixels
|
|
99
|
+
* lineWidth - Width of line in pixels
|
|
100
|
+
* normalRangeMin
|
|
101
|
+
* normalRangeMax - If set draws a filled horizontal bar between these two values marking the "normal"
|
|
102
|
+
* or expected range of values
|
|
103
|
+
* normalRangeColor - Color to use for the above bar
|
|
104
|
+
* drawNormalOnTop - Draw the normal range above the chart fill color if true
|
|
105
|
+
* defaultPixelsPerValue - Defaults to 3 pixels of width for each value in the chart
|
|
106
|
+
*
|
|
107
|
+
* bar - Bar chart. Options:
|
|
108
|
+
* barColor - Color of bars for postive values
|
|
109
|
+
* negBarColor - Color of bars for negative values
|
|
110
|
+
* zeroColor - Color of bars with zero values
|
|
111
|
+
* nullColor - Color of bars with null values - Defaults to omitting the bar entirely
|
|
112
|
+
* barWidth - Width of bars in pixels
|
|
113
|
+
* colorMap - Optional mappnig of values to colors to override the *BarColor values above
|
|
114
|
+
* can be an Array of values to control the color of individual bars
|
|
115
|
+
* barSpacing - Gap between bars in pixels
|
|
116
|
+
* zeroAxis - Centers the y-axis around zero if true
|
|
117
|
+
*
|
|
118
|
+
* tristate - Charts values of win (>0), lose (<0) or draw (=0)
|
|
119
|
+
* posBarColor - Color of win values
|
|
120
|
+
* negBarColor - Color of lose values
|
|
121
|
+
* zeroBarColor - Color of draw values
|
|
122
|
+
* barWidth - Width of bars in pixels
|
|
123
|
+
* barSpacing - Gap between bars in pixels
|
|
124
|
+
* colorMap - Optional mappnig of values to colors to override the *BarColor values above
|
|
125
|
+
* can be an Array of values to control the color of individual bars
|
|
126
|
+
*
|
|
127
|
+
* discrete - Options:
|
|
128
|
+
* lineHeight - Height of each line in pixels - Defaults to 30% of the graph height
|
|
129
|
+
* thesholdValue - Values less than this value will be drawn using thresholdColor instead of lineColor
|
|
130
|
+
* thresholdColor
|
|
131
|
+
*
|
|
132
|
+
* bullet - Values for bullet graphs msut be in the order: target, performance, range1, range2, range3, ...
|
|
133
|
+
* options:
|
|
134
|
+
* targetColor - The color of the vertical target marker
|
|
135
|
+
* targetWidth - The width of the target marker in pixels
|
|
136
|
+
* performanceColor - The color of the performance measure horizontal bar
|
|
137
|
+
* rangeColors - Colors to use for each qualitative range background color
|
|
138
|
+
*
|
|
139
|
+
* pie - Pie chart. Options:
|
|
140
|
+
* sliceColors - An array of colors to use for pie slices
|
|
141
|
+
* offset - Angle in degrees to offset the first slice - Try -90 or +90
|
|
142
|
+
*
|
|
143
|
+
* box - Box plot. Options:
|
|
144
|
+
* raw - Set to true to supply pre-computed plot points as values
|
|
145
|
+
* values should be: low_outlier, low_whisker, q1, median, q3, high_whisker, high_outlier
|
|
146
|
+
* When set to false you can supply any number of values and the box plot will
|
|
147
|
+
* be computed for you. Default is false.
|
|
148
|
+
* showOutliers - Set to true (default) to display outliers as circles
|
|
149
|
+
* outlierIRQ - Interquartile range used to determine outliers. Default 1.5
|
|
150
|
+
* boxLineColor - Outline color of the box
|
|
151
|
+
* boxFillColor - Fill color for the box
|
|
152
|
+
* whiskerColor - Line color used for whiskers
|
|
153
|
+
* outlierLineColor - Outline color of outlier circles
|
|
154
|
+
* outlierFillColor - Fill color of the outlier circles
|
|
155
|
+
* spotRadius - Radius of outlier circles
|
|
156
|
+
* medianColor - Line color of the median line
|
|
157
|
+
* target - Draw a target cross hair at the supplied value (default undefined)
|
|
158
|
+
*
|
|
159
|
+
*
|
|
160
|
+
*
|
|
161
|
+
* Examples:
|
|
162
|
+
* $('#sparkline1').sparkline(myvalues, { lineColor: '#f00', fillColor: false });
|
|
163
|
+
* $('.barsparks').sparkline('html', { type:'bar', height:'40px', barWidth:5 });
|
|
164
|
+
* $('#tristate').sparkline([1,1,-1,1,0,0,-1], { type:'tristate' }):
|
|
165
|
+
* $('#discrete').sparkline([1,3,4,5,5,3,4,5], { type:'discrete' });
|
|
166
|
+
* $('#bullet').sparkline([10,12,12,9,7], { type:'bullet' });
|
|
167
|
+
* $('#pie').sparkline([1,1,2], { type:'pie' });
|
|
168
|
+
*/
|
|
169
169
|
|
|
170
170
|
|
|
171
171
|
(function($) {
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
lineColor : '#00f',
|
|
181
181
|
fillColor : '#cdf',
|
|
182
182
|
defaultPixelsPerValue : 3,
|
|
183
|
-
width : 'auto',
|
|
183
|
+
width : 'auto',
|
|
184
184
|
height : 'auto',
|
|
185
185
|
composite : false,
|
|
186
186
|
tagValuesAttribute: 'values',
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
spotRadius : 1.5,
|
|
194
194
|
minSpotColor : '#f80',
|
|
195
195
|
maxSpotColor : '#f80',
|
|
196
|
-
lineWidth: 1,
|
|
196
|
+
lineWidth: 1,
|
|
197
197
|
normalRangeMin : undefined,
|
|
198
198
|
normalRangeMax : undefined,
|
|
199
199
|
normalRangeColor : '#ccc',
|
|
@@ -272,11 +272,11 @@
|
|
|
272
272
|
if (use_existing && this[0].VCanvas) {
|
|
273
273
|
return this[0].VCanvas;
|
|
274
274
|
}
|
|
275
|
-
if (width === undefined) {
|
|
276
|
-
width
|
|
275
|
+
if (width === undefined) {
|
|
276
|
+
width = $(this).innerWidth();
|
|
277
277
|
}
|
|
278
278
|
if (height === undefined) {
|
|
279
|
-
height
|
|
279
|
+
height = $(this).innerHeight();
|
|
280
280
|
}
|
|
281
281
|
if ($.browser.hasCanvas) {
|
|
282
282
|
return new VCanvas_canvas(width, height, this);
|
|
@@ -295,9 +295,9 @@
|
|
|
295
295
|
var options = new $.fn.sparkline.options(this, userOptions);
|
|
296
296
|
var render = function() {
|
|
297
297
|
var values, width, height;
|
|
298
|
-
if (uservalues==='html' || uservalues===undefined) {
|
|
298
|
+
if (uservalues === 'html' || uservalues === undefined) {
|
|
299
299
|
var vals = this.getAttribute(options.get('tagValuesAttribute'));
|
|
300
|
-
if (vals===undefined || vals===null) {
|
|
300
|
+
if (vals === undefined || vals === null) {
|
|
301
301
|
vals = $(this).html();
|
|
302
302
|
}
|
|
303
303
|
values = vals.replace(/(^\s*<!--)|(-->\s*$)|\s+/g, '').split(',');
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
values = uservalues;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
width = options.get('width')=='auto' ? values.length*options.get('defaultPixelsPerValue') : options.get('width');
|
|
308
|
+
width = options.get('width') == 'auto' ? values.length * options.get('defaultPixelsPerValue') : options.get('width');
|
|
309
309
|
if (options.get('height') == 'auto') {
|
|
310
310
|
if (!options.get('composite') || !this.VCanvas) {
|
|
311
311
|
// must be a better way to get the line height
|
|
@@ -334,7 +334,7 @@
|
|
|
334
334
|
|
|
335
335
|
|
|
336
336
|
$.sparkline_display_visible = function() {
|
|
337
|
-
for (var i=pending.length-1; i>=0; i--) {
|
|
337
|
+
for (var i = pending.length - 1; i >= 0; i--) {
|
|
338
338
|
var el = pending[i][0];
|
|
339
339
|
if ($(el).is(':visible') && !$(el).parents().is(':hidden')) {
|
|
340
340
|
pending[i][1].call(el);
|
|
@@ -349,7 +349,7 @@
|
|
|
349
349
|
*/
|
|
350
350
|
var UNSET_OPTION = {};
|
|
351
351
|
var normalizeValue = function(val) {
|
|
352
|
-
switch(val) {
|
|
352
|
+
switch (val) {
|
|
353
353
|
case 'undefined':
|
|
354
354
|
val = undefined;
|
|
355
355
|
break;
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
var defaults = $.fn.sparkline.defaults;
|
|
379
379
|
var base = defaults.common;
|
|
380
380
|
this.tagOptionsPrefix = userOptions.enableTagOptions && (userOptions.tagOptionsPrefix || base.tagOptionsPrefix);
|
|
381
|
-
|
|
381
|
+
|
|
382
382
|
var tagOptionType = this.getTagSetting('type');
|
|
383
383
|
if (tagOptionType === UNSET_OPTION) {
|
|
384
384
|
extendedOptions = defaults[userOptions.type || base.type];
|
|
@@ -401,14 +401,14 @@
|
|
|
401
401
|
if (val === undefined || val === null) {
|
|
402
402
|
val = UNSET_OPTION;
|
|
403
403
|
} else if (val.substr(0, 1) == '[') {
|
|
404
|
-
val = val.substr(1, val.length-2).split(',');
|
|
405
|
-
for(i=val.length; i--;) {
|
|
404
|
+
val = val.substr(1, val.length - 2).split(',');
|
|
405
|
+
for (i = val.length; i--;) {
|
|
406
406
|
val[i] = normalizeValue(val[i].replace(/(^\s*)|(\s*$)/g, ''));
|
|
407
407
|
}
|
|
408
408
|
} else if (val.substr(0, 1) == '{') {
|
|
409
|
-
var pairs= val.substr(1, val.length-2).split(',');
|
|
409
|
+
var pairs = val.substr(1, val.length - 2).split(',');
|
|
410
410
|
val = {};
|
|
411
|
-
for(i=pairs.length; i--;) {
|
|
411
|
+
for (i = pairs.length; i--;) {
|
|
412
412
|
var keyval = pairs[i].split(':', 2);
|
|
413
413
|
val[keyval[0].replace(/(^\s*)|(\s*$)/g, '')] = normalizeValue(keyval[1].replace(/(^\s*)|(\s*$)/g, ''));
|
|
414
414
|
}
|
|
@@ -417,7 +417,7 @@
|
|
|
417
417
|
}
|
|
418
418
|
this.tagValCache.key = val;
|
|
419
419
|
}
|
|
420
|
-
return val;
|
|
420
|
+
return val;
|
|
421
421
|
};
|
|
422
422
|
|
|
423
423
|
$.fn.sparkline.options.prototype.get = function(key) {
|
|
@@ -434,10 +434,10 @@
|
|
|
434
434
|
*/
|
|
435
435
|
$.fn.sparkline.line = function(values, options, width, height) {
|
|
436
436
|
var xvalues = [], yvalues = [], yminmax = [];
|
|
437
|
-
for (var i=0; i<values.length; i++) {
|
|
437
|
+
for (var i = 0; i < values.length; i++) {
|
|
438
438
|
var val = values[i];
|
|
439
|
-
var isstr = typeof(values[i])=='string';
|
|
440
|
-
var isarray = typeof(values[i])=='object' && values[i] instanceof Array;
|
|
439
|
+
var isstr = typeof(values[i]) == 'string';
|
|
440
|
+
var isarray = typeof(values[i]) == 'object' && values[i] instanceof Array;
|
|
441
441
|
var sp = isstr && values[i].split(':');
|
|
442
442
|
if (isstr && sp.length == 2) { // x:y
|
|
443
443
|
xvalues.push(Number(sp[0]));
|
|
@@ -449,7 +449,7 @@
|
|
|
449
449
|
yminmax.push(val[1]);
|
|
450
450
|
} else {
|
|
451
451
|
xvalues.push(i);
|
|
452
|
-
if (values[i]===null || values[i]=='null') {
|
|
452
|
+
if (values[i] === null || values[i] == 'null') {
|
|
453
453
|
yvalues.push(null);
|
|
454
454
|
} else {
|
|
455
455
|
yvalues.push(Number(val));
|
|
@@ -472,31 +472,31 @@
|
|
|
472
472
|
var normalRangeMin = options.get('normalRangeMin');
|
|
473
473
|
var normalRangeMax = options.get('normalRangeMax');
|
|
474
474
|
|
|
475
|
-
if (normalRangeMin!==undefined) {
|
|
476
|
-
if (normalRangeMin<miny) {
|
|
475
|
+
if (normalRangeMin !== undefined) {
|
|
476
|
+
if (normalRangeMin < miny) {
|
|
477
477
|
miny = normalRangeMin;
|
|
478
478
|
}
|
|
479
|
-
if (normalRangeMax>maxy) {
|
|
479
|
+
if (normalRangeMax > maxy) {
|
|
480
480
|
maxy = normalRangeMax;
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
|
-
if (options.get('chartRangeMin')!==undefined && (options.get('chartRangeClip') ||
|
|
483
|
+
if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < miny)) {
|
|
484
484
|
miny = options.get('chartRangeMin');
|
|
485
485
|
}
|
|
486
|
-
if (options.get('chartRangeMax')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMax')>maxy)) {
|
|
486
|
+
if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > maxy)) {
|
|
487
487
|
maxy = options.get('chartRangeMax');
|
|
488
488
|
}
|
|
489
|
-
if (options.get('chartRangeMinX')!==undefined && (options.get('chartRangeClipX') || options.get('chartRangeMinX')<minx)) {
|
|
489
|
+
if (options.get('chartRangeMinX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMinX') < minx)) {
|
|
490
490
|
minx = options.get('chartRangeMinX');
|
|
491
491
|
}
|
|
492
|
-
if (options.get('chartRangeMaxX')!==undefined && (options.get('chartRangeClipX') || options.get('chartRangeMaxX')>maxx)) {
|
|
492
|
+
if (options.get('chartRangeMaxX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMaxX') > maxx)) {
|
|
493
493
|
maxx = options.get('chartRangeMaxX');
|
|
494
494
|
}
|
|
495
|
-
var rangex = maxx-minx === 0 ? 1 : maxx-minx;
|
|
496
|
-
var rangey = maxy-miny === 0 ? 1 : maxy-miny;
|
|
497
|
-
var vl = yvalues.length-1;
|
|
495
|
+
var rangex = maxx - minx === 0 ? 1 : maxx - minx;
|
|
496
|
+
var rangey = maxy - miny === 0 ? 1 : maxy - miny;
|
|
497
|
+
var vl = yvalues.length - 1;
|
|
498
498
|
|
|
499
|
-
if (vl<1) {
|
|
499
|
+
if (vl < 1) {
|
|
500
500
|
this.innerHTML = '';
|
|
501
501
|
return;
|
|
502
502
|
}
|
|
@@ -509,23 +509,23 @@
|
|
|
509
509
|
var canvas_left = 0;
|
|
510
510
|
|
|
511
511
|
var spotRadius = options.get('spotRadius');
|
|
512
|
-
if (spotRadius && (canvas_width < (spotRadius*4) || canvas_height < (spotRadius*4))) {
|
|
512
|
+
if (spotRadius && (canvas_width < (spotRadius * 4) || canvas_height < (spotRadius * 4))) {
|
|
513
513
|
spotRadius = 0;
|
|
514
514
|
}
|
|
515
515
|
if (spotRadius) {
|
|
516
516
|
// adjust the canvas size as required so that spots will fit
|
|
517
|
-
if (options.get('minSpotColor') || (options.get('spotColor') && yvalues[vl]==miny)) {
|
|
517
|
+
if (options.get('minSpotColor') || (options.get('spotColor') && yvalues[vl] == miny)) {
|
|
518
518
|
canvas_height -= Math.ceil(spotRadius);
|
|
519
519
|
}
|
|
520
|
-
if (options.get('maxSpotColor') || (options.get('spotColor') && yvalues[vl]==maxy)) {
|
|
520
|
+
if (options.get('maxSpotColor') || (options.get('spotColor') && yvalues[vl] == maxy)) {
|
|
521
521
|
canvas_height -= Math.ceil(spotRadius);
|
|
522
522
|
canvas_top += Math.ceil(spotRadius);
|
|
523
523
|
}
|
|
524
|
-
if (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[0]==miny || yvalues[0]==maxy)) {
|
|
524
|
+
if (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[0] == miny || yvalues[0] == maxy)) {
|
|
525
525
|
canvas_left += Math.ceil(spotRadius);
|
|
526
526
|
canvas_width -= Math.ceil(spotRadius);
|
|
527
527
|
}
|
|
528
|
-
if (options.get('spotColor') || (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[vl]==miny||yvalues[vl]==maxy))) {
|
|
528
|
+
if (options.get('spotColor') || (options.get('minSpotColor') || options.get('maxSpotColor') && (yvalues[vl] == miny || yvalues[vl] == maxy))) {
|
|
529
529
|
canvas_width -= Math.ceil(spotRadius);
|
|
530
530
|
}
|
|
531
531
|
}
|
|
@@ -534,9 +534,9 @@
|
|
|
534
534
|
canvas_height--;
|
|
535
535
|
|
|
536
536
|
var drawNormalRange = function() {
|
|
537
|
-
if (normalRangeMin!==undefined) {
|
|
538
|
-
var ytop = canvas_top+Math.round(canvas_height-(canvas_height*((normalRangeMax-miny)/rangey)));
|
|
539
|
-
var height = Math.round((canvas_height*(normalRangeMax-normalRangeMin))/rangey);
|
|
537
|
+
if (normalRangeMin !== undefined) {
|
|
538
|
+
var ytop = canvas_top + Math.round(canvas_height - (canvas_height * ((normalRangeMax - miny) / rangey)));
|
|
539
|
+
var height = Math.round((canvas_height * (normalRangeMax - normalRangeMin)) / rangey);
|
|
540
540
|
target.drawRect(canvas_left, ytop, canvas_width, height, undefined, options.get('normalRangeColor'));
|
|
541
541
|
}
|
|
542
542
|
};
|
|
@@ -547,47 +547,47 @@
|
|
|
547
547
|
|
|
548
548
|
var path = [];
|
|
549
549
|
var paths = [path];
|
|
550
|
-
var x, y, vlen=yvalues.length;
|
|
551
|
-
for(i=0; i<vlen; i++) {
|
|
552
|
-
x=xvalues[i];
|
|
553
|
-
y=yvalues[i];
|
|
554
|
-
if (y===null) {
|
|
550
|
+
var x, y, vlen = yvalues.length;
|
|
551
|
+
for (i = 0; i < vlen; i++) {
|
|
552
|
+
x = xvalues[i];
|
|
553
|
+
y = yvalues[i];
|
|
554
|
+
if (y === null) {
|
|
555
555
|
if (i) {
|
|
556
|
-
if (yvalues[i-1]!==null) {
|
|
556
|
+
if (yvalues[i - 1] !== null) {
|
|
557
557
|
path = [];
|
|
558
558
|
paths.push(path);
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
} else {
|
|
562
562
|
if (y < miny) {
|
|
563
|
-
y=miny;
|
|
563
|
+
y = miny;
|
|
564
564
|
}
|
|
565
565
|
if (y > maxy) {
|
|
566
|
-
y=maxy;
|
|
566
|
+
y = maxy;
|
|
567
567
|
}
|
|
568
568
|
if (!path.length) {
|
|
569
569
|
// previous value was null
|
|
570
|
-
path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+canvas_height]);
|
|
570
|
+
path.push([canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + canvas_height]);
|
|
571
571
|
}
|
|
572
|
-
path.push([canvas_left+Math.round((x-minx)*(canvas_width/rangex)), canvas_top+Math.round(canvas_height-(canvas_height*((y-miny)/rangey)))]);
|
|
572
|
+
path.push([canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((y - miny) / rangey)))]);
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
var lineshapes = [];
|
|
576
576
|
var fillshapes = [];
|
|
577
|
-
var plen=paths.length;
|
|
578
|
-
for(i=0; i<plen; i++) {
|
|
577
|
+
var plen = paths.length;
|
|
578
|
+
for (i = 0; i < plen; i++) {
|
|
579
579
|
path = paths[i];
|
|
580
580
|
if (!path.length) {
|
|
581
581
|
continue; // last value was null
|
|
582
582
|
}
|
|
583
583
|
if (options.get('fillColor')) {
|
|
584
|
-
path.push([path[path.length-1][0], canvas_top+canvas_height-1]);
|
|
584
|
+
path.push([path[path.length - 1][0], canvas_top + canvas_height - 1]);
|
|
585
585
|
fillshapes.push(path.slice(0));
|
|
586
586
|
path.pop();
|
|
587
587
|
}
|
|
588
588
|
// if there's only a single point in this path, then we want to display it as a vertical line
|
|
589
589
|
// which means we keep path[0] as is
|
|
590
|
-
if (path.length>2) {
|
|
590
|
+
if (path.length > 2) {
|
|
591
591
|
// else we want the first value
|
|
592
592
|
path[0] = [ path[0][0], path[1][1] ];
|
|
593
593
|
}
|
|
@@ -596,7 +596,7 @@
|
|
|
596
596
|
|
|
597
597
|
// draw the fill first, then optionally the normal range, then the line on top of that
|
|
598
598
|
plen = fillshapes.length;
|
|
599
|
-
for(i=0; i<plen; i++) {
|
|
599
|
+
for (i = 0; i < plen; i++) {
|
|
600
600
|
target.drawShape(fillshapes[i], undefined, options.get('fillColor'));
|
|
601
601
|
}
|
|
602
602
|
|
|
@@ -605,21 +605,21 @@
|
|
|
605
605
|
}
|
|
606
606
|
|
|
607
607
|
plen = lineshapes.length;
|
|
608
|
-
for(i=0; i<plen; i++) {
|
|
608
|
+
for (i = 0; i < plen; i++) {
|
|
609
609
|
target.drawShape(lineshapes[i], options.get('lineColor'), undefined, options.get('lineWidth'));
|
|
610
610
|
}
|
|
611
|
-
|
|
611
|
+
|
|
612
612
|
if (spotRadius && options.get('spotColor')) {
|
|
613
|
-
target.drawCircle(canvas_left+Math.round(xvalues[xvalues.length-1]*(canvas_width/rangex)),
|
|
613
|
+
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))), spotRadius, undefined, options.get('spotColor'));
|
|
614
614
|
}
|
|
615
|
-
if (maxy!=minyval) {
|
|
615
|
+
if (maxy != minyval) {
|
|
616
616
|
if (spotRadius && options.get('minSpotColor')) {
|
|
617
617
|
x = xvalues[$.inArray(minyval, yvalues)];
|
|
618
|
-
target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)),
|
|
618
|
+
target.drawCircle(canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((minyval - miny) / rangey))), spotRadius, undefined, options.get('minSpotColor'));
|
|
619
619
|
}
|
|
620
620
|
if (spotRadius && options.get('maxSpotColor')) {
|
|
621
621
|
x = xvalues[$.inArray(maxyval, yvalues)];
|
|
622
|
-
target.drawCircle(canvas_left+Math.round((x-minx)*(canvas_width/rangex)),
|
|
622
|
+
target.drawCircle(canvas_left + Math.round((x - minx) * (canvas_width / rangex)), canvas_top + Math.round(canvas_height - (canvas_height * ((maxyval - miny) / rangey))), spotRadius, undefined, options.get('maxSpotColor'));
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
|
|
@@ -629,15 +629,15 @@
|
|
|
629
629
|
}
|
|
630
630
|
};
|
|
631
631
|
|
|
632
|
-
|
|
633
|
-
/**
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
634
|
* Bar charts
|
|
635
635
|
*/
|
|
636
636
|
$.fn.sparkline.bar = function(values, options, width, height) {
|
|
637
|
-
width = (values.length * options.get('barWidth')) + ((values.length-1) * options.get('barSpacing'));
|
|
637
|
+
width = (values.length * options.get('barWidth')) + ((values.length - 1) * options.get('barSpacing'));
|
|
638
638
|
var num_values = [];
|
|
639
|
-
for(var i=0, vlen=values.length; i<vlen; i++) {
|
|
640
|
-
if (values[i]=='null' || values[i]===null) {
|
|
639
|
+
for (var i = 0, vlen = values.length; i < vlen; i++) {
|
|
640
|
+
if (values[i] == 'null' || values[i] === null) {
|
|
641
641
|
values[i] = null;
|
|
642
642
|
} else {
|
|
643
643
|
values[i] = Number(values[i]);
|
|
@@ -645,18 +645,18 @@
|
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
647
|
var max = Math.max.apply(Math, num_values),
|
|
648
|
-
|
|
649
|
-
if (options.get('chartRangeMin')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMin')<min)) {
|
|
648
|
+
min = Math.min.apply(Math, num_values);
|
|
649
|
+
if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < min)) {
|
|
650
650
|
min = options.get('chartRangeMin');
|
|
651
651
|
}
|
|
652
|
-
if (options.get('chartRangeMax')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMax')>max)) {
|
|
652
|
+
if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) {
|
|
653
653
|
max = options.get('chartRangeMax');
|
|
654
654
|
}
|
|
655
655
|
var zeroAxis = options.get('zeroAxis');
|
|
656
656
|
if (zeroAxis === undefined) {
|
|
657
|
-
zeroAxis = min<0;
|
|
657
|
+
zeroAxis = min < 0;
|
|
658
658
|
}
|
|
659
|
-
var range = max-min === 0 ? 1 : max-min;
|
|
659
|
+
var range = max - min === 0 ? 1 : max - min;
|
|
660
660
|
|
|
661
661
|
var colorMapByIndex, colorMapByValue;
|
|
662
662
|
if ($.isArray(options.get('colorMap'))) {
|
|
@@ -670,50 +670,50 @@
|
|
|
670
670
|
var target = $(this).simpledraw(width, height, options.get('composite'));
|
|
671
671
|
if (target) {
|
|
672
672
|
var color,
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
for(i=values.length; i--;) {
|
|
677
|
-
var x = i*(options.get('barWidth')+options.get('barSpacing')),
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
if (val===null) {
|
|
673
|
+
canvas_height = target.pixel_height,
|
|
674
|
+
yzero = min < 0 && zeroAxis ? canvas_height - Math.round(canvas_height * (Math.abs(min) / range)) - 1 : canvas_height - 1;
|
|
675
|
+
|
|
676
|
+
for (i = values.length; i--;) {
|
|
677
|
+
var x = i * (options.get('barWidth') + options.get('barSpacing')),
|
|
678
|
+
y,
|
|
679
|
+
val = values[i];
|
|
680
|
+
if (val === null) {
|
|
681
681
|
if (options.get('nullColor')) {
|
|
682
682
|
color = options.get('nullColor');
|
|
683
|
-
val = (zeroAxis && min<0) ? 0 : min;
|
|
683
|
+
val = (zeroAxis && min < 0) ? 0 : min;
|
|
684
684
|
height = 1;
|
|
685
|
-
y = (zeroAxis && min<0) ? yzero : canvas_height - height;
|
|
685
|
+
y = (zeroAxis && min < 0) ? yzero : canvas_height - height;
|
|
686
686
|
} else {
|
|
687
687
|
continue;
|
|
688
688
|
}
|
|
689
689
|
} else {
|
|
690
690
|
if (val < min) {
|
|
691
|
-
val=min;
|
|
691
|
+
val = min;
|
|
692
692
|
}
|
|
693
693
|
if (val > max) {
|
|
694
|
-
val=max;
|
|
694
|
+
val = max;
|
|
695
695
|
}
|
|
696
696
|
color = (val < 0) ? options.get('negBarColor') : options.get('barColor');
|
|
697
|
-
if (zeroAxis && min<0) {
|
|
698
|
-
height = Math.round(canvas_height*((Math.abs(val)/range)))+1;
|
|
699
|
-
y = (val < 0) ? yzero : yzero-height;
|
|
697
|
+
if (zeroAxis && min < 0) {
|
|
698
|
+
height = Math.round(canvas_height * ((Math.abs(val) / range))) + 1;
|
|
699
|
+
y = (val < 0) ? yzero : yzero - height;
|
|
700
700
|
} else {
|
|
701
|
-
height = Math.round(canvas_height*((val-min)/range))+1;
|
|
702
|
-
y = canvas_height-height;
|
|
701
|
+
height = Math.round(canvas_height * ((val - min) / range)) + 1;
|
|
702
|
+
y = canvas_height - height;
|
|
703
703
|
}
|
|
704
|
-
if (val===0 && options.get('zeroColor')!==undefined) {
|
|
704
|
+
if (val === 0 && options.get('zeroColor') !== undefined) {
|
|
705
705
|
color = options.get('zeroColor');
|
|
706
706
|
}
|
|
707
707
|
if (colorMapByValue && colorMapByValue[val]) {
|
|
708
708
|
color = colorMapByValue[val];
|
|
709
|
-
} else if (colorMapByIndex && colorMapByIndex.length>i) {
|
|
709
|
+
} else if (colorMapByIndex && colorMapByIndex.length > i) {
|
|
710
710
|
color = colorMapByIndex[i];
|
|
711
711
|
}
|
|
712
|
-
if (color===null) {
|
|
712
|
+
if (color === null) {
|
|
713
713
|
continue;
|
|
714
714
|
}
|
|
715
715
|
}
|
|
716
|
-
target.drawRect(x, y, options.get('barWidth')-1, height-1, color, color);
|
|
716
|
+
target.drawRect(x, y, options.get('barWidth') - 1, height - 1, color, color);
|
|
717
717
|
}
|
|
718
718
|
} else {
|
|
719
719
|
// Remove the tag contents if sparklines aren't supported
|
|
@@ -727,7 +727,7 @@
|
|
|
727
727
|
*/
|
|
728
728
|
$.fn.sparkline.tristate = function(values, options, width, height) {
|
|
729
729
|
values = $.map(values, Number);
|
|
730
|
-
width = (values.length * options.get('barWidth')) + ((values.length-1) * options.get('barSpacing'));
|
|
730
|
+
width = (values.length * options.get('barWidth')) + ((values.length - 1) * options.get('barSpacing'));
|
|
731
731
|
|
|
732
732
|
var colorMapByIndex, colorMapByValue;
|
|
733
733
|
if ($.isArray(options.get('colorMap'))) {
|
|
@@ -741,33 +741,33 @@
|
|
|
741
741
|
var target = $(this).simpledraw(width, height, options.get('composite'));
|
|
742
742
|
if (target) {
|
|
743
743
|
var canvas_height = target.pixel_height,
|
|
744
|
-
|
|
744
|
+
half_height = Math.round(canvas_height / 2);
|
|
745
745
|
|
|
746
|
-
for(var i=values.length; i--;) {
|
|
747
|
-
var x = i*(options.get('barWidth')+options.get('barSpacing')),
|
|
748
|
-
|
|
746
|
+
for (var i = values.length; i--;) {
|
|
747
|
+
var x = i * (options.get('barWidth') + options.get('barSpacing')),
|
|
748
|
+
y, color;
|
|
749
749
|
if (values[i] < 0) {
|
|
750
750
|
y = half_height;
|
|
751
|
-
height = half_height-1;
|
|
751
|
+
height = half_height - 1;
|
|
752
752
|
color = options.get('negBarColor');
|
|
753
753
|
} else if (values[i] > 0) {
|
|
754
754
|
y = 0;
|
|
755
|
-
height = half_height-1;
|
|
755
|
+
height = half_height - 1;
|
|
756
756
|
color = options.get('posBarColor');
|
|
757
757
|
} else {
|
|
758
|
-
y = half_height-1;
|
|
758
|
+
y = half_height - 1;
|
|
759
759
|
height = 2;
|
|
760
760
|
color = options.get('zeroBarColor');
|
|
761
761
|
}
|
|
762
762
|
if (colorMapByValue && colorMapByValue[values[i]]) {
|
|
763
763
|
color = colorMapByValue[values[i]];
|
|
764
|
-
} else if (colorMapByIndex && colorMapByIndex.length>i) {
|
|
764
|
+
} else if (colorMapByIndex && colorMapByIndex.length > i) {
|
|
765
765
|
color = colorMapByIndex[i];
|
|
766
766
|
}
|
|
767
|
-
if (color===null) {
|
|
767
|
+
if (color === null) {
|
|
768
768
|
continue;
|
|
769
769
|
}
|
|
770
|
-
target.drawRect(x, y, options.get('barWidth')-1, height-1, color, color);
|
|
770
|
+
target.drawRect(x, y, options.get('barWidth') - 1, height - 1, color, color);
|
|
771
771
|
}
|
|
772
772
|
} else {
|
|
773
773
|
// Remove the tag contents if sparklines aren't supported
|
|
@@ -776,46 +776,46 @@
|
|
|
776
776
|
};
|
|
777
777
|
|
|
778
778
|
|
|
779
|
-
/**
|
|
779
|
+
/**
|
|
780
780
|
* Discrete charts
|
|
781
781
|
*/
|
|
782
782
|
$.fn.sparkline.discrete = function(values, options, width, height) {
|
|
783
783
|
values = $.map(values, Number);
|
|
784
|
-
width = options.get('width')=='auto' ? values.length*2 : width;
|
|
784
|
+
width = options.get('width') == 'auto' ? values.length * 2 : width;
|
|
785
785
|
var interval = Math.floor(width / values.length);
|
|
786
786
|
|
|
787
787
|
var target = $(this).simpledraw(width, height, options.get('composite'));
|
|
788
788
|
if (target) {
|
|
789
789
|
var canvas_height = target.pixel_height,
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
if (options.get('chartRangeMin')!==undefined && (options.get('chartRangeClip') || options.get('chartRangeMin')<min)) {
|
|
790
|
+
line_height = options.get('lineHeight') == 'auto' ? Math.round(canvas_height * 0.3) : options.get('lineHeight'),
|
|
791
|
+
pheight = canvas_height - line_height,
|
|
792
|
+
min = Math.min.apply(Math, values),
|
|
793
|
+
max = Math.max.apply(Math, values);
|
|
794
|
+
if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < min)) {
|
|
795
795
|
min = options.get('chartRangeMin');
|
|
796
796
|
}
|
|
797
|
-
if (options.get('chartRangeMax')!==undefined && (options.get('chartRangeClip')
|
|
797
|
+
if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) {
|
|
798
798
|
max = options.get('chartRangeMax');
|
|
799
799
|
}
|
|
800
|
-
var range = max-min;
|
|
800
|
+
var range = max - min;
|
|
801
801
|
|
|
802
|
-
for(var i=values.length; i--;) {
|
|
802
|
+
for (var i = values.length; i--;) {
|
|
803
803
|
var val = values[i];
|
|
804
804
|
if (val < min) {
|
|
805
|
-
val=min;
|
|
805
|
+
val = min;
|
|
806
806
|
}
|
|
807
807
|
if (val > max) {
|
|
808
|
-
val=max;
|
|
808
|
+
val = max;
|
|
809
809
|
}
|
|
810
|
-
var x = (i*interval),
|
|
811
|
-
|
|
812
|
-
target.drawLine(x, ytop, x, ytop+line_height, (options.get('thresholdColor') && val < options.get('thresholdValue')) ? options.get('thresholdColor') : options.get('lineColor'));
|
|
810
|
+
var x = (i * interval),
|
|
811
|
+
ytop = Math.round(pheight - pheight * ((val - min) / range));
|
|
812
|
+
target.drawLine(x, ytop, x, ytop + line_height, (options.get('thresholdColor') && val < options.get('thresholdValue')) ? options.get('thresholdColor') : options.get('lineColor'));
|
|
813
813
|
}
|
|
814
|
-
}
|
|
814
|
+
} else {
|
|
815
815
|
// Remove the tag contents if sparklines aren't supported
|
|
816
816
|
this.innerHTML = '';
|
|
817
817
|
}
|
|
818
|
-
|
|
818
|
+
|
|
819
819
|
};
|
|
820
820
|
|
|
821
821
|
|
|
@@ -825,42 +825,42 @@
|
|
|
825
825
|
$.fn.sparkline.bullet = function(values, options, width, height) {
|
|
826
826
|
values = $.map(values, Number);
|
|
827
827
|
// target, performance, range1, range2, range3
|
|
828
|
-
|
|
829
|
-
width = options.get('width')=='auto' ? '4.0em' : width;
|
|
828
|
+
|
|
829
|
+
width = options.get('width') == 'auto' ? '4.0em' : width;
|
|
830
830
|
|
|
831
831
|
var target = $(this).simpledraw(width, height, options.get('composite'));
|
|
832
|
-
if (target && values.length>1) {
|
|
833
|
-
var canvas_width = target.pixel_width-Math.ceil(options.get('targetWidth')/2),
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
832
|
+
if (target && values.length > 1) {
|
|
833
|
+
var canvas_width = target.pixel_width - Math.ceil(options.get('targetWidth') / 2),
|
|
834
|
+
canvas_height = target.pixel_height,
|
|
835
|
+
min = Math.min.apply(Math, values),
|
|
836
|
+
max = Math.max.apply(Math, values);
|
|
837
837
|
|
|
838
838
|
if (options.get('base') === undefined) {
|
|
839
839
|
min = min < 0 ? min : 0;
|
|
840
840
|
} else {
|
|
841
841
|
min = options.get('base');
|
|
842
842
|
}
|
|
843
|
-
var range = max-min;
|
|
843
|
+
var range = max - min;
|
|
844
844
|
|
|
845
845
|
// draw range values
|
|
846
|
-
for(var i=2, vlen=values.length; i<vlen; i++) {
|
|
846
|
+
for (var i = 2, vlen = values.length; i < vlen; i++) {
|
|
847
847
|
var rangeval = values[i],
|
|
848
|
-
|
|
849
|
-
target.drawRect(0, 0, rangewidth-1, canvas_height-1, options.get('rangeColors')[i-2], options.get('rangeColors')[i-2]);
|
|
848
|
+
rangewidth = Math.round(canvas_width * ((rangeval - min) / range));
|
|
849
|
+
target.drawRect(0, 0, rangewidth - 1, canvas_height - 1, options.get('rangeColors')[i - 2], options.get('rangeColors')[i - 2]);
|
|
850
850
|
}
|
|
851
851
|
|
|
852
852
|
// draw the performance bar
|
|
853
853
|
var perfval = values[1],
|
|
854
|
-
|
|
855
|
-
target.drawRect(0, Math.round(canvas_height*0.3), perfwidth-1, Math.round(canvas_height*0.4)-1, options.get('performanceColor'), options.get('performanceColor'));
|
|
854
|
+
perfwidth = Math.round(canvas_width * ((perfval - min) / range));
|
|
855
|
+
target.drawRect(0, Math.round(canvas_height * 0.3), perfwidth - 1, Math.round(canvas_height * 0.4) - 1, options.get('performanceColor'), options.get('performanceColor'));
|
|
856
856
|
|
|
857
857
|
// draw the target line
|
|
858
858
|
var targetval = values[0],
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
target.drawRect(x, targettop, options.get('targetWidth')-1, targetheight-1, options.get('targetColor'), options.get('targetColor'));
|
|
863
|
-
}
|
|
859
|
+
x = Math.round(canvas_width * ((targetval - min) / range) - (options.get('targetWidth') / 2)),
|
|
860
|
+
targettop = Math.round(canvas_height * 0.10),
|
|
861
|
+
targetheight = canvas_height - (targettop * 2);
|
|
862
|
+
target.drawRect(x, targettop, options.get('targetWidth') - 1, targetheight - 1, options.get('targetColor'), options.get('targetColor'));
|
|
863
|
+
} else {
|
|
864
864
|
// Remove the tag contents if sparklines aren't supported
|
|
865
865
|
this.innerHTML = '';
|
|
866
866
|
}
|
|
@@ -872,30 +872,30 @@
|
|
|
872
872
|
*/
|
|
873
873
|
$.fn.sparkline.pie = function(values, options, width, height) {
|
|
874
874
|
values = $.map(values, Number);
|
|
875
|
-
width = options.get('width')=='auto' ? height : width;
|
|
875
|
+
width = options.get('width') == 'auto' ? height : width;
|
|
876
876
|
|
|
877
877
|
var target = $(this).simpledraw(width, height, options.get('composite'));
|
|
878
|
-
if (target && values.length>1) {
|
|
878
|
+
if (target && values.length > 1) {
|
|
879
879
|
var canvas_width = target.pixel_width,
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
880
|
+
canvas_height = target.pixel_height,
|
|
881
|
+
radius = Math.floor(Math.min(canvas_width, canvas_height) / 2),
|
|
882
|
+
total = 0,
|
|
883
|
+
next = 0,
|
|
884
|
+
circle = 2 * Math.PI;
|
|
885
885
|
|
|
886
|
-
for(var i=values.length; i--;) {
|
|
886
|
+
for (var i = values.length; i--;) {
|
|
887
887
|
total += values[i];
|
|
888
888
|
}
|
|
889
889
|
|
|
890
890
|
if (options.get('offset')) {
|
|
891
|
-
next += (2*Math.PI)*(options.get('offset')/360);
|
|
891
|
+
next += (2 * Math.PI) * (options.get('offset') / 360);
|
|
892
892
|
}
|
|
893
893
|
var vlen = values.length;
|
|
894
|
-
for(i=0; i<vlen; i++) {
|
|
894
|
+
for (i = 0; i < vlen; i++) {
|
|
895
895
|
var start = next;
|
|
896
896
|
var end = next;
|
|
897
897
|
if (total > 0) { // avoid divide by zero
|
|
898
|
-
end = next + (circle*(values[i]/total));
|
|
898
|
+
end = next + (circle * (values[i] / total));
|
|
899
899
|
}
|
|
900
900
|
target.drawPieSlice(radius, radius, radius, start, end, undefined, options.get('sliceColors')[i % options.get('sliceColors').length]);
|
|
901
901
|
next = end;
|
|
@@ -908,128 +908,141 @@
|
|
|
908
908
|
* Box plots
|
|
909
909
|
*/
|
|
910
910
|
var quartile = function(values, q) {
|
|
911
|
-
if (q==2) {
|
|
912
|
-
var vl2 = Math.floor(values.length/2);
|
|
913
|
-
return values.length % 2 ? values[vl2] : (values[vl2]+values[vl2+1])/2;
|
|
911
|
+
if (q == 2) {
|
|
912
|
+
var vl2 = Math.floor(values.length / 2);
|
|
913
|
+
return values.length % 2 ? values[vl2] : (values[vl2] + values[vl2 + 1]) / 2;
|
|
914
914
|
} else {
|
|
915
|
-
var vl4 = Math.floor(values.length/4);
|
|
916
|
-
return values.length % 2 ? (values[vl4*q]+values[vl4*q+1])/2 : values[vl4*q];
|
|
915
|
+
var vl4 = Math.floor(values.length / 4);
|
|
916
|
+
return values.length % 2 ? (values[vl4 * q] + values[vl4 * q + 1]) / 2 : values[vl4 * q];
|
|
917
917
|
}
|
|
918
918
|
};
|
|
919
919
|
|
|
920
920
|
$.fn.sparkline.box = function(values, options, width, height) {
|
|
921
921
|
values = $.map(values, Number);
|
|
922
|
-
width = options.get('width')=='auto' ? '4.0em' : width;
|
|
922
|
+
width = options.get('width') == 'auto' ? '4.0em' : width;
|
|
923
923
|
|
|
924
|
-
var minvalue = options.get('chartRangeMin')===undefined ? Math.min.apply(Math, values) : options.get('chartRangeMin'),
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
924
|
+
var minvalue = options.get('chartRangeMin') === undefined ? Math.min.apply(Math, values) : options.get('chartRangeMin'),
|
|
925
|
+
maxvalue = options.get('chartRangeMax') === undefined ? Math.max.apply(Math, values) : options.get('chartRangeMax'),
|
|
926
|
+
target = $(this).simpledraw(width, height, options.get('composite')),
|
|
927
|
+
vlen = values.length,
|
|
928
|
+
lwhisker, loutlier, q1, q2, q3, rwhisker, routlier;
|
|
929
929
|
|
|
930
|
-
if (target && values.length>1) {
|
|
930
|
+
if (target && values.length > 1) {
|
|
931
931
|
var canvas_width = target.pixel_width,
|
|
932
|
-
|
|
932
|
+
canvas_height = target.pixel_height;
|
|
933
933
|
if (options.get('raw')) {
|
|
934
|
-
if (options.get('showOutliers') && values.length>5) {
|
|
935
|
-
loutlier
|
|
934
|
+
if (options.get('showOutliers') && values.length > 5) {
|
|
935
|
+
loutlier = values[0];
|
|
936
|
+
lwhisker = values[1];
|
|
937
|
+
q1 = values[2];
|
|
938
|
+
q2 = values[3];
|
|
939
|
+
q3 = values[4];
|
|
940
|
+
rwhisker = values[5];
|
|
941
|
+
routlier = values[6];
|
|
936
942
|
} else {
|
|
937
|
-
lwhisker
|
|
943
|
+
lwhisker = values[0];
|
|
944
|
+
q1 = values[1];
|
|
945
|
+
q2 = values[2];
|
|
946
|
+
q3 = values[3];
|
|
947
|
+
rwhisker = values[4];
|
|
938
948
|
}
|
|
939
949
|
} else {
|
|
940
|
-
values.sort(function(a, b) {
|
|
950
|
+
values.sort(function(a, b) {
|
|
951
|
+
return a - b;
|
|
952
|
+
});
|
|
941
953
|
q1 = quartile(values, 1);
|
|
942
954
|
q2 = quartile(values, 2);
|
|
943
955
|
q3 = quartile(values, 3);
|
|
944
|
-
var iqr = q3-q1;
|
|
956
|
+
var iqr = q3 - q1;
|
|
945
957
|
if (options.get('showOutliers')) {
|
|
946
|
-
lwhisker=
|
|
947
|
-
|
|
948
|
-
|
|
958
|
+
lwhisker = undefined;
|
|
959
|
+
rwhisker = undefined;
|
|
960
|
+
for (var i = 0; i < vlen; i++) {
|
|
961
|
+
if (lwhisker === undefined && values[i] > q1 - (iqr * options.get('outlierIQR'))) {
|
|
949
962
|
lwhisker = values[i];
|
|
950
963
|
}
|
|
951
|
-
if (values[i] < q3+(iqr*options.get('outlierIQR'))) {
|
|
964
|
+
if (values[i] < q3 + (iqr * options.get('outlierIQR'))) {
|
|
952
965
|
rwhisker = values[i];
|
|
953
966
|
}
|
|
954
967
|
}
|
|
955
968
|
loutlier = values[0];
|
|
956
|
-
routlier = values[vlen-1];
|
|
969
|
+
routlier = values[vlen - 1];
|
|
957
970
|
} else {
|
|
958
971
|
lwhisker = values[0];
|
|
959
|
-
rwhisker = values[vlen-1];
|
|
972
|
+
rwhisker = values[vlen - 1];
|
|
960
973
|
}
|
|
961
974
|
}
|
|
962
975
|
|
|
963
|
-
var unitsize = canvas_width / (maxvalue-minvalue+1),
|
|
964
|
-
|
|
976
|
+
var unitsize = canvas_width / (maxvalue - minvalue + 1),
|
|
977
|
+
canvas_left = 0;
|
|
965
978
|
if (options.get('showOutliers')) {
|
|
966
979
|
canvas_left = Math.ceil(options.get('spotRadius'));
|
|
967
|
-
canvas_width -= 2*Math.ceil(options.get('spotRadius'));
|
|
968
|
-
unitsize = canvas_width / (maxvalue-minvalue+1);
|
|
980
|
+
canvas_width -= 2 * Math.ceil(options.get('spotRadius'));
|
|
981
|
+
unitsize = canvas_width / (maxvalue - minvalue + 1);
|
|
969
982
|
if (loutlier < lwhisker) {
|
|
970
|
-
target.drawCircle((loutlier-minvalue)*unitsize+canvas_left, canvas_height/2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
|
|
983
|
+
target.drawCircle((loutlier - minvalue) * unitsize + canvas_left, canvas_height / 2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
|
|
971
984
|
}
|
|
972
985
|
if (routlier > rwhisker) {
|
|
973
|
-
target.drawCircle((routlier-minvalue)*unitsize+canvas_left, canvas_height/2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
|
|
986
|
+
target.drawCircle((routlier - minvalue) * unitsize + canvas_left, canvas_height / 2, options.get('spotRadius'), options.get('outlierLineColor'), options.get('outlierFillColor'));
|
|
974
987
|
}
|
|
975
988
|
}
|
|
976
989
|
|
|
977
990
|
// box
|
|
978
991
|
target.drawRect(
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
992
|
+
Math.round((q1 - minvalue) * unitsize + canvas_left),
|
|
993
|
+
Math.round(canvas_height * 0.1),
|
|
994
|
+
Math.round((q3 - q1) * unitsize),
|
|
995
|
+
Math.round(canvas_height * 0.8),
|
|
996
|
+
options.get('boxLineColor'),
|
|
997
|
+
options.get('boxFillColor'));
|
|
985
998
|
// left whisker
|
|
986
999
|
target.drawLine(
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1000
|
+
Math.round((lwhisker - minvalue) * unitsize + canvas_left),
|
|
1001
|
+
Math.round(canvas_height / 2),
|
|
1002
|
+
Math.round((q1 - minvalue) * unitsize + canvas_left),
|
|
1003
|
+
Math.round(canvas_height / 2),
|
|
1004
|
+
options.get('lineColor'));
|
|
992
1005
|
target.drawLine(
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1006
|
+
Math.round((lwhisker - minvalue) * unitsize + canvas_left),
|
|
1007
|
+
Math.round(canvas_height / 4),
|
|
1008
|
+
Math.round((lwhisker - minvalue) * unitsize + canvas_left),
|
|
1009
|
+
Math.round(canvas_height - canvas_height / 4),
|
|
1010
|
+
options.get('whiskerColor'));
|
|
998
1011
|
// right whisker
|
|
999
|
-
target.drawLine(Math.round((rwhisker-minvalue)*unitsize+canvas_left),
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1012
|
+
target.drawLine(Math.round((rwhisker - minvalue) * unitsize + canvas_left),
|
|
1013
|
+
Math.round(canvas_height / 2),
|
|
1014
|
+
Math.round((q3 - minvalue) * unitsize + canvas_left),
|
|
1015
|
+
Math.round(canvas_height / 2),
|
|
1016
|
+
options.get('lineColor'));
|
|
1004
1017
|
target.drawLine(
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1018
|
+
Math.round((rwhisker - minvalue) * unitsize + canvas_left),
|
|
1019
|
+
Math.round(canvas_height / 4),
|
|
1020
|
+
Math.round((rwhisker - minvalue) * unitsize + canvas_left),
|
|
1021
|
+
Math.round(canvas_height - canvas_height / 4),
|
|
1022
|
+
options.get('whiskerColor'));
|
|
1010
1023
|
// median line
|
|
1011
1024
|
target.drawLine(
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1025
|
+
Math.round((q2 - minvalue) * unitsize + canvas_left),
|
|
1026
|
+
Math.round(canvas_height * 0.1),
|
|
1027
|
+
Math.round((q2 - minvalue) * unitsize + canvas_left),
|
|
1028
|
+
Math.round(canvas_height * 0.9),
|
|
1029
|
+
options.get('medianColor'));
|
|
1017
1030
|
if (options.get('target')) {
|
|
1018
1031
|
var size = Math.ceil(options.get('spotRadius'));
|
|
1019
1032
|
target.drawLine(
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1033
|
+
Math.round((options.get('target') - minvalue) * unitsize + canvas_left),
|
|
1034
|
+
Math.round((canvas_height / 2) - size),
|
|
1035
|
+
Math.round((options.get('target') - minvalue) * unitsize + canvas_left),
|
|
1036
|
+
Math.round((canvas_height / 2) + size),
|
|
1037
|
+
options.get('targetColor'));
|
|
1025
1038
|
target.drawLine(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1039
|
+
Math.round((options.get('target') - minvalue) * unitsize + canvas_left - size),
|
|
1040
|
+
Math.round(canvas_height / 2),
|
|
1041
|
+
Math.round((options.get('target') - minvalue) * unitsize + canvas_left + size),
|
|
1042
|
+
Math.round(canvas_height / 2),
|
|
1043
|
+
options.get('targetColor'));
|
|
1031
1044
|
}
|
|
1032
|
-
}
|
|
1045
|
+
} else {
|
|
1033
1046
|
// Remove the tag contents if sparklines aren't supported
|
|
1034
1047
|
this.innerHTML = '';
|
|
1035
1048
|
}
|
|
@@ -1045,7 +1058,7 @@
|
|
|
1045
1058
|
|
|
1046
1059
|
if ($.browser.hasCanvas === undefined) {
|
|
1047
1060
|
var t = document.createElement('canvas');
|
|
1048
|
-
$.browser.hasCanvas = t.getContext!==undefined;
|
|
1061
|
+
$.browser.hasCanvas = t.getContext !== undefined;
|
|
1049
1062
|
}
|
|
1050
1063
|
|
|
1051
1064
|
VCanvas_base = function(width, height, target) {
|
|
@@ -1057,7 +1070,7 @@
|
|
|
1057
1070
|
this.height = height;
|
|
1058
1071
|
this.target = target;
|
|
1059
1072
|
if (target[0]) {
|
|
1060
|
-
target=target[0];
|
|
1073
|
+
target = target[0];
|
|
1061
1074
|
}
|
|
1062
1075
|
target.VCanvas = this;
|
|
1063
1076
|
},
|
|
@@ -1067,7 +1080,10 @@
|
|
|
1067
1080
|
},
|
|
1068
1081
|
|
|
1069
1082
|
drawLine : function(x1, y1, x2, y2, lineColor, lineWidth) {
|
|
1070
|
-
return this.drawShape([
|
|
1083
|
+
return this.drawShape([
|
|
1084
|
+
[x1,y1],
|
|
1085
|
+
[x2,y2]
|
|
1086
|
+
], lineColor, lineWidth);
|
|
1071
1087
|
},
|
|
1072
1088
|
|
|
1073
1089
|
drawCircle : function(x, y, radius, lineColor, fillColor) {
|
|
@@ -1102,7 +1118,7 @@
|
|
|
1102
1118
|
this._super.init(width, height, target);
|
|
1103
1119
|
this.canvas = document.createElement('canvas');
|
|
1104
1120
|
if (target[0]) {
|
|
1105
|
-
target=target[0];
|
|
1121
|
+
target = target[0];
|
|
1106
1122
|
}
|
|
1107
1123
|
target.VCanvas = this;
|
|
1108
1124
|
$(this.canvas).css({ display:'inline-block', width:width, height:height, verticalAlign:'top' });
|
|
@@ -1119,7 +1135,7 @@
|
|
|
1119
1135
|
if (lineColor !== undefined) {
|
|
1120
1136
|
context.strokeStyle = lineColor;
|
|
1121
1137
|
}
|
|
1122
|
-
context.lineWidth = lineWidth===undefined ? 1 : lineWidth;
|
|
1138
|
+
context.lineWidth = lineWidth === undefined ? 1 : lineWidth;
|
|
1123
1139
|
if (fillColor !== undefined) {
|
|
1124
1140
|
context.fillStyle = fillColor;
|
|
1125
1141
|
}
|
|
@@ -1129,9 +1145,9 @@
|
|
|
1129
1145
|
drawShape : function(path, lineColor, fillColor, lineWidth) {
|
|
1130
1146
|
var context = this._getContext(lineColor, fillColor, lineWidth);
|
|
1131
1147
|
context.beginPath();
|
|
1132
|
-
context.moveTo(path[0][0]+0.5, path[0][1]+0.5);
|
|
1133
|
-
for(var i=1, plen=path.length; i<plen; i++) {
|
|
1134
|
-
context.lineTo(path[i][0]+0.5, path[i][1]+0.5); // the 0.5 offset gives us crisp pixel-width lines
|
|
1148
|
+
context.moveTo(path[0][0] + 0.5, path[0][1] + 0.5);
|
|
1149
|
+
for (var i = 1, plen = path.length; i < plen; i++) {
|
|
1150
|
+
context.lineTo(path[i][0] + 0.5, path[i][1] + 0.5); // the 0.5 offset gives us crisp pixel-width lines
|
|
1135
1151
|
}
|
|
1136
1152
|
if (lineColor !== undefined) {
|
|
1137
1153
|
context.stroke();
|
|
@@ -1144,14 +1160,14 @@
|
|
|
1144
1160
|
drawCircle : function(x, y, radius, lineColor, fillColor) {
|
|
1145
1161
|
var context = this._getContext(lineColor, fillColor);
|
|
1146
1162
|
context.beginPath();
|
|
1147
|
-
context.arc(x, y, radius, 0, 2*Math.PI, false);
|
|
1163
|
+
context.arc(x, y, radius, 0, 2 * Math.PI, false);
|
|
1148
1164
|
if (lineColor !== undefined) {
|
|
1149
1165
|
context.stroke();
|
|
1150
1166
|
}
|
|
1151
1167
|
if (fillColor !== undefined) {
|
|
1152
1168
|
context.fill();
|
|
1153
1169
|
}
|
|
1154
|
-
},
|
|
1170
|
+
},
|
|
1155
1171
|
|
|
1156
1172
|
drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
|
|
1157
1173
|
var context = this._getContext(lineColor, fillColor);
|
|
@@ -1169,9 +1185,15 @@
|
|
|
1169
1185
|
},
|
|
1170
1186
|
|
|
1171
1187
|
drawRect : function(x, y, width, height, lineColor, fillColor) {
|
|
1172
|
-
return this.drawShape([
|
|
1188
|
+
return this.drawShape([
|
|
1189
|
+
[x,y],
|
|
1190
|
+
[x + width, y],
|
|
1191
|
+
[x + width, y + height],
|
|
1192
|
+
[x, y + height],
|
|
1193
|
+
[x, y]
|
|
1194
|
+
], lineColor, fillColor);
|
|
1173
1195
|
}
|
|
1174
|
-
|
|
1196
|
+
|
|
1175
1197
|
});
|
|
1176
1198
|
|
|
1177
1199
|
VCanvas_vml = function(width, height, target) {
|
|
@@ -1184,7 +1206,7 @@
|
|
|
1184
1206
|
init : function(width, height, target) {
|
|
1185
1207
|
this._super.init(width, height, target);
|
|
1186
1208
|
if (target[0]) {
|
|
1187
|
-
target=target[0];
|
|
1209
|
+
target = target[0];
|
|
1188
1210
|
}
|
|
1189
1211
|
target.VCanvas = this;
|
|
1190
1212
|
this.canvas = document.createElement('span');
|
|
@@ -1194,51 +1216,51 @@
|
|
|
1194
1216
|
this.pixel_width = $(this.canvas).width();
|
|
1195
1217
|
this.canvas.width = this.pixel_width;
|
|
1196
1218
|
this.canvas.height = this.pixel_height;
|
|
1197
|
-
var groupel = '<v:group coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'"' +
|
|
1198
|
-
' style="position:absolute;top:0;left:0;width:'+this.pixel_width+'px;height='+this.pixel_height+'px;"></v:group>';
|
|
1219
|
+
var groupel = '<v:group coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '"' +
|
|
1220
|
+
' style="position:absolute;top:0;left:0;width:' + this.pixel_width + 'px;height=' + this.pixel_height + 'px;"></v:group>';
|
|
1199
1221
|
this.canvas.insertAdjacentHTML('beforeEnd', groupel);
|
|
1200
1222
|
this.group = $(this.canvas).children()[0];
|
|
1201
1223
|
},
|
|
1202
1224
|
|
|
1203
1225
|
drawShape : function(path, lineColor, fillColor, lineWidth) {
|
|
1204
1226
|
var vpath = [];
|
|
1205
|
-
for(var i=0, plen=path.length; i<plen; i++) {
|
|
1206
|
-
vpath[i] = ''+(path[i][0])+','+(path[i][1]);
|
|
1227
|
+
for (var i = 0, plen = path.length; i < plen; i++) {
|
|
1228
|
+
vpath[i] = '' + (path[i][0]) + ',' + (path[i][1]);
|
|
1207
1229
|
}
|
|
1208
|
-
var initial = vpath.splice(0,1);
|
|
1230
|
+
var initial = vpath.splice(0, 1);
|
|
1209
1231
|
lineWidth = lineWidth === undefined ? 1 : lineWidth;
|
|
1210
|
-
var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="'+lineWidth+'" strokeColor="'+lineColor+'" ';
|
|
1211
|
-
var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
|
|
1212
|
-
var closed = vpath[0] == vpath[vpath.length-1] ? 'x ' : '';
|
|
1213
|
-
var vel = '<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" ' +
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1232
|
+
var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="' + lineWidth + '" strokeColor="' + lineColor + '" ';
|
|
1233
|
+
var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
|
|
1234
|
+
var closed = vpath[0] == vpath[vpath.length - 1] ? 'x ' : '';
|
|
1235
|
+
var vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '" ' +
|
|
1236
|
+
stroke +
|
|
1237
|
+
fill +
|
|
1238
|
+
' style="position:absolute;left:0px;top:0px;height:' + this.pixel_height + 'px;width:' + this.pixel_width + 'px;padding:0px;margin:0px;" ' +
|
|
1239
|
+
' path="m ' + initial + ' l ' + vpath.join(', ') + ' ' + closed + 'e">' +
|
|
1240
|
+
' </v:shape>';
|
|
1241
|
+
this.group.insertAdjacentHTML('beforeEnd', vel);
|
|
1220
1242
|
},
|
|
1221
1243
|
|
|
1222
1244
|
drawCircle : function(x, y, radius, lineColor, fillColor) {
|
|
1223
|
-
x -= radius+1;
|
|
1224
|
-
y -= radius+1;
|
|
1225
|
-
var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="'+lineColor+'" ';
|
|
1226
|
-
var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
|
|
1245
|
+
x -= radius + 1;
|
|
1246
|
+
y -= radius + 1;
|
|
1247
|
+
var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="' + lineColor + '" ';
|
|
1248
|
+
var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
|
|
1227
1249
|
var vel = '<v:oval ' +
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1250
|
+
stroke +
|
|
1251
|
+
fill +
|
|
1252
|
+
' style="position:absolute;top:' + y + 'px; left:' + x + 'px; width:' + (radius * 2) + 'px; height:' + (radius * 2) + 'px"></v:oval>';
|
|
1231
1253
|
this.group.insertAdjacentHTML('beforeEnd', vel);
|
|
1232
|
-
|
|
1254
|
+
|
|
1233
1255
|
},
|
|
1234
|
-
|
|
1256
|
+
|
|
1235
1257
|
drawPieSlice : function(x, y, radius, startAngle, endAngle, lineColor, fillColor) {
|
|
1236
1258
|
if (startAngle == endAngle) {
|
|
1237
1259
|
return; // VML seems to have problem when start angle equals end angle.
|
|
1238
1260
|
}
|
|
1239
|
-
if ((endAngle - startAngle) == (2*Math.PI)) {
|
|
1261
|
+
if ((endAngle - startAngle) == (2 * Math.PI)) {
|
|
1240
1262
|
startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0
|
|
1241
|
-
endAngle = (2*Math.PI);
|
|
1263
|
+
endAngle = (2 * Math.PI);
|
|
1242
1264
|
}
|
|
1243
1265
|
|
|
1244
1266
|
var startx = x + Math.round(Math.cos(startAngle) * radius);
|
|
@@ -1247,24 +1269,30 @@
|
|
|
1247
1269
|
var endy = y + Math.round(Math.sin(endAngle) * radius);
|
|
1248
1270
|
|
|
1249
1271
|
// Prevent very small slices from being mistaken as a whole pie
|
|
1250
|
-
if (startx==endx && starty==endy && (endAngle-startAngle) < Math.PI) {
|
|
1272
|
+
if (startx == endx && starty == endy && (endAngle - startAngle) < Math.PI) {
|
|
1251
1273
|
return;
|
|
1252
1274
|
}
|
|
1253
1275
|
|
|
1254
|
-
var vpath = [ x-radius, y-radius, x+radius, y+radius, startx, starty, endx, endy ];
|
|
1255
|
-
var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="'+lineColor+'" ';
|
|
1256
|
-
var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="'+fillColor+'" filled="true" ';
|
|
1257
|
-
var vel = '<v:shape coordorigin="0 0" coordsize="'+this.pixel_width+' '+this.pixel_height+'" ' +
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1276
|
+
var vpath = [ x - radius, y - radius, x + radius, y + radius, startx, starty, endx, endy ];
|
|
1277
|
+
var stroke = lineColor === undefined ? ' stroked="false" ' : ' strokeWeight="1" strokeColor="' + lineColor + '" ';
|
|
1278
|
+
var fill = fillColor === undefined ? ' filled="false"' : ' fillColor="' + fillColor + '" filled="true" ';
|
|
1279
|
+
var vel = '<v:shape coordorigin="0 0" coordsize="' + this.pixel_width + ' ' + this.pixel_height + '" ' +
|
|
1280
|
+
stroke +
|
|
1281
|
+
fill +
|
|
1282
|
+
' style="position:absolute;left:0px;top:0px;height:' + this.pixel_height + 'px;width:' + this.pixel_width + 'px;padding:0px;margin:0px;" ' +
|
|
1283
|
+
' path="m ' + x + ',' + y + ' wa ' + vpath.join(', ') + ' x e">' +
|
|
1284
|
+
' </v:shape>';
|
|
1285
|
+
this.group.insertAdjacentHTML('beforeEnd', vel);
|
|
1264
1286
|
},
|
|
1265
1287
|
|
|
1266
1288
|
drawRect : function(x, y, width, height, lineColor, fillColor) {
|
|
1267
|
-
return this.drawShape(
|
|
1289
|
+
return this.drawShape([
|
|
1290
|
+
[x, y],
|
|
1291
|
+
[x, y + height],
|
|
1292
|
+
[x + width, y + height],
|
|
1293
|
+
[x + width, y],
|
|
1294
|
+
[x, y]
|
|
1295
|
+
], lineColor, fillColor);
|
|
1268
1296
|
}
|
|
1269
1297
|
});
|
|
1270
1298
|
|