app/assets/javascripts/highstock/modules/heatmap.js in highstock-rails-2.1.10 vs app/assets/javascripts/highstock/modules/heatmap.js in highstock-rails-5.0.11

- old
+ new

@@ -1,23 +1,25 @@ /* - Highcharts JS v4.1.10 (2015-12-07) + Highcharts JS v5.0.11 (2017-05-04) - (c) 2011-2014 Torstein Honsi + (c) 2009-2017 Torstein Honsi License: www.highcharts.com/license */ -(function(d){typeof module==="object"&&module.exports?module.exports=d:d(Highcharts)})(function(d){var m=d.Axis,q=d.Chart,i=d.Color,x=d.Legend,s=d.LegendSymbolMixin,t=d.Series,y=d.Point,u=d.getOptions(),h=d.each,r=d.extend,v=d.extendClass,j=d.merge,k=d.pick,o=d.seriesTypes,w=d.wrap,n=function(){},p=d.ColorAxis=function(){this.isColorAxis=!0;this.init.apply(this,arguments)};r(p.prototype,m.prototype);r(p.prototype,{defaultColorAxisOptions:{lineWidth:0,minPadding:0,maxPadding:0,gridLineWidth:1,tickPixelInterval:72, -startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50},color:"gray",width:0.01},labels:{overflow:"justify"},minColor:"#EFEFFF",maxColor:"#003875",tickLength:5},init:function(a,b){var c=a.options.legend.layout!=="vertical",f;f=j(this.defaultColorAxisOptions,{side:c?2:1,reversed:!c},b,{opposite:!c,showEmpty:!1,title:null,isColor:!0});m.prototype.init.call(this,a,f);b.dataClasses&&this.initDataClasses(b);this.initStops(b);this.horiz=c;this.zoomEnabled=!1},tweenColors:function(a,b,c){var f; -!b.rgba.length||!a.rgba.length?a=b.input||"none":(a=a.rgba,b=b.rgba,f=b[3]!==1||a[3]!==1,a=(f?"rgba(":"rgb(")+Math.round(b[0]+(a[0]-b[0])*(1-c))+","+Math.round(b[1]+(a[1]-b[1])*(1-c))+","+Math.round(b[2]+(a[2]-b[2])*(1-c))+(f?","+(b[3]+(a[3]-b[3])*(1-c)):"")+")");return a},initDataClasses:function(a){var b=this,c=this.chart,f,e=0,l=this.options,g=a.dataClasses.length;this.dataClasses=f=[];this.legendItems=[];h(a.dataClasses,function(a,d){var h,a=j(a);f.push(a);if(!a.color)l.dataClassColor==="category"? -(h=c.options.colors,a.color=h[e++],e===h.length&&(e=0)):a.color=b.tweenColors(i(l.minColor),i(l.maxColor),g<2?0.5:d/(g-1))})},initStops:function(a){this.stops=a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];h(this.stops,function(a){a.color=i(a[1])})},setOptions:function(a){m.prototype.setOptions.call(this,a);this.options.crosshair=this.options.marker;this.coll="colorAxis"},setAxisSize:function(){var a=this.legendSymbol,b=this.chart,c,f,e;if(a)this.left=c=a.attr("x"),this.top=f=a.attr("y"), -this.width=e=a.attr("width"),this.height=a=a.attr("height"),this.right=b.chartWidth-c-e,this.bottom=b.chartHeight-f-a,this.len=this.horiz?e:a,this.pos=this.horiz?c:f},toColor:function(a,b){var c,f=this.stops,e,l=this.dataClasses,g,d;if(l)for(d=l.length;d--;){if(g=l[d],e=g.from,f=g.to,(e===void 0||a>=e)&&(f===void 0||a<=f)){c=g.color;if(b)b.dataClass=d;break}}else{this.isLog&&(a=this.val2lin(a));c=1-(this.max-a)/(this.max-this.min||1);for(d=f.length;d--;)if(c>f[d][0])break;e=f[d]||f[d+1];f=f[d+1]|| -e;c=1-(f[0]-c)/(f[0]-e[0]||1);c=this.tweenColors(e.color,f.color,c)}return c},getOffset:function(){var a=this.legendGroup,b=this.chart.axisOffset[this.side];if(a){this.axisParent=a;m.prototype.getOffset.call(this);if(!this.added)this.added=!0,this.labelLeft=0,this.labelRight=this.width;this.chart.axisOffset[this.side]=b}},setLegendColor:function(){var a,b=this.options,c=this.reversed;a=c?1:0;c=c?0:1;a=this.horiz?[a,0,c,0]:[0,c,0,a];this.legendColor={linearGradient:{x1:a[0],y1:a[1],x2:a[2],y2:a[3]}, -stops:b.stops||[[0,b.minColor],[1,b.maxColor]]}},drawLegendSymbol:function(a,b){var c=a.padding,f=a.options,e=this.horiz,d=k(f.symbolWidth,e?200:12),g=k(f.symbolHeight,e?12:200),h=k(f.labelPadding,e?16:30),f=k(f.itemDistance,10);this.setLegendColor();b.legendSymbol=this.chart.renderer.rect(0,a.baseline-11,d,g).attr({zIndex:1}).add(b.legendGroup);this.legendItemWidth=d+c+(e?f:h);this.legendItemHeight=g+c+(e?h:0)},setState:n,visible:!0,setVisible:n,getSeriesExtremes:function(){var a;if(this.series.length)a= -this.series[0],this.dataMin=a.valueMin,this.dataMax=a.valueMax},drawCrosshair:function(a,b){var c=b&&b.plotX,f=b&&b.plotY,e,d=this.pos,g=this.len;if(b)e=this.toPixels(b[b.series.colorKey]),e<d?e=d-2:e>d+g&&(e=d+g+2),b.plotX=e,b.plotY=this.len-e,m.prototype.drawCrosshair.call(this,a,b),b.plotX=c,b.plotY=f,this.cross&&this.cross.attr({fill:this.crosshair.color}).add(this.legendGroup)},getPlotLinePath:function(a,b,c,f,e){return typeof e==="number"?this.horiz?["M",e-4,this.top-6,"L",e+4,this.top-6,e, -this.top,"Z"]:["M",this.left,e,"L",this.left-6,e+6,this.left-6,e-6,"Z"]:m.prototype.getPlotLinePath.call(this,a,b,c,f)},update:function(a,b){var c=this.chart,f=c.legend;h(this.series,function(a){a.isDirtyData=!0});if(a.dataClasses&&f.allItems)h(f.allItems,function(a){a.isDataClass&&a.legendGroup.destroy()}),c.isDirtyLegend=!0;c.options[this.coll]=j(this.userOptions,a);m.prototype.update.call(this,a,b);this.legendItem&&(this.setLegendColor(),f.colorizeItem(this,!0))},getDataClassLegendSymbols:function(){var a= -this,b=this.chart,c=this.legendItems,f=b.options.legend,e=f.valueDecimals,l=f.valueSuffix||"",g;c.length||h(this.dataClasses,function(f,m){var i=!0,j=f.from,k=f.to;g="";j===void 0?g="< ":k===void 0&&(g="> ");j!==void 0&&(g+=d.numberFormat(j,e)+l);j!==void 0&&k!==void 0&&(g+=" - ");k!==void 0&&(g+=d.numberFormat(k,e)+l);c.push(r({chart:b,name:g,options:{},drawLegendSymbol:s.drawRectangle,visible:!0,setState:n,isDataClass:!0,setVisible:function(){i=this.visible=!i;h(a.series,function(a){h(a.points, -function(a){a.dataClass===m&&a.setVisible(i)})});b.legend.colorizeItem(this,i)}},f))});return c},name:""});h(["fill","stroke"],function(a){d.addAnimSetter(a,function(b){b.elem.attr(a,p.prototype.tweenColors(i(b.start),i(b.end),b.pos))})});w(q.prototype,"getAxes",function(a){var b=this.options.colorAxis;a.call(this);this.colorAxis=[];b&&new p(this,b)});w(x.prototype,"getAllItems",function(a){var b=[],c=this.chart.colorAxis[0];c&&(c.options.dataClasses?b=b.concat(c.getDataClassLegendSymbols()):b.push(c), -h(c.series,function(a){a.options.showInLegend=!1}));return b.concat(a.call(this))});q={pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",dashstyle:"dashStyle"},pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:n,parallelArrays:["x","y","value"],colorKey:"value",translateColors:function(){var a=this,b=this.options.nullColor,c=this.colorAxis,f=this.colorKey;h(this.data, -function(e){var d=e[f];if(d=e.options.color||(d===null?b:c&&d!==void 0?c.toColor(d,e):e.color||a.color))e.color=d})}};u.plotOptions.heatmap=j(u.plotOptions.scatter,{animation:!1,borderWidth:0,nullColor:"#F8F8F8",dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null,pointRange:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}<br/>"},states:{normal:{animation:!0},hover:{halo:!1,brightness:0.2}}});o.heatmap= -v(o.scatter,j(q,{type:"heatmap",pointArrayMap:["y","value"],hasPointSpecificOptions:!0,pointClass:v(y,{setVisible:function(a){var b=this,c=a?"show":"hide";h(["graphic","dataLabel"],function(a){if(b[a])b[a][c]()})}}),supportsDrilldown:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var a;o.scatter.prototype.init.apply(this,arguments);a=this.options;a.pointRange=k(a.pointRange,a.colsize||1);this.yAxis.axisPointRange=a.rowsize||1},translate:function(){var a=this.options,b=this.xAxis,c=this.yAxis, -f=function(a,b,c){return Math.min(Math.max(b,a),c)};this.generatePoints();h(this.points,function(e){var d=(a.colsize||1)/2,g=(a.rowsize||1)/2,h=f(Math.round(b.len-b.translate(e.x-d,0,1,0,1)),0,b.len),d=f(Math.round(b.len-b.translate(e.x+d,0,1,0,1)),0,b.len),i=f(Math.round(c.translate(e.y-g,0,1,0,1)),0,c.len),g=f(Math.round(c.translate(e.y+g,0,1,0,1)),0,c.len);e.plotX=e.clientX=(h+d)/2;e.plotY=(i+g)/2;e.shapeType="rect";e.shapeArgs={x:Math.min(h,d),y:Math.min(i,g),width:Math.abs(d-h),height:Math.abs(g- -i)}});this.translateColors();this.chart.hasRendered&&h(this.points,function(a){a.shapeArgs.fill=a.options.color||a.color})},drawPoints:o.column.prototype.drawPoints,animate:n,getBox:n,drawLegendSymbol:s.drawRectangle,getExtremes:function(){t.prototype.getExtremes.call(this,this.valueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;t.prototype.getExtremes.call(this)}}))}); +(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(c){var k=c.Axis,r=c.Chart,h=c.color,g,e=c.each,w=c.extend,x=c.isNumber,m=c.Legend,t=c.LegendSymbolMixin,y=c.noop,q=c.merge,v=c.pick,u=c.wrap;g=c.ColorAxis=function(){this.init.apply(this,arguments)};w(g.prototype,k.prototype);w(g.prototype,{defaultColorAxisOptions:{lineWidth:0,minPadding:0,maxPadding:0,gridLineWidth:1,tickPixelInterval:72,startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50}, +width:.01},labels:{overflow:"justify",rotation:0},minColor:"#e6ebf5",maxColor:"#003399",tickLength:5,showInLegend:!0},keepProps:["legendGroup","legendItemHeight","legendItemWidth","legendItem","legendSymbol"].concat(k.prototype.keepProps),init:function(a,b){var d="vertical"!==a.options.legend.layout,f;this.coll="colorAxis";f=q(this.defaultColorAxisOptions,{side:d?2:1,reversed:!d},b,{opposite:!d,showEmpty:!1,title:null});k.prototype.init.call(this,a,f);b.dataClasses&&this.initDataClasses(b);this.initStops(b); +this.horiz=d;this.zoomEnabled=!1;this.defaultLegendLength=200},tweenColors:function(a,b,d){var f;b.rgba.length&&a.rgba.length?(a=a.rgba,b=b.rgba,f=1!==b[3]||1!==a[3],a=(f?"rgba(":"rgb(")+Math.round(b[0]+(a[0]-b[0])*(1-d))+","+Math.round(b[1]+(a[1]-b[1])*(1-d))+","+Math.round(b[2]+(a[2]-b[2])*(1-d))+(f?","+(b[3]+(a[3]-b[3])*(1-d)):"")+")"):a=b.input||"none";return a},initDataClasses:function(a){var b=this,d,f=0,p=this.chart.options.chart.colorCount,c=this.options,l=a.dataClasses.length;this.dataClasses= +d=[];this.legendItems=[];e(a.dataClasses,function(a,e){a=q(a);d.push(a);a.color||("category"===c.dataClassColor?(a.colorIndex=f,f++,f===p&&(f=0)):a.color=b.tweenColors(h(c.minColor),h(c.maxColor),2>l?.5:e/(l-1)))})},initStops:function(a){this.stops=a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];e(this.stops,function(a){a.color=h(a[1])})},setOptions:function(a){k.prototype.setOptions.call(this,a);this.options.crosshair=this.options.marker},setAxisSize:function(){var a=this.legendSymbol, +b=this.chart,d=b.options.legend||{},f,p;a?(this.left=d=a.attr("x"),this.top=f=a.attr("y"),this.width=p=a.attr("width"),this.height=a=a.attr("height"),this.right=b.chartWidth-d-p,this.bottom=b.chartHeight-f-a,this.len=this.horiz?p:a,this.pos=this.horiz?d:f):this.len=(this.horiz?d.symbolWidth:d.symbolHeight)||this.defaultLegendLength},toColor:function(a,b){var d=this.stops,f,p,c=this.dataClasses,l,e;if(c)for(e=c.length;e--;){if(l=c[e],f=l.from,d=l.to,(void 0===f||a>=f)&&(void 0===d||a<=d)){p=l.color; +b&&(b.dataClass=e,b.colorIndex=l.colorIndex);break}}else{this.isLog&&(a=this.val2lin(a));a=1-(this.max-a)/(this.max-this.min||1);for(e=d.length;e--&&!(a>d[e][0]););f=d[e]||d[e+1];d=d[e+1]||f;a=1-(d[0]-a)/(d[0]-f[0]||1);p=this.tweenColors(f.color,d.color,a)}return p},getOffset:function(){var a=this.legendGroup,b=this.chart.axisOffset[this.side];a&&(this.axisParent=a,k.prototype.getOffset.call(this),this.added||(this.added=!0,this.labelLeft=0,this.labelRight=this.width),this.chart.axisOffset[this.side]= +b)},setLegendColor:function(){var a,b=this.options,d=this.reversed;a=d?1:0;d=d?0:1;a=this.horiz?[a,0,d,0]:[0,d,0,a];this.legendColor={linearGradient:{x1:a[0],y1:a[1],x2:a[2],y2:a[3]},stops:b.stops||[[0,b.minColor],[1,b.maxColor]]}},drawLegendSymbol:function(a,b){var d=a.padding,f=a.options,c=this.horiz,e=v(f.symbolWidth,c?this.defaultLegendLength:12),l=v(f.symbolHeight,c?12:this.defaultLegendLength),g=v(f.labelPadding,c?16:30),f=v(f.itemDistance,10);this.setLegendColor();b.legendSymbol=this.chart.renderer.rect(0, +a.baseline-11,e,l).attr({zIndex:1}).add(b.legendGroup);this.legendItemWidth=e+d+(c?f:g);this.legendItemHeight=l+d+(c?g:0)},setState:y,visible:!0,setVisible:y,getSeriesExtremes:function(){var a=this.series,b=a.length;this.dataMin=Infinity;for(this.dataMax=-Infinity;b--;)void 0!==a[b].valueMin&&(this.dataMin=Math.min(this.dataMin,a[b].valueMin),this.dataMax=Math.max(this.dataMax,a[b].valueMax))},drawCrosshair:function(a,b){var d=b&&b.plotX,c=b&&b.plotY,e,g=this.pos,l=this.len;b&&(e=this.toPixels(b[b.series.colorKey]), +e<g?e=g-2:e>g+l&&(e=g+l+2),b.plotX=e,b.plotY=this.len-e,k.prototype.drawCrosshair.call(this,a,b),b.plotX=d,b.plotY=c,this.cross&&this.cross.addClass("highcharts-coloraxis-marker").add(this.legendGroup))},getPlotLinePath:function(a,b,d,c,e){return x(e)?this.horiz?["M",e-4,this.top-6,"L",e+4,this.top-6,e,this.top,"Z"]:["M",this.left,e,"L",this.left-6,e+6,this.left-6,e-6,"Z"]:k.prototype.getPlotLinePath.call(this,a,b,d,c)},update:function(a,b){var d=this.chart,c=d.legend;e(this.series,function(a){a.isDirtyData= +!0});a.dataClasses&&c.allItems&&(e(c.allItems,function(a){a.isDataClass&&a.legendGroup&&a.legendGroup.destroy()}),d.isDirtyLegend=!0);d.options[this.coll]=q(this.userOptions,a);k.prototype.update.call(this,a,b);this.legendItem&&(this.setLegendColor(),c.colorizeItem(this,!0))},remove:function(){this.legendItem&&this.chart.legend.destroyItem(this);k.prototype.remove.call(this)},getDataClassLegendSymbols:function(){var a=this,b=this.chart,d=this.legendItems,f=b.options.legend,g=f.valueDecimals,u=f.valueSuffix|| +"",l;d.length||e(this.dataClasses,function(f,k){var m=!0,q=f.from,h=f.to;l="";void 0===q?l="\x3c ":void 0===h&&(l="\x3e ");void 0!==q&&(l+=c.numberFormat(q,g)+u);void 0!==q&&void 0!==h&&(l+=" - ");void 0!==h&&(l+=c.numberFormat(h,g)+u);d.push(w({chart:b,name:l,options:{},drawLegendSymbol:t.drawRectangle,visible:!0,setState:y,isDataClass:!0,setVisible:function(){m=this.visible=!m;e(a.series,function(a){e(a.points,function(a){a.dataClass===k&&a.setVisible(m)})});b.legend.colorizeItem(this,m)}},f))}); +return d},name:""});e(["fill","stroke"],function(a){c.Fx.prototype[a+"Setter"]=function(){this.elem.attr(a,g.prototype.tweenColors(h(this.start),h(this.end),this.pos),null,!0)}});u(r.prototype,"getAxes",function(a){var b=this.options.colorAxis;a.call(this);this.colorAxis=[];b&&new g(this,b)});u(m.prototype,"getAllItems",function(a){var b=[],d=this.chart.colorAxis[0];d&&d.options&&(d.options.showInLegend&&(d.options.dataClasses?b=b.concat(d.getDataClassLegendSymbols()):b.push(d)),e(d.series,function(a){a.options.showInLegend= +!1}));return b.concat(a.call(this))});u(m.prototype,"colorizeItem",function(a,b,d){a.call(this,b,d);d&&b.legendColor&&b.legendSymbol.attr({fill:b.legendColor})})})(n);(function(c){var k=c.defined,r=c.each,h=c.noop;c.colorPointMixin={isValid:function(){return null!==this.value},setVisible:function(c){var e=this,g=c?"show":"hide";r(["graphic","dataLabel"],function(c){if(e[c])e[c][g]()})},setState:function(g){c.Point.prototype.setState.call(this,g);this.graphic&&this.graphic.attr({zIndex:"hover"===g? +1:0})}};c.colorSeriesMixin={pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:h,parallelArrays:["x","y","value"],colorKey:"value",translateColors:function(){var c=this,e=this.options.nullColor,k=this.colorAxis,h=this.colorKey;r(this.data,function(g){var t=g[h];if(t=g.options.color||(g.isNull?e:k&&void 0!==t?k.toColor(t,g):g.color||c.color))g.color=t})},colorAttribs:function(c){var e={};k(c.color)&& +(e[this.colorProp||"fill"]=c.color);return e}}})(n);(function(c){var k=c.colorPointMixin,r=c.each,h=c.merge,g=c.noop,e=c.pick,n=c.Series,x=c.seriesType,m=c.seriesTypes;x("heatmap","scatter",{animation:!1,borderWidth:0,dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null,pointRange:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}\x3cbr/\x3e"},states:{normal:{animation:!0},hover:{halo:!1,brightness:.2}}}, +h(c.colorSeriesMixin,{pointArrayMap:["y","value"],hasPointSpecificOptions:!0,supportsDrilldown:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var c;m.scatter.prototype.init.apply(this,arguments);c=this.options;c.pointRange=e(c.pointRange,c.colsize||1);this.yAxis.axisPointRange=c.rowsize||1},translate:function(){var c=this.options,e=this.xAxis,g=this.yAxis,k=function(c,a,b){return Math.min(Math.max(a,c),b)};this.generatePoints();r(this.points,function(h){var a=(c.colsize||1)/2,b=(c.rowsize|| +1)/2,d=k(Math.round(e.len-e.translate(h.x-a,0,1,0,1)),-e.len,2*e.len),a=k(Math.round(e.len-e.translate(h.x+a,0,1,0,1)),-e.len,2*e.len),f=k(Math.round(g.translate(h.y-b,0,1,0,1)),-g.len,2*g.len),b=k(Math.round(g.translate(h.y+b,0,1,0,1)),-g.len,2*g.len);h.plotX=h.clientX=(d+a)/2;h.plotY=(f+b)/2;h.shapeType="rect";h.shapeArgs={x:Math.min(d,a),y:Math.min(f,b),width:Math.abs(a-d),height:Math.abs(b-f)}});this.translateColors()},drawPoints:function(){m.column.prototype.drawPoints.call(this);r(this.points, +function(c){c.graphic.css(this.colorAttribs(c))},this)},animate:g,getBox:g,drawLegendSymbol:c.LegendSymbolMixin.drawRectangle,alignDataLabel:m.column.prototype.alignDataLabel,getExtremes:function(){n.prototype.getExtremes.call(this,this.valueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;n.prototype.getExtremes.call(this)}}),k)})(n)});