| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| (function($) { |
| |
| var undefined; |
| |
| $.fn.emptyForce = function() { |
| for ( var i = 0, elem; (elem = $(this)[i]) != null; i++ ) { |
| |
| if ( elem.nodeType === 1 ) { |
| $.cleanData( elem.getElementsByTagName("*") ); |
| } |
| |
| |
| if ($.jqplot.use_excanvas) { |
| elem.outerHTML = ""; |
| } |
| else { |
| while ( elem.firstChild ) { |
| elem.removeChild( elem.firstChild ); |
| } |
| } |
|
|
| elem = null; |
| } |
| |
| return $(this); |
| }; |
| |
| $.fn.removeChildForce = function(parent) { |
| while ( parent.firstChild ) { |
| this.removeChildForce( parent.firstChild ); |
| parent.removeChild( parent.firstChild ); |
| } |
| }; |
|
|
| $.fn.jqplot = function() { |
| var datas = []; |
| var options = []; |
| |
| for (var i=0, l=arguments.length; i<l; i++) { |
| if ($.isArray(arguments[i])) { |
| datas.push(arguments[i]); |
| } |
| else if ($.isPlainObject(arguments[i])) { |
| options.push(arguments[i]); |
| } |
| } |
|
|
| return this.each(function(index) { |
| var tid, |
| plot, |
| $this = $(this), |
| dl = datas.length, |
| ol = options.length, |
| data, |
| opts; |
|
|
| if (index < dl) { |
| data = datas[index]; |
| } |
| else { |
| data = dl ? datas[dl-1] : null; |
| } |
|
|
| if (index < ol) { |
| opts = options[index]; |
| } |
| else { |
| opts = ol ? options[ol-1] : null; |
| } |
|
|
| |
| |
| tid = $this.attr('id'); |
| if (tid === undefined) { |
| tid = 'jqplot_target_' + $.jqplot.targetCounter++; |
| $this.attr('id', tid); |
| } |
|
|
| plot = $.jqplot(tid, data, opts); |
|
|
| $this.data('jqplot', plot); |
| }); |
| }; |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| $.jqplot = function(target, data, options) { |
| var _data = null, _options = null; |
|
|
| if (arguments.length === 3) { |
| _data = data; |
| _options = options; |
| } |
|
|
| else if (arguments.length === 2) { |
| if ($.isArray(data)) { |
| _data = data; |
| } |
|
|
| else if ($.isPlainObject(data)) { |
| _options = data; |
| } |
| } |
|
|
| if (_data === null && _options !== null && _options.data) { |
| _data = _options.data; |
| } |
|
|
| var plot = new jqPlot(); |
| |
| $('#'+target).removeClass('jqplot-error'); |
| |
| if ($.jqplot.config.catchErrors) { |
| try { |
| plot.init(target, _data, _options); |
| plot.draw(); |
| plot.themeEngine.init.call(plot); |
| return plot; |
| } |
| catch(e) { |
| var msg = $.jqplot.config.errorMessage || e.message; |
| $('#'+target).append('<div class="jqplot-error-message">'+msg+'</div>'); |
| $('#'+target).addClass('jqplot-error'); |
| document.getElementById(target).style.background = $.jqplot.config.errorBackground; |
| document.getElementById(target).style.border = $.jqplot.config.errorBorder; |
| document.getElementById(target).style.fontFamily = $.jqplot.config.errorFontFamily; |
| document.getElementById(target).style.fontSize = $.jqplot.config.errorFontSize; |
| document.getElementById(target).style.fontStyle = $.jqplot.config.errorFontStyle; |
| document.getElementById(target).style.fontWeight = $.jqplot.config.errorFontWeight; |
| } |
| } |
| else { |
| plot.init(target, _data, _options); |
| plot.draw(); |
| plot.themeEngine.init.call(plot); |
| return plot; |
| } |
| }; |
|
|
| $.jqplot.version = "@VERSION"; |
| $.jqplot.revision = "@REVISION"; |
|
|
| $.jqplot.targetCounter = 1; |
|
|
| |
| |
| |
| $.jqplot.CanvasManager = function() { |
| |
| |
| if (typeof $.jqplot.CanvasManager.canvases == 'undefined') { |
| $.jqplot.CanvasManager.canvases = []; |
| $.jqplot.CanvasManager.free = []; |
| } |
| |
| var myCanvases = []; |
| |
| this.getCanvas = function() { |
| var canvas; |
| var makeNew = true; |
| |
| if (!$.jqplot.use_excanvas) { |
| for (var i = 0, l = $.jqplot.CanvasManager.canvases.length; i < l; i++) { |
| if ($.jqplot.CanvasManager.free[i] === true) { |
| makeNew = false; |
| canvas = $.jqplot.CanvasManager.canvases[i]; |
| |
| $.jqplot.CanvasManager.free[i] = false; |
| myCanvases.push(i); |
| break; |
| } |
| } |
| } |
|
|
| if (makeNew) { |
| canvas = document.createElement('canvas'); |
| myCanvases.push($.jqplot.CanvasManager.canvases.length); |
| $.jqplot.CanvasManager.canvases.push(canvas); |
| $.jqplot.CanvasManager.free.push(false); |
| } |
| |
| return canvas; |
| }; |
| |
| |
| |
| this.initCanvas = function(canvas) { |
| if ($.jqplot.use_excanvas) { |
| return window.G_vmlCanvasManager.initElement(canvas); |
| } |
| var cctx = canvas.getContext('2d'); |
|
|
| var canvasBackingScale = 1; |
| if (window.devicePixelRatio > 1 && (cctx.webkitBackingStorePixelRatio === undefined || |
| cctx.webkitBackingStorePixelRatio < 2)) { |
| canvasBackingScale = window.devicePixelRatio; |
| } |
| var oldWidth = canvas.width; |
| var oldHeight = canvas.height; |
|
|
| canvas.width = canvasBackingScale * canvas.width; |
| canvas.height = canvasBackingScale * canvas.height; |
| canvas.style.width = oldWidth + 'px'; |
| canvas.style.height = oldHeight + 'px'; |
| cctx.save(); |
|
|
| cctx.scale(canvasBackingScale, canvasBackingScale); |
|
|
| return canvas; |
| }; |
|
|
| this.freeAllCanvases = function() { |
| for (var i = 0, l=myCanvases.length; i < l; i++) { |
| this.freeCanvas(myCanvases[i]); |
| } |
| myCanvases = []; |
| }; |
|
|
| this.freeCanvas = function(idx) { |
| if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) { |
| |
| window.G_vmlCanvasManager.uninitElement($.jqplot.CanvasManager.canvases[idx]); |
| $.jqplot.CanvasManager.canvases[idx] = null; |
| } |
| else { |
| var canvas = $.jqplot.CanvasManager.canvases[idx]; |
| canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height); |
| $(canvas).unbind().removeAttr('class').removeAttr('style'); |
| |
| |
| $(canvas).css({left: '', top: '', position: ''}); |
| |
| canvas.width = 0; |
| canvas.height = 0; |
| $.jqplot.CanvasManager.free[idx] = true; |
| } |
| }; |
| |
| }; |
|
|
| |
| |
| $.jqplot.log = function() { |
| if (window.console) { |
| window.console.log.apply(window.console, arguments); |
| } |
| }; |
| |
| $.jqplot.config = { |
| addDomReference: false, |
| enablePlugins:false, |
| defaultHeight:300, |
| defaultWidth:400, |
| UTCAdjust:false, |
| timezoneOffset: new Date(new Date().getTimezoneOffset() * 60000), |
| errorMessage: '', |
| errorBackground: '', |
| errorBorder: '', |
| errorFontFamily: '', |
| errorFontSize: '', |
| errorFontStyle: '', |
| errorFontWeight: '', |
| catchErrors: false, |
| defaultTickFormatString: "%.1f", |
| defaultColors: [ "#4bb2c5", "#EAA228", "#c5b47f", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#d8b83f", "#ff5800", "#0085cc", "#c747a3", "#cddf54", "#FBD178", "#26B4E3", "#bd70c7"], |
| defaultNegativeColors: [ "#498991", "#C08840", "#9F9274", "#546D61", "#646C4A", "#6F6621", "#6E3F5F", "#4F64B0", "#A89050", "#C45923", "#187399", "#945381", "#959E5C", "#C7AF7B", "#478396", "#907294"], |
| dashLength: 4, |
| gapLength: 4, |
| dotGapLength: 2.5, |
| srcLocation: 'jqplot/src/', |
| pluginLocation: 'jqplot/src/plugins/' |
| }; |
| |
| |
| $.jqplot.arrayMax = function( array ){ |
| return Math.max.apply( Math, array ); |
| }; |
| |
| $.jqplot.arrayMin = function( array ){ |
| return Math.min.apply( Math, array ); |
| }; |
| |
| $.jqplot.enablePlugins = $.jqplot.config.enablePlugins; |
| |
| |
| |
| |
| |
| $.jqplot.support_canvas = function() { |
| if (typeof $.jqplot.support_canvas.result == 'undefined') { |
| $.jqplot.support_canvas.result = !!document.createElement('canvas').getContext; |
| } |
| return $.jqplot.support_canvas.result; |
| }; |
| |
| $.jqplot.support_canvas_text = function() { |
| if (typeof $.jqplot.support_canvas_text.result == 'undefined') { |
| if (window.G_vmlCanvasManager !== undefined && window.G_vmlCanvasManager._version > 887) { |
| $.jqplot.support_canvas_text.result = true; |
| } |
| else { |
| $.jqplot.support_canvas_text.result = !!(document.createElement('canvas').getContext && typeof document.createElement('canvas').getContext('2d').fillText == 'function'); |
| } |
| |
| } |
| return $.jqplot.support_canvas_text.result; |
| }; |
| |
| $.jqplot.use_excanvas = ((!$.support.boxModel || !$.support.objectAll || !$support.leadingWhitespace) && !$.jqplot.support_canvas()) ? true : false; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| $.jqplot.preInitHooks = []; |
| $.jqplot.postInitHooks = []; |
| $.jqplot.preParseOptionsHooks = []; |
| $.jqplot.postParseOptionsHooks = []; |
| $.jqplot.preDrawHooks = []; |
| $.jqplot.postDrawHooks = []; |
| $.jqplot.preDrawSeriesHooks = []; |
| $.jqplot.postDrawSeriesHooks = []; |
| $.jqplot.preDrawLegendHooks = []; |
| $.jqplot.addLegendRowHooks = []; |
| $.jqplot.preSeriesInitHooks = []; |
| $.jqplot.postSeriesInitHooks = []; |
| $.jqplot.preParseSeriesOptionsHooks = []; |
| $.jqplot.postParseSeriesOptionsHooks = []; |
| $.jqplot.eventListenerHooks = []; |
| $.jqplot.preDrawSeriesShadowHooks = []; |
| $.jqplot.postDrawSeriesShadowHooks = []; |
|
|
| |
| $.jqplot.ElemContainer = function() { |
| this._elem; |
| this._plotWidth; |
| this._plotHeight; |
| this._plotDimensions = {height:null, width:null}; |
| }; |
| |
| $.jqplot.ElemContainer.prototype.createElement = function(el, offsets, clss, cssopts, attrib) { |
| this._offsets = offsets; |
| var klass = clss || 'jqplot'; |
| var elem = document.createElement(el); |
| this._elem = $(elem); |
| this._elem.addClass(klass); |
| this._elem.css(cssopts); |
| this._elem.attr(attrib); |
| |
| elem = null; |
| return this._elem; |
| }; |
| |
| $.jqplot.ElemContainer.prototype.getWidth = function() { |
| if (this._elem) { |
| return this._elem.outerWidth(true); |
| } |
| else { |
| return null; |
| } |
| }; |
| |
| $.jqplot.ElemContainer.prototype.getHeight = function() { |
| if (this._elem) { |
| return this._elem.outerHeight(true); |
| } |
| else { |
| return null; |
| } |
| }; |
| |
| $.jqplot.ElemContainer.prototype.getPosition = function() { |
| if (this._elem) { |
| return this._elem.position(); |
| } |
| else { |
| return {top:null, left:null, bottom:null, right:null}; |
| } |
| }; |
| |
| $.jqplot.ElemContainer.prototype.getTop = function() { |
| return this.getPosition().top; |
| }; |
| |
| $.jqplot.ElemContainer.prototype.getLeft = function() { |
| return this.getPosition().left; |
| }; |
| |
| $.jqplot.ElemContainer.prototype.getBottom = function() { |
| return this._elem.css('bottom'); |
| }; |
| |
| $.jqplot.ElemContainer.prototype.getRight = function() { |
| return this._elem.css('right'); |
| }; |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| function Axis(name) { |
| $.jqplot.ElemContainer.call(this); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| this.name = name; |
| this._series = []; |
| |
| |
| this.show = false; |
| |
| |
| |
| this.tickRenderer = $.jqplot.AxisTickRenderer; |
| |
| |
| this.tickOptions = {}; |
| |
| |
| this.labelRenderer = $.jqplot.AxisLabelRenderer; |
| |
| |
| this.labelOptions = {}; |
| |
| |
| this.label = null; |
| |
| |
| this.showLabel = true; |
| |
| |
| this.min = null; |
| |
| |
| this.max = null; |
| |
| |
| |
| this.autoscale = false; |
| |
| |
| |
| |
| this.pad = 1.2; |
| |
| |
| |
| |
| this.padMax = null; |
| |
| |
| |
| |
| this.padMin = null; |
| |
| |
| |
| this.ticks = []; |
| |
| |
| this.numberTicks; |
| |
| |
| this.tickInterval; |
| |
| |
| |
| this.renderer = $.jqplot.LinearAxisRenderer; |
| |
| |
| this.rendererOptions = {}; |
| |
| |
| |
| this.showTicks = true; |
| |
| |
| |
| this.showTickMarks = true; |
| |
| |
| this.showMinorTicks = true; |
| |
| |
| this.drawMajorGridlines = true; |
| |
| |
| this.drawMinorGridlines = false; |
| |
| |
| this.drawMajorTickMarks = true; |
| |
| |
| this.drawMinorTickMarks = true; |
| |
| |
| |
| this.useSeriesColor = false; |
| |
| |
| |
| this.borderWidth = null; |
| |
| |
| this.borderColor = null; |
| |
| |
| this.scaleToHiddenSeries = false; |
| |
| this._dataBounds = {min:null, max:null}; |
| |
| |
| this._intervalStats = []; |
| |
| this._offsets = {min:null, max:null}; |
| this._ticks=[]; |
| this._label = null; |
| |
| |
| |
| |
| |
| this.syncTicks = null; |
| |
| |
| |
| this.tickSpacing = 75; |
| |
| |
| this._min = null; |
| this._max = null; |
| this._tickInterval = null; |
| this._numberTicks = null; |
| this.__ticks = null; |
| |
| this._options = {}; |
| } |
| |
| Axis.prototype = new $.jqplot.ElemContainer(); |
| Axis.prototype.constructor = Axis; |
| |
| Axis.prototype.init = function() { |
| if ($.isFunction(this.renderer)) { |
| this.renderer = new this.renderer(); |
| } |
| |
| this.tickOptions.axis = this.name; |
| |
| |
| if (this.tickOptions.showMark == null) { |
| this.tickOptions.showMark = this.showTicks; |
| } |
| if (this.tickOptions.showMark == null) { |
| this.tickOptions.showMark = this.showTickMarks; |
| } |
| if (this.tickOptions.showLabel == null) { |
| this.tickOptions.showLabel = this.showTicks; |
| } |
| |
| if (this.label == null || this.label == '') { |
| this.showLabel = false; |
| } |
| else { |
| this.labelOptions.label = this.label; |
| } |
| if (this.showLabel == false) { |
| this.labelOptions.show = false; |
| } |
| |
| |
| |
| if (this.pad == 0) { |
| this.pad = 1.0; |
| } |
| if (this.padMax == 0) { |
| this.padMax = 1.0; |
| } |
| if (this.padMin == 0) { |
| this.padMin = 1.0; |
| } |
| if (this.padMax == null) { |
| this.padMax = (this.pad-1)/2 + 1; |
| } |
| if (this.padMin == null) { |
| this.padMin = (this.pad-1)/2 + 1; |
| } |
| |
| |
| this.pad = this.padMax + this.padMin - 1; |
| if (this.min != null || this.max != null) { |
| this.autoscale = false; |
| } |
| |
| if (this.syncTicks == null && this.name.indexOf('y') > -1) { |
| this.syncTicks = true; |
| } |
| else if (this.syncTicks == null){ |
| this.syncTicks = false; |
| } |
| this.renderer.init.call(this, this.rendererOptions); |
| |
| }; |
| |
| Axis.prototype.draw = function(ctx, plot) { |
| |
| if (this.__ticks) { |
| this.__ticks = null; |
| } |
|
|
| return this.renderer.draw.call(this, ctx, plot); |
| |
| }; |
| |
| Axis.prototype.set = function() { |
| this.renderer.set.call(this); |
| }; |
| |
| Axis.prototype.pack = function(pos, offsets) { |
| if (this.show) { |
| this.renderer.pack.call(this, pos, offsets); |
| } |
| |
| if (this._min == null) { |
| this._min = this.min; |
| this._max = this.max; |
| this._tickInterval = this.tickInterval; |
| this._numberTicks = this.numberTicks; |
| this.__ticks = this._ticks; |
| } |
| }; |
| |
| |
| Axis.prototype.reset = function() { |
| this.renderer.reset.call(this); |
| }; |
| |
| Axis.prototype.resetScale = function(opts) { |
| $.extend(true, this, {min: null, max: null, numberTicks: null, tickInterval: null, _ticks: [], ticks: []}, opts); |
| this.resetDataBounds(); |
| }; |
| |
| Axis.prototype.resetDataBounds = function() { |
| |
| |
| var db = this._dataBounds; |
| db.min = null; |
| db.max = null; |
| var l, s, d; |
| |
| var doforce = (this.show) ? true : false; |
| for (var i=0; i<this._series.length; i++) { |
| s = this._series[i]; |
| if (s.show || this.scaleToHiddenSeries) { |
| d = s._plotData; |
| if (s._type === 'line' && s.renderer.bands.show && this.name.charAt(0) !== 'x') { |
| d = [[0, s.renderer.bands._min], [1, s.renderer.bands._max]]; |
| } |
|
|
| var minyidx = 1, maxyidx = 1; |
|
|
| if (s._type != null && s._type == 'ohlc') { |
| minyidx = 3; |
| maxyidx = 2; |
| } |
| |
| for (var j=0, l=d.length; j<l; j++) { |
| if (this.name == 'xaxis' || this.name == 'x2axis') { |
| if ((d[j][0] != null && d[j][0] < db.min) || db.min == null) { |
| db.min = d[j][0]; |
| } |
| if ((d[j][0] != null && d[j][0] > db.max) || db.max == null) { |
| db.max = d[j][0]; |
| } |
| } |
| else { |
| if ((d[j][minyidx] != null && d[j][minyidx] < db.min) || db.min == null) { |
| db.min = d[j][minyidx]; |
| } |
| if ((d[j][maxyidx] != null && d[j][maxyidx] > db.max) || db.max == null) { |
| db.max = d[j][maxyidx]; |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| if (doforce && s.renderer.constructor !== $.jqplot.BarRenderer) { |
| doforce = false; |
| } |
|
|
| else if (doforce && this._options.hasOwnProperty('forceTickAt0') && this._options.forceTickAt0 == false) { |
| doforce = false; |
| } |
|
|
| else if (doforce && s.renderer.constructor === $.jqplot.BarRenderer) { |
| if (s.barDirection == 'vertical' && this.name != 'xaxis' && this.name != 'x2axis') { |
| if (this._options.pad != null || this._options.padMin != null) { |
| doforce = false; |
| } |
| } |
|
|
| else if (s.barDirection == 'horizontal' && (this.name == 'xaxis' || this.name == 'x2axis')) { |
| if (this._options.pad != null || this._options.padMin != null) { |
| doforce = false; |
| } |
| } |
|
|
| } |
| } |
| } |
|
|
| if (doforce && this.renderer.constructor === $.jqplot.LinearAxisRenderer && db.min >= 0) { |
| this.padMin = 1.0; |
| this.forceTickAt0 = true; |
| } |
| }; |
|
|
| |
| |
| |
| |
| |
| |
| function Legend(options) { |
| $.jqplot.ElemContainer.call(this); |
| |
| |
| |
| |
| this.show = false; |
| |
| |
| this.location = 'ne'; |
| |
| |
| |
| this.labels = []; |
| |
| |
| this.showLabels = true; |
| |
| |
| this.showSwatches = true; |
| |
| |
| |
| |
| |
| |
| |
| this.placement = "insideGrid"; |
| |
| |
| |
| this.xoffset = 0; |
| |
| |
| |
| this.yoffset = 0; |
| |
| |
| this.border; |
| |
| |
| this.background; |
| |
| |
| this.textColor; |
| |
| |
| this.fontFamily; |
| |
| |
| this.fontSize ; |
| |
| |
| this.rowSpacing = '0.5em'; |
| |
| |
| |
| this.renderer = $.jqplot.TableLegendRenderer; |
| |
| |
| this.rendererOptions = {}; |
| |
| |
| |
| this.preDraw = false; |
| |
| |
| |
| |
| this.marginTop = null; |
| |
| |
| |
| |
| this.marginRight = null; |
| |
| |
| |
| |
| this.marginBottom = null; |
| |
| |
| |
| |
| this.marginLeft = null; |
| |
| |
| |
| this.escapeHtml = false; |
| this._series = []; |
| |
| $.extend(true, this, options); |
| } |
| |
| Legend.prototype = new $.jqplot.ElemContainer(); |
| Legend.prototype.constructor = Legend; |
| |
| Legend.prototype.setOptions = function(options) { |
| $.extend(true, this, options); |
| |
| |
| |
| |
| |
| if (this.placement == 'inside') { |
| this.placement = 'insideGrid'; |
| } |
| |
| if (this.xoffset >0) { |
| if (this.placement == 'insideGrid') { |
| switch (this.location) { |
| case 'nw': |
| case 'w': |
| case 'sw': |
| if (this.marginLeft == null) { |
| this.marginLeft = this.xoffset + 'px'; |
| } |
| this.marginRight = '0px'; |
| break; |
| case 'ne': |
| case 'e': |
| case 'se': |
| default: |
| if (this.marginRight == null) { |
| this.marginRight = this.xoffset + 'px'; |
| } |
| this.marginLeft = '0px'; |
| break; |
| } |
| } |
| else if (this.placement == 'outside') { |
| switch (this.location) { |
| case 'nw': |
| case 'w': |
| case 'sw': |
| if (this.marginRight == null) { |
| this.marginRight = this.xoffset + 'px'; |
| } |
| this.marginLeft = '0px'; |
| break; |
| case 'ne': |
| case 'e': |
| case 'se': |
| default: |
| if (this.marginLeft == null) { |
| this.marginLeft = this.xoffset + 'px'; |
| } |
| this.marginRight = '0px'; |
| break; |
| } |
| } |
| this.xoffset = 0; |
| } |
| |
| if (this.yoffset >0) { |
| if (this.placement == 'outside') { |
| switch (this.location) { |
| case 'sw': |
| case 's': |
| case 'se': |
| if (this.marginTop == null) { |
| this.marginTop = this.yoffset + 'px'; |
| } |
| this.marginBottom = '0px'; |
| break; |
| case 'ne': |
| case 'n': |
| case 'nw': |
| default: |
| if (this.marginBottom == null) { |
| this.marginBottom = this.yoffset + 'px'; |
| } |
| this.marginTop = '0px'; |
| break; |
| } |
| } |
| else if (this.placement == 'insideGrid') { |
| switch (this.location) { |
| case 'sw': |
| case 's': |
| case 'se': |
| if (this.marginBottom == null) { |
| this.marginBottom = this.yoffset + 'px'; |
| } |
| this.marginTop = '0px'; |
| break; |
| case 'ne': |
| case 'n': |
| case 'nw': |
| default: |
| if (this.marginTop == null) { |
| this.marginTop = this.yoffset + 'px'; |
| } |
| this.marginBottom = '0px'; |
| break; |
| } |
| } |
| this.yoffset = 0; |
| } |
| |
| |
| |
| |
| }; |
| |
| Legend.prototype.init = function() { |
| if ($.isFunction(this.renderer)) { |
| this.renderer = new this.renderer(); |
| } |
| this.renderer.init.call(this, this.rendererOptions); |
| }; |
| |
| Legend.prototype.draw = function(offsets, plot) { |
| for (var i=0; i<$.jqplot.preDrawLegendHooks.length; i++){ |
| $.jqplot.preDrawLegendHooks[i].call(this, offsets); |
| } |
| return this.renderer.draw.call(this, offsets, plot); |
| }; |
| |
| Legend.prototype.pack = function(offsets) { |
| this.renderer.pack.call(this, offsets); |
| }; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function Title(text) { |
| $.jqplot.ElemContainer.call(this); |
| |
| |
| |
| |
| this.text = text; |
| |
| |
| this.show = true; |
| |
| |
| this.fontFamily; |
| |
| |
| this.fontSize ; |
| |
| |
| this.textAlign; |
| |
| |
| this.textColor; |
| |
| |
| |
| this.renderer = $.jqplot.DivTitleRenderer; |
| |
| |
| this.rendererOptions = {}; |
| |
| |
| |
| this.escapeHtml = false; |
| } |
| |
| Title.prototype = new $.jqplot.ElemContainer(); |
| Title.prototype.constructor = Title; |
| |
| Title.prototype.init = function() { |
| if ($.isFunction(this.renderer)) { |
| this.renderer = new this.renderer(); |
| } |
| this.renderer.init.call(this, this.rendererOptions); |
| }; |
| |
| Title.prototype.draw = function(width) { |
| return this.renderer.draw.call(this, width); |
| }; |
| |
| Title.prototype.pack = function() { |
| this.renderer.pack.call(this); |
| }; |
|
|
|
|
| |
| |
| |
| |
| |
| |
| function Series(options) { |
| options = options || {}; |
| $.jqplot.ElemContainer.call(this); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| this.show = true; |
| |
| |
| this.xaxis = 'xaxis'; |
| this._xaxis; |
| |
| |
| this.yaxis = 'yaxis'; |
| this._yaxis; |
| this.gridBorderWidth = 2.0; |
| |
| |
| |
| this.renderer = $.jqplot.LineRenderer; |
| |
| |
| this.rendererOptions = {}; |
| this.data = []; |
| this.gridData = []; |
| |
| |
| this.label = ''; |
| |
| |
| this.showLabel = true; |
| |
| |
| this.color; |
| |
| |
| |
| this.negativeColor; |
| |
| |
| this.lineWidth = 2.5; |
| |
| |
| this.lineJoin = 'round'; |
| |
| |
| this.lineCap = 'round'; |
| |
| |
| |
| |
| |
| this.linePattern = 'solid'; |
| this.shadow = true; |
| |
| |
| this.shadowAngle = 45; |
| |
| |
| this.shadowOffset = 1.25; |
| |
| |
| this.shadowDepth = 3; |
| |
| |
| this.shadowAlpha = '0.1'; |
| |
| |
| |
| this.breakOnNull = false; |
| |
| |
| |
| this.markerRenderer = $.jqplot.MarkerRenderer; |
| |
| |
| |
| this.markerOptions = {}; |
| |
| |
| this.showLine = true; |
| |
| |
| this.showMarker = true; |
| |
| |
| this.index; |
| |
| |
| |
| this.fill = false; |
| |
| |
| this.fillColor; |
| |
| |
| |
| this.fillAlpha; |
| |
| |
| |
| this.fillAndStroke = false; |
| |
| |
| |
| |
| |
| |
| |
| |
| this.disableStack = false; |
| |
| |
| |
| this._stack = false; |
| |
| |
| this.neighborThreshold = 4; |
| |
| |
| this.fillToZero = false; |
| |
| |
| |
| this.fillToValue = 0; |
| |
| |
| |
| this.fillAxis = 'y'; |
| |
| |
| this.useNegativeColors = true; |
| this._stackData = []; |
| |
| |
| this._plotData = []; |
| |
| this._plotValues = {x:[], y:[]}; |
| |
| this._intervals = {x:{}, y:{}}; |
| |
| this._prevPlotData = []; |
| this._prevGridData = []; |
| this._stackAxis = 'y'; |
| this._primaryAxis = '_xaxis'; |
| |
| this.canvas = new $.jqplot.GenericCanvas(); |
| this.shadowCanvas = new $.jqplot.GenericCanvas(); |
| this.plugins = {}; |
| |
| this._sumy = 0; |
| this._sumx = 0; |
| this._type = ''; |
| } |
| |
| Series.prototype = new $.jqplot.ElemContainer(); |
| Series.prototype.constructor = Series; |
| |
| Series.prototype.init = function(index, gridbw, plot) { |
| |
| this.index = index; |
| this.gridBorderWidth = gridbw; |
| var d = this.data; |
| var temp = [], i, l; |
| for (i=0, l=d.length; i<l; i++) { |
| if (! this.breakOnNull) { |
| if (d[i] == null || d[i][0] == null || d[i][1] == null) { |
| continue; |
| } |
| else { |
| temp.push(d[i]); |
| } |
| } |
| else { |
| |
| |
| |
| |
| |
| temp.push(d[i]); |
| } |
| } |
| this.data = temp; |
|
|
| |
| |
| |
| if (!this.color) { |
| this.color = plot.colorGenerator.get(this.index); |
| } |
| if (!this.negativeColor) { |
| this.negativeColor = plot.negativeColorGenerator.get(this.index); |
| } |
|
|
|
|
| if (!this.fillColor) { |
| this.fillColor = this.color; |
| } |
| if (this.fillAlpha) { |
| var comp = $.jqplot.normalize2rgb(this.fillColor); |
| var comp = $.jqplot.getColorComponents(comp); |
| this.fillColor = 'rgba('+comp[0]+','+comp[1]+','+comp[2]+','+this.fillAlpha+')'; |
| } |
| if ($.isFunction(this.renderer)) { |
| this.renderer = new this.renderer(); |
| } |
| this.renderer.init.call(this, this.rendererOptions, plot); |
| this.markerRenderer = new this.markerRenderer(); |
| if (!this.markerOptions.color) { |
| this.markerOptions.color = this.color; |
| } |
| if (this.markerOptions.show == null) { |
| this.markerOptions.show = this.showMarker; |
| } |
| this.showMarker = this.markerOptions.show; |
| |
| this.markerRenderer.init(this.markerOptions); |
| }; |
| |
| |
| |
| |
| Series.prototype.draw = function(sctx, opts, plot) { |
| var options = (opts == undefined) ? {} : opts; |
| sctx = (sctx == undefined) ? this.canvas._ctx : sctx; |
| |
| var j, data, gridData; |
| |
| |
| |
| for (j=0; j<$.jqplot.preDrawSeriesHooks.length; j++) { |
| $.jqplot.preDrawSeriesHooks[j].call(this, sctx, options); |
| } |
| if (this.show) { |
| this.renderer.setGridData.call(this, plot); |
| if (!options.preventJqPlotSeriesDrawTrigger) { |
| $(sctx.canvas).trigger('jqplotSeriesDraw', [this.data, this.gridData]); |
| } |
| data = []; |
| if (options.data) { |
| data = options.data; |
| } |
| else if (!this._stack) { |
| data = this.data; |
| } |
| else { |
| data = this._plotData; |
| } |
| gridData = options.gridData || this.renderer.makeGridData.call(this, data, plot); |
|
|
| if (this._type === 'line' && this.renderer.smooth && this.renderer._smoothedData.length) { |
| gridData = this.renderer._smoothedData; |
| } |
|
|
| this.renderer.draw.call(this, sctx, gridData, options, plot); |
| } |
| |
| for (j=0; j<$.jqplot.postDrawSeriesHooks.length; j++) { |
| $.jqplot.postDrawSeriesHooks[j].call(this, sctx, options, plot); |
| } |
| |
| sctx = opts = plot = j = data = gridData = null; |
| }; |
| |
| Series.prototype.drawShadow = function(sctx, opts, plot) { |
| var options = (opts == undefined) ? {} : opts; |
| sctx = (sctx == undefined) ? this.shadowCanvas._ctx : sctx; |
| |
| var j, data, gridData; |
| |
| |
| |
| for (j=0; j<$.jqplot.preDrawSeriesShadowHooks.length; j++) { |
| $.jqplot.preDrawSeriesShadowHooks[j].call(this, sctx, options); |
| } |
| if (this.shadow) { |
| this.renderer.setGridData.call(this, plot); |
|
|
| data = []; |
| if (options.data) { |
| data = options.data; |
| } |
| else if (!this._stack) { |
| data = this.data; |
| } |
| else { |
| data = this._plotData; |
| } |
| gridData = options.gridData || this.renderer.makeGridData.call(this, data, plot); |
| |
| this.renderer.drawShadow.call(this, sctx, gridData, options, plot); |
| } |
| |
| for (j=0; j<$.jqplot.postDrawSeriesShadowHooks.length; j++) { |
| $.jqplot.postDrawSeriesShadowHooks[j].call(this, sctx, options); |
| } |
| |
| sctx = opts = plot = j = data = gridData = null; |
| |
| }; |
| |
| |
| Series.prototype.toggleDisplay = function(ev, callback) { |
| var s, speed; |
| if (ev.data.series) { |
| s = ev.data.series; |
| } |
| else { |
| s = this; |
| } |
|
|
| if (ev.data.speed) { |
| speed = ev.data.speed; |
| } |
| if (speed) { |
| |
| if (s.canvas._elem.is(':hidden') || !s.show) { |
| s.show = true; |
|
|
| s.canvas._elem.removeClass('jqplot-series-hidden'); |
| if (s.shadowCanvas._elem) { |
| s.shadowCanvas._elem.fadeIn(speed); |
| } |
| s.canvas._elem.fadeIn(speed, callback); |
| s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).fadeIn(speed); |
| } |
| else { |
| s.show = false; |
|
|
| s.canvas._elem.addClass('jqplot-series-hidden'); |
| if (s.shadowCanvas._elem) { |
| s.shadowCanvas._elem.fadeOut(speed); |
| } |
| s.canvas._elem.fadeOut(speed, callback); |
| s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).fadeOut(speed); |
| } |
| } |
| else { |
| |
| if (s.canvas._elem.is(':hidden') || !s.show) { |
| s.show = true; |
|
|
| s.canvas._elem.removeClass('jqplot-series-hidden'); |
| if (s.shadowCanvas._elem) { |
| s.shadowCanvas._elem.show(); |
| } |
| s.canvas._elem.show(0, callback); |
| s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).show(); |
| } |
| else { |
| s.show = false; |
|
|
| s.canvas._elem.addClass('jqplot-series-hidden'); |
| if (s.shadowCanvas._elem) { |
| s.shadowCanvas._elem.hide(); |
| } |
| s.canvas._elem.hide(0, callback); |
| s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).hide(); |
| } |
| } |
| }; |
| |
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function Grid() { |
| $.jqplot.ElemContainer.call(this); |
| |
| |
| |
| |
| this.drawGridlines = true; |
| |
| |
| this.gridLineColor = '#cccccc'; |
| |
| |
| this.gridLineWidth = 1.0; |
| |
| |
| this.background = '#fffdf6'; |
| |
| |
| this.borderColor = '#999999'; |
| |
| |
| this.borderWidth = 2.0; |
| |
| |
| this.drawBorder = true; |
| |
| |
| this.shadow = true; |
| |
| |
| this.shadowAngle = 45; |
| |
| |
| this.shadowOffset = 1.5; |
| |
| |
| this.shadowWidth = 3; |
| |
| |
| this.shadowDepth = 3; |
| |
| |
| this.shadowColor = null; |
| |
| |
| this.shadowAlpha = '0.07'; |
| this._left; |
| this._top; |
| this._right; |
| this._bottom; |
| this._width; |
| this._height; |
| this._axes = []; |
| |
| |
| |
| this.renderer = $.jqplot.CanvasGridRenderer; |
| |
| |
| |
| this.rendererOptions = {}; |
| this._offsets = {top:null, bottom:null, left:null, right:null}; |
| } |
| |
| Grid.prototype = new $.jqplot.ElemContainer(); |
| Grid.prototype.constructor = Grid; |
| |
| Grid.prototype.init = function() { |
| if ($.isFunction(this.renderer)) { |
| this.renderer = new this.renderer(); |
| } |
| this.renderer.init.call(this, this.rendererOptions); |
| }; |
| |
| Grid.prototype.createElement = function(offsets,plot) { |
| this._offsets = offsets; |
| return this.renderer.createElement.call(this, plot); |
| }; |
| |
| Grid.prototype.draw = function() { |
| this.renderer.draw.call(this); |
| }; |
| |
| $.jqplot.GenericCanvas = function() { |
| $.jqplot.ElemContainer.call(this); |
| this._ctx; |
| }; |
| |
| $.jqplot.GenericCanvas.prototype = new $.jqplot.ElemContainer(); |
| $.jqplot.GenericCanvas.prototype.constructor = $.jqplot.GenericCanvas; |
| |
| $.jqplot.GenericCanvas.prototype.createElement = function(offsets, clss, plotDimensions, plot) { |
| this._offsets = offsets; |
| var klass = 'jqplot'; |
| if (clss != undefined) { |
| klass = clss; |
| } |
| var elem; |
|
|
| elem = plot.canvasManager.getCanvas(); |
| |
| |
| if (plotDimensions != null) { |
| this._plotDimensions = plotDimensions; |
| } |
| |
| elem.width = this._plotDimensions.width - this._offsets.left - this._offsets.right; |
| elem.height = this._plotDimensions.height - this._offsets.top - this._offsets.bottom; |
| this._elem = $(elem); |
| this._elem.css({ position: 'absolute', left: this._offsets.left, top: this._offsets.top }); |
| |
| this._elem.addClass(klass); |
| |
| elem = plot.canvasManager.initCanvas(elem); |
| |
| elem = null; |
| return this._elem; |
| }; |
| |
| $.jqplot.GenericCanvas.prototype.setContext = function() { |
| this._ctx = this._elem.get(0).getContext("2d"); |
| return this._ctx; |
| }; |
| |
| |
| $.jqplot.GenericCanvas.prototype.resetCanvas = function() { |
| if (this._elem) { |
| if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) { |
| window.G_vmlCanvasManager.uninitElement(this._elem.get(0)); |
| } |
| |
| |
| this._elem.emptyForce(); |
| } |
| |
| this._ctx = null; |
| }; |
| |
| $.jqplot.HooksManager = function () { |
| this.hooks =[]; |
| this.args = []; |
| }; |
| |
| $.jqplot.HooksManager.prototype.addOnce = function(fn, args) { |
| args = args || []; |
| var havehook = false; |
| for (var i=0, l=this.hooks.length; i<l; i++) { |
| if (this.hooks[i] == fn) { |
| havehook = true; |
| } |
| } |
| if (!havehook) { |
| this.hooks.push(fn); |
| this.args.push(args); |
| } |
| }; |
| |
| $.jqplot.HooksManager.prototype.add = function(fn, args) { |
| args = args || []; |
| this.hooks.push(fn); |
| this.args.push(args); |
| }; |
| |
| $.jqplot.EventListenerManager = function () { |
| this.hooks =[]; |
| }; |
| |
| $.jqplot.EventListenerManager.prototype.addOnce = function(ev, fn) { |
| var havehook = false, h, i; |
| for (var i=0, l=this.hooks.length; i<l; i++) { |
| h = this.hooks[i]; |
| if (h[0] == ev && h[1] == fn) { |
| havehook = true; |
| } |
| } |
| if (!havehook) { |
| this.hooks.push([ev, fn]); |
| } |
| }; |
| |
| $.jqplot.EventListenerManager.prototype.add = function(ev, fn) { |
| this.hooks.push([ev, fn]); |
| }; |
|
|
|
|
| var _axisNames = ['yMidAxis', 'xaxis', 'yaxis', 'x2axis', 'y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis']; |
|
|
| |
| |
| |
| |
| |
| function jqPlot() { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| this.animate = false; |
| |
| |
| |
| |
| |
| this.animateReplot = false; |
| |
| |
| |
| this.axes = {xaxis: new Axis('xaxis'), yaxis: new Axis('yaxis'), x2axis: new Axis('x2axis'), y2axis: new Axis('y2axis'), y3axis: new Axis('y3axis'), y4axis: new Axis('y4axis'), y5axis: new Axis('y5axis'), y6axis: new Axis('y6axis'), y7axis: new Axis('y7axis'), y8axis: new Axis('y8axis'), y9axis: new Axis('y9axis'), yMidAxis: new Axis('yMidAxis')}; |
| this.baseCanvas = new $.jqplot.GenericCanvas(); |
| |
| |
| this.captureRightClick = false; |
| |
| |
| |
| |
| |
| |
| this.data = []; |
| |
| |
| |
| |
| this.dataRenderer; |
| |
| |
| |
| this.dataRendererOptions; |
| this.defaults = { |
| |
| |
| |
| axesDefaults: {}, |
| axes: {xaxis:{}, yaxis:{}, x2axis:{}, y2axis:{}, y3axis:{}, y4axis:{}, y5axis:{}, y6axis:{}, y7axis:{}, y8axis:{}, y9axis:{}, yMidAxis:{}}, |
| |
| |
| |
| seriesDefaults: {}, |
| series:[] |
| }; |
| |
| |
| |
| |
| |
| this.defaultAxisStart = 1; |
| |
| |
| |
| |
| |
| |
| this.drawIfHidden = false; |
| this.eventCanvas = new $.jqplot.GenericCanvas(); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| this.fillBetween = { |
| series1: null, |
| series2: null, |
| color: null, |
| baseSeries: 0, |
| fill: true |
| }; |
| |
| |
| this.fontFamily; |
| |
| |
| this.fontSize; |
| |
| |
| this.grid = new Grid(); |
| |
| |
| this.legend = new Legend(); |
| |
| |
| this.noDataIndicator = { |
| show: false, |
| indicator: 'Loading Data...', |
| axes: { |
| xaxis: { |
| min: 0, |
| max: 10, |
| tickInterval: 2, |
| show: true |
| }, |
| yaxis: { |
| min: 0, |
| max: 12, |
| tickInterval: 3, |
| show: true |
| } |
| } |
| }; |
| |
| |
| this.negativeSeriesColors = $.jqplot.config.defaultNegativeColors; |
| |
| this.options = {}; |
| this.previousSeriesStack = []; |
| |
| this.plugins = {}; |
| |
| |
| |
| this.series = []; |
| |
| |
| |
| this.seriesStack = []; |
| |
| |
| |
| |
| |
| this.seriesColors = $.jqplot.config.defaultColors; |
| |
| |
| |
| |
| this.sortData = true; |
| |
| |
| |
| this.stackSeries = false; |
| |
| this.syncXTicks = true; |
| |
| this.syncYTicks = true; |
| |
| this.target = null; |
| |
| this.targetId = null; |
| |
| |
| this.textColor; |
| |
| |
| |
| |
| this.title = new Title(); |
| |
| |
| |
| |
| |
| |
| this._drawCount = 0; |
| |
| |
| this._sumy = 0; |
| this._sumx = 0; |
| |
| |
| |
| this._stackData = []; |
| |
| |
| this._plotData = []; |
| this._width = null; |
| this._height = null; |
| this._plotDimensions = {height:null, width:null}; |
| this._gridPadding = {top:null, right:null, bottom:null, left:null}; |
| this._defaultGridPadding = {top:10, right:10, bottom:23, left:10}; |
|
|
| this._addDomReference = $.jqplot.config.addDomReference; |
|
|
| this.preInitHooks = new $.jqplot.HooksManager(); |
| this.postInitHooks = new $.jqplot.HooksManager(); |
| this.preParseOptionsHooks = new $.jqplot.HooksManager(); |
| this.postParseOptionsHooks = new $.jqplot.HooksManager(); |
| this.preDrawHooks = new $.jqplot.HooksManager(); |
| this.postDrawHooks = new $.jqplot.HooksManager(); |
| this.preDrawSeriesHooks = new $.jqplot.HooksManager(); |
| this.postDrawSeriesHooks = new $.jqplot.HooksManager(); |
| this.preDrawLegendHooks = new $.jqplot.HooksManager(); |
| this.addLegendRowHooks = new $.jqplot.HooksManager(); |
| this.preSeriesInitHooks = new $.jqplot.HooksManager(); |
| this.postSeriesInitHooks = new $.jqplot.HooksManager(); |
| this.preParseSeriesOptionsHooks = new $.jqplot.HooksManager(); |
| this.postParseSeriesOptionsHooks = new $.jqplot.HooksManager(); |
| this.eventListenerHooks = new $.jqplot.EventListenerManager(); |
| this.preDrawSeriesShadowHooks = new $.jqplot.HooksManager(); |
| this.postDrawSeriesShadowHooks = new $.jqplot.HooksManager(); |
| |
| this.colorGenerator = new $.jqplot.ColorGenerator(); |
| this.negativeColorGenerator = new $.jqplot.ColorGenerator(); |
|
|
| this.canvasManager = new $.jqplot.CanvasManager(); |
|
|
| this.themeEngine = new $.jqplot.ThemeEngine(); |
| |
| var seriesColorsIndex = 0; |
|
|
| |
| |
| |
| |
| |
| this.init = function(target, data, options) { |
| options = options || {}; |
| for (var i=0; i<$.jqplot.preInitHooks.length; i++) { |
| $.jqplot.preInitHooks[i].call(this, target, data, options); |
| } |
|
|
| for (var i=0; i<this.preInitHooks.hooks.length; i++) { |
| this.preInitHooks.hooks[i].call(this, target, data, options); |
| } |
| |
| this.targetId = '#'+target; |
| this.target = $('#'+target); |
|
|
| |
| |
| |
| if (this._addDomReference) { |
| this.target.data('jqplot', this); |
| } |
| |
| this.target.removeClass('jqplot-error'); |
| if (!this.target.get(0)) { |
| throw new Error("No plot target specified"); |
| } |
| |
| |
| if (this.target.css('position') == 'static') { |
| this.target.css('position', 'relative'); |
| } |
| if (!this.target.hasClass('jqplot-target')) { |
| this.target.addClass('jqplot-target'); |
| } |
| |
| |
| if (!this.target.height()) { |
| var h; |
| if (options && options.height) { |
| h = parseInt(options.height, 10); |
| } |
| else if (this.target.attr('data-height')) { |
| h = parseInt(this.target.attr('data-height'), 10); |
| } |
| else { |
| h = parseInt($.jqplot.config.defaultHeight, 10); |
| } |
| this._height = h; |
| this.target.css('height', h+'px'); |
| } |
| else { |
| this._height = h = this.target.height(); |
| } |
| if (!this.target.width()) { |
| var w; |
| if (options && options.width) { |
| w = parseInt(options.width, 10); |
| } |
| else if (this.target.attr('data-width')) { |
| w = parseInt(this.target.attr('data-width'), 10); |
| } |
| else { |
| w = parseInt($.jqplot.config.defaultWidth, 10); |
| } |
| this._width = w; |
| this.target.css('width', w+'px'); |
| } |
| else { |
| this._width = w = this.target.width(); |
| } |
|
|
| for (var i=0, l=_axisNames.length; i<l; i++) { |
| this.axes[_axisNames[i]] = new Axis(_axisNames[i]); |
| } |
| |
| this._plotDimensions.height = this._height; |
| this._plotDimensions.width = this._width; |
| this.grid._plotDimensions = this._plotDimensions; |
| this.title._plotDimensions = this._plotDimensions; |
| this.baseCanvas._plotDimensions = this._plotDimensions; |
| this.eventCanvas._plotDimensions = this._plotDimensions; |
| this.legend._plotDimensions = this._plotDimensions; |
| if (this._height <=0 || this._width <=0 || !this._height || !this._width) { |
| throw new Error("Canvas dimension not set"); |
| } |
| |
| if (options.dataRenderer && $.isFunction(options.dataRenderer)) { |
| if (options.dataRendererOptions) { |
| this.dataRendererOptions = options.dataRendererOptions; |
| } |
| this.dataRenderer = options.dataRenderer; |
| data = this.dataRenderer(data, this, this.dataRendererOptions); |
| } |
| |
| if (options.noDataIndicator && $.isPlainObject(options.noDataIndicator)) { |
| $.extend(true, this.noDataIndicator, options.noDataIndicator); |
| } |
| |
| if (data == null || $.isArray(data) == false || data.length == 0 || $.isArray(data[0]) == false || data[0].length == 0) { |
| |
| if (this.noDataIndicator.show == false) { |
| throw new Error("No data specified"); |
| } |
| |
| else { |
| |
| |
| |
| |
| for (var ax in this.noDataIndicator.axes) { |
| for (var prop in this.noDataIndicator.axes[ax]) { |
| this.axes[ax][prop] = this.noDataIndicator.axes[ax][prop]; |
| } |
| } |
| |
| this.postDrawHooks.add(function() { |
| var eh = this.eventCanvas.getHeight(); |
| var ew = this.eventCanvas.getWidth(); |
| var temp = $('<div class="jqplot-noData-container" style="position:absolute;"></div>'); |
| this.target.append(temp); |
| temp.height(eh); |
| temp.width(ew); |
| temp.css('top', this.eventCanvas._offsets.top); |
| temp.css('left', this.eventCanvas._offsets.left); |
| |
| var temp2 = $('<div class="jqplot-noData-contents" style="text-align:center; position:relative; margin-left:auto; margin-right:auto;"></div>'); |
| temp.append(temp2); |
| temp2.html(this.noDataIndicator.indicator); |
| var th = temp2.height(); |
| var tw = temp2.width(); |
| temp2.height(th); |
| temp2.width(tw); |
| temp2.css('top', (eh - th)/2 + 'px'); |
| }); |
|
|
| } |
| } |
| |
| |
| this.data = $.extend(true, [], data); |
| |
| this.parseOptions(options); |
| |
| if (this.textColor) { |
| this.target.css('color', this.textColor); |
| } |
| if (this.fontFamily) { |
| this.target.css('font-family', this.fontFamily); |
| } |
| if (this.fontSize) { |
| this.target.css('font-size', this.fontSize); |
| } |
| |
| this.title.init(); |
| this.legend.init(); |
| this._sumy = 0; |
| this._sumx = 0; |
| this.computePlotData(); |
| for (var i=0; i<this.series.length; i++) { |
| |
| this.seriesStack.push(i); |
| this.previousSeriesStack.push(i); |
| this.series[i].shadowCanvas._plotDimensions = this._plotDimensions; |
| this.series[i].canvas._plotDimensions = this._plotDimensions; |
| for (var j=0; j<$.jqplot.preSeriesInitHooks.length; j++) { |
| $.jqplot.preSeriesInitHooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this); |
| } |
| for (var j=0; j<this.preSeriesInitHooks.hooks.length; j++) { |
| this.preSeriesInitHooks.hooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this); |
| } |
| |
| this.series[i]._plotDimensions = this._plotDimensions; |
| this.series[i].init(i, this.grid.borderWidth, this); |
| for (var j=0; j<$.jqplot.postSeriesInitHooks.length; j++) { |
| $.jqplot.postSeriesInitHooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this); |
| } |
| for (var j=0; j<this.postSeriesInitHooks.hooks.length; j++) { |
| this.postSeriesInitHooks.hooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this); |
| } |
| this._sumy += this.series[i]._sumy; |
| this._sumx += this.series[i]._sumx; |
| } |
|
|
| var name, |
| axis; |
| for (var i=0, l=_axisNames.length; i<l; i++) { |
| name = _axisNames[i]; |
| axis = this.axes[name]; |
| axis._plotDimensions = this._plotDimensions; |
| axis.init(); |
| if (this.axes[name].borderColor == null) { |
| if (name.charAt(0) !== 'x' && axis.useSeriesColor === true && axis.show) { |
| axis.borderColor = axis._series[0].color; |
| } |
| else { |
| axis.borderColor = this.grid.borderColor; |
| } |
| } |
| } |
| |
| if (this.sortData) { |
| sortData(this.series); |
| } |
| this.grid.init(); |
| this.grid._axes = this.axes; |
| |
| this.legend._series = this.series; |
|
|
| for (var i=0; i<$.jqplot.postInitHooks.length; i++) { |
| $.jqplot.postInitHooks[i].call(this, target, this.data, options); |
| } |
|
|
| for (var i=0; i<this.postInitHooks.hooks.length; i++) { |
| this.postInitHooks.hooks[i].call(this, target, this.data, options); |
| } |
| }; |
| |
| |
| |
| |
| |
| |
| |
| this.resetAxesScale = function(axes, options) { |
| var opts = options || {}; |
| var ax = axes || this.axes; |
| if (ax === true) { |
| ax = this.axes; |
| } |
| if ($.isArray(ax)) { |
| for (var i = 0; i < ax.length; i++) { |
| this.axes[ax[i]].resetScale(opts[ax[i]]); |
| } |
| } |
| else if (typeof(ax) === 'object') { |
| for (var name in ax) { |
| this.axes[name].resetScale(opts[name]); |
| } |
| } |
| }; |
| |
| |
| |
| this.reInitialize = function (data, opts) { |
| |
| |
| |
| |
|
|
| var options = $.extend(true, {}, this.options, opts); |
|
|
| var target = this.targetId.substr(1); |
| var tdata = (data == null) ? this.data : data; |
|
|
| for (var i=0; i<$.jqplot.preInitHooks.length; i++) { |
| $.jqplot.preInitHooks[i].call(this, target, tdata, options); |
| } |
|
|
| for (var i=0; i<this.preInitHooks.hooks.length; i++) { |
| this.preInitHooks.hooks[i].call(this, target, tdata, options); |
| } |
| |
| this._height = this.target.height(); |
| this._width = this.target.width(); |
| |
| if (this._height <=0 || this._width <=0 || !this._height || !this._width) { |
| throw new Error("Target dimension not set"); |
| } |
| |
| this._plotDimensions.height = this._height; |
| this._plotDimensions.width = this._width; |
| this.grid._plotDimensions = this._plotDimensions; |
| this.title._plotDimensions = this._plotDimensions; |
| this.baseCanvas._plotDimensions = this._plotDimensions; |
| this.eventCanvas._plotDimensions = this._plotDimensions; |
| this.legend._plotDimensions = this._plotDimensions; |
|
|
| var name, |
| t, |
| j, |
| axis; |
|
|
| for (var i=0, l=_axisNames.length; i<l; i++) { |
| name = _axisNames[i]; |
| axis = this.axes[name]; |
|
|
| |
| t = axis._ticks; |
| for (var j = 0, tlen = t.length; j < tlen; j++) { |
| var el = t[j]._elem; |
| if (el) { |
| |
| if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) { |
| window.G_vmlCanvasManager.uninitElement(el.get(0)); |
| } |
| el.emptyForce(); |
| el = null; |
| t._elem = null; |
| } |
| } |
| t = null; |
|
|
| delete axis.ticks; |
| delete axis._ticks; |
| this.axes[name] = new Axis(name); |
| this.axes[name]._plotWidth = this._width; |
| this.axes[name]._plotHeight = this._height; |
| } |
| |
| if (data) { |
| if (options.dataRenderer && $.isFunction(options.dataRenderer)) { |
| if (options.dataRendererOptions) { |
| this.dataRendererOptions = options.dataRendererOptions; |
| } |
| this.dataRenderer = options.dataRenderer; |
| data = this.dataRenderer(data, this, this.dataRendererOptions); |
| } |
| |
| |
| this.data = $.extend(true, [], data); |
| } |
|
|
| if (opts) { |
| this.parseOptions(options); |
| } |
| |
| this.title._plotWidth = this._width; |
| |
| if (this.textColor) { |
| this.target.css('color', this.textColor); |
| } |
| if (this.fontFamily) { |
| this.target.css('font-family', this.fontFamily); |
| } |
| if (this.fontSize) { |
| this.target.css('font-size', this.fontSize); |
| } |
|
|
| this.title.init(); |
| this.legend.init(); |
| this._sumy = 0; |
| this._sumx = 0; |
|
|
| this.seriesStack = []; |
| this.previousSeriesStack = []; |
|
|
| this.computePlotData(); |
| for (var i=0, l=this.series.length; i<l; i++) { |
| |
| this.seriesStack.push(i); |
| this.previousSeriesStack.push(i); |
| this.series[i].shadowCanvas._plotDimensions = this._plotDimensions; |
| this.series[i].canvas._plotDimensions = this._plotDimensions; |
| for (var j=0; j<$.jqplot.preSeriesInitHooks.length; j++) { |
| $.jqplot.preSeriesInitHooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this); |
| } |
| for (var j=0; j<this.preSeriesInitHooks.hooks.length; j++) { |
| this.preSeriesInitHooks.hooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this); |
| } |
| |
| this.series[i]._plotDimensions = this._plotDimensions; |
| this.series[i].init(i, this.grid.borderWidth, this); |
| for (var j=0; j<$.jqplot.postSeriesInitHooks.length; j++) { |
| $.jqplot.postSeriesInitHooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this); |
| } |
| for (var j=0; j<this.postSeriesInitHooks.hooks.length; j++) { |
| this.postSeriesInitHooks.hooks[j].call(this.series[i], target, this.data, this.options.seriesDefaults, this.options.series[i], this); |
| } |
| this._sumy += this.series[i]._sumy; |
| this._sumx += this.series[i]._sumx; |
| } |
|
|
| for (var i=0, l=_axisNames.length; i<l; i++) { |
| name = _axisNames[i]; |
| axis = this.axes[name]; |
|
|
| axis._plotDimensions = this._plotDimensions; |
| axis.init(); |
| if (axis.borderColor == null) { |
| if (name.charAt(0) !== 'x' && axis.useSeriesColor === true && axis.show) { |
| axis.borderColor = axis._series[0].color; |
| } |
| else { |
| axis.borderColor = this.grid.borderColor; |
| } |
| } |
| } |
| |
| if (this.sortData) { |
| sortData(this.series); |
| } |
| this.grid.init(); |
| this.grid._axes = this.axes; |
| |
| this.legend._series = this.series; |
|
|
| for (var i=0, l=$.jqplot.postInitHooks.length; i<l; i++) { |
| $.jqplot.postInitHooks[i].call(this, target, this.data, options); |
| } |
|
|
| for (var i=0, l=this.postInitHooks.hooks.length; i<l; i++) { |
| this.postInitHooks.hooks[i].call(this, target, this.data, options); |
| } |
| }; |
|
|
|
|
|
|
| |
| |
| |
| |
| |
| this.quickInit = function () { |
| |
| |
| |
| |
| |
| this._height = this.target.height(); |
| this._width = this.target.width(); |
| |
| if (this._height <=0 || this._width <=0 || !this._height || !this._width) { |
| throw new Error("Target dimension not set"); |
| } |
| |
| this._plotDimensions.height = this._height; |
| this._plotDimensions.width = this._width; |
| this.grid._plotDimensions = this._plotDimensions; |
| this.title._plotDimensions = this._plotDimensions; |
| this.baseCanvas._plotDimensions = this._plotDimensions; |
| this.eventCanvas._plotDimensions = this._plotDimensions; |
| this.legend._plotDimensions = this._plotDimensions; |
| |
| for (var n in this.axes) { |
| this.axes[n]._plotWidth = this._width; |
| this.axes[n]._plotHeight = this._height; |
| } |
| |
| this.title._plotWidth = this._width; |
| |
| if (this.textColor) { |
| this.target.css('color', this.textColor); |
| } |
| if (this.fontFamily) { |
| this.target.css('font-family', this.fontFamily); |
| } |
| if (this.fontSize) { |
| this.target.css('font-size', this.fontSize); |
| } |
| |
| this._sumy = 0; |
| this._sumx = 0; |
| this.computePlotData(); |
| for (var i=0; i<this.series.length; i++) { |
| |
| if (this.series[i]._type === 'line' && this.series[i].renderer.bands.show) { |
| this.series[i].renderer.initBands.call(this.series[i], this.series[i].renderer.options, this); |
| } |
| this.series[i]._plotDimensions = this._plotDimensions; |
| this.series[i].canvas._plotDimensions = this._plotDimensions; |
| |
| this._sumy += this.series[i]._sumy; |
| this._sumx += this.series[i]._sumx; |
| } |
|
|
| var name; |
| |
| for (var j=0; j<12; j++) { |
| name = _axisNames[j]; |
| |
| var t = this.axes[name]._ticks; |
| for (var i = 0; i < t.length; i++) { |
| var el = t[i]._elem; |
| if (el) { |
| |
| if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) { |
| window.G_vmlCanvasManager.uninitElement(el.get(0)); |
| } |
| el.emptyForce(); |
| el = null; |
| t._elem = null; |
| } |
| } |
| t = null; |
| |
| this.axes[name]._plotDimensions = this._plotDimensions; |
| this.axes[name]._ticks = []; |
| |
| } |
| |
| if (this.sortData) { |
| sortData(this.series); |
| } |
| |
| this.grid._axes = this.axes; |
| |
| this.legend._series = this.series; |
| }; |
| |
| |
| function sortData(series) { |
| var d, sd, pd, ppd, ret; |
| for (var i=0; i<series.length; i++) { |
| var check; |
| var bat = [series[i].data, series[i]._stackData, series[i]._plotData, series[i]._prevPlotData]; |
| for (var n=0; n<4; n++) { |
| check = true; |
| d = bat[n]; |
| if (series[i]._stackAxis == 'x') { |
| for (var j = 0; j < d.length; j++) { |
| if (typeof(d[j][1]) != "number") { |
| check = false; |
| break; |
| } |
| } |
| if (check) { |
| d.sort(function(a,b) { return a[1] - b[1]; }); |
| } |
| } |
| else { |
| for (var j = 0; j < d.length; j++) { |
| if (typeof(d[j][0]) != "number") { |
| check = false; |
| break; |
| } |
| } |
| if (check) { |
| d.sort(function(a,b) { return a[0] - b[0]; }); |
| } |
| } |
| } |
| |
| } |
| } |
|
|
| this.computePlotData = function() { |
| this._plotData = []; |
| this._stackData = []; |
| var series, |
| index, |
| l; |
|
|
|
|
| for (index=0, l=this.series.length; index<l; index++) { |
| series = this.series[index]; |
| this._plotData.push([]); |
| this._stackData.push([]); |
| var cd = series.data; |
| this._plotData[index] = $.extend(true, [], cd); |
| this._stackData[index] = $.extend(true, [], cd); |
| series._plotData = this._plotData[index]; |
| series._stackData = this._stackData[index]; |
| var plotValues = {x:[], y:[]}; |
|
|
| if (this.stackSeries && !series.disableStack) { |
| series._stack = true; |
| |
| |
| |
| var sidx = (series._stackAxis === 'x') ? 0 : 1; |
|
|
| for (var k=0, cdl=cd.length; k<cdl; k++) { |
| var temp = cd[k][sidx]; |
| if (temp == null) { |
| temp = 0; |
| } |
| this._plotData[index][k][sidx] = temp; |
| this._stackData[index][k][sidx] = temp; |
|
|
| if (index > 0) { |
| for (var j=index; j--;) { |
| var prevval = this._plotData[j][k][sidx]; |
| |
| |
| |
| |
| if (temp * prevval >= 0) { |
| this._plotData[index][k][sidx] += prevval; |
| this._stackData[index][k][sidx] += prevval; |
| break; |
| } |
| } |
| } |
| } |
|
|
| } |
| else { |
| for (var i=0; i<series.data.length; i++) { |
| plotValues.x.push(series.data[i][0]); |
| plotValues.y.push(series.data[i][1]); |
| } |
| this._stackData.push(series.data); |
| this.series[index]._stackData = series.data; |
| this._plotData.push(series.data); |
| series._plotData = series.data; |
| series._plotValues = plotValues; |
| } |
| if (index>0) { |
| series._prevPlotData = this.series[index-1]._plotData; |
| } |
| series._sumy = 0; |
| series._sumx = 0; |
| for (i=series.data.length-1; i>-1; i--) { |
| series._sumy += series.data[i][1]; |
| series._sumx += series.data[i][0]; |
| } |
| } |
|
|
| }; |
| |
| |
| this.populatePlotData = function(series, index) { |
| |
| this._plotData = []; |
| this._stackData = []; |
| series._stackData = []; |
| series._plotData = []; |
| var plotValues = {x:[], y:[]}; |
| if (this.stackSeries && !series.disableStack) { |
| series._stack = true; |
| var sidx = (series._stackAxis === 'x') ? 0 : 1; |
| |
| |
| |
| var temp = $.extend(true, [], series.data); |
| |
| var plotdata = $.extend(true, [], series.data); |
| var tempx, tempy, dval, stackval, comparator; |
| |
| for (var j=0; j<index; j++) { |
| var cd = this.series[j].data; |
| for (var k=0; k<cd.length; k++) { |
| dval = cd[k]; |
| tempx = (dval[0] != null) ? dval[0] : 0; |
| tempy = (dval[1] != null) ? dval[1] : 0; |
| temp[k][0] += tempx; |
| temp[k][1] += tempy; |
| stackval = (sidx) ? tempy : tempx; |
| |
| |
| if (series.data[k][sidx] * stackval >= 0) { |
| plotdata[k][sidx] += stackval; |
| } |
| } |
| } |
| for (var i=0; i<plotdata.length; i++) { |
| plotValues.x.push(plotdata[i][0]); |
| plotValues.y.push(plotdata[i][1]); |
| } |
| this._plotData.push(plotdata); |
| this._stackData.push(temp); |
| series._stackData = temp; |
| series._plotData = plotdata; |
| series._plotValues = plotValues; |
| } |
| else { |
| for (var i=0; i<series.data.length; i++) { |
| plotValues.x.push(series.data[i][0]); |
| plotValues.y.push(series.data[i][1]); |
| } |
| this._stackData.push(series.data); |
| this.series[index]._stackData = series.data; |
| this._plotData.push(series.data); |
| series._plotData = series.data; |
| series._plotValues = plotValues; |
| } |
| if (index>0) { |
| series._prevPlotData = this.series[index-1]._plotData; |
| } |
| series._sumy = 0; |
| series._sumx = 0; |
| for (i=series.data.length-1; i>-1; i--) { |
| series._sumy += series.data[i][1]; |
| series._sumx += series.data[i][0]; |
| } |
| }; |
| |
| |
| this.getNextSeriesColor = (function(t) { |
| var idx = 0; |
| var sc = t.seriesColors; |
| |
| return function () { |
| if (idx < sc.length) { |
| return sc[idx++]; |
| } |
| else { |
| idx = 0; |
| return sc[idx++]; |
| } |
| }; |
| })(this); |
| |
| this.parseOptions = function(options){ |
| for (var i=0; i<this.preParseOptionsHooks.hooks.length; i++) { |
| this.preParseOptionsHooks.hooks[i].call(this, options); |
| } |
| for (var i=0; i<$.jqplot.preParseOptionsHooks.length; i++) { |
| $.jqplot.preParseOptionsHooks[i].call(this, options); |
| } |
| this.options = $.extend(true, {}, this.defaults, options); |
| var opts = this.options; |
| this.animate = opts.animate; |
| this.animateReplot = opts.animateReplot; |
| this.stackSeries = opts.stackSeries; |
| if ($.isPlainObject(opts.fillBetween)) { |
|
|
| var temp = ['series1', 'series2', 'color', 'baseSeries', 'fill'], |
| tempi; |
|
|
| for (var i=0, l=temp.length; i<l; i++) { |
| tempi = temp[i]; |
| if (opts.fillBetween[tempi] != null) { |
| this.fillBetween[tempi] = opts.fillBetween[tempi]; |
| } |
| } |
| } |
|
|
| if (opts.seriesColors) { |
| this.seriesColors = opts.seriesColors; |
| } |
| if (opts.negativeSeriesColors) { |
| this.negativeSeriesColors = opts.negativeSeriesColors; |
| } |
| if (opts.captureRightClick) { |
| this.captureRightClick = opts.captureRightClick; |
| } |
| this.defaultAxisStart = (options && options.defaultAxisStart != null) ? options.defaultAxisStart : this.defaultAxisStart; |
| this.colorGenerator.setColors(this.seriesColors); |
| this.negativeColorGenerator.setColors(this.negativeSeriesColors); |
| |
| |
| |
| $.extend(true, this._gridPadding, opts.gridPadding); |
| this.sortData = (opts.sortData != null) ? opts.sortData : this.sortData; |
| for (var i=0; i<12; i++) { |
| var n = _axisNames[i]; |
| var axis = this.axes[n]; |
| axis._options = $.extend(true, {}, opts.axesDefaults, opts.axes[n]); |
| $.extend(true, axis, opts.axesDefaults, opts.axes[n]); |
| axis._plotWidth = this._width; |
| axis._plotHeight = this._height; |
| } |
| |
| |
| |
| |
| |
| |
| |
| var normalizeData = function(data, dir, start) { |
| |
| |
| var temp = []; |
| var i, l; |
| dir = dir || 'vertical'; |
| if (!$.isArray(data[0])) { |
| |
| |
| |
| for (i=0, l=data.length; i<l; i++) { |
| if (dir == 'vertical') { |
| temp.push([start + i, data[i]]); |
| } |
| else { |
| temp.push([data[i], start+i]); |
| } |
| } |
| } |
| else { |
| |
| $.extend(true, temp, data); |
| } |
| return temp; |
| }; |
|
|
| var colorIndex = 0; |
| this.series = []; |
| for (var i=0; i<this.data.length; i++) { |
| var sopts = $.extend(true, {index: i}, {seriesColors:this.seriesColors, negativeSeriesColors:this.negativeSeriesColors}, this.options.seriesDefaults, this.options.series[i], {rendererOptions:{animation:{show: this.animate}}}); |
| |
| var temp = new Series(sopts); |
| for (var j=0; j<$.jqplot.preParseSeriesOptionsHooks.length; j++) { |
| $.jqplot.preParseSeriesOptionsHooks[j].call(temp, this.options.seriesDefaults, this.options.series[i]); |
| } |
| for (var j=0; j<this.preParseSeriesOptionsHooks.hooks.length; j++) { |
| this.preParseSeriesOptionsHooks.hooks[j].call(temp, this.options.seriesDefaults, this.options.series[i]); |
| } |
| |
| |
| $.extend(true, temp, sopts); |
| var dir = 'vertical'; |
| if (temp.renderer === $.jqplot.BarRenderer && temp.rendererOptions && temp.rendererOptions.barDirection == 'horizontal') { |
| dir = 'horizontal'; |
| temp._stackAxis = 'x'; |
| temp._primaryAxis = '_yaxis'; |
| } |
| temp.data = normalizeData(this.data[i], dir, this.defaultAxisStart); |
| switch (temp.xaxis) { |
| case 'xaxis': |
| temp._xaxis = this.axes.xaxis; |
| break; |
| case 'x2axis': |
| temp._xaxis = this.axes.x2axis; |
| break; |
| default: |
| break; |
| } |
| temp._yaxis = this.axes[temp.yaxis]; |
| temp._xaxis._series.push(temp); |
| temp._yaxis._series.push(temp); |
| if (temp.show) { |
| temp._xaxis.show = true; |
| temp._yaxis.show = true; |
| } |
| else { |
| if (temp._xaxis.scaleToHiddenSeries) { |
| temp._xaxis.show = true; |
| } |
| if (temp._yaxis.scaleToHiddenSeries) { |
| temp._yaxis.show = true; |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| if (!temp.label) { |
| temp.label = 'Series '+ (i+1).toString(); |
| } |
| |
| |
| this.series.push(temp); |
| for (var j=0; j<$.jqplot.postParseSeriesOptionsHooks.length; j++) { |
| $.jqplot.postParseSeriesOptionsHooks[j].call(this.series[i], this.options.seriesDefaults, this.options.series[i]); |
| } |
| for (var j=0; j<this.postParseSeriesOptionsHooks.hooks.length; j++) { |
| this.postParseSeriesOptionsHooks.hooks[j].call(this.series[i], this.options.seriesDefaults, this.options.series[i]); |
| } |
| } |
| |
| |
| $.extend(true, this.grid, this.options.grid); |
| |
| for (var i=0, l=_axisNames.length; i<l; i++) { |
| var n = _axisNames[i]; |
| var axis = this.axes[n]; |
| if (axis.borderWidth == null) { |
| axis.borderWidth =this.grid.borderWidth; |
| } |
| } |
| |
| if (typeof this.options.title == 'string') { |
| this.title.text = this.options.title; |
| } |
| else if (typeof this.options.title == 'object') { |
| $.extend(true, this.title, this.options.title); |
| } |
| this.title._plotWidth = this._width; |
| this.legend.setOptions(this.options.legend); |
| |
| for (var i=0; i<$.jqplot.postParseOptionsHooks.length; i++) { |
| $.jqplot.postParseOptionsHooks[i].call(this, options); |
| } |
| for (var i=0; i<this.postParseOptionsHooks.hooks.length; i++) { |
| this.postParseOptionsHooks.hooks[i].call(this, options); |
| } |
| }; |
| |
| |
| |
| this.destroy = function() { |
| this.canvasManager.freeAllCanvases(); |
| if (this.eventCanvas && this.eventCanvas._elem) { |
| this.eventCanvas._elem.unbind(); |
| } |
| |
| |
| |
| |
| this.target.empty(); |
|
|
| this.target[0].innerHTML = ''; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| this.replot = function(options) { |
| var opts = options || {}; |
| var data = opts.data || null; |
| var clear = (opts.clear === false) ? false : true; |
| var resetAxes = opts.resetAxes || false; |
| delete opts.data; |
| delete opts.clear; |
| delete opts.resetAxes; |
|
|
| this.target.trigger('jqplotPreReplot'); |
| |
| if (clear) { |
| this.destroy(); |
| } |
| |
| |
| if (data || !$.isEmptyObject(opts)) { |
| this.reInitialize(data, opts); |
| } |
| else { |
| this.quickInit(); |
| } |
|
|
| if (resetAxes) { |
| this.resetAxesScale(resetAxes, opts.axes); |
| } |
| this.draw(); |
| this.target.trigger('jqplotPostReplot'); |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| this.redraw = function(clear) { |
| clear = (clear != null) ? clear : true; |
| this.target.trigger('jqplotPreRedraw'); |
| if (clear) { |
| this.canvasManager.freeAllCanvases(); |
| this.eventCanvas._elem.unbind(); |
| |
| |
| |
| this.target.empty(); |
| } |
| for (var ax in this.axes) { |
| this.axes[ax]._ticks = []; |
| } |
| this.computePlotData(); |
| |
| |
| |
| this._sumy = 0; |
| this._sumx = 0; |
| for (var i=0, tsl = this.series.length; i<tsl; i++) { |
| this._sumy += this.series[i]._sumy; |
| this._sumx += this.series[i]._sumx; |
| } |
| this.draw(); |
| this.target.trigger('jqplotPostRedraw'); |
| }; |
| |
| |
| |
| |
| this.draw = function(){ |
| if (this.drawIfHidden || this.target.is(':visible')) { |
| this.target.trigger('jqplotPreDraw'); |
| var i, |
| j, |
| l, |
| tempseries; |
| for (i=0, l=$.jqplot.preDrawHooks.length; i<l; i++) { |
| $.jqplot.preDrawHooks[i].call(this); |
| } |
| for (i=0, l=this.preDrawHooks.hooks.length; i<l; i++) { |
| this.preDrawHooks.hooks[i].apply(this, this.preDrawSeriesHooks.args[i]); |
| } |
| |
| this.target.append(this.baseCanvas.createElement({left:0, right:0, top:0, bottom:0}, 'jqplot-base-canvas', null, this)); |
| this.baseCanvas.setContext(); |
| this.target.append(this.title.draw()); |
| this.title.pack({top:0, left:0}); |
| |
| |
| |
| var legendElem = this.legend.draw({}, this); |
| |
| var gridPadding = {top:0, left:0, bottom:0, right:0}; |
| |
| if (this.legend.placement == "outsideGrid") { |
| |
| this.target.append(legendElem); |
| switch (this.legend.location) { |
| case 'n': |
| gridPadding.top += this.legend.getHeight(); |
| break; |
| case 's': |
| gridPadding.bottom += this.legend.getHeight(); |
| break; |
| case 'ne': |
| case 'e': |
| case 'se': |
| gridPadding.right += this.legend.getWidth(); |
| break; |
| case 'nw': |
| case 'w': |
| case 'sw': |
| gridPadding.left += this.legend.getWidth(); |
| break; |
| default: |
| gridPadding.right += this.legend.getWidth(); |
| break; |
| } |
| legendElem = legendElem.detach(); |
| } |
| |
| var ax = this.axes; |
| var name; |
| |
| for (i=0; i<12; i++) { |
| name = _axisNames[i]; |
| this.target.append(ax[name].draw(this.baseCanvas._ctx, this)); |
| ax[name].set(); |
| } |
| if (ax.yaxis.show) { |
| gridPadding.left += ax.yaxis.getWidth(); |
| } |
| var ra = ['y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis']; |
| var rapad = [0, 0, 0, 0, 0, 0, 0, 0]; |
| var gpr = 0; |
| var n; |
| for (n=0; n<8; n++) { |
| if (ax[ra[n]].show) { |
| gpr += ax[ra[n]].getWidth(); |
| rapad[n] = gpr; |
| } |
| } |
| gridPadding.right += gpr; |
| if (ax.x2axis.show) { |
| gridPadding.top += ax.x2axis.getHeight(); |
| } |
| if (this.title.show) { |
| gridPadding.top += this.title.getHeight(); |
| } |
| if (ax.xaxis.show) { |
| gridPadding.bottom += ax.xaxis.getHeight(); |
| } |
| |
| |
|
|
| |
| if (this.options.gridDimensions && $.isPlainObject(this.options.gridDimensions)) { |
| var gdw = parseInt(this.options.gridDimensions.width, 10) || 0; |
| var gdh = parseInt(this.options.gridDimensions.height, 10) || 0; |
| var widthAdj = (this._width - gridPadding.left - gridPadding.right - gdw)/2; |
| var heightAdj = (this._height - gridPadding.top - gridPadding.bottom - gdh)/2; |
|
|
| if (heightAdj >= 0 && widthAdj >= 0) { |
| gridPadding.top += heightAdj; |
| gridPadding.bottom += heightAdj; |
| gridPadding.left += widthAdj; |
| gridPadding.right += widthAdj; |
| } |
| } |
| var arr = ['top', 'bottom', 'left', 'right']; |
| for (var n in arr) { |
| if (this._gridPadding[arr[n]] == null && gridPadding[arr[n]] > 0) { |
| this._gridPadding[arr[n]] = gridPadding[arr[n]]; |
| } |
| else if (this._gridPadding[arr[n]] == null) { |
| this._gridPadding[arr[n]] = this._defaultGridPadding[arr[n]]; |
| } |
| } |
| |
| var legendPadding = this._gridPadding; |
| |
| if (this.legend.placement === 'outsideGrid') { |
| legendPadding = {top:this.title.getHeight(), left: 0, right: 0, bottom: 0}; |
| if (this.legend.location === 's') { |
| legendPadding.left = this._gridPadding.left; |
| legendPadding.right = this._gridPadding.right; |
| } |
| } |
| |
| ax.xaxis.pack({position:'absolute', bottom:this._gridPadding.bottom - ax.xaxis.getHeight(), left:0, width:this._width}, {min:this._gridPadding.left, max:this._width - this._gridPadding.right}); |
| ax.yaxis.pack({position:'absolute', top:0, left:this._gridPadding.left - ax.yaxis.getWidth(), height:this._height}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top}); |
| ax.x2axis.pack({position:'absolute', top:this._gridPadding.top - ax.x2axis.getHeight(), left:0, width:this._width}, {min:this._gridPadding.left, max:this._width - this._gridPadding.right}); |
| for (i=8; i>0; i--) { |
| ax[ra[i-1]].pack({position:'absolute', top:0, right:this._gridPadding.right - rapad[i-1]}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top}); |
| } |
| var ltemp = (this._width - this._gridPadding.left - this._gridPadding.right)/2.0 + this._gridPadding.left - ax.yMidAxis.getWidth()/2.0; |
| ax.yMidAxis.pack({position:'absolute', top:0, left:ltemp, zIndex:9, textAlign: 'center'}, {min:this._height - this._gridPadding.bottom, max: this._gridPadding.top}); |
| |
| this.target.append(this.grid.createElement(this._gridPadding, this)); |
| this.grid.draw(); |
| |
| var series = this.series; |
| var seriesLength = series.length; |
| |
| for (i=0, l=seriesLength; i<l; i++) { |
| |
| |
| j = this.seriesStack[i]; |
| this.target.append(series[j].shadowCanvas.createElement(this._gridPadding, 'jqplot-series-shadowCanvas', null, this)); |
| series[j].shadowCanvas.setContext(); |
| series[j].shadowCanvas._elem.data('seriesIndex', j); |
| } |
| |
| for (i=0, l=seriesLength; i<l; i++) { |
| |
| |
| j = this.seriesStack[i]; |
| this.target.append(series[j].canvas.createElement(this._gridPadding, 'jqplot-series-canvas', null, this)); |
| series[j].canvas.setContext(); |
| series[j].canvas._elem.data('seriesIndex', j); |
| } |
| |
| |
| this.target.append(this.eventCanvas.createElement(this._gridPadding, 'jqplot-event-canvas', null, this)); |
| this.eventCanvas.setContext(); |
| this.eventCanvas._ctx.fillStyle = 'rgba(0,0,0,0)'; |
| this.eventCanvas._ctx.fillRect(0,0,this.eventCanvas._ctx.canvas.width, this.eventCanvas._ctx.canvas.height); |
| |
| |
| this.bindCustomEvents(); |
| |
| |
| if (this.legend.preDraw) { |
| this.eventCanvas._elem.before(legendElem); |
| this.legend.pack(legendPadding); |
| if (this.legend._elem) { |
| this.drawSeries({legendInfo:{location:this.legend.location, placement:this.legend.placement, width:this.legend.getWidth(), height:this.legend.getHeight(), xoffset:this.legend.xoffset, yoffset:this.legend.yoffset}}); |
| } |
| else { |
| this.drawSeries(); |
| } |
| } |
| else { |
| this.drawSeries(); |
| if (seriesLength) { |
| $(series[seriesLength-1].canvas._elem).after(legendElem); |
| } |
| this.legend.pack(legendPadding); |
| } |
| |
| |
| for (var i=0, l=$.jqplot.eventListenerHooks.length; i<l; i++) { |
| |
| |
| this.eventCanvas._elem.bind($.jqplot.eventListenerHooks[i][0], {plot:this}, $.jqplot.eventListenerHooks[i][1]); |
| } |
| |
| |
| for (var i=0, l=this.eventListenerHooks.hooks.length; i<l; i++) { |
| |
| |
| this.eventCanvas._elem.bind(this.eventListenerHooks.hooks[i][0], {plot:this}, this.eventListenerHooks.hooks[i][1]); |
| } |
|
|
| var fb = this.fillBetween; |
| if (fb.fill && fb.series1 !== fb.series2 && fb.series1 < seriesLength && fb.series2 < seriesLength && series[fb.series1]._type === 'line' && series[fb.series2]._type === 'line') { |
| this.doFillBetweenLines(); |
| } |
|
|
| for (var i=0, l=$.jqplot.postDrawHooks.length; i<l; i++) { |
| $.jqplot.postDrawHooks[i].call(this); |
| } |
|
|
| for (var i=0, l=this.postDrawHooks.hooks.length; i<l; i++) { |
| this.postDrawHooks.hooks[i].apply(this, this.postDrawHooks.args[i]); |
| } |
| |
| if (this.target.is(':visible')) { |
| this._drawCount += 1; |
| } |
|
|
| var temps, |
| tempr, |
| sel, |
| _els; |
| |
| for (i=0, l=seriesLength; i<l; i++) { |
| temps = series[i]; |
| tempr = temps.renderer; |
| sel = '.jqplot-point-label.jqplot-series-'+i; |
| if (tempr.animation && tempr.animation._supported && tempr.animation.show && (this._drawCount < 2 || this.animateReplot)) { |
| _els = this.target.find(sel); |
| _els.stop(true, true).hide(); |
| temps.canvas._elem.stop(true, true).hide(); |
| temps.shadowCanvas._elem.stop(true, true).hide(); |
| temps.canvas._elem.jqplotEffect('blind', {mode: 'show', direction: tempr.animation.direction}, tempr.animation.speed); |
| temps.shadowCanvas._elem.jqplotEffect('blind', {mode: 'show', direction: tempr.animation.direction}, tempr.animation.speed); |
| _els.fadeIn(tempr.animation.speed*0.8); |
| } |
| } |
| _els = null; |
| |
| this.target.trigger('jqplotPostDraw', [this]); |
| } |
| }; |
|
|
| jqPlot.prototype.doFillBetweenLines = function () { |
| var fb = this.fillBetween; |
| var sid1 = fb.series1; |
| var sid2 = fb.series2; |
| |
| var id1 = (sid1 < sid2) ? sid1 : sid2; |
| var id2 = (sid2 > sid1) ? sid2 : sid1; |
|
|
| var series1 = this.series[id1]; |
| var series2 = this.series[id2]; |
|
|
| if (series2.renderer.smooth) { |
| var tempgd = series2.renderer._smoothedData.slice(0).reverse(); |
| } |
| else { |
| var tempgd = series2.gridData.slice(0).reverse(); |
| } |
|
|
| if (series1.renderer.smooth) { |
| var gd = series1.renderer._smoothedData.concat(tempgd); |
| } |
| else { |
| var gd = series1.gridData.concat(tempgd); |
| } |
|
|
| var color = (fb.color !== null) ? fb.color : this.series[sid1].fillColor; |
| var baseSeries = (fb.baseSeries !== null) ? fb.baseSeries : id1; |
|
|
| |
| |
| var sr = this.series[baseSeries].renderer.shapeRenderer; |
| var opts = {fillStyle: color, fill: true, closePath: true}; |
| sr.draw(series1.shadowCanvas._ctx, gd, opts); |
| }; |
| |
| this.bindCustomEvents = function() { |
| this.eventCanvas._elem.bind('click', {plot:this}, this.onClick); |
| this.eventCanvas._elem.bind('dblclick', {plot:this}, this.onDblClick); |
| this.eventCanvas._elem.bind('mousedown', {plot:this}, this.onMouseDown); |
| this.eventCanvas._elem.bind('mousemove', {plot:this}, this.onMouseMove); |
| this.eventCanvas._elem.bind('mouseenter', {plot:this}, this.onMouseEnter); |
| this.eventCanvas._elem.bind('mouseleave', {plot:this}, this.onMouseLeave); |
| if (this.captureRightClick) { |
| this.eventCanvas._elem.bind('mouseup', {plot:this}, this.onRightClick); |
| this.eventCanvas._elem.get(0).oncontextmenu = function() { |
| return false; |
| }; |
| } |
| else { |
| this.eventCanvas._elem.bind('mouseup', {plot:this}, this.onMouseUp); |
| } |
| }; |
| |
| function getEventPosition(ev) { |
| var plot = ev.data.plot; |
| var go = plot.eventCanvas._elem.offset(); |
| var gridPos = {x:ev.pageX - go.left, y:ev.pageY - go.top}; |
| var dataPos = {xaxis:null, yaxis:null, x2axis:null, y2axis:null, y3axis:null, y4axis:null, y5axis:null, y6axis:null, y7axis:null, y8axis:null, y9axis:null, yMidAxis:null}; |
| var an = ['xaxis', 'yaxis', 'x2axis', 'y2axis', 'y3axis', 'y4axis', 'y5axis', 'y6axis', 'y7axis', 'y8axis', 'y9axis', 'yMidAxis']; |
| var ax = plot.axes; |
| var n, axis; |
| for (n=11; n>0; n--) { |
| axis = an[n-1]; |
| if (ax[axis].show) { |
| dataPos[axis] = ax[axis].series_p2u(gridPos[axis.charAt(0)]); |
| } |
| } |
|
|
| return {offsets:go, gridPos:gridPos, dataPos:dataPos}; |
| } |
| |
| |
| |
| function checkIntersection(gridpos, plot) { |
| var series = plot.series; |
| var i, j, k, s, r, x, y, theta, sm, sa, minang, maxang; |
| var d0, d, p, pp, points, bw, hp; |
| var threshold, t; |
| for (k=plot.seriesStack.length-1; k>=0; k--) { |
| i = plot.seriesStack[k]; |
| s = series[i]; |
| hp = s._highlightThreshold; |
| switch (s.renderer.constructor) { |
| case $.jqplot.BarRenderer: |
| x = gridpos.x; |
| y = gridpos.y; |
| for (j=0; j<s._barPoints.length; j++) { |
| points = s._barPoints[j]; |
| p = s.gridData[j]; |
| if (x>points[0][0] && x<points[2][0] && y>points[2][1] && y<points[0][1]) { |
| return {seriesIndex:s.index, pointIndex:j, gridData:p, data:s.data[j], points:s._barPoints[j]}; |
| } |
| } |
| break; |
| case $.jqplot.PyramidRenderer: |
| x = gridpos.x; |
| y = gridpos.y; |
| for (j=0; j<s._barPoints.length; j++) { |
| points = s._barPoints[j]; |
| p = s.gridData[j]; |
| if (x > points[0][0] + hp[0][0] && x < points[2][0] + hp[2][0] && y > points[2][1] && y < points[0][1]) { |
| return {seriesIndex:s.index, pointIndex:j, gridData:p, data:s.data[j], points:s._barPoints[j]}; |
| } |
| } |
| break; |
| |
| case $.jqplot.DonutRenderer: |
| sa = s.startAngle/180*Math.PI; |
| x = gridpos.x - s._center[0]; |
| y = gridpos.y - s._center[1]; |
| r = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); |
| if (x > 0 && -y >= 0) { |
| theta = 2*Math.PI - Math.atan(-y/x); |
| } |
| else if (x > 0 && -y < 0) { |
| theta = -Math.atan(-y/x); |
| } |
| else if (x < 0) { |
| theta = Math.PI - Math.atan(-y/x); |
| } |
| else if (x == 0 && -y > 0) { |
| theta = 3*Math.PI/2; |
| } |
| else if (x == 0 && -y < 0) { |
| theta = Math.PI/2; |
| } |
| else if (x == 0 && y == 0) { |
| theta = 0; |
| } |
| if (sa) { |
| theta -= sa; |
| if (theta < 0) { |
| theta += 2*Math.PI; |
| } |
| else if (theta > 2*Math.PI) { |
| theta -= 2*Math.PI; |
| } |
| } |
| |
| sm = s.sliceMargin/180*Math.PI; |
| if (r < s._radius && r > s._innerRadius) { |
| for (j=0; j<s.gridData.length; j++) { |
| minang = (j>0) ? s.gridData[j-1][1]+sm : sm; |
| maxang = s.gridData[j][1]; |
| if (theta > minang && theta < maxang) { |
| return {seriesIndex:s.index, pointIndex:j, gridData:[gridpos.x,gridpos.y], data:s.data[j]}; |
| } |
| } |
| } |
| break; |
| |
| case $.jqplot.PieRenderer: |
| sa = s.startAngle/180*Math.PI; |
| x = gridpos.x - s._center[0]; |
| y = gridpos.y - s._center[1]; |
| r = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); |
| if (x > 0 && -y >= 0) { |
| theta = 2*Math.PI - Math.atan(-y/x); |
| } |
| else if (x > 0 && -y < 0) { |
| theta = -Math.atan(-y/x); |
| } |
| else if (x < 0) { |
| theta = Math.PI - Math.atan(-y/x); |
| } |
| else if (x == 0 && -y > 0) { |
| theta = 3*Math.PI/2; |
| } |
| else if (x == 0 && -y < 0) { |
| theta = Math.PI/2; |
| } |
| else if (x == 0 && y == 0) { |
| theta = 0; |
| } |
| if (sa) { |
| theta -= sa; |
| if (theta < 0) { |
| theta += 2*Math.PI; |
| } |
| else if (theta > 2*Math.PI) { |
| theta -= 2*Math.PI; |
| } |
| } |
| |
| sm = s.sliceMargin/180*Math.PI; |
| if (r < s._radius) { |
| for (j=0; j<s.gridData.length; j++) { |
| minang = (j>0) ? s.gridData[j-1][1]+sm : sm; |
| maxang = s.gridData[j][1]; |
| if (theta > minang && theta < maxang) { |
| return {seriesIndex:s.index, pointIndex:j, gridData:[gridpos.x,gridpos.y], data:s.data[j]}; |
| } |
| } |
| } |
| break; |
| |
| case $.jqplot.BubbleRenderer: |
| x = gridpos.x; |
| y = gridpos.y; |
| var ret = null; |
| |
| if (s.show) { |
| for (var j=0; j<s.gridData.length; j++) { |
| p = s.gridData[j]; |
| d = Math.sqrt( (x-p[0]) * (x-p[0]) + (y-p[1]) * (y-p[1]) ); |
| if (d <= p[2] && (d <= d0 || d0 == null)) { |
| d0 = d; |
| ret = {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| if (ret != null) { |
| return ret; |
| } |
| } |
| break; |
| |
| case $.jqplot.FunnelRenderer: |
| x = gridpos.x; |
| y = gridpos.y; |
| var v = s._vertices, |
| vfirst = v[0], |
| vlast = v[v.length-1], |
| lex, |
| rex, |
| cv; |
| |
| |
| |
| function findedge (l, p1 , p2) { |
| var m = (p1[1] - p2[1])/(p1[0] - p2[0]); |
| var b = p1[1] - m*p1[0]; |
| var y = l + p1[1]; |
| |
| return [(y - b)/m, y]; |
| } |
| |
| |
| lex = findedge(y, vfirst[0], vlast[3]); |
| rex = findedge(y, vfirst[1], vlast[2]); |
| for (j=0; j<v.length; j++) { |
| cv = v[j]; |
| if (y >= cv[0][1] && y <= cv[3][1] && x >= lex[0] && x <= rex[0]) { |
| return {seriesIndex:s.index, pointIndex:j, gridData:null, data:s.data[j]}; |
| } |
| } |
| break; |
| |
| case $.jqplot.LineRenderer: |
| x = gridpos.x; |
| y = gridpos.y; |
| r = s.renderer; |
| if (s.show) { |
| if ((s.fill || (s.renderer.bands.show && s.renderer.bands.fill)) && (!plot.plugins.highlighter || !plot.plugins.highlighter.show)) { |
| |
| var inside = false; |
| if (x>s._boundingBox[0][0] && x<s._boundingBox[1][0] && y>s._boundingBox[1][1] && y<s._boundingBox[0][1]) { |
| |
| |
| var numPoints = s._areaPoints.length; |
| var ii; |
| var j = numPoints-1; |
|
|
| for(var ii=0; ii < numPoints; ii++) { |
| var vertex1 = [s._areaPoints[ii][0], s._areaPoints[ii][1]]; |
| var vertex2 = [s._areaPoints[j][0], s._areaPoints[j][1]]; |
|
|
| if (vertex1[1] < y && vertex2[1] >= y || vertex2[1] < y && vertex1[1] >= y) { |
| if (vertex1[0] + (y - vertex1[1]) / (vertex2[1] - vertex1[1]) * (vertex2[0] - vertex1[0]) < x) { |
| inside = !inside; |
| } |
| } |
|
|
| j = ii; |
| } |
| } |
| if (inside) { |
| return {seriesIndex:i, pointIndex:null, gridData:s.gridData, data:s.data, points:s._areaPoints}; |
| } |
| break; |
| |
| } |
|
|
| else { |
| t = s.markerRenderer.size/2+s.neighborThreshold; |
| threshold = (t > 0) ? t : 0; |
| for (var j=0; j<s.gridData.length; j++) { |
| p = s.gridData[j]; |
| |
| if (r.constructor == $.jqplot.OHLCRenderer) { |
| if (r.candleStick) { |
| var yp = s._yaxis.series_u2p; |
| if (x >= p[0]-r._bodyWidth/2 && x <= p[0]+r._bodyWidth/2 && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) { |
| return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| |
| else if (!r.hlc){ |
| var yp = s._yaxis.series_u2p; |
| if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) { |
| return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| |
| else { |
| var yp = s._yaxis.series_u2p; |
| if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][1]) && y <= yp(s.data[j][2])) { |
| return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| |
| } |
| else if (p[0] != null && p[1] != null){ |
| d = Math.sqrt( (x-p[0]) * (x-p[0]) + (y-p[1]) * (y-p[1]) ); |
| if (d <= threshold && (d <= d0 || d0 == null)) { |
| d0 = d; |
| return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| } |
| } |
| } |
| break; |
| |
| default: |
| x = gridpos.x; |
| y = gridpos.y; |
| r = s.renderer; |
| if (s.show) { |
| t = s.markerRenderer.size/2+s.neighborThreshold; |
| threshold = (t > 0) ? t : 0; |
| for (var j=0; j<s.gridData.length; j++) { |
| p = s.gridData[j]; |
| |
| if (r.constructor == $.jqplot.OHLCRenderer) { |
| if (r.candleStick) { |
| var yp = s._yaxis.series_u2p; |
| if (x >= p[0]-r._bodyWidth/2 && x <= p[0]+r._bodyWidth/2 && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) { |
| return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| |
| else if (!r.hlc){ |
| var yp = s._yaxis.series_u2p; |
| if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) { |
| return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| |
| else { |
| var yp = s._yaxis.series_u2p; |
| if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][1]) && y <= yp(s.data[j][2])) { |
| return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| |
| } |
| else { |
| d = Math.sqrt( (x-p[0]) * (x-p[0]) + (y-p[1]) * (y-p[1]) ); |
| if (d <= threshold && (d <= d0 || d0 == null)) { |
| d0 = d; |
| return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]}; |
| } |
| } |
| } |
| } |
| break; |
| } |
| } |
| |
| return null; |
| } |
| |
| |
| |
| this.onClick = function(ev) { |
| |
| |
| var positions = getEventPosition(ev); |
| var p = ev.data.plot; |
| var neighbor = checkIntersection(positions.gridPos, p); |
| var evt = $.Event('jqplotClick'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]); |
| }; |
| |
| this.onDblClick = function(ev) { |
| |
| |
| var positions = getEventPosition(ev); |
| var p = ev.data.plot; |
| var neighbor = checkIntersection(positions.gridPos, p); |
| var evt = $.Event('jqplotDblClick'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]); |
| }; |
| |
| this.onMouseDown = function(ev) { |
| var positions = getEventPosition(ev); |
| var p = ev.data.plot; |
| var neighbor = checkIntersection(positions.gridPos, p); |
| var evt = $.Event('jqplotMouseDown'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]); |
| }; |
| |
| this.onMouseUp = function(ev) { |
| var positions = getEventPosition(ev); |
| var evt = $.Event('jqplotMouseUp'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, null, ev.data.plot]); |
| }; |
| |
| this.onRightClick = function(ev) { |
| var positions = getEventPosition(ev); |
| var p = ev.data.plot; |
| var neighbor = checkIntersection(positions.gridPos, p); |
| if (p.captureRightClick) { |
| if (ev.which == 3) { |
| var evt = $.Event('jqplotRightClick'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]); |
| } |
| else { |
| var evt = $.Event('jqplotMouseUp'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]); |
| } |
| } |
| }; |
| |
| this.onMouseMove = function(ev) { |
| var positions = getEventPosition(ev); |
| var p = ev.data.plot; |
| var neighbor = checkIntersection(positions.gridPos, p); |
| var evt = $.Event('jqplotMouseMove'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, neighbor, p]); |
| }; |
| |
| this.onMouseEnter = function(ev) { |
| var positions = getEventPosition(ev); |
| var p = ev.data.plot; |
| var evt = $.Event('jqplotMouseEnter'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| evt.relatedTarget = ev.relatedTarget; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, null, p]); |
| }; |
| |
| this.onMouseLeave = function(ev) { |
| var positions = getEventPosition(ev); |
| var p = ev.data.plot; |
| var evt = $.Event('jqplotMouseLeave'); |
| evt.pageX = ev.pageX; |
| evt.pageY = ev.pageY; |
| evt.relatedTarget = ev.relatedTarget; |
| $(this).trigger(evt, [positions.gridPos, positions.dataPos, null, p]); |
| }; |
| |
| |
| |
| |
| |
| |
| |
| this.drawSeries = function(options, idx){ |
| var i, series, ctx; |
| |
| idx = (typeof(options) === "number" && idx == null) ? options : idx; |
| options = (typeof(options) === "object") ? options : {}; |
| |
| if (idx != undefined) { |
| series = this.series[idx]; |
| ctx = series.shadowCanvas._ctx; |
| ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); |
| series.drawShadow(ctx, options, this); |
| ctx = series.canvas._ctx; |
| ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); |
| series.draw(ctx, options, this); |
| if (series.renderer.constructor == $.jqplot.BezierCurveRenderer) { |
| if (idx < this.series.length - 1) { |
| this.drawSeries(idx+1); |
| } |
| } |
| } |
| |
| else { |
| |
| |
| |
| for (i=0; i<this.series.length; i++) { |
| |
| series = this.series[i]; |
| ctx = series.shadowCanvas._ctx; |
| ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); |
| series.drawShadow(ctx, options, this); |
| ctx = series.canvas._ctx; |
| ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); |
| series.draw(ctx, options, this); |
| } |
| } |
| options = idx = i = series = ctx = null; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| this.moveSeriesToFront = function (idx) { |
| idx = parseInt(idx, 10); |
| var stackIndex = $.inArray(idx, this.seriesStack); |
| |
| if (stackIndex == -1) { |
| return; |
| } |
| if (stackIndex == this.seriesStack.length -1) { |
| this.previousSeriesStack = this.seriesStack.slice(0); |
| return; |
| } |
| var opidx = this.seriesStack[this.seriesStack.length -1]; |
| var serelem = this.series[idx].canvas._elem.detach(); |
| var shadelem = this.series[idx].shadowCanvas._elem.detach(); |
| this.series[opidx].shadowCanvas._elem.after(shadelem); |
| this.series[opidx].canvas._elem.after(serelem); |
| this.previousSeriesStack = this.seriesStack.slice(0); |
| this.seriesStack.splice(stackIndex, 1); |
| this.seriesStack.push(idx); |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| this.moveSeriesToBack = function (idx) { |
| idx = parseInt(idx, 10); |
| var stackIndex = $.inArray(idx, this.seriesStack); |
| |
| if (stackIndex == 0 || stackIndex == -1) { |
| return; |
| } |
| var opidx = this.seriesStack[0]; |
| var serelem = this.series[idx].canvas._elem.detach(); |
| var shadelem = this.series[idx].shadowCanvas._elem.detach(); |
| this.series[opidx].shadowCanvas._elem.before(shadelem); |
| this.series[opidx].canvas._elem.before(serelem); |
| this.previousSeriesStack = this.seriesStack.slice(0); |
| this.seriesStack.splice(stackIndex, 1); |
| this.seriesStack.unshift(idx); |
| }; |
| |
| |
| |
| |
| |
| |
| this.restorePreviousSeriesOrder = function () { |
| var i, j, serelem, shadelem, temp, move, keep; |
| |
| if (this.seriesStack == this.previousSeriesStack) { |
| return; |
| } |
| for (i=1; i<this.previousSeriesStack.length; i++) { |
| move = this.previousSeriesStack[i]; |
| keep = this.previousSeriesStack[i-1]; |
| serelem = this.series[move].canvas._elem.detach(); |
| shadelem = this.series[move].shadowCanvas._elem.detach(); |
| this.series[keep].shadowCanvas._elem.after(shadelem); |
| this.series[keep].canvas._elem.after(serelem); |
| } |
| temp = this.seriesStack.slice(0); |
| this.seriesStack = this.previousSeriesStack.slice(0); |
| this.previousSeriesStack = temp; |
| }; |
| |
| |
| |
| |
| |
| this.restoreOriginalSeriesOrder = function () { |
| var i, j, arr=[], serelem, shadelem; |
| for (i=0; i<this.series.length; i++) { |
| arr.push(i); |
| } |
| if (this.seriesStack == arr) { |
| return; |
| } |
| this.previousSeriesStack = this.seriesStack.slice(0); |
| this.seriesStack = arr; |
| for (i=1; i<this.seriesStack.length; i++) { |
| serelem = this.series[i].canvas._elem.detach(); |
| shadelem = this.series[i].shadowCanvas._elem.detach(); |
| this.series[i-1].shadowCanvas._elem.after(shadelem); |
| this.series[i-1].canvas._elem.after(serelem); |
| } |
| }; |
| |
| this.activateTheme = function (name) { |
| this.themeEngine.activate(this, name); |
| }; |
| } |
| |
| |
| |
| $.jqplot.computeHighlightColors = function(colors) { |
| var ret; |
| if ($.isArray(colors)) { |
| ret = []; |
| for (var i=0; i<colors.length; i++){ |
| var rgba = $.jqplot.getColorComponents(colors[i]); |
| var newrgb = [rgba[0], rgba[1], rgba[2]]; |
| var sum = newrgb[0] + newrgb[1] + newrgb[2]; |
| for (var j=0; j<3; j++) { |
| |
| newrgb[j] = (sum > 660) ? newrgb[j] * 0.85 : 0.73 * newrgb[j] + 90; |
| newrgb[j] = parseInt(newrgb[j], 10); |
| (newrgb[j] > 255) ? 255 : newrgb[j]; |
| } |
| |
| |
| newrgb[3] = 0.3 + 0.35 * rgba[3]; |
| ret.push('rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+newrgb[3]+')'); |
| } |
| } |
| else { |
| var rgba = $.jqplot.getColorComponents(colors); |
| var newrgb = [rgba[0], rgba[1], rgba[2]]; |
| var sum = newrgb[0] + newrgb[1] + newrgb[2]; |
| for (var j=0; j<3; j++) { |
| |
| |
| |
| newrgb[j] = (sum > 660) ? newrgb[j] * 0.85 : 0.73 * newrgb[j] + 90; |
| newrgb[j] = parseInt(newrgb[j], 10); |
| (newrgb[j] > 255) ? 255 : newrgb[j]; |
| } |
| |
| |
| newrgb[3] = 0.3 + 0.35 * rgba[3]; |
| ret = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+newrgb[3]+')'; |
| } |
| return ret; |
| }; |
| |
| $.jqplot.ColorGenerator = function(colors) { |
| colors = colors || $.jqplot.config.defaultColors; |
| var idx = 0; |
| |
| this.next = function () { |
| if (idx < colors.length) { |
| return colors[idx++]; |
| } |
| else { |
| idx = 0; |
| return colors[idx++]; |
| } |
| }; |
| |
| this.previous = function () { |
| if (idx > 0) { |
| return colors[idx--]; |
| } |
| else { |
| idx = colors.length-1; |
| return colors[idx]; |
| } |
| }; |
| |
| |
| this.get = function(i) { |
| var idx = i - colors.length * Math.floor(i/colors.length); |
| return colors[idx]; |
| }; |
| |
| this.setColors = function(c) { |
| colors = c; |
| }; |
| |
| this.reset = function() { |
| idx = 0; |
| }; |
|
|
| this.getIndex = function() { |
| return idx; |
| }; |
|
|
| this.setIndex = function(index) { |
| idx = index; |
| }; |
| }; |
|
|
| |
| |
| |
| $.jqplot.hex2rgb = function(h, a) { |
| h = h.replace('#', ''); |
| if (h.length == 3) { |
| h = h.charAt(0)+h.charAt(0)+h.charAt(1)+h.charAt(1)+h.charAt(2)+h.charAt(2); |
| } |
| var rgb; |
| rgb = 'rgba('+parseInt(h.slice(0,2), 16)+', '+parseInt(h.slice(2,4), 16)+', '+parseInt(h.slice(4,6), 16); |
| if (a) { |
| rgb += ', '+a; |
| } |
| rgb += ')'; |
| return rgb; |
| }; |
| |
| |
| $.jqplot.rgb2hex = function(s) { |
| var pat = /rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *(?:, *[0-9.]*)?\)/; |
| var m = s.match(pat); |
| var h = '#'; |
| for (var i=1; i<4; i++) { |
| var temp; |
| if (m[i].search(/%/) != -1) { |
| temp = parseInt(255*m[i]/100, 10).toString(16); |
| if (temp.length == 1) { |
| temp = '0'+temp; |
| } |
| } |
| else { |
| temp = parseInt(m[i], 10).toString(16); |
| if (temp.length == 1) { |
| temp = '0'+temp; |
| } |
| } |
| h += temp; |
| } |
| return h; |
| }; |
| |
| |
| $.jqplot.normalize2rgb = function(s, a) { |
| if (s.search(/^ *rgba?\(/) != -1) { |
| return s; |
| } |
| else if (s.search(/^ *#?[0-9a-fA-F]?[0-9a-fA-F]/) != -1) { |
| return $.jqplot.hex2rgb(s, a); |
| } |
| else { |
| throw new Error('Invalid color spec'); |
| } |
| }; |
| |
| |
| $.jqplot.getColorComponents = function(s) { |
| |
| s = $.jqplot.colorKeywordMap[s] || s; |
| var rgb = $.jqplot.normalize2rgb(s); |
| var pat = /rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *,? *([0-9.]* *)?\)/; |
| var m = rgb.match(pat); |
| var ret = []; |
| for (var i=1; i<4; i++) { |
| if (m[i].search(/%/) != -1) { |
| ret[i-1] = parseInt(255*m[i]/100, 10); |
| } |
| else { |
| ret[i-1] = parseInt(m[i], 10); |
| } |
| } |
| ret[3] = parseFloat(m[4]) ? parseFloat(m[4]) : 1.0; |
| return ret; |
| }; |
| |
| $.jqplot.colorKeywordMap = { |
| aliceblue: 'rgb(240, 248, 255)', |
| antiquewhite: 'rgb(250, 235, 215)', |
| aqua: 'rgb( 0, 255, 255)', |
| aquamarine: 'rgb(127, 255, 212)', |
| azure: 'rgb(240, 255, 255)', |
| beige: 'rgb(245, 245, 220)', |
| bisque: 'rgb(255, 228, 196)', |
| black: 'rgb( 0, 0, 0)', |
| blanchedalmond: 'rgb(255, 235, 205)', |
| blue: 'rgb( 0, 0, 255)', |
| blueviolet: 'rgb(138, 43, 226)', |
| brown: 'rgb(165, 42, 42)', |
| burlywood: 'rgb(222, 184, 135)', |
| cadetblue: 'rgb( 95, 158, 160)', |
| chartreuse: 'rgb(127, 255, 0)', |
| chocolate: 'rgb(210, 105, 30)', |
| coral: 'rgb(255, 127, 80)', |
| cornflowerblue: 'rgb(100, 149, 237)', |
| cornsilk: 'rgb(255, 248, 220)', |
| crimson: 'rgb(220, 20, 60)', |
| cyan: 'rgb( 0, 255, 255)', |
| darkblue: 'rgb( 0, 0, 139)', |
| darkcyan: 'rgb( 0, 139, 139)', |
| darkgoldenrod: 'rgb(184, 134, 11)', |
| darkgray: 'rgb(169, 169, 169)', |
| darkgreen: 'rgb( 0, 100, 0)', |
| darkgrey: 'rgb(169, 169, 169)', |
| darkkhaki: 'rgb(189, 183, 107)', |
| darkmagenta: 'rgb(139, 0, 139)', |
| darkolivegreen: 'rgb( 85, 107, 47)', |
| darkorange: 'rgb(255, 140, 0)', |
| darkorchid: 'rgb(153, 50, 204)', |
| darkred: 'rgb(139, 0, 0)', |
| darksalmon: 'rgb(233, 150, 122)', |
| darkseagreen: 'rgb(143, 188, 143)', |
| darkslateblue: 'rgb( 72, 61, 139)', |
| darkslategray: 'rgb( 47, 79, 79)', |
| darkslategrey: 'rgb( 47, 79, 79)', |
| darkturquoise: 'rgb( 0, 206, 209)', |
| darkviolet: 'rgb(148, 0, 211)', |
| deeppink: 'rgb(255, 20, 147)', |
| deepskyblue: 'rgb( 0, 191, 255)', |
| dimgray: 'rgb(105, 105, 105)', |
| dimgrey: 'rgb(105, 105, 105)', |
| dodgerblue: 'rgb( 30, 144, 255)', |
| firebrick: 'rgb(178, 34, 34)', |
| floralwhite: 'rgb(255, 250, 240)', |
| forestgreen: 'rgb( 34, 139, 34)', |
| fuchsia: 'rgb(255, 0, 255)', |
| gainsboro: 'rgb(220, 220, 220)', |
| ghostwhite: 'rgb(248, 248, 255)', |
| gold: 'rgb(255, 215, 0)', |
| goldenrod: 'rgb(218, 165, 32)', |
| gray: 'rgb(128, 128, 128)', |
| grey: 'rgb(128, 128, 128)', |
| green: 'rgb( 0, 128, 0)', |
| greenyellow: 'rgb(173, 255, 47)', |
| honeydew: 'rgb(240, 255, 240)', |
| hotpink: 'rgb(255, 105, 180)', |
| indianred: 'rgb(205, 92, 92)', |
| indigo: 'rgb( 75, 0, 130)', |
| ivory: 'rgb(255, 255, 240)', |
| khaki: 'rgb(240, 230, 140)', |
| lavender: 'rgb(230, 230, 250)', |
| lavenderblush: 'rgb(255, 240, 245)', |
| lawngreen: 'rgb(124, 252, 0)', |
| lemonchiffon: 'rgb(255, 250, 205)', |
| lightblue: 'rgb(173, 216, 230)', |
| lightcoral: 'rgb(240, 128, 128)', |
| lightcyan: 'rgb(224, 255, 255)', |
| lightgoldenrodyellow: 'rgb(250, 250, 210)', |
| lightgray: 'rgb(211, 211, 211)', |
| lightgreen: 'rgb(144, 238, 144)', |
| lightgrey: 'rgb(211, 211, 211)', |
| lightpink: 'rgb(255, 182, 193)', |
| lightsalmon: 'rgb(255, 160, 122)', |
| lightseagreen: 'rgb( 32, 178, 170)', |
| lightskyblue: 'rgb(135, 206, 250)', |
| lightslategray: 'rgb(119, 136, 153)', |
| lightslategrey: 'rgb(119, 136, 153)', |
| lightsteelblue: 'rgb(176, 196, 222)', |
| lightyellow: 'rgb(255, 255, 224)', |
| lime: 'rgb( 0, 255, 0)', |
| limegreen: 'rgb( 50, 205, 50)', |
| linen: 'rgb(250, 240, 230)', |
| magenta: 'rgb(255, 0, 255)', |
| maroon: 'rgb(128, 0, 0)', |
| mediumaquamarine: 'rgb(102, 205, 170)', |
| mediumblue: 'rgb( 0, 0, 205)', |
| mediumorchid: 'rgb(186, 85, 211)', |
| mediumpurple: 'rgb(147, 112, 219)', |
| mediumseagreen: 'rgb( 60, 179, 113)', |
| mediumslateblue: 'rgb(123, 104, 238)', |
| mediumspringgreen: 'rgb( 0, 250, 154)', |
| mediumturquoise: 'rgb( 72, 209, 204)', |
| mediumvioletred: 'rgb(199, 21, 133)', |
| midnightblue: 'rgb( 25, 25, 112)', |
| mintcream: 'rgb(245, 255, 250)', |
| mistyrose: 'rgb(255, 228, 225)', |
| moccasin: 'rgb(255, 228, 181)', |
| navajowhite: 'rgb(255, 222, 173)', |
| navy: 'rgb( 0, 0, 128)', |
| oldlace: 'rgb(253, 245, 230)', |
| olive: 'rgb(128, 128, 0)', |
| olivedrab: 'rgb(107, 142, 35)', |
| orange: 'rgb(255, 165, 0)', |
| orangered: 'rgb(255, 69, 0)', |
| orchid: 'rgb(218, 112, 214)', |
| palegoldenrod: 'rgb(238, 232, 170)', |
| palegreen: 'rgb(152, 251, 152)', |
| paleturquoise: 'rgb(175, 238, 238)', |
| palevioletred: 'rgb(219, 112, 147)', |
| papayawhip: 'rgb(255, 239, 213)', |
| peachpuff: 'rgb(255, 218, 185)', |
| peru: 'rgb(205, 133, 63)', |
| pink: 'rgb(255, 192, 203)', |
| plum: 'rgb(221, 160, 221)', |
| powderblue: 'rgb(176, 224, 230)', |
| purple: 'rgb(128, 0, 128)', |
| red: 'rgb(255, 0, 0)', |
| rosybrown: 'rgb(188, 143, 143)', |
| royalblue: 'rgb( 65, 105, 225)', |
| saddlebrown: 'rgb(139, 69, 19)', |
| salmon: 'rgb(250, 128, 114)', |
| sandybrown: 'rgb(244, 164, 96)', |
| seagreen: 'rgb( 46, 139, 87)', |
| seashell: 'rgb(255, 245, 238)', |
| sienna: 'rgb(160, 82, 45)', |
| silver: 'rgb(192, 192, 192)', |
| skyblue: 'rgb(135, 206, 235)', |
| slateblue: 'rgb(106, 90, 205)', |
| slategray: 'rgb(112, 128, 144)', |
| slategrey: 'rgb(112, 128, 144)', |
| snow: 'rgb(255, 250, 250)', |
| springgreen: 'rgb( 0, 255, 127)', |
| steelblue: 'rgb( 70, 130, 180)', |
| tan: 'rgb(210, 180, 140)', |
| teal: 'rgb( 0, 128, 128)', |
| thistle: 'rgb(216, 191, 216)', |
| tomato: 'rgb(255, 99, 71)', |
| turquoise: 'rgb( 64, 224, 208)', |
| violet: 'rgb(238, 130, 238)', |
| wheat: 'rgb(245, 222, 179)', |
| white: 'rgb(255, 255, 255)', |
| whitesmoke: 'rgb(245, 245, 245)', |
| yellow: 'rgb(255, 255, 0)', |
| yellowgreen: 'rgb(154, 205, 50)' |
| }; |
|
|
| |
| })(jQuery); |
|
|