Update all JQuery related libraries to more recent versions
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
* jqPlot
|
||||
* Pure JavaScript plotting plugin using jQuery
|
||||
*
|
||||
* Version: 1.0.0b2_r792
|
||||
* Version: 1.0.8
|
||||
* Revision: 1250
|
||||
*
|
||||
* Copyright (c) 2009-2011 Chris Leonello
|
||||
* Copyright (c) 2009-2013 Chris Leonello
|
||||
* jqPlot is currently available for use in all personal or commercial projects
|
||||
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||
@@ -92,6 +93,19 @@
|
||||
// prop: highlightColors
|
||||
// an array of colors to use when highlighting a bar.
|
||||
this.highlightColors = [];
|
||||
// prop: transposedData
|
||||
// NOT IMPLEMENTED YET. True if this is a horizontal bar plot and
|
||||
// x and y values are "transposed". Tranposed, or "swapped", data is
|
||||
// required prior to rev. 894 builds of jqPlot with horizontal bars.
|
||||
// Allows backward compatability of bar renderer horizontal bars with
|
||||
// old style data sets.
|
||||
this.transposedData = true;
|
||||
this.renderer.animation = {
|
||||
show: false,
|
||||
direction: 'down',
|
||||
speed: 3000,
|
||||
_supported: true
|
||||
};
|
||||
this._type = 'bar';
|
||||
|
||||
// if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
|
||||
@@ -99,10 +113,25 @@
|
||||
options.highlightMouseOver = false;
|
||||
}
|
||||
|
||||
//////
|
||||
// This is probably wrong here.
|
||||
// After going back and forth on whether renderer should be the thing
|
||||
// or extend the thing, it seems that it it best if it is a property
|
||||
// on the thing. This should be something that is commonized
|
||||
// among series renderers in the future.
|
||||
//////
|
||||
$.extend(true, this, options);
|
||||
|
||||
// really should probably do this
|
||||
$.extend(true, this.renderer, options);
|
||||
// fill is still needed to properly draw the legend.
|
||||
// bars have to be filled.
|
||||
this.fill = true;
|
||||
|
||||
// if horizontal bar and animating, reset the default direction
|
||||
if (this.barDirection === 'horizontal' && this.rendererOptions.animation && this.rendererOptions.animation.direction == null) {
|
||||
this.renderer.animation.direction = 'left';
|
||||
}
|
||||
|
||||
if (this.waterfall) {
|
||||
this.fillToZero = false;
|
||||
@@ -152,7 +181,7 @@
|
||||
if (this.rendererOptions.waterfall == true) {
|
||||
this._data = $.extend(true, [], this.data);
|
||||
var sum = 0;
|
||||
var pos = (!this.rendererOptions.barDirection || this.rendererOptions.barDirection == 'vertical') ? 1 : 0;
|
||||
var pos = (!this.rendererOptions.barDirection || this.rendererOptions.barDirection === 'vertical' || this.transposedData === false) ? 1 : 0;
|
||||
for(var i=0; i<this.data.length; i++) {
|
||||
sum += this.data[i][pos];
|
||||
if (i>0) {
|
||||
@@ -169,14 +198,20 @@
|
||||
var count = 0;
|
||||
for (var i=skip; i<l; i+=skip) {
|
||||
this.data.splice(i+count, 0, [null, null]);
|
||||
this._plotData.splice(i+count, 0, [null, null]);
|
||||
this._stackData.splice(i+count, 0, [null, null]);
|
||||
count++;
|
||||
}
|
||||
for (i=0; i<this.data.length; i++) {
|
||||
if (this._primaryAxis == '_xaxis') {
|
||||
this.data[i][0] = i+1;
|
||||
this._plotData[i][0] = i+1;
|
||||
this._stackData[i][0] = i+1;
|
||||
}
|
||||
else {
|
||||
this.data[i][1] = i+1;
|
||||
this._plotData[i][1] = i+1;
|
||||
this._stackData[i][1] = i+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,8 +291,42 @@
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getStart(sidx, didx, comp, plot, axis) {
|
||||
// check if sign change
|
||||
var seriesIndex = sidx,
|
||||
prevSeriesIndex = sidx - 1,
|
||||
start,
|
||||
prevVal,
|
||||
aidx = (axis === 'x') ? 0 : 1;
|
||||
|
||||
// is this not the first series?
|
||||
if (seriesIndex > 0) {
|
||||
prevVal = plot.series[prevSeriesIndex]._plotData[didx][aidx];
|
||||
|
||||
// is there a sign change
|
||||
if ((comp * prevVal) < 0) {
|
||||
start = getStart(prevSeriesIndex, didx, comp, plot, axis);
|
||||
}
|
||||
|
||||
// no sign change.
|
||||
else {
|
||||
start = plot.series[prevSeriesIndex].gridData[didx][aidx];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if first series, return value at 0
|
||||
else {
|
||||
|
||||
start = (aidx === 0) ? plot.series[seriesIndex]._xaxis.series_u2p(0) : plot.series[seriesIndex]._yaxis.series_u2p(0);
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
$.jqplot.BarRenderer.prototype.draw = function(ctx, gridData, options) {
|
||||
$.jqplot.BarRenderer.prototype.draw = function(ctx, gridData, options, plot) {
|
||||
var i;
|
||||
// Ughhh, have to make a copy of options b/c it may be modified later.
|
||||
var opts = $.extend({}, options);
|
||||
@@ -281,7 +350,7 @@
|
||||
var nvals = temp[0];
|
||||
var nseries = temp[1];
|
||||
var pos = temp[2];
|
||||
var points = [];
|
||||
var points = [];
|
||||
|
||||
if (this._stack) {
|
||||
this._barNudge = 0;
|
||||
@@ -297,24 +366,24 @@
|
||||
negativeColor = opts.fillStyle;
|
||||
}
|
||||
var positiveColor = opts.fillStyle;
|
||||
var base;
|
||||
var xstart;
|
||||
var ystart;
|
||||
var base;
|
||||
var xstart;
|
||||
var ystart;
|
||||
|
||||
if (this.barDirection == 'vertical') {
|
||||
for (var i=0; i<gridData.length; i++) {
|
||||
if (this.data[i][1] == null) {
|
||||
if (!this._stack && this.data[i][1] == null) {
|
||||
continue;
|
||||
}
|
||||
points = [];
|
||||
base = gridData[i][0] + this._barNudge;
|
||||
ystart;
|
||||
|
||||
// stacked
|
||||
if (this._stack && this._prevGridData.length) {
|
||||
ystart = this._prevGridData[i][1];
|
||||
ystart = getStart(this.index, i, this._plotData[i][1], plot, 'y');
|
||||
}
|
||||
// not stacked and first series in stack
|
||||
|
||||
// not stacked
|
||||
else {
|
||||
if (this.fillToZero) {
|
||||
ystart = this._yaxis.series_u2p(0);
|
||||
@@ -369,20 +438,20 @@
|
||||
opts.fillStyle = positiveColor;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.fillToZero || this._plotData[i][1] >= 0) {
|
||||
points.push([base-this.barWidth/2, ystart]);
|
||||
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base+this.barWidth/2, ystart]);
|
||||
}
|
||||
// for negative bars make sure points are always ordered clockwise
|
||||
else {
|
||||
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base-this.barWidth/2, ystart]);
|
||||
points.push([base+this.barWidth/2, ystart]);
|
||||
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||
}
|
||||
|
||||
if (!this.fillToZero || this._plotData[i][1] >= 0) {
|
||||
points.push([base-this.barWidth/2, ystart]);
|
||||
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base+this.barWidth/2, ystart]);
|
||||
}
|
||||
// for negative bars make sure points are always ordered clockwise
|
||||
else {
|
||||
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||
points.push([base-this.barWidth/2, ystart]);
|
||||
points.push([base+this.barWidth/2, ystart]);
|
||||
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||
}
|
||||
this._barPoints.push(points);
|
||||
// now draw the shadows if not stacked.
|
||||
// for stacked plots, they are predrawn by drawShadow
|
||||
@@ -400,7 +469,7 @@
|
||||
|
||||
else if (this.barDirection == 'horizontal'){
|
||||
for (var i=0; i<gridData.length; i++) {
|
||||
if (this.data[i][0] == null) {
|
||||
if (!this._stack && this.data[i][0] == null) {
|
||||
continue;
|
||||
}
|
||||
points = [];
|
||||
@@ -408,15 +477,15 @@
|
||||
xstart;
|
||||
|
||||
if (this._stack && this._prevGridData.length) {
|
||||
xstart = this._prevGridData[i][0];
|
||||
xstart = getStart(this.index, i, this._plotData[i][0], plot, 'x');
|
||||
}
|
||||
// not stacked and first series in stack
|
||||
// not stacked
|
||||
else {
|
||||
if (this.fillToZero) {
|
||||
xstart = this._xaxis.series_u2p(0);
|
||||
}
|
||||
else if (this.waterfall && i > 0 && i < this.gridData.length-1) {
|
||||
xstart = this.gridData[i-1][1];
|
||||
xstart = this.gridData[i-1][0];
|
||||
}
|
||||
else if (this.waterfall && i == 0 && i < this.gridData.length-1) {
|
||||
if (this._xaxis.min <= 0 && this._xaxis.max >= 0) {
|
||||
@@ -426,7 +495,7 @@
|
||||
xstart = 0;
|
||||
}
|
||||
else {
|
||||
xstart = ctx.canvas.width;
|
||||
xstart = 0;
|
||||
}
|
||||
}
|
||||
else if (this.waterfall && i == this.gridData.length - 1) {
|
||||
@@ -444,7 +513,7 @@
|
||||
xstart = 0;
|
||||
}
|
||||
}
|
||||
if ((this.fillToZero && this._plotData[i][1] < 0) || (this.waterfall && this._data[i][1] < 0)) {
|
||||
if ((this.fillToZero && this._plotData[i][0] < 0) || (this.waterfall && this._data[i][0] < 0)) {
|
||||
if (this.varyBarColor && !this._stack) {
|
||||
if (this.useNegativeColors) {
|
||||
opts.fillStyle = negativeColors.next();
|
||||
@@ -453,6 +522,9 @@
|
||||
opts.fillStyle = positiveColors.next();
|
||||
}
|
||||
}
|
||||
else {
|
||||
opts.fillStyle = negativeColor;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this.varyBarColor && !this._stack) {
|
||||
@@ -463,10 +535,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
points.push([xstart, base+this.barWidth/2]);
|
||||
points.push([xstart, base-this.barWidth/2]);
|
||||
points.push([gridData[i][0], base-this.barWidth/2]);
|
||||
points.push([gridData[i][0], base+this.barWidth/2]);
|
||||
|
||||
if (!this.fillToZero || this._plotData[i][0] >= 0) {
|
||||
points.push([xstart, base + this.barWidth / 2]);
|
||||
points.push([xstart, base - this.barWidth / 2]);
|
||||
points.push([gridData[i][0], base - this.barWidth / 2]);
|
||||
points.push([gridData[i][0], base + this.barWidth / 2]);
|
||||
}
|
||||
else {
|
||||
points.push([gridData[i][0], base + this.barWidth / 2]);
|
||||
points.push([gridData[i][0], base - this.barWidth / 2]);
|
||||
points.push([xstart, base - this.barWidth / 2]);
|
||||
points.push([xstart, base + this.barWidth / 2]);
|
||||
}
|
||||
|
||||
this._barPoints.push(points);
|
||||
// now draw the shadows if not stacked.
|
||||
// for stacked plots, they are predrawn by drawShadow
|
||||
@@ -477,13 +559,13 @@
|
||||
}
|
||||
var clr = opts.fillStyle || this.color;
|
||||
this._dataColors.push(clr);
|
||||
this.renderer.shapeRenderer.draw(ctx, points, opts);
|
||||
}
|
||||
this.renderer.shapeRenderer.draw(ctx, points, opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.highlightColors.length == 0) {
|
||||
this.highlightColors = computeHighlightColors(this._dataColors);
|
||||
this.highlightColors = $.jqplot.computeHighlightColors(this._dataColors);
|
||||
}
|
||||
|
||||
else if (typeof(this.highlightColors) == 'string') {
|
||||
@@ -498,7 +580,7 @@
|
||||
|
||||
|
||||
// for stacked plots, shadows will be pre drawn by drawShadow.
|
||||
$.jqplot.BarRenderer.prototype.drawShadow = function(ctx, gridData, options) {
|
||||
$.jqplot.BarRenderer.prototype.drawShadow = function(ctx, gridData, options, plot) {
|
||||
var i;
|
||||
var opts = (options != undefined) ? options : {};
|
||||
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
||||
@@ -538,7 +620,7 @@
|
||||
var ystart;
|
||||
|
||||
if (this._stack && this._prevGridData.length) {
|
||||
ystart = this._prevGridData[i][1];
|
||||
ystart = getStart(this.index, i, this._plotData[i][1], plot, 'y');
|
||||
}
|
||||
else {
|
||||
if (this.fillToZero) {
|
||||
@@ -567,10 +649,15 @@
|
||||
var xstart;
|
||||
|
||||
if (this._stack && this._prevGridData.length) {
|
||||
xstart = this._prevGridData[i][0];
|
||||
xstart = getStart(this.index, i, this._plotData[i][0], plot, 'x');
|
||||
}
|
||||
else {
|
||||
xstart = 0;
|
||||
if (this.fillToZero) {
|
||||
xstart = this._xaxis.series_u2p(0);
|
||||
}
|
||||
else {
|
||||
xstart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
points.push([xstart, base+this.barWidth/2]);
|
||||
@@ -594,7 +681,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
this.target.bind('mouseout', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
|
||||
}
|
||||
|
||||
// called within context of plot
|
||||
@@ -613,6 +699,7 @@
|
||||
|
||||
this.eventCanvas._elem.before(this.plugins.barRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-barRenderer-highlight-canvas', this._plotDimensions, this));
|
||||
this.plugins.barRenderer.highlightCanvas.setContext();
|
||||
this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
|
||||
}
|
||||
|
||||
function highlight (plot, sidx, pidx, points) {
|
||||
@@ -645,8 +732,10 @@
|
||||
evt1.pageX = ev.pageX;
|
||||
evt1.pageY = ev.pageY;
|
||||
plot.target.trigger(evt1, ins);
|
||||
if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||
if (plot.series[ins[0]].show && plot.series[ins[0]].highlightMouseOver &&
|
||||
!(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||
var evt = jQuery.Event('jqplotDataHighlight');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
@@ -663,6 +752,7 @@
|
||||
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||
var evt = jQuery.Event('jqplotDataHighlight');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
@@ -685,6 +775,7 @@
|
||||
if (neighbor) {
|
||||
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||
var evt = jQuery.Event('jqplotDataClick');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
@@ -699,6 +790,7 @@
|
||||
unhighlight(plot);
|
||||
}
|
||||
var evt = jQuery.Event('jqplotDataRightClick');
|
||||
evt.which = ev.which;
|
||||
evt.pageX = ev.pageX;
|
||||
evt.pageY = ev.pageY;
|
||||
plot.target.trigger(evt, ins);
|
||||
@@ -706,4 +798,4 @@
|
||||
}
|
||||
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user