jqplot version update to 1.0.8

This commit is contained in:
Nathan Gray
2013-10-24 20:24:26 +00:00
parent 2d2462c825
commit ae04210b66
354 changed files with 15456 additions and 33947 deletions

View File

@ -2,9 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.0b2_r947
* 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
@ -79,6 +80,20 @@
// prop: highlightColors
// an array of colors to use when highlighting a slice.
this.highlightColors = [];
// prop highlightThreshold
// Expand the highlightable region in the x direction.
// E.g. a value of 3 will highlight a bar when the mouse is
// within 3 pixels of the bar in the x direction.
this.highlightThreshold = 2;
// prop: synchronizeHighlight
// Index of another series to highlight when this series is highlighted.
// null or false to not synchronize.
this.synchronizeHighlight = false;
// prop: offsetBars
// False will center bars on their y value.
// True will push bars up by 1/2 bar width to fill between their y values.
// If true, there needs to be 1 more tick than there are bars.
this.offsetBars = false;
// if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
if (options.highlightMouseDown && options.highlightMouseOver == null) {
@ -92,6 +107,14 @@
// if (this.fill === false) {
// this.shadow = false;
// }
if (this.side === 'left') {
this._highlightThreshold = [[-this.highlightThreshold, 0], [-this.highlightThreshold, 0], [0,0], [0,0]];
}
else {
this._highlightThreshold = [[0,0], [0,0], [this.highlightThreshold, 0], [this.highlightThreshold, 0]];
}
this.renderer.options = options;
// index of the currenty highlighted point, if any
@ -294,8 +317,10 @@
var xstart = this._xaxis.series_u2p(this._xnudge);
var ystart = this._yaxis.series_u2p(this._yaxis.min);
var yend = this._yaxis.series_u2p(this._yaxis.max);
var bw2 = this.barWidth/2.0;
var bw = this.barWidth;
var bw2 = bw/2.0;
var points = [];
var yadj = this.offsetBars ? bw2 : 0;
for (var i=0, l=gridData.length; i<l; i++) {
if (this.data[i][0] == null) {
@ -324,17 +349,18 @@
}
if (this.fill) {
if (this._plotData[i][1] >= 0) {
// xstart = this._xaxis.series_u2p(this._xnudge);
w = gridData[i][0] - xstart;
h = this.barWidth;
points = [xstart, base - bw2, w, h];
points = [xstart, base - bw2 - yadj, w, h];
}
else {
// xstart = this._xaxis.series_u2p(0);
w = xstart - gridData[i][0];
h = this.barWidth;
points = [gridData[i][0], base - bw2, w, h];
points = [gridData[i][0], base - bw2 - yadj, w, h];
}
this._barPoints.push([[points[0], points[1] + h], [points[0], points[1]], [points[0] + w, points[1]], [points[0] + w, points[1] + h]]);
@ -349,16 +375,16 @@
else {
if (i === 0) {
points =[[xstart, ystart], [gridData[i][0], ystart], [gridData[i][0], gridData[i][1] - bw2]];
points =[[xstart, ystart], [gridData[i][0], ystart], [gridData[i][0], gridData[i][1] - bw2 - yadj]];
}
else if (i < l-1) {
points = points.concat([[gridData[i-1][0], gridData[i-1][1] - bw2], [gridData[i][0], gridData[i][1] + bw2], [gridData[i][0], gridData[i][1] - bw2]]);
points = points.concat([[gridData[i-1][0], gridData[i-1][1] - bw2 - yadj], [gridData[i][0], gridData[i][1] + bw2 - yadj], [gridData[i][0], gridData[i][1] - bw2 - yadj]]);
}
// finally, draw the line
else {
points = points.concat([[gridData[i-1][0], gridData[i-1][1] - bw2], [gridData[i][0], gridData[i][1] + bw2], [gridData[i][0], yend], [xstart, yend]]);
points = points.concat([[gridData[i-1][0], gridData[i-1][1] - bw2 - yadj], [gridData[i][0], gridData[i][1] + bw2 - yadj], [gridData[i][0], yend], [xstart, yend]]);
if (shadow) {
this.renderer.shadowRenderer.draw(ctx, points);
@ -440,6 +466,11 @@
plot.plugins.pyramidRenderer.highlightedSeriesIndex = sidx;
var opts = {fillStyle: s.highlightColors[pidx], fillRect: false};
s.renderer.shapeRenderer.draw(canvas._ctx, points, opts);
if (s.synchronizeHighlight !== false && plot.series.length >= s.synchronizeHighlight && s.synchronizeHighlight !== sidx) {
s = plot.series[s.synchronizeHighlight];
opts = {fillStyle: s.highlightColors[pidx], fillRect: false};
s.renderer.shapeRenderer.draw(canvas._ctx, s._barPoints[pidx], opts);
}
canvas = null;
}
@ -464,6 +495,7 @@
plot.target.trigger(evt1, ins);
if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.pyramidRenderer.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);