vendor/assets/javascripts/jqplot-plugins/jqplot.pointLabels.js in outfielding-jqplot-rails-1.0.5 vs vendor/assets/javascripts/jqplot-plugins/jqplot.pointLabels.js in outfielding-jqplot-rails-1.0.7
- old
+ new
@@ -1,11 +1,11 @@
/**
* jqPlot
* Pure JavaScript plotting plugin using jQuery
*
- * Version: 1.0.5
- * Revision: 1122+
+ * Version: 1.0.7
+ * Revision: 1224
*
* 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
@@ -153,11 +153,11 @@
var labelIdx;
if (p.seriesLabelIndex != null) {
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;
}
p._labels = [];
@@ -292,16 +292,14 @@
var elem, helem;
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);
elem = p._elems[i];
\ No newline at end of file