Skip to content

Commit

Permalink
Merge branch 'atul-QA_3_5-jqplot' into QA_3_5
Browse files Browse the repository at this point in the history
  • Loading branch information
lem9 committed Aug 20, 2012
2 parents 2396bf0 + 935e8fd commit 0fa11e0
Show file tree
Hide file tree
Showing 10 changed files with 865 additions and 221 deletions.
601 changes: 495 additions & 106 deletions js/jqplot/jquery.jqplot.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.0b2_r1012
* Version: 1.0.2
* Revision: 1108
*
* Copyright (c) 2009-2011 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
Expand Down
3 changes: 2 additions & 1 deletion js/jqplot/plugins/jqplot.canvasTextRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.0b2_r1012
* Version: 1.0.2
* Revision: 1108
*
* Copyright (c) 2009-2011 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
Expand Down
33 changes: 24 additions & 9 deletions js/jqplot/plugins/jqplot.cursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.0b2_r1012
* Version: 1.0.2
* Revision: 1108
*
* Copyright (c) 2009-2011 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
Expand Down Expand Up @@ -480,11 +481,14 @@
s += '<br />';
}
if (c.useAxesFormatters) {
var xf = plot.axes[g[0]]._ticks[0].formatter;
var yf = plot.axes[g[1]]._ticks[0].formatter;
var xfstr = plot.axes[g[0]]._ticks[0].formatString;
var yfstr = plot.axes[g[1]]._ticks[0].formatString;
s += xf(xfstr, datapos[g[0]]) + ', '+ yf(yfstr, datapos[g[1]]);
for (var j=0; j<g.length; j++) {
if (j) {
s += ', ';
}
var af = plot.axes[g[j]]._ticks[0].formatter;
var afstr = plot.axes[g[j]]._ticks[0].formatString;
s += af(afstr, datapos[g[j]]);
}
}
else {
s += $.jqplot.sprintf(c.tooltipFormatString, datapos[g[0]], datapos[g[1]]);
Expand Down Expand Up @@ -752,6 +756,7 @@
if (c.show) {
$(ev.target).css('cursor', c.previousCursor);
if (c.showTooltip && !(c._zoom.zooming && c.showTooltipOutsideZoom && !c.constrainOutsideZoom)) {
c._tooltipElem.empty();
c._tooltipElem.hide();
}
if (c.zoom) {
Expand Down Expand Up @@ -845,6 +850,7 @@
var c = plot.plugins.cursor;
// don't do anything if not on grid.
if (c.show && c.zoom && c._zoom.started && !c.zoomTarget) {
ev.preventDefault();
var ctx = c.zoomCanvas._ctx;
var positions = getEventPosition(ev);
var gridpos = positions.gridPos;
Expand Down Expand Up @@ -886,7 +892,11 @@

function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
var c = plot.plugins.cursor;
$(document).one('mouseup.jqplot_cursor', {plot:plot}, handleMouseUp);
if(plot.plugins.mobile){
$(document).one('vmouseup.jqplot_cursor', {plot:plot}, handleMouseUp);
} else {
$(document).one('mouseup.jqplot_cursor', {plot:plot}, handleMouseUp);
}
var axes = plot.axes;
if (document.onselectstart != undefined) {
c._oldHandlers.onselectstart = document.onselectstart;
Expand Down Expand Up @@ -920,7 +930,12 @@
// get zoom starting position.
c._zoom.axes.start[ax] = datapos[ax];
}
$(document).bind('mousemove.jqplotCursor', {plot:plot}, handleZoomMove);
if(plot.plugins.mobile){
$(document).bind('vmousemove.jqplotCursor', {plot:plot}, handleZoomMove);
} else {
$(document).bind('mousemove.jqplotCursor', {plot:plot}, handleZoomMove);
}

}
}

Expand Down Expand Up @@ -1090,4 +1105,4 @@
return this._elem;
};

})(jQuery);
})(jQuery);
74 changes: 68 additions & 6 deletions js/jqplot/plugins/jqplot.dateAxisRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.0b2_r1012
* Version: 1.0.2
* Revision: 1108
*
* Copyright (c) 2009-2011 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
Expand Down Expand Up @@ -334,6 +335,28 @@
var threshold = 30;
var insetMult = 1;

var daTickInterval = null;

// if user specified a tick interval, convert to usable.
if (this.tickInterval != null)
{
// if interval is a number or can be converted to one, use it.
// Assume it is in SECONDS!!!
if (Number(this.tickInterval)) {
daTickInterval = [Number(this.tickInterval), 'seconds'];
}
// else, parse out something we can build from.
else if (typeof this.tickInterval == "string") {
var parts = this.tickInterval.split(' ');
if (parts.length == 1) {
daTickInterval = [1, parts[0]];
}
else if (parts.length == 2) {
daTickInterval = [parts[0], parts[1]];
}
}
}

var tickInterval = this.tickInterval;

// if we already have ticks, use them.
Expand Down Expand Up @@ -400,9 +423,43 @@
// We don't have any ticks yet, let's make some!
////////

// special case when there is only one point, make three tick marks to center the point
else if (this.min == null && this.max == null && db.min == db.max)
{
var onePointOpts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
var delta = 300000;
this.min = db.min - delta;
this.max = db.max + delta;
this.numberTicks = 3;

for(var i=this.min;i<=this.max;i+= delta)
{
onePointOpts.value = i;

var t = new this.tickRenderer(onePointOpts);

if (this._overrideFormatString && this._autoFormatString != '') {
t.formatString = this._autoFormatString;
}

t.showLabel = false;
t.showMark = false;

this._ticks.push(t);
}

if(this.showTicks) {
this._ticks[1].showLabel = true;
}
if(this.showTickMarks) {
this._ticks[1].showTickMarks = true;
}
}
// if user specified min and max are null, we set those to make best ticks.
else if (this.min == null && this.max == null) {

var opts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});

// want to find a nice interval
var nttarget,
titarget;
Expand All @@ -429,7 +486,7 @@
// tickInterval will be used before numberTicks, that is if
// both are specified, numberTicks will be ignored.
else if (this.tickInterval) {
titarget = this.tickInterval;
titarget = new $.jsDate(0).add(daTickInterval[0], daTickInterval[1]).getTime();
}

// if numberTicks specified, try to honor it.
Expand All @@ -445,9 +502,10 @@
var tempti = ret[0];
this._autoFormatString = ret[1];

min = Math.floor(min/tempti) * tempti;
//min = Math.floor(min/tempti) * tempti;
min = new $.jsDate(min);
min = min.getTime() + min.getUtcOffset();
//min = min.getTime() + min.getUtcOffset();
min = Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset();

nttarget = Math.ceil((max - min) / tempti) + 1;
this.min = min;
Expand Down Expand Up @@ -605,7 +663,7 @@
this.tickInterval = null;
}

// if user specified a tick interval, convert to usable.
/* // if user specified a tick interval, convert to usable.
if (this.tickInterval != null)
{
// if interval is a number or can be converted to one, use it.
Expand All @@ -623,8 +681,12 @@
this.daTickInterval = [parts[0], parts[1]];
}
}
}
}*/

if (this.tickInterval != null && daTickInterval != null) {
this.daTickInterval = daTickInterval;
}

// if min and max are same, space them out a bit
if (min == max) {
var adj = 24*60*60*500; // 1/2 day
Expand Down
13 changes: 12 additions & 1 deletion js/jqplot/plugins/jqplot.highlighter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.0b2_r1012
* Version: 1.0.2
* Revision: 1108
*
* Copyright (c) 2009-2011 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
Expand Down Expand Up @@ -400,6 +401,9 @@
var c = plot.plugins.cursor;
if (hl.show) {
if (neighbor == null && hl.isHighlighting) {
var evt = jQuery.Event('jqplotHighlighterUnhighlight');
plot.target.trigger(evt);

var ctx = hl.highlightCanvas._ctx;
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
if (hl.fadeTooltip) {
Expand All @@ -416,6 +420,13 @@
ctx = null;
}
else if (neighbor != null && plot.series[neighbor.seriesIndex].showHighlight && !hl.isHighlighting) {
var evt = jQuery.Event('jqplotHighlighterHighlight');
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data, plot];
plot.target.trigger(evt, ins);

hl.isHighlighting = true;
hl.currentNeighbor = neighbor;
if (hl.showMarker) {
Expand Down
7 changes: 6 additions & 1 deletion js/jqplot/plugins/jqplot.pieRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.0b2_r1012
* Version: 1.0.2
* Revision: 1108
*
* Copyright (c) 2009-2011 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
Expand Down Expand Up @@ -800,6 +801,7 @@
plot.target.trigger(evt1, ins);
if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.pieRenderer.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);
Expand All @@ -816,6 +818,7 @@
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.pieRenderer.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);
Expand All @@ -838,6 +841,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);
Expand All @@ -852,6 +856,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);
Expand Down
Loading

0 comments on commit 0fa11e0

Please sign in to comment.