app/assets/javascripts/highcharts.js in highcharts-rails-4.2.2 vs app/assets/javascripts/highcharts.js in highcharts-rails-4.2.3

- old
+ new

@@ -1,10 +1,10 @@ // ==ClosureCompiler== // @compilation_level SIMPLE_OPTIMIZATIONS /** - * @license Highcharts JS v4.2.2 (2016-02-04) + * @license Highcharts JS v4.2.3 (2016-02-08) * * (c) 2009-2016 Torstein Honsi * * License: www.highcharts.com/license */ @@ -57,11 +57,11 @@ timeUnits, noop = function () {}, charts = [], chartCount = 0, PRODUCT = 'Highcharts', - VERSION = '4.2.2', + VERSION = '4.2.3', // some constants for frequently used strings DIV = 'div', ABSOLUTE = 'absolute', RELATIVE = 'relative', @@ -1531,11 +1531,11 @@ }, global: { useUTC: true, //timezoneOffset: 0, canvasToolsURL: 'http://code.highcharts.com/modules/canvas-tools.js', - VMLRadialGradientURL: 'http://code.highcharts.com/4.2.2/gfx/vml-radial-gradient.png' + VMLRadialGradientURL: 'http://code.highcharts.com/4.2.3/gfx/vml-radial-gradient.png' }, chart: { //animation: true, //alignTicks: false, //reflow: true, @@ -2480,11 +2480,11 @@ var wrapper = this, key, attribs = {}, normalizer, - strokeWidth = rect.strokeWidth || wrapper.strokeWidth || 0; + strokeWidth = wrapper.strokeWidth || 0; normalizer = mathRound(strokeWidth) % 2 / 2; // mathRound because strokeWidth can sometimes have roundoff errors // normalize for crisp edges rect.x = mathFloor(rect.x || wrapper.x || 0) + normalizer; @@ -3955,20 +3955,20 @@ width: mathMax(width, 0), height: mathMax(height, 0) }; if (strokeWidth !== UNDEFINED) { - attribs.strokeWidth = strokeWidth; + wrapper.strokeWidth = strokeWidth; attribs = wrapper.crisp(attribs); } if (r) { attribs.r = r; } - wrapper.rSetter = function (value) { - attr(this.element, { + wrapper.rSetter = function (value, key, element) { + attr(element, { rx: value, ry: value }); }; @@ -10543,11 +10543,11 @@ // The mousemove, touchmove and touchstart event handler onContainerMouseMove: function (e) { var chart = this.chart; - if (!defined(hoverChartIndex) || !charts[hoverChartIndex].mouseIsDown) { + if (!defined(hoverChartIndex) || !charts[hoverChartIndex] || !charts[hoverChartIndex].mouseIsDown) { hoverChartIndex = chart.index; } e = this.normalize(e); e.returnValue = false; // #2251, #3224 @@ -12850,12 +12850,13 @@ fill: NONE, zIndex: 1 }) .add(); } else { + plotBorder.strokeWidth = -plotBorderWidth; plotBorder.animate( - plotBorder.crisp({ x: plotLeft, y: plotTop, width: plotWidth, height: plotHeight, strokeWidth: -plotBorderWidth }) //#3282 plotBorder should be negative + plotBorder.crisp({ x: plotLeft, y: plotTop, width: plotWidth, height: plotHeight }) //#3282 plotBorder should be negative ); } } // reset @@ -13362,12 +13363,12 @@ } point.isNull = point.y === null; // If no x is set by now, get auto incremented value. All points must have an // x value, however the y value can be null to create a gap in the series - if (point.x === UNDEFINED && series) { - point.x = x === UNDEFINED ? series.autoIncrement() : x; + if (typeof point.x !== 'number' && series) { + point.x = x === undefined ? series.autoIncrement() : x; } return point; }, @@ -14349,12 +14350,12 @@ }, /** * Return the series points with null points filtered out */ - getValidPoints: function () { - return grep(this.points, function (point) { + getValidPoints: function (points) { + return grep(points || this.points, function (point) { return !point.isNull; }); }, /** @@ -14809,15 +14810,32 @@ */ getGraphPath: function (points, nullsAsZeroes, connectCliffs) { var series = this, options = series.options, step = options.step, + reversed, graphPath = [], gap; points = points || series.points; + // Bottom of a stack is reversed + reversed = points.reversed; + if (reversed) { + points.reverse(); + } + // Reverse the steps (#5004) + step = { right: 1, center: 2 }[step] || (step && 3); + if (step && reversed) { + step = 4 - step; + } + + // Remove invalid points, especially in spline (#5015) + if (options.connectNulls && !nullsAsZeroes && !connectCliffs) { + points = this.getValidPoints(points); + } + // Build the line each(points, function (point, i) { var plotX = point.plotX, plotY = point.plotY, @@ -14845,18 +14863,18 @@ pathToPoint = series.getPointSpline(points, point, i); } else if (step) { - if (step === 'right') { + if (step === 1) { // right pathToPoint = [ L, lastPoint.plotX, plotY ]; - } else if (step === 'center') { + } else if (step === 2) { // center pathToPoint = [ L, (lastPoint.plotX + plotX) / 2, lastPoint.plotY, L, @@ -15325,15 +15343,11 @@ } } // Start the recursive build process with a clone of the points array and null points filtered out (#3873) function startRecursive() { - var points = grep(series.points || [], function (point) { // #4390 - return point.y !== null; - }); - - series.kdTree = _kdtree(points, dimensions, dimensions); + series.kdTree = _kdtree(series.getValidPoints(), dimensions, dimensions); } delete series.kdTree; // For testing tooltips, don't build async syncTimeout(startRecursive, series.options.kdNow ? 0 : 1); @@ -16562,11 +16576,12 @@ } } topPath = getGraphPath.call(this, graphPoints, true, true); - bottomPath = getGraphPath.call(this, bottomPoints.reverse(), true, true); + bottomPoints.reversed = true; + bottomPath = getGraphPath.call(this, bottomPoints, true, true); if (bottomPath.length) { bottomPath[0] = L; } areaPath = topPath.concat(bottomPath); @@ -16658,19 +16673,21 @@ if (lastPoint && !lastPoint.isNull && nextPoint && !nextPoint.isNull) { var lastX = lastPoint.plotX, lastY = lastPoint.plotY, nextX = nextPoint.plotX, nextY = nextPoint.plotY, - correction; + correction = 0; leftContX = (smoothing * plotX + lastX) / denom; leftContY = (smoothing * plotY + lastY) / denom; rightContX = (smoothing * plotX + nextX) / denom; rightContY = (smoothing * plotY + nextY) / denom; - // have the two control points make a straight line through main point - correction = ((rightContY - leftContY) * (rightContX - plotX)) / - (rightContX - leftContX) + plotY - rightContY; + // Have the two control points make a straight line through main point + if (rightContX !== leftContX) { // #5016, division by zero + correction = ((rightContY - leftContY) * (rightContX - plotX)) / + (rightContX - leftContX) + plotY - rightContY; + } leftContY += correction; rightContY += correction; // to prevent false extremes, check that control points are between