Update jqplot to version 1.0.8

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2014-12-04 15:55:35 +05:30
parent 60079cd297
commit df1b1971dc
10 changed files with 237 additions and 195 deletions

View File

@ -5,12 +5,12 @@
*
* About: Version
*
* version: 1.0.4
* revision: 1121
* version: 1.0.8
* revision: 1250
*
* About: Copyright & License
*
* Copyright (c) 2009-2012 Chris Leonello
* Copyright (c) 2009-2013 Chris Leonello
* jqPlot is currently available for use in all personal or commercial projects
* under both the MIT and GPL version 2.0 licenses. This means that you can
* choose the license that best suits your project and use it accordingly.
@ -244,8 +244,8 @@
}
};
$.jqplot.version = "1.0.4";
$.jqplot.revision = "1121";
$.jqplot.version = "1.0.8";
$.jqplot.revision = "1250";
$.jqplot.targetCounter = 1;
@ -395,7 +395,7 @@
return $.jqplot.support_canvas_text.result;
};
$.jqplot.use_excanvas = ($.browser.msie && !$.jqplot.support_canvas()) ? true : false;
$.jqplot.use_excanvas = ((!$.support.boxModel || !$.support.objectAll || !$support.leadingWhitespace) && !$.jqplot.support_canvas()) ? true : false;
/**
*
@ -511,7 +511,7 @@
/**
* Class: Axis
* An individual axis object. Cannot be instantiated directly, but created
* by the Plot oject. Axis properties can be set or overriden by the
* by the Plot object. Axis properties can be set or overridden by the
* options passed in from the user.
*
*/
@ -848,7 +848,7 @@
/**
* Class: Legend
* Legend object. Cannot be instantiated directly, but created
* by the Plot oject. Legend properties can be set or overriden by the
* by the Plot object. Legend properties can be set or overridden by the
* options passed in from the user.
*/
function Legend(options) {
@ -1077,7 +1077,7 @@
/**
* Class: Title
* Plot Title object. Cannot be instantiated directly, but created
* by the Plot oject. Title properties can be set or overriden by the
* by the Plot object. Title properties can be set or overridden by the
* options passed in from the user.
*
* Parameters:
@ -1091,7 +1091,7 @@
// text of the title;
this.text = text;
// prop: show
// wether or not to show the title
// whether or not to show the title
this.show = true;
// prop: fontFamily
// css font-family spec for the text.
@ -1140,7 +1140,7 @@
/**
* Class: Series
* An individual data series object. Cannot be instantiated directly, but created
* by the Plot oject. Series properties can be set or overriden by the
* by the Plot object. Series properties can be set or overridden by the
* options passed in from the user.
*/
function Series(options) {
@ -1159,7 +1159,7 @@
// > }
// prop: show
// wether or not to draw the series.
// whether or not to draw the series.
this.show = true;
// prop: xaxis
// which x axis to use with this series, either 'xaxis' or 'x2axis'.
@ -1233,16 +1233,16 @@
// see <$.jqplot.MarkerRenderer>.
this.markerOptions = {};
// prop: showLine
// wether to actually draw the line or not. Series will still be renderered, even if no line is drawn.
// whether to actually draw the line or not. Series will still be renderered, even if no line is drawn.
this.showLine = true;
// prop: showMarker
// wether or not to show the markers at the data points.
// whether or not to show the markers at the data points.
this.showMarker = true;
// prop: index
// 0 based index of this series in the plot series array.
this.index;
// prop: fill
// true or false, wether to fill under lines or in bars.
// true or false, whether to fill under lines or in bars.
// May not be implemented in all renderers.
this.fill = false;
// prop: fillColor
@ -1369,7 +1369,7 @@
this.markerOptions.show = this.showMarker;
}
this.showMarker = this.markerOptions.show;
// the markerRenderer is called within it's own scaope, don't want to overwrite series options!!
// the markerRenderer is called within its own scope, don't want to overwrite series options!!
this.markerRenderer.init(this.markerOptions);
};
@ -1524,15 +1524,15 @@
* Object representing the grid on which the plot is drawn. The grid in this
* context is the area bounded by the axes, the area which will contain the series.
* Note, the series are drawn on their own canvas.
* The Grid object cannot be instantiated directly, but is created by the Plot oject.
* Grid properties can be set or overriden by the options passed in from the user.
* The Grid object cannot be instantiated directly, but is created by the Plot object.
* Grid properties can be set or overridden by the options passed in from the user.
*/
function Grid() {
$.jqplot.ElemContainer.call(this);
// Group: Properties
// prop: drawGridlines
// wether to draw the gridlines on the plot.
// whether to draw the gridlines on the plot.
this.drawGridlines = true;
// prop: gridLineColor
// color of the grid lines.
@ -1553,7 +1553,7 @@
// True to draw border around grid.
this.drawBorder = true;
// prop: shadow
// wether to show a shadow behind the grid.
// whether to show a shadow behind the grid.
this.shadow = true;
// prop: shadowAngle
// shadow angle in degrees
@ -1741,7 +1741,7 @@
// animation in these situations can cause problems.
this.animateReplot = false;
// prop: axes
// up to 4 axes are supported, each with it's own options,
// up to 4 axes are supported, each with its own options,
// See <Axis> for axis specific options.
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();
@ -1757,7 +1757,8 @@
this.data = [];
// prop: dataRenderer
// A callable which can be used to preprocess data passed into the plot.
// Will be called with 2 arguments, the plot data and a reference to the plot.
// Will be called with 3 arguments: the plot data, a reference to the plot,
// and the value of dataRendererOptions.
this.dataRenderer;
// prop: dataRendererOptions
// Options that will be passed to the dataRenderer.
@ -1820,7 +1821,6 @@
this.legend = new Legend();
// prop: noDataIndicator
// Options to set up a mock plot with a data loading indicator if no data is specified.
this.negativeSeriesColors = $.jqplot.config.defaultNegativeColors;
this.noDataIndicator = {
show: false,
indicator: 'Loading Data...',
@ -1839,16 +1839,19 @@
}
}
};
// prop: negativeSeriesColors
// colors to use for portions of the line below zero.
this.negativeSeriesColors = $.jqplot.config.defaultNegativeColors;
// container to hold all of the merged options. Convienence for plugins.
this.options = {};
this.previousSeriesStack = [];
// Namespece to hold plugins. Generally non-renderer plugins add themselves to here.
// Namespace to hold plugins. Generally non-renderer plugins add themselves to here.
this.plugins = {};
// prop: series
// Array of series object options.
// see <Series> for series specific options.
this.series = [];
// array of series indicies. Keep track of order
// array of series indices. Keep track of order
// which series canvases are displayed, lowest
// to highest, back to front.
this.seriesStack = [];
@ -1860,7 +1863,7 @@
this.seriesColors = $.jqplot.config.defaultColors;
// prop: sortData
// false to not sort the data passed in by the user.
// Many bar, stakced and other graphs as well as many plugins depend on
// Many bar, stacked and other graphs as well as many plugins depend on
// having sorted data.
this.sortData = true;
// prop: stackSeries
@ -1887,7 +1890,7 @@
// Mostly used to test if plot has never been dran (=0), has been successfully drawn
// into a visible container once (=1) or draw more than once into a visible container.
// Can use this in tests to see if plot has been visibly drawn at least one time.
// After plot has been visibly drawn once, it generally doesn't need redrawn if its
// After plot has been visibly drawn once, it generally doesn't need redrawing if its
// container is hidden and shown.
this._drawCount = 0;
// sum of y values for all series in plot.
@ -1963,7 +1966,7 @@
// remove any error class that may be stuck on target.
this.target.removeClass('jqplot-error');
if (!this.target.get(0)) {
throw "No plot target specified";
throw new Error("No plot target specified");
}
// make sure the target is positioned by some means and set css
@ -2022,7 +2025,7 @@
this.eventCanvas._plotDimensions = this._plotDimensions;
this.legend._plotDimensions = this._plotDimensions;
if (this._height <=0 || this._width <=0 || !this._height || !this._width) {
throw "Canvas dimension not set";
throw new Error("Canvas dimension not set");
}
if (options.dataRenderer && $.isFunction(options.dataRenderer)) {
@ -2040,7 +2043,7 @@
if (data == null || $.isArray(data) == false || data.length == 0 || $.isArray(data[0]) == false || data[0].length == 0) {
if (this.noDataIndicator.show == false) {
throw "No Data";
throw new Error("No data specified");
}
else {
@ -2205,7 +2208,7 @@
this._width = this.target.width();
if (this._height <=0 || this._width <=0 || !this._height || !this._width) {
throw "Target dimension not set";
throw new Error("Target dimension not set");
}
this._plotDimensions.height = this._height;
@ -2361,7 +2364,7 @@
this._width = this.target.width();
if (this._height <=0 || this._width <=0 || !this._height || !this._width) {
throw "Target dimension not set";
throw new Error("Target dimension not set");
}
this._plotDimensions.height = this._height;
@ -2924,7 +2927,7 @@
for (i=0, l=$.jqplot.preDrawHooks.length; i<l; i++) {
$.jqplot.preDrawHooks[i].call(this);
}
for (i=0, l=this.preDrawHooks.length; i<l; i++) {
for (i=0, l=this.preDrawHooks.hooks.length; i<l; i++) {
this.preDrawHooks.hooks[i].apply(this, this.preDrawSeriesHooks.args[i]);
}
// create an underlying canvas to be used for special features.
@ -3296,7 +3299,7 @@
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:s.gridData[j], data:s.data[j]};
return {seriesIndex:s.index, pointIndex:j, gridData:[gridpos.x,gridpos.y], data:s.data[j]};
}
}
}
@ -3341,7 +3344,7 @@
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:s.gridData[j], data:s.data[j]};
return {seriesIndex:s.index, pointIndex:j, gridData:[gridpos.x,gridpos.y], data:s.data[j]};
}
}
}
@ -3906,7 +3909,7 @@
return $.jqplot.hex2rgb(s, a);
}
else {
throw 'invalid color spec';
throw new Error('Invalid color spec');
}
};
@ -4082,6 +4085,7 @@
// class: $.jqplot.AxisLabelRenderer
// Renderer to place labels on the axes.
$.jqplot.AxisLabelRenderer = function(options) {
@ -4090,7 +4094,7 @@
// name of the axis associated with this tick
this.axis;
// prop: show
// wether or not to show the tick (mark and label).
// whether or not to show the tick (mark and label).
this.show = true;
// prop: label
// The text or html for the label.
@ -4159,10 +4163,10 @@
// name of the axis associated with this tick
this.axis;
// prop: showMark
// wether or not to show the mark on the axis.
// whether or not to show the mark on the axis.
this.showMark = true;
// prop: showGridline
// wether or not to draw the gridline on the grid at this tick.
// whether or not to draw the gridline on the grid at this tick.
this.showGridline = true;
// prop: isMinorTick
// if this is a minor tick.
@ -4176,12 +4180,12 @@
// will be stoked above and below axis, so total length will be twice this.
this.markSize = 6;
// prop: show
// wether or not to show the tick (mark and label).
// whether or not to show the tick (mark and label).
// Setting this to false requires more testing. It is recommended
// to set showLabel and showMark to false instead.
this.show = true;
// prop: showLabel
// wether or not to show the label.
// whether or not to show the label.
this.showLabel = true;
this.label = null;
this.value = null;
@ -4213,7 +4217,7 @@
// true to escape HTML entities in the label.
this.escapeHTML = false;
this._elem;
this._breakTick = false;
this._breakTick = false;
$.extend(true, this, options);
};
@ -4273,9 +4277,9 @@
if (this.textColor) {
this._elem.css('color', this.textColor);
}
if (this._breakTick) {
this._elem.addClass('jqplot-breakTick');
}
if (this._breakTick) {
this._elem.addClass('jqplot-breakTick');
}
return this._elem;
};
@ -4349,8 +4353,8 @@
this._elem.addClass('jqplot-grid-canvas');
this._elem.css({ position: 'absolute', left: 0, top: 0 });
elem = plot.canvasManager.initCanvas(elem);
elem = plot.canvasManager.initCanvas(elem);
this._top = this._offsets.top;
this._bottom = h - this._offsets.bottom;
this._left = this._offsets.left;
@ -4754,11 +4758,11 @@
$.jqplot.LinePattern = function (ctx, pattern) {
var defaultLinePatterns = {
dotted: [ dotlen, $.jqplot.config.dotGapLength ],
dashed: [ $.jqplot.config.dashLength, $.jqplot.config.gapLength ],
solid: null
};
var defaultLinePatterns = {
dotted: [ dotlen, $.jqplot.config.dotGapLength ],
dashed: [ $.jqplot.config.dashLength, $.jqplot.config.gapLength ],
solid: null
};
if (typeof pattern === 'string') {
if (pattern[0] === '.' || pattern[0] === '-') {
@ -5732,7 +5736,7 @@
tempgd.push(gd[i]);
this._areaPoints.push(gd[i]);
// do we have an axis crossing?
if (pd[i][1] * pd[i+1][1] < 0) {
if (pd[i][1] * pd[i+1][1] <= 0) {
if (pd[i][1] < 0) {
isnegative = true;
opts.fillStyle = negativeColor;
@ -5992,7 +5996,7 @@
plot.target.trigger(evt1, ins);
if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.lineRenderer.highlightedSeriesIndex)) {
var evt = jQuery.Event('jqplotDataHighlight');
evt.which = ev.which;
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -6009,7 +6013,7 @@
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.lineRenderer.highlightedSeriesIndex)) {
var evt = jQuery.Event('jqplotDataHighlight');
evt.which = ev.which;
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -6032,7 +6036,7 @@
if (neighbor) {
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt = jQuery.Event('jqplotDataClick');
evt.which = ev.which;
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -6047,7 +6051,7 @@
unhighlight(plot);
}
var evt = jQuery.Event('jqplotDataRightClick');
evt.which = ev.which;
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -6142,7 +6146,7 @@
// call it within the scope of the axis.
this.renderer.createTicks.call(this, plot);
// fill a div with axes labels in the right direction.
// Need to pregenerate each axis to get it's bounds and
// Need to pregenerate each axis to get its bounds and
// position it and the labels correctly on the plot.
var dim=0;
var temp;
@ -7399,7 +7403,7 @@
// Group: Properties
// prop: show
// wether or not to show the marker.
// whether or not to show the marker.
this.show = true;
// prop: style
// One of diamond, circle, square, x, plus, dash, filledDiamond, filledCircle, filledSquare
@ -7414,7 +7418,7 @@
// color of marker. Will be set to color of series by default on init.
this.color = '#666666';
// prop: shadow
// wether or not to draw a shadow on the line
// whether or not to draw a shadow on the line
this.shadow = true;
// prop: shadowAngle
// Shadow angle in degrees
@ -7625,7 +7629,7 @@
this.depth = 3;
this.strokeStyle = 'rgba(0,0,0,0.1)';
// prop: isarc
// wether the shadow is an arc or not.
// whether the shadow is an arc or not.
this.isarc = false;
$.extend(true, this, options);
@ -7727,7 +7731,7 @@
// whether to fill the shape.
this.fill = false;
// prop: isarc
// wether the shadow is an arc or not.
// whether the shadow is an arc or not.
this.isarc = false;
// prop: fillRect
// true to draw shape as a filled rectangle.
@ -7950,7 +7954,7 @@
var pad = false,
reverse = false,
s;
s;
for (var i = 0; i< series.length; i++) {
s = series[i];
if (s._stack || s.renderer.constructor == $.jqplot.BezierCurveRenderer){
@ -9283,7 +9287,7 @@
return str;
};
// Not gauranteed to work, even on canvas supporting browsers due to
// Not guaranteed to work, even on canvas supporting browsers due to
// limitations with location.href and browser support.
$.fn.jqplotSaveImage = function() {
var imgData = $(this).jqplotToImageStr({});
@ -9293,7 +9297,7 @@
};
// Not gauranteed to work, even on canvas supporting browsers due to
// Not guaranteed to work, even on canvas supporting browsers due to
// limitations with window.open and arbitrary data.
$.fn.jqplotViewImage = function() {
var imgStr = $(this).jqplotToImageElemStr({});
@ -9323,12 +9327,12 @@
* @author Chris Leonello
* @date #date#
* @version #VERSION#
* @copyright (c) 2010 Chris Leonello
* @copyright (c) 2010-2013 Chris Leonello
* jsDate is currently available for use in all personal or commercial projects
* under both the MIT and GPL version 2.0 licenses. This means that you can
* choose the license that best suits your project and use it accordingly.
*
* <p>Ken's origianl Date Instance Methods and copyright notice:</p>
* <p>Ken's original Date Instance Methods and copyright notice:</p>
* <pre>
* Ken Snyder (ken d snyder at gmail dot com)
* 2008-09-10
@ -9616,7 +9620,7 @@
jsDate.prototype.getIsoWeek = function() {
var d = this.proxy;
var woy = d.getWeekOfYear();
var woy = this.getWeekOfYear();
var dow1_1 = (new Date('' + d.getFullYear() + '/1/1')).getDay();
// First week is 01 and not 00 as in the case of %U and %W,
// so we add 1 to the final result except if day 1 of the year
@ -10010,8 +10014,31 @@
dayNames: ['Domingo','Segunda-feira','Ter&ccedil;a-feira','Quarta-feira','Quinta-feira','Sexta-feira','S&aacute;bado'],
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','S&aacute;b'],
formatString: '%Y-%m-%d %H:%M:%S'
}
},
'pl': {
monthNames: ['Styczeń','Luty','Marzec','Kwiecień','Maj','Czerwiec','Lipiec','Sierpień','Wrzesień','Październik','Listopad','Grudzień'],
monthNamesShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze','Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'],
dayNames: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],
dayNamesShort: ['Ni', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'Sb'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'nl': {
monthNames: ['Januari','Februari','Maart','April','Mei','Juni','July','Augustus','September','Oktober','November','December'],
monthNamesShort: ['Jan','Feb','Mar','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec'],
dayNames:','['Zondag','Maandag','Dinsdag','Woensdag','Donderdag','Vrijdag','Zaterdag'],
dayNamesShort: ['Zo','Ma','Di','Wo','Do','Vr','Za'],
formatString: '%Y-%m-%d %H:%M:%S'
},
'sv': {
monthNames: ['januari','februari','mars','april','maj','juni','juli','augusti','september','oktober','november','december'],
monthNamesShort: ['jan','feb','mar','apr','maj','jun','jul','aug','sep','okt','nov','dec'],
dayNames: ['söndag','måndag','tisdag','onsdag','torsdag','fredag','lördag'],
dayNamesShort: ['sön','mån','tis','ons','tor','fre','lör'],
formatString: '%Y-%m-%d %H:%M:%S'
}
};
@ -10976,15 +11003,18 @@
var method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())];
var textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) % 2];
var number_str = Math.abs(number)[method](precision);
number_str = thousandSeparation ? thousand_separate(number_str): number_str;
// Apply the decimal mark properly by splitting the number by the
// decimalMark, applying thousands separator, and then placing it
// back in.
var parts = number_str.toString().split('.');
parts[0] = thousandSeparation ? thousand_separate(parts[0]) : parts[0];
number_str = parts.join($.jqplot.sprintf.decimalMark);
value = prefix + number_str;
var justified = justify(value, prefix, leftJustify, minWidth, zeroPad, htmlSpace)[textTransform]();
if ($.jqplot.sprintf.decimalMark !== '.' && $.jqplot.sprintf.decimalMark !== $.jqplot.sprintf.thousandsSeparator) {
return justified.replace(/\./, $.jqplot.sprintf.decimalMark);
} else {
return justified;
}
return justified;
}
case 'p':
case 'P':
@ -10997,7 +11027,7 @@
var prefix = number < 0 ? '-' : positivePrefix;
var parts = String(Number(Math.abs(number)).toExponential()).split(/e|E/);
var sd = (parts[0].indexOf('.') != -1) ? parts[0].length - 1 : parts[0].length;
var sd = (parts[0].indexOf('.') != -1) ? parts[0].length - 1 : String(number).length;
var zeros = (parts[1] < 0) ? -parts[1] - 1 : 0;
if (Math.abs(number) < 1) {
@ -11053,7 +11083,7 @@
return $.jqplot.getSignificantFigures(number).digitsRight;
};
})(jQuery);
var backCompat = $.uiBackCompat !== false;
@ -11378,4 +11408,4 @@
};
})(jQuery);

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -115,7 +115,7 @@
//////
// This is probably wrong here.
// After going back and forth on wether renderer should be the thing
// 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.
@ -350,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;
@ -366,9 +366,9 @@
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++) {
@ -438,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
@ -513,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();
@ -522,6 +522,9 @@
opts.fillStyle = positiveColors.next();
}
}
else {
opts.fillStyle = negativeColor;
}
}
else {
if (this.varyBarColor && !this._stack) {
@ -729,9 +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.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -748,7 +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.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -771,7 +775,7 @@
if (neighbor) {
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt = jQuery.Event('jqplotDataClick');
evt.which = ev.which;
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -786,7 +790,7 @@
unhighlight(plot);
}
var evt = jQuery.Event('jqplotDataRightClick');
evt.which = ev.which;
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -794,4 +798,4 @@
}
})(jQuery);
})(jQuery);

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -52,10 +52,10 @@
// name of the axis associated with this tick
this.axis;
// prop: show
// wether or not to show the tick (mark and label).
// whether or not to show the tick (mark and label).
this.show = true;
// prop: showLabel
// wether or not to show the label.
// whether or not to show the label.
this.showLabel = true;
// prop: label
// label for the axis.
@ -186,8 +186,8 @@
elem.style.width = w;
elem.style.height = h;
elem = plot.canvasManager.initCanvas(elem);
elem = plot.canvasManager.initCanvas(elem);
this._elem = $(elem);
this._elem.css({ position: 'absolute'});
this._elem.addClass('jqplot-'+this.axis+'-label');

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -29,7 +29,7 @@
*
* included jsDate library by Chris Leonello:
*
* Copyright (c) 2010-2012 Chris Leonello
* Copyright (c) 2010-2013 Chris Leonello
*
* jsDate is currently available for use in all personal or commercial projects
* under both the MIT and GPL version 2.0 licenses. This means that you can
@ -38,7 +38,7 @@
* jsDate borrows many concepts and ideas from the Date Instance
* Methods by Ken Snyder along with some parts of Ken's actual code.
*
* Ken's origianl Date Instance Methods and copyright notice:
* Ken's original Date Instance Methods and copyright notice:
*
* Ken Snyder (ken d snyder at gmail dot com)
* 2008-09-10

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -211,7 +211,11 @@
}
if (isMerged && this.sortMergedLabels) {
labels.sort(function(a,b) { return a - b; });
if (typeof labels[0] == "string") {
labels.sort();
} else {
labels.sort(function(a,b) { return a - b; });
}
}
// keep a reference to these tick labels to use for redrawing plot (see bug #57)
@ -306,7 +310,7 @@
// call it within the scope of the axis.
this.renderer.createTicks.call(this);
// fill a div with axes labels in the right direction.
// Need to pregenerate each axis to get it's bounds and
// Need to pregenerate each axis to get its bounds and
// position it and the labels correctly on the plot.
var dim=0;
var temp;
@ -432,7 +436,7 @@
var offmin = offsets.min;
var lshow = (this._label == null) ? false : this._label.show;
var i;
for (var p in pos) {
this._elem.css(p, pos[p]);
}
@ -564,11 +568,12 @@
}
// draw the group labels
var step = parseInt(this._ticks.length/this.groups, 10);
var step = parseInt(this._ticks.length/this.groups, 10) + 1;
for (i=0; i<this._groupLabels.length; i++) {
var mid = 0;
var count = 0;
for (var j=i*step; j<=(i+1)*step; j++) {
for (var j=i*step; j<(i+1)*step; j++) {
if (j >= this._ticks.length-1) continue; // the last tick does not exist as there is no other group in order to have an empty one.
if (this._ticks[j]._elem && this._ticks[j].label != " ") {
var t = this._ticks[j]._elem;
var p = t.position();
@ -648,11 +653,12 @@
}
// draw the group labels, position top here, do left after label position.
var step = parseInt(this._ticks.length/this.groups, 10);
var step = parseInt(this._ticks.length/this.groups, 10) + 1; // step is one more than before as we don't want to have overlaps in loops
for (i=0; i<this._groupLabels.length; i++) {
var mid = 0;
var count = 0;
for (var j=i*step; j<=(i+1)*step; j++) {
for (var j=i*step; j<(i+1)*step; j++) { // j must never reach (i+1)*step as we don't want to have overlap between loops
if (j >= this._ticks.length-1) continue; // the last tick does not exist as there is no other group in order to have an empty one.
if (this._ticks[j]._elem && this._ticks[j].label != " ") {
var t = this._ticks[j]._elem;
var p = t.position();
@ -670,4 +676,4 @@
};
})(jQuery);
})(jQuery);

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -42,7 +42,7 @@
this.style = 'crosshair';
this.previousCursor = 'auto';
// prop: show
// wether to show the cursor or not.
// whether to show the cursor or not.
this.show = $.jqplot.config.enablePlugins;
// prop: showTooltip
// show a cursor position tooltip. Location of the tooltip
@ -654,7 +654,7 @@
elem.css('left', x);
elem.css('top', y);
elem = null;
elem = null;
}
function positionTooltip(plot) {
@ -1048,7 +1048,7 @@
if (this.show) {
var series = this._series, s;
// make a table. one line label per row.
var elem = document.createElement('div');
var elem = document.createElement('table');
this._elem = $(elem);
elem = null;
this._elem.addClass('jqplot-legend jqplot-cursor-legend');

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -33,7 +33,7 @@
* Class: $.jqplot.DateAxisRenderer
* A plugin for a jqPlot to render an axis as a series of date values.
* This renderer has no options beyond those supplied by the <Axis> class.
* It supplies it's own tick formatter, so the tickOptions.formatter option
* It supplies its own tick formatter, so the tickOptions.formatter option
* should not be overridden.
*
* Thanks to Ken Synder for his enhanced Date instance methods which are
@ -334,14 +334,35 @@
var tt, i;
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.
// ticks must be in order of increasing value.
min = ((this.min != null) ? new $.jsDate(this.min).getTime() : db.min);
max = ((this.max != null) ? new $.jsDate(this.max).getTime() : db.max);
min = new $.jsDate((this.min != null) ? this.min : db.min).getTime();
max = new $.jsDate((this.max != null) ? this.max : db.max).getTime();
// see if we're zooming. if we are, don't use the min and max we're given,
// but compute some nice ones. They will be reset later.
@ -459,16 +480,16 @@
}
// If tickInterval is specified, we'll try to honor it.
// Not gauranteed to get this interval, but we'll get as close as
// Not guaranteed to get this interval, but we'll get as close as
// we can.
// 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.
// Not gauranteed, but will try to get close.
// Not guaranteed, but will try to get close.
else if (this.numberTicks) {
nttarget = this.numberTicks;
titarget = (max - min) / (nttarget - 1);
@ -480,9 +501,8 @@
var tempti = ret[0];
this._autoFormatString = ret[1];
min = Math.floor(min/tempti) * tempti;
min = new $.jsDate(min);
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;
@ -640,24 +660,8 @@
this.tickInterval = 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)) {
this.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) {
this.daTickInterval = [1, parts[0]];
}
else if (parts.length == 2) {
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

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -44,7 +44,7 @@
* To disable the tooltip, set "showTooltip" to false.
*
* You can control what data is displayed in the tooltip with various
* options. The "tooltipAxes" option controls wether the x, y or both
* options. The "tooltipAxes" option controls whether the x, y or both
* data values are displayed.
*
* Some chart types (e.g. hi-low-close) have more than one y value per
@ -339,12 +339,12 @@
if (series.markerRenderer.show == true) {
ms = (series.markerRenderer.size + opts.sizeAdjust)/2;
}
var loc = locations;
if (series.fillToZero && series.fill && neighbor.data[1] < 0) {
loc = oppositeLocations;
}
var loc = locations;
if (series.fillToZero && series.fill && neighbor.data[1] < 0) {
loc = oppositeLocations;
}
switch (loc[locationIndicies[opts.tooltipLocation]]) {
case 'nw':
var x = gridpos.x + plot._gridPadding.left - elem.outerWidth(true) - opts.tooltipOffset - fact * ms;
@ -432,7 +432,7 @@
if (hl.showMarker) {
draw(plot, neighbor);
}
if (hl.showTooltip && (!c || !c._zoom.started)) {
if (plot.series[neighbor.seriesIndex].show && hl.showTooltip && (!c || !c._zoom.started)) {
showTooltip(plot, plot.series[neighbor.seriesIndex], neighbor);
}
if (hl.bringSeriesToFront) {
@ -452,7 +452,7 @@
if (hl.showMarker) {
draw(plot, neighbor);
}
if (hl.showTooltip && (!c || !c._zoom.started)) {
if (plot.series[neighbor.seriesIndex].show && hl.showTooltip && (!c || !c._zoom.started)) {
showTooltip(plot, plot.series[neighbor.seriesIndex], neighbor);
}
if (hl.bringSeriesToFront) {

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -88,7 +88,7 @@
// angular spacing between pie slices in degrees.
this.sliceMargin = 0;
// prop: fill
// true or false, wether to fil the slices.
// true or false, whether to fil the slices.
this.fill = true;
// prop: shadowOffset
// offset of the shadow from the slice and offset of
@ -801,7 +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.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -818,7 +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.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -841,7 +841,7 @@
if (neighbor) {
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
var evt = jQuery.Event('jqplotDataClick');
evt.which = ev.which;
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);
@ -856,7 +856,7 @@
unhighlight(plot);
}
var evt = jQuery.Event('jqplotDataRightClick');
evt.which = ev.which;
evt.which = ev.which;
evt.pageX = ev.pageX;
evt.pageY = ev.pageY;
plot.target.trigger(evt, ins);

View File

@ -2,10 +2,10 @@
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
* Version: 1.0.4
* Revision: 1121
* Version: 1.0.8
* Revision: 1250
*
* Copyright (c) 2009-2012 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
@ -155,7 +155,7 @@
labelIdx = p.seriesLabelIndex;
}
else if (this.renderer.constructor === $.jqplot.BarRenderer && this.barDirection === 'horizontal') {
labelIdx = 0;
labelIdx = (this._plotData[0].length < 3) ? 0 : this._plotData[0].length -1;
}
else {
labelIdx = (this._plotData.length === 0) ? 0 : this._plotData[0].length -1;
@ -294,13 +294,11 @@
for (var i=0, l=p._labels.length; i < l; i++) {
var label = p._labels[i];
if (p.hideZeros && parseInt(p._labels[i], 10) == 0) {
label = '';
if (label == null || (p.hideZeros && parseInt(label, 10) == 0)) {
continue;
}
if (label != null) {
label = p.formatter(p.formatString, label);
}
label = p.formatter(p.formatString, label);
helem = document.createElement('div');
p._elems[i] = $(helem);