Browse Source

Spacing and Tabbing reported by Travis CI.

pull/254/head
Brandon Bernal 11 years ago
parent
commit
a320d66211
  1. 66
      c3.js

66
c3.js

@ -515,7 +515,7 @@
function updateRadius() { function updateRadius() {
radiusExpanded = Math.min(arcWidth, arcHeight) / 2; radiusExpanded = Math.min(arcWidth, arcHeight) / 2;
radius = radiusExpanded * 0.95; radius = radiusExpanded * 0.95;
var innerRadiusRatio = __gauge_width ? ((radius-__gauge_width)/radius) : 0.6; var innerRadiusRatio = __gauge_width ? ((radius - __gauge_width) / radius) : 0.6;
innerRadius = hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets) ? radius * innerRadiusRatio : 0; innerRadius = hasDonutType(c3.data.targets) || hasGaugeType(c3.data.targets) ? radius * innerRadiusRatio : 0;
} }
function getSvgLeft() { function getSvgLeft() {
@ -991,14 +991,16 @@
d = t; d = t;
} }
}); });
if (isNaN(d.endAngle)) d.endAngle = d.startAngle; if (isNaN(d.endAngle)) {
d.endAngle = d.startAngle;
}
if (isGaugeType(d.data)) { if (isGaugeType(d.data)) {
var sA = d.startAngle, eA = d.endAngle; var sA = d.startAngle, eA = d.endAngle;
var gMin = __gauge_min, gMax = __gauge_max, var gMin = __gauge_min, gMax = __gauge_max,
gF = Math.abs(gMin)+gMax, fA = Math.abs(sA)+eA, gF = Math.abs(gMin) + gMax, fA = Math.abs(sA) + eA,
aTic = (Math.PI)/gF; aTic = (Math.PI) / gF;
d.startAngle = (-1*(Math.PI/2))+(aTic*Math.abs(gMin)); d.startAngle = (-1 * (Math.PI / 2)) + (aTic * Math.abs(gMin));
d.endAngle = d.startAngle+(aTic*( (d.value > gMax) ? gMax : d.value )); d.endAngle = d.startAngle + (aTic * ((d.value > gMax) ? gMax : d.value ));
} }
return found ? d : null; return found ? d : null;
} }
@ -1034,7 +1036,7 @@
h = Math.sqrt(x * x + y * y); h = Math.sqrt(x * x + y * y);
// TODO: ratio should be an option? // TODO: ratio should be an option?
ratio = (36 / radius > 0.375 ? 1.175 - 36 / radius : 0.8) * radius / h; ratio = (36 / radius > 0.375 ? 1.175 - 36 / radius : 0.8) * radius / h;
translate = __gauge_style == 'arc' ? "translate(1,1)" : "translate(" + (x * ratio) + ',' + (y * ratio) + ")"; translate = __gauge_style === 'arc' ? "translate(1,1)" : "translate(" + (x * ratio) + ',' + (y * ratio) + ")";
} }
return translate; return translate;
} }
@ -1089,13 +1091,13 @@
} }
function shouldShowArcLable() { function shouldShowArcLable() {
if (hasGaugeType(c3.data.targets)) { if (hasGaugeType(c3.data.targets)) {
return true; return true;
} }
return hasDonutType(c3.data.targets) ? __donut_label_show : __pie_label_show; return hasDonutType(c3.data.targets) ? __donut_label_show : __pie_label_show;
} }
function getArcLabelFormat() { function getArcLabelFormat() {
if (hasGaugeType(c3.data.targets)) { if (hasGaugeType(c3.data.targets)) {
return __gauge_label_format; return __gauge_label_format;
} }
return hasDonutType(c3.data.targets) ? __donut_label_format : __pie_label_format; return hasDonutType(c3.data.targets) ? __donut_label_format : __pie_label_format;
} }
@ -1104,21 +1106,21 @@
} }
function getArcOnClick() { function getArcOnClick() {
if (hasGaugeType(c3.data.targets)) { if (hasGaugeType(c3.data.targets)) {
return typeof __gauge_onclick === 'function' ? __gauge_onclick : function () {}; return typeof __gauge_onclick === 'function' ? __gauge_onclick : function () {};
} }
var callback = hasDonutType(c3.data.targets) ? __donut_onclick : __pie_onclick; var callback = hasDonutType(c3.data.targets) ? __donut_onclick : __pie_onclick;
return typeof callback === 'function' ? callback : function () {}; return typeof callback === 'function' ? callback : function () {};
} }
function getArcOnMouseOver() { function getArcOnMouseOver() {
if (hasGaugeType(c3.data.targets)) { if (hasGaugeType(c3.data.targets)) {
return typeof __gauge_onmouseover === 'function' ? __gauge_onmouseover : function () {}; return typeof __gauge_onmouseover === 'function' ? __gauge_onmouseover : function () {};
} }
var callback = hasDonutType(c3.data.targets) ? __donut_onmouseover : __pie_onmouseover; var callback = hasDonutType(c3.data.targets) ? __donut_onmouseover : __pie_onmouseover;
return typeof callback === 'function' ? callback : function () {}; return typeof callback === 'function' ? callback : function () {};
} }
function getArcOnMouseOut() { function getArcOnMouseOut() {
if (hasGaugeType(c3.data.targets)) { if (hasGaugeType(c3.data.targets)) {
return typeof __gauge_onmouseout === 'function' ? __gauge_onmouseout : function () {}; return typeof __gauge_onmouseout === 'function' ? __gauge_onmouseout : function () {};
} }
var callback = hasDonutType(c3.data.targets) ? __donut_onmouseout : __pie_onmouseout; var callback = hasDonutType(c3.data.targets) ? __donut_onmouseout : __pie_onmouseout;
return typeof callback === 'function' ? callback : function () {}; return typeof callback === 'function' ? callback : function () {};
@ -1228,7 +1230,7 @@
padding_bottom = yDomainMin; padding_bottom = yDomainMin;
} }
if (!hasNegativeValueInTargets(yTargets)) { if (!hasNegativeValueInTargets(yTargets)) {
padding_bottom -= padding_bottom; padding_bottom -= padding_bottom;
} }
return [yDomainMin - padding_bottom, yDomainMax + padding_top]; return [yDomainMin - padding_bottom, yDomainMax + padding_top];
} }
@ -1957,9 +1959,9 @@
function circleX(d) { function circleX(d) {
return d.x || d.x === 0 ? x(d.x) : null; return d.x || d.x === 0 ? x(d.x) : null;
} }
function circleY(d,i) { function circleY(d, i) {
var lineIndices = getLineIndices(), getPoint = generateGetLinePoint(lineIndices); var lineIndices = getLineIndices(), getPoint = generateGetLinePoint(lineIndices);
if (__data_groups.length > 0) { var point = getPoint(d,i); return point[0][1]; } if (__data_groups.length > 0) { var point = getPoint(d, i); return point[0][1]; }
return getYScale(d.id)(d.value); return getYScale(d.id)(d.value);
} }
@ -2249,20 +2251,20 @@
} }
function generateLevelColor(_colors, _values) { function generateLevelColor(_colors, _values) {
var colors = _colors, var colors = _colors,
levels = _values; levels = _values;
return function (value) { return function (value) {
for (var a=1; a<levels.length; a++) { for (var a = 1; a < levels.length; a++) {
if (levels[0] === 'percentage' && ((value/__gauge_max)*100) < levels[a]) { if (levels[0] === 'percentage' && ((value / __gauge_max) * 100) < levels[a]) {
return colors[a-1]; return colors[a-1];
} }
if (levels[0] === 'whole' && value < levels[a]) { if (levels[0] === 'whole' && value < levels[a]) {
return colors[a-1]; return colors[a-1];
} }
} }
return colors[colors.length-1]; return colors[colors.length-1];
}; };
} }
//-- Date --// //-- Date --//
@ -2491,8 +2493,8 @@
return line(data); return line(data);
} }
} else if (isStepType(d)) { } else if (isStepType(d)) {
line.interpolate("step-after"); line.interpolate("step-after");
return line(data); return line(data);
} else { } else {
if (data[0]) { if (data[0]) {
x0 = x(data[0].x); x0 = x(data[0].x);

Loading…
Cancel
Save