first commit
This commit is contained in:
BIN
assets/plugin/chart/highcharts/._code
Executable file
BIN
assets/plugin/chart/highcharts/._code
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._css
Executable file
BIN
assets/plugin/chart/highcharts/._css
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._highcharts-3d.js
Executable file
BIN
assets/plugin/chart/highcharts/._highcharts-3d.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._highcharts-3d.src.js
Executable file
BIN
assets/plugin/chart/highcharts/._highcharts-3d.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._highcharts-more.js
Executable file
BIN
assets/plugin/chart/highcharts/._highcharts-more.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._highcharts-more.src.js
Executable file
BIN
assets/plugin/chart/highcharts/._highcharts-more.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._highcharts.js
Executable file
BIN
assets/plugin/chart/highcharts/._highcharts.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._highcharts.src.js
Executable file
BIN
assets/plugin/chart/highcharts/._highcharts.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._js
Executable file
BIN
assets/plugin/chart/highcharts/._js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._lib
Executable file
BIN
assets/plugin/chart/highcharts/._lib
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._modules
Executable file
BIN
assets/plugin/chart/highcharts/._modules
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._readme.txt
Executable file
BIN
assets/plugin/chart/highcharts/._readme.txt
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/._themes
Executable file
BIN
assets/plugin/chart/highcharts/._themes
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/._js
Executable file
BIN
assets/plugin/chart/highcharts/code/._js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/._modules
Executable file
BIN
assets/plugin/chart/highcharts/code/js/._modules
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._accessibility.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._accessibility.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._accessibility.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._accessibility.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._annotations.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._annotations.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._annotations.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._annotations.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._boost.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._boost.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._boost.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._boost.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._broken-axis.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._broken-axis.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._broken-axis.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._broken-axis.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._data.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._data.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._data.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._data.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._drilldown.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._drilldown.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._drilldown.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._drilldown.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._exporting.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._exporting.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._exporting.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._exporting.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._funnel.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._funnel.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._funnel.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._funnel.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._gantt.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._gantt.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._gantt.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._gantt.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._grid-axis.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._grid-axis.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._grid-axis.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._grid-axis.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._heatmap.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._heatmap.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._heatmap.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._heatmap.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._no-data-to-display.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._no-data-to-display.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._no-data-to-display.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._no-data-to-display.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._offline-exporting.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._offline-exporting.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._offline-exporting.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._offline-exporting.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._overlapping-datalabels.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._overlapping-datalabels.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._overlapping-datalabels.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._overlapping-datalabels.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._series-label.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._series-label.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._series-label.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._series-label.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._solid-gauge.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._solid-gauge.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._solid-gauge.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._solid-gauge.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._treemap.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._treemap.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._treemap.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._treemap.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._xrange-series.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._xrange-series.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/code/js/modules/._xrange-series.src.js
Executable file
BIN
assets/plugin/chart/highcharts/code/js/modules/._xrange-series.src.js
Executable file
Binary file not shown.
46
assets/plugin/chart/highcharts/code/js/modules/accessibility.js
Executable file
46
assets/plugin/chart/highcharts/code/js/modules/accessibility.js
Executable file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Accessibility module
|
||||
|
||||
(c) 2010-2016 Highsoft AS
|
||||
Author: Oystein Moseng
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(h){"object"===typeof module&&module.exports?module.exports=h:h(Highcharts)})(function(h){(function(e){function h(a){for(var b=a.childNodes.length;b--;)a.appendChild(a.childNodes[b])}function q(a){var b;a&&a.onclick&&(b=l.createEvent("Events"),b.initEvent("click",!0,!1),a.onclick(b))}var y=e.win,l=y.document,g=e.each,A=e.erase,v=e.addEvent,B=e.removeEvent,w=e.fireEvent,C=e.dateFormat,u=e.merge,r={"default":["series","data point","data points"],line:["line","data point","data points"],spline:["line",
|
||||
"data point","data points"],area:["line","data point","data points"],areaspline:["line","data point","data points"],pie:["pie","slice","slices"],column:["column series","column","columns"],bar:["bar series","bar","bars"],scatter:["scatter series","data point","data points"],boxplot:["boxplot series","box","boxes"],arearange:["arearange series","data point","data points"],areasplinerange:["areasplinerange series","data point","data points"],bubble:["bubble series","bubble","bubbles"],columnrange:["columnrange series",
|
||||
"column","columns"],errorbar:["errorbar series","errorbar","errorbars"],funnel:["funnel","data point","data points"],pyramid:["pyramid","data point","data points"],waterfall:["waterfall series","column","columns"],map:["map","area","areas"],mapline:["line","data point","data points"],mappoint:["point series","data point","data points"],mapbubble:["bubble series","bubble","bubbles"]},D={boxplot:" Box plot charts are typically used to display groups of statistical data. Each data point in the chart can have up to 5 values: minimum, lower quartile, median, upper quartile and maximum. ",
|
||||
arearange:" Arearange charts are line charts displaying a range between a lower and higher value for each point. ",areasplinerange:" These charts are line charts displaying a range between a lower and higher value for each point. ",bubble:" Bubble charts are scatter charts where each data point also has a size value. ",columnrange:" Columnrange charts are column charts displaying a range between a lower and higher value for each point. ",errorbar:" Errorbar series are used to display the variability of the data. ",
|
||||
funnel:" Funnel charts are used to display reduction of data in stages. ",pyramid:" Pyramid charts consist of a single pyramid with item heights corresponding to each point value. ",waterfall:" A waterfall chart is a column chart where each column contributes towards a total end value. "},E="name id category x value y".split(" "),z="z open high q3 median q1 low close".split(" ");e.setOptions({accessibility:{enabled:!0,pointDescriptionThreshold:30,keyboardNavigation:{enabled:!0}}});e.wrap(e.Series.prototype,
|
||||
"render",function(a){a.apply(this,Array.prototype.slice.call(arguments,1));this.chart.options.accessibility.enabled&&this.setA11yDescription()});e.Series.prototype.setA11yDescription=function(){var a=this.chart.options.accessibility,b=this.points&&this.points.length&&this.points[0].graphic&&this.points[0].graphic.element,d=b&&b.parentNode||this.graph&&this.graph.element||this.group&&this.group.element;d&&(d.lastChild===b&&h(d),this.points&&(this.points.length<a.pointDescriptionThreshold||!1===a.pointDescriptionThreshold)&&
|
||||
g(this.points,function(c){c.graphic&&(c.graphic.element.setAttribute("role","img"),c.graphic.element.setAttribute("tabindex","-1"),c.graphic.element.setAttribute("aria-label",a.pointDescriptionFormatter&&a.pointDescriptionFormatter(c)||c.buildPointInfoString()))}),1<this.chart.series.length||a.describeSingleSeries)&&(d.setAttribute("role","region"),d.setAttribute("tabindex","-1"),d.setAttribute("aria-label",a.seriesDescriptionFormatter&&a.seriesDescriptionFormatter(this)||this.buildSeriesInfoString()))};
|
||||
e.Series.prototype.buildSeriesInfoString=function(){var a=r[this.type]||r.default,b=this.description||this.options.description;return(this.name?this.name+", ":"")+(1===this.chart.types.length?a[0]:"series")+" "+(this.index+1)+" of "+this.chart.series.length+(1===this.chart.types.length?" with ":". "+a[0]+" with ")+(this.points.length+" "+(1===this.points.length?a[1]:a[2]))+(b?". "+b:"")+(1<this.chart.yAxis.length&&this.yAxis?". Y axis, "+this.yAxis.getDescription():"")+(1<this.chart.xAxis.length&&
|
||||
this.xAxis?". X axis, "+this.xAxis.getDescription():"")};e.Point.prototype.buildPointInfoString=function(){var a=this,b=a.series,d=b.chart.options.accessibility,c="",f=!1,x=b.xAxis&&b.xAxis.isDatetimeAxis,b=x&&C(d.pointDateFormatter&&d.pointDateFormatter(a)||d.pointDateFormat||e.Tooltip.prototype.getXDateFormat(a,b.chart.options.tooltip,b.xAxis),a.x);g(z,function(c){void 0!==a[c]&&(f=!0)});f?(x&&(c=b),g(E.concat(z),function(b){void 0===a[b]||x&&"x"===b||(c+=(c?". ":"")+b+", "+this[b])})):c=(this.name||
|
||||
b||this.category||this.id||"x, "+this.x)+", "+(void 0!==this.value?this.value:this.y);return this.index+1+". "+c+"."+(this.description?" "+this.description:"")};e.Axis.prototype.getDescription=function(){return this.userOptions&&this.userOptions.description||this.axisTitle&&this.axisTitle.textStr||this.options.id||this.categories&&"categories"||"values"};e.Axis.prototype.panStep=function(a,b){var d=b||3;b=this.getExtremes();var c=(b.max-b.min)/d*a,d=b.max+c,c=b.min+c,f=d-c;0>a&&c<b.dataMin?(c=b.dataMin,
|
||||
d=c+f):0<a&&d>b.dataMax&&(d=b.dataMax,c=d-f);this.setExtremes(c,d)};e.wrap(e.Series.prototype,"init",function(a){a.apply(this,Array.prototype.slice.call(arguments,1));var b=this.chart;b.options.accessibility.enabled&&(b.types=b.types||[],0>b.types.indexOf(this.type)&&b.types.push(this.type),v(this,"remove",function(){var a=this,c=!1;g(b.series,function(f){f!==a&&0>b.types.indexOf(a.type)&&(c=!0)});c||A(b.types,a.type)}))});e.Chart.prototype.getTypeDescription=function(){var a=this.types&&this.types[0],
|
||||
b=this.series[0]&&this.series[0].mapTitle;if(a){if("map"===a)return b?"Map of "+b:"Map of unspecified region.";if(1<this.types.length)return"Combination chart.";if(-1<["spline","area","areaspline"].indexOf(a))return"Line chart."}else return"Empty chart.";return a+" chart."+(D[a]||"")};e.Chart.prototype.getAxesDescription=function(){var a=this.xAxis.length,b=this.yAxis.length,d={},c;if(a)if(d.xAxis="The chart has "+a+(1<a?" X axes":" X axis")+" displaying ",2>a)d.xAxis+=this.xAxis[0].getDescription()+
|
||||
".";else{for(c=0;c<a-1;++c)d.xAxis+=(c?", ":"")+this.xAxis[c].getDescription();d.xAxis+=" and "+this.xAxis[c].getDescription()+"."}if(b)if(d.yAxis="The chart has "+b+(1<b?" Y axes":" Y axis")+" displaying ",2>b)d.yAxis+=this.yAxis[0].getDescription()+".";else{for(c=0;c<b-1;++c)d.yAxis+=(c?", ":"")+this.yAxis[c].getDescription();d.yAxis+=" and "+this.yAxis[c].getDescription()+"."}return d};e.Chart.prototype.addAccessibleContextMenuAttribs=function(){var a=this.exportDivElements;a&&(g(a,function(b){"DIV"!==
|
||||
b.tagName||b.children&&b.children.length||(b.setAttribute("role","menuitem"),b.setAttribute("tabindex",-1))}),a[0].parentNode.setAttribute("role","menu"),a[0].parentNode.setAttribute("aria-label","Chart export"))};e.Point.prototype.highlight=function(){var a=this.series.chart;this.graphic&&this.graphic.element.focus&&this.graphic.element.focus();this.isNull?a.tooltip.hide(0):(this.onMouseOver(),a.tooltip.refresh(a.tooltip.shared?[this]:this));a.highlightedPoint=this;return this};e.Chart.prototype.highlightAdjacentPoint=
|
||||
function(a){var b=this.series,d=this.highlightedPoint,c=d&&d.index||0;if(!b[0]||!b[0].points)return!1;if(!d)return b[0].points[0].highlight();if(d.series.points[c]!==d)for(var f=0;f<d.series.points.length;++f)if(d.series.points[f]===d){c=f;break}b=b[d.series.index+(a?1:-1)];d=d.series.points[c+(a?1:-1)]||b&&b.points[a?0:b.points.length-1];return void 0===d?!1:d.isNull&&this.options.accessibility.keyboardNavigation&&this.options.accessibility.keyboardNavigation.skipNullPoints?(this.highlightedPoint=
|
||||
d,this.highlightAdjacentPoint(a)):d.highlight()};e.Chart.prototype.showExportMenu=function(){this.exportSVGElements&&this.exportSVGElements[0]&&(this.exportSVGElements[0].element.onclick(),this.highlightExportItem(0))};e.Chart.prototype.highlightExportItem=function(a){var b=this.exportDivElements&&this.exportDivElements[a],d=this.exportDivElements&&this.exportDivElements[this.highlightedExportItem];if(b&&"DIV"===b.tagName&&(!b.children||!b.children.length)){b.focus&&b.focus();if(d&&d.onmouseout)d.onmouseout();
|
||||
if(b.onmouseover)b.onmouseover();this.highlightedExportItem=a;return!0}};e.Chart.prototype.highlightRangeSelectorButton=function(a){var b=this.rangeSelector.buttons;b[this.highlightedRangeSelectorItemIx]&&b[this.highlightedRangeSelectorItemIx].setState(this.oldRangeSelectorItemState||0);this.highlightedRangeSelectorItemIx=a;return b[a]?(b[a].element.focus&&b[a].element.focus(),this.oldRangeSelectorItemState=b[a].state,b[a].setState(2),!0):!1};e.Chart.prototype.highlightLegendItem=function(a){var b=
|
||||
this.legend.allItems;b[this.highlightedLegendItemIx]&&w(b[this.highlightedLegendItemIx].legendGroup.element,"mouseout");this.highlightedLegendItemIx=a;return b[a]?(b[a].legendGroup.element.focus&&b[a].legendGroup.element.focus(),w(b[a].legendGroup.element,"mouseover"),!0):!1};e.Chart.prototype.hideExportMenu=function(){var a=this.exportDivElements;if(a){g(a,function(b){w(b,"mouseleave")});if(a[this.highlightedExportItem]&&a[this.highlightedExportItem].onmouseout)a[this.highlightedExportItem].onmouseout();
|
||||
this.highlightedExportItem=0;this.renderTo.focus()}};e.Chart.prototype.addKeyboardNavEvents=function(){function a(c){this.keyCodeMap=c.keyCodeMap;this.move=c.move;this.validate=c.validate;this.init=c.init;this.transformTabs=!1!==c.transformTabs}function b(b,d){return new a(u({keyCodeMap:b,move:function(b){c.keyboardNavigationModuleIndex+=b;var a=c.keyboardNavigationModules[c.keyboardNavigationModuleIndex];if(a){if(a.validate&&!a.validate())return this.move(b);if(a.init)return a.init(b),!0}c.keyboardNavigationModuleIndex=
|
||||
0;c.slipNextTab=!0;return!1}},d))}function d(b){b=b||y.event;var a=c.keyboardNavigationModules[c.keyboardNavigationModuleIndex];9===(b.which||b.keyCode)&&c.slipNextTab?c.slipNextTab=!1:(c.slipNextTab=!1,a&&a.run(b)&&b.preventDefault())}var c=this;a.prototype={run:function(c){var b=this,a=c.which||c.keyCode,f=!1,a=this.transformTabs&&9===a?c.shiftKey?37:39:a;g(this.keyCodeMap,function(d){-1<d[0].indexOf(a)&&(f=!1===d[1].call(b,a,c)?!1:!0)});return f}};c.keyboardNavigationModules=[b([[[37,39],function(b){if(!c.highlightAdjacentPoint(39===
|
||||
b))return this.move(39===b?1:-1)}],[[38,40],function(b){var a;if(c.highlightedPoint)if((a=c.series[c.highlightedPoint.series.index+(38===b?-1:1)])&&a.points[0])a.points[0].highlight();else return this.move(40===b?1:-1)}],[[13,32],function(){c.highlightedPoint&&c.highlightedPoint.firePointEvent("click")}]],{init:function(b){var a=c.series&&c.series[c.series.length-1],a=a&&a.points&&a.points[a.points.length-1];0>b&&a&&a.highlight()}}),b([[[37,38],function(){for(var a=c.highlightedExportItem||0,b=!0,
|
||||
d=c.series;a--;)if(c.highlightExportItem(a)){b=!1;break}if(b)return c.hideExportMenu(),d&&d.length&&(a=d[d.length-1],a.points.length&&a.points[a.points.length-1].highlight()),this.move(-1)}],[[39,40],function(){for(var a=!0,b=(c.highlightedExportItem||0)+1;b<c.exportDivElements.length;++b)if(c.highlightExportItem(b)){a=!1;break}if(a)return c.hideExportMenu(),this.move(1)}],[[13,32],function(){q(c.exportDivElements[c.highlightedExportItem])}]],{validate:function(){return c.exportChart&&!(c.options.exporting&&
|
||||
!1===c.options.exporting.enabled)},init:function(a){c.highlightedPoint=null;c.showExportMenu();if(0>a&&c.exportDivElements)for(a=c.exportDivElements.length;-1<a&&!c.highlightExportItem(a);--a);}}),b([[[38,40,37,39],function(a){c[38===a||40===a?"yAxis":"xAxis"][0].panStep(39>a?-1:1)}],[[9],function(a,b){c.mapNavButtons[c.focusedMapNavButtonIx].setState(0);if(b.shiftKey&&!c.focusedMapNavButtonIx||!b.shiftKey&&c.focusedMapNavButtonIx)return c.mapZoom(),this.move(b.shiftKey?-1:1);c.focusedMapNavButtonIx+=
|
||||
b.shiftKey?-1:1;a=c.mapNavButtons[c.focusedMapNavButtonIx];a.element.focus&&a.element.focus();a.setState(2)}],[[13,32],function(){q(c.mapNavButtons[c.focusedMapNavButtonIx].element)}]],{validate:function(){return c.mapZoom&&c.mapNavButtons&&2===c.mapNavButtons.length},transformTabs:!1,init:function(a){var b=c.mapNavButtons[0],d=c.mapNavButtons[1],b=0<a?b:d;g(c.mapNavButtons,function(a,c){a.element.setAttribute("tabindex",-1);a.element.setAttribute("role","button");a.element.setAttribute("aria-label",
|
||||
"Zoom "+(c?"out":"")+"chart")});b.element.focus&&b.element.focus();b.setState(2);c.focusedMapNavButtonIx=0<a?0:1}}),b([[[37,39,38,40],function(a){a=37===a||38===a?-1:1;if(!c.highlightRangeSelectorButton(c.highlightedRangeSelectorItemIx+a))return this.move(a)}],[[13,32],function(){3!==c.oldRangeSelectorItemState&&q(c.rangeSelector.buttons[c.highlightedRangeSelectorItemIx].element)}]],{validate:function(){return c.rangeSelector&&c.rangeSelector.buttons&&c.rangeSelector.buttons.length},init:function(a){g(c.rangeSelector.buttons,
|
||||
function(a){a.element.setAttribute("tabindex","-1");a.element.setAttribute("role","button");a.element.setAttribute("aria-label","Select range "+(a.text&&a.text.textStr))});c.highlightRangeSelectorButton(0<a?0:c.rangeSelector.buttons.length-1)}}),b([[[9,38,40],function(a,b){a=9===a&&b.shiftKey||38===a?-1:1;b=c.highlightedInputRangeIx+=a;if(1<b||0>b)return this.move(a);c.rangeSelector[b?"maxInput":"minInput"].focus()}]],{validate:function(){return c.rangeSelector&&c.rangeSelector.inputGroup&&"hidden"!==
|
||||
c.rangeSelector.inputGroup.element.getAttribute("visibility")&&!1!==c.options.rangeSelector.inputEnabled&&c.rangeSelector.minInput&&c.rangeSelector.maxInput},transformTabs:!1,init:function(a){c.highlightedInputRangeIx=0<a?0:1;c.rangeSelector[c.highlightedInputRangeIx?"maxInput":"minInput"].focus()}}),b([[[37,39,38,40],function(a){a=37===a||38===a?-1:1;if(!c.highlightLegendItem(c.highlightedLegendItemIx+a))return this.move(a)}],[[13,32],function(){q(c.legend.allItems[c.highlightedLegendItemIx].legendItem.element.parentNode)}]],
|
||||
{validate:function(){return c.legend&&c.legend.allItems&&!c.colorAxis},init:function(a){g(c.legend.allItems,function(a){a.legendGroup.element.setAttribute("tabindex","-1");a.legendGroup.element.setAttribute("role","button");a.legendGroup.element.setAttribute("aria-label","Toggle visibility of series "+a.name)});c.highlightLegendItem(0<a?0:c.legend.allItems.length-1)}})];c.keyboardNavigationModuleIndex=0;c.renderTo.tabIndex||c.renderTo.setAttribute("tabindex","0");v(c.renderTo,"keydown",d);v(c,"destroy",
|
||||
function(){B(c.renderTo,"keydown",d)})};e.Chart.prototype.addScreenReaderRegion=function(a){var b=this,d=b.series,c=b.options,e=c.accessibility,g=b.screenReaderRegion=l.createElement("div"),h=l.createElement("h3"),n=l.createElement("a"),p=l.createElement("h3"),t={position:"absolute",left:"-9999px",top:"auto",width:"1px",height:"1px",overflow:"hidden"},k=b.types||[],k=(1===k.length&&"pie"===k[0]||"map"===k[0])&&{}||b.getAxesDescription(),m=d[0]&&r[d[0].type]||r.default;g.setAttribute("role","region");
|
||||
g.setAttribute("aria-label","Chart screen reader information.");g.innerHTML=e.screenReaderSectionFormatter&&e.screenReaderSectionFormatter(b)||'\x3cdiv tabindex\x3d"0"\x3eUse regions/landmarks to skip ahead to chart'+(1<d.length?" and navigate between data series":"")+".\x3c/div\x3e\x3ch3\x3eSummary.\x3c/h3\x3e\x3cdiv\x3e"+(c.title.text||"Chart")+(c.subtitle&&c.subtitle.text?". "+c.subtitle.text:"")+"\x3c/div\x3e\x3ch3\x3eLong description.\x3c/h3\x3e\x3cdiv\x3e"+(c.chart.description||"No description available.")+
|
||||
"\x3c/div\x3e\x3ch3\x3eStructure.\x3c/h3\x3e\x3cdiv\x3eChart type: "+(c.chart.typeDescription||b.getTypeDescription())+"\x3c/div\x3e"+(1===d.length?"\x3cdiv\x3e"+m[0]+" with "+d[0].points.length+" "+(1===d[0].points.length?m[1]:m[2])+".\x3c/div\x3e":"")+(k.xAxis?"\x3cdiv\x3e"+k.xAxis+"\x3c/div\x3e":"")+(k.yAxis?"\x3cdiv\x3e"+k.yAxis+"\x3c/div\x3e":"");b.getCSV&&(n.innerHTML="View as data table.",n.href="#"+a,n.setAttribute("tabindex","-1"),n.onclick=e.onTableAnchorClick||function(){b.viewData();l.getElementById(a).focus()},
|
||||
h.appendChild(n),g.appendChild(h));p.innerHTML="Chart graphic.";b.renderTo.insertBefore(p,b.renderTo.firstChild);b.renderTo.insertBefore(g,b.renderTo.firstChild);u(!0,p.style,t);u(!0,g.style,t)};e.Chart.prototype.callbacks.push(function(a){var b=a.options,d=b.accessibility;if(d.enabled){var c=l.createElementNS("http://www.w3.org/2000/svg","title"),f=l.createElementNS("http://www.w3.org/2000/svg","g"),h=a.container.getElementsByTagName("desc")[0],q=a.container.getElementsByTagName("text"),n="highcharts-title-"+
|
||||
a.index,p="highcharts-data-table-"+a.index,t=b.title.text||"Chart",k=b.exporting&&b.exporting.csv&&b.exporting.csv.columnHeaderFormatter,m=[];c.textContent=t;c.id=n;h.parentNode.insertBefore(c,h);a.renderTo.setAttribute("role","region");a.renderTo.setAttribute("aria-label",t+". Use up and down arrows to navigate.");if(a.exportSVGElements&&a.exportSVGElements[0]&&a.exportSVGElements[0].element){var r=a.exportSVGElements[0].element.onclick,c=a.exportSVGElements[0].element.parentNode;a.exportSVGElements[0].element.onclick=
|
||||
function(){r.apply(this,Array.prototype.slice.call(arguments));a.addAccessibleContextMenuAttribs();a.highlightExportItem(0)};a.exportSVGElements[0].element.setAttribute("role","button");a.exportSVGElements[0].element.setAttribute("aria-label","View export menu");f.appendChild(a.exportSVGElements[0].element);f.setAttribute("role","region");f.setAttribute("aria-label","Chart export menu");c.appendChild(f)}a.rangeSelector&&g(["minInput","maxInput"],function(b,c){a.rangeSelector[b]&&(a.rangeSelector[b].setAttribute("tabindex",
|
||||
"-1"),a.rangeSelector[b].setAttribute("role","textbox"),a.rangeSelector[b].setAttribute("aria-label","Select "+(c?"end":"start")+" date."))});g(q,function(a){a.setAttribute("aria-hidden","true")});a.addScreenReaderRegion(p);d.keyboardNavigation&&a.addKeyboardNavEvents();u(!0,b.exporting,{csv:{columnHeaderFormatter:function(a,b,c){var d=m[m.length-1];1<c&&(d&&d.text)!==a.name&&m.push({text:a.name,span:c});return k?k.call(this,a,b,c):1<c?b:a.name}}});e.wrap(a,"getTable",function(a){return a.apply(this,
|
||||
Array.prototype.slice.call(arguments,1)).replace("\x3ctable\x3e",'\x3ctable id\x3d"'+p+'" summary\x3d"Table representation of chart"\x3e\x3ccaption\x3e'+t+"\x3c/caption\x3e")});e.wrap(a,"viewData",function(a){if(!this.insertedTable){a.apply(this,Array.prototype.slice.call(arguments,1));var b=l.getElementById(p),c=b.getElementsByTagName("tbody")[0],d=c.firstChild.children,e="\x3ctr\x3e\x3ctd\x3e\x3c/td\x3e",f,h;b.setAttribute("tabindex","-1");g(c.children,function(a){f=a.firstChild;h=l.createElement("th");
|
||||
h.setAttribute("scope","row");h.innerHTML=f.innerHTML;f.parentNode.replaceChild(h,f)});g(d,function(a){"TH"===a.tagName&&a.setAttribute("scope","col")});m.length&&(g(m,function(a){e+='\x3cth scope\x3d"col" colspan\x3d"'+a.span+'"\x3e'+a.text+"\x3c/th\x3e"}),c.insertAdjacentHTML("afterbegin",e))}})}})})(h)});
|
||||
1072
assets/plugin/chart/highcharts/code/js/modules/accessibility.src.js
Executable file
1072
assets/plugin/chart/highcharts/code/js/modules/accessibility.src.js
Executable file
File diff suppressed because it is too large
Load Diff
14
assets/plugin/chart/highcharts/code/js/modules/annotations.js
Executable file
14
assets/plugin/chart/highcharts/code/js/modules/annotations.js
Executable file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
(c) 2009-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(f){var q=f.defined,k=f.isNumber,n=f.inArray,v=f.isArray,w=f.merge,B=f.Chart,x=f.extend,C=f.each,r,D;D=["path","rect","circle"];r={top:0,left:0,center:.5,middle:.5,bottom:1,right:1};var E=function(){this.init.apply(this,arguments)};E.prototype={init:function(a,d){var c=d.shape&&d.shape.type;this.chart=a;var b;b={xAxis:0,yAxis:0,title:{style:{},text:"",x:0,y:0},shape:{params:{stroke:"#000000",
|
||||
fill:"transparent",strokeWidth:2}}};a={circle:{params:{x:0,y:0}}};a[c]&&(b.shape=w(b.shape,a[c]));this.options=w({},b,d)},render:function(a){var d=this.chart,c=this.chart.renderer,b=this.group,f=this.title,e=this.shape,h=this.options,k=h.title,p=h.shape;b||(b=this.group=c.g());!e&&p&&-1!==n(p.type,D)&&(e=this.shape=c[h.shape.type](p.params),e.add(b));!f&&k&&(f=this.title=c.label(k),f.add(b));b.add(d.annotations.group);this.linkObjects();!1!==a&&this.redraw()},redraw:function(){var a=this.options,
|
||||
d=this.chart,c=this.group,b=this.title,F=this.shape,e=this.linkedObject,h=d.xAxis[a.xAxis],d=d.yAxis[a.yAxis],y=a.width,p=a.height,z=r[a.anchorY],A=r[a.anchorX],t,l,g,u;e&&(t=e instanceof f.Point?"point":e instanceof f.Series?"series":null,"point"===t?(a.xValue=e.x,a.yValue=e.y,l=e.series):"series"===t&&(l=e),c.visibility!==l.group.visibility&&c.attr({visibility:l.group.visibility}));e=q(a.xValue)?h.toPixels(a.xValue+h.minPointOffset)-h.minPixelPadding:a.x;l=q(a.yValue)?d.toPixels(a.yValue):a.y;if(k(e)&&
|
||||
k(l)){b&&(b.attr(a.title),b.css(a.title.style));if(F){b=x({},a.shape.params);if("values"===a.units){for(g in b)-1<n(g,["width","x"])?b[g]=h.translate(b[g]):-1<n(g,["height","y"])&&(b[g]=d.translate(b[g]));b.width&&(b.width-=h.toPixels(0)-h.left);b.x&&(b.x+=h.minPixelPadding);if("path"===a.shape.type){g=b.d;t=e;for(var v=l,w=g.length,m=0;m<w;)k(g[m])&&k(g[m+1])?(g[m]=h.toPixels(g[m])-t,g[m+1]=d.toPixels(g[m+1])-v,m+=2):m+=1}}"circle"===a.shape.type&&(b.x+=b.r,b.y+=b.r);F.attr(b)}c.bBox=null;k(y)||
|
||||
(u=c.getBBox(),y=u.width);k(p)||(u||(u=c.getBBox()),p=u.height);k(A)||(A=r.center);k(z)||(z=r.center);e-=y*A;l-=p*z;q(c.translateX)&&q(c.translateY)?c.animate({translateX:e,translateY:l}):c.translate(e,l)}},destroy:function(){var a=this,d=this.chart.annotations.allItems,c=d.indexOf(a);-1<c&&d.splice(c,1);C(["title","shape","group"],function(b){a[b]&&(a[b].destroy(),a[b]=null)});a.group=a.title=a.shape=a.chart=a.options=null},update:function(a,d){x(this.options,a);this.linkObjects();this.render(d)},
|
||||
linkObjects:function(){var a=this.chart,d=this.linkedObject,c=d&&(d.id||d.options.id),b=this.options.linkedTo;q(b)?q(d)&&b===c||(this.linkedObject=a.get(b)):this.linkedObject=null}};x(B.prototype,{annotations:{add:function(a,d){var c=this.allItems,b=this.chart,f,e;v(a)||(a=[a]);for(e=a.length;e--;)f=new E(b,a[e]),c.push(f),f.render(d)},redraw:function(){C(this.allItems,function(a){a.redraw()})}}});B.prototype.callbacks.push(function(a){var d=a.options.annotations,c;c=a.renderer.g("annotations");c.attr({zIndex:7});
|
||||
c.add();a.annotations.allItems=[];a.annotations.chart=a;a.annotations.group=c;v(d)&&0<d.length&&a.annotations.add(a.options.annotations);f.addEvent(a,"redraw",function(){a.annotations.redraw()})})})(n)});
|
||||
408
assets/plugin/chart/highcharts/code/js/modules/annotations.src.js
Executable file
408
assets/plugin/chart/highcharts/code/js/modules/annotations.src.js
Executable file
@ -0,0 +1,408 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
*
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var defined = H.defined,
|
||||
isNumber = H.isNumber,
|
||||
inArray = H.inArray,
|
||||
isArray = H.isArray,
|
||||
merge = H.merge,
|
||||
Chart = H.Chart,
|
||||
extend = H.extend,
|
||||
each = H.each;
|
||||
|
||||
var ALIGN_FACTOR,
|
||||
ALLOWED_SHAPES;
|
||||
|
||||
ALLOWED_SHAPES = ['path', 'rect', 'circle'];
|
||||
|
||||
ALIGN_FACTOR = {
|
||||
top: 0,
|
||||
left: 0,
|
||||
center: 0.5,
|
||||
middle: 0.5,
|
||||
bottom: 1,
|
||||
right: 1
|
||||
};
|
||||
|
||||
function defaultOptions(shapeType) {
|
||||
var shapeOptions,
|
||||
options;
|
||||
|
||||
options = {
|
||||
xAxis: 0,
|
||||
yAxis: 0,
|
||||
title: {
|
||||
style: {},
|
||||
text: '',
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
shape: {
|
||||
params: {
|
||||
stroke: '#000000',
|
||||
fill: 'transparent',
|
||||
strokeWidth: 2
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
shapeOptions = {
|
||||
circle: {
|
||||
params: {
|
||||
x: 0,
|
||||
y: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (shapeOptions[shapeType]) {
|
||||
options.shape = merge(options.shape, shapeOptions[shapeType]);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function translatePath(d, xAxis, yAxis, xOffset, yOffset) {
|
||||
var len = d.length,
|
||||
i = 0;
|
||||
|
||||
while (i < len) {
|
||||
if (isNumber(d[i]) && isNumber(d[i + 1])) {
|
||||
d[i] = xAxis.toPixels(d[i]) - xOffset;
|
||||
d[i + 1] = yAxis.toPixels(d[i + 1]) - yOffset;
|
||||
i += 2;
|
||||
} else {
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
// Define annotation prototype
|
||||
var Annotation = function() {
|
||||
this.init.apply(this, arguments);
|
||||
};
|
||||
Annotation.prototype = {
|
||||
/*
|
||||
* Initialize the annotation
|
||||
*/
|
||||
init: function(chart, options) {
|
||||
var shapeType = options.shape && options.shape.type;
|
||||
|
||||
this.chart = chart;
|
||||
this.options = merge({}, defaultOptions(shapeType), options);
|
||||
},
|
||||
|
||||
/*
|
||||
* Render the annotation
|
||||
*/
|
||||
render: function(redraw) {
|
||||
var annotation = this,
|
||||
chart = this.chart,
|
||||
renderer = annotation.chart.renderer,
|
||||
group = annotation.group,
|
||||
title = annotation.title,
|
||||
shape = annotation.shape,
|
||||
options = annotation.options,
|
||||
titleOptions = options.title,
|
||||
shapeOptions = options.shape;
|
||||
|
||||
if (!group) {
|
||||
group = annotation.group = renderer.g();
|
||||
}
|
||||
|
||||
|
||||
if (!shape && shapeOptions && inArray(shapeOptions.type, ALLOWED_SHAPES) !== -1) {
|
||||
shape = annotation.shape = renderer[options.shape.type](shapeOptions.params);
|
||||
shape.add(group);
|
||||
}
|
||||
|
||||
if (!title && titleOptions) {
|
||||
title = annotation.title = renderer.label(titleOptions);
|
||||
title.add(group);
|
||||
}
|
||||
|
||||
group.add(chart.annotations.group);
|
||||
|
||||
// link annotations to point or series
|
||||
annotation.linkObjects();
|
||||
|
||||
if (redraw !== false) {
|
||||
annotation.redraw();
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Redraw the annotation title or shape after options update
|
||||
*/
|
||||
redraw: function() {
|
||||
var options = this.options,
|
||||
chart = this.chart,
|
||||
group = this.group,
|
||||
title = this.title,
|
||||
shape = this.shape,
|
||||
linkedTo = this.linkedObject,
|
||||
xAxis = chart.xAxis[options.xAxis],
|
||||
yAxis = chart.yAxis[options.yAxis],
|
||||
width = options.width,
|
||||
height = options.height,
|
||||
anchorY = ALIGN_FACTOR[options.anchorY],
|
||||
anchorX = ALIGN_FACTOR[options.anchorX],
|
||||
shapeParams,
|
||||
linkType,
|
||||
series,
|
||||
param,
|
||||
bbox,
|
||||
x,
|
||||
y;
|
||||
|
||||
if (linkedTo) {
|
||||
linkType = (linkedTo instanceof H.Point) ? 'point' :
|
||||
(linkedTo instanceof H.Series) ? 'series' : null;
|
||||
|
||||
if (linkType === 'point') {
|
||||
options.xValue = linkedTo.x;
|
||||
options.yValue = linkedTo.y;
|
||||
series = linkedTo.series;
|
||||
} else if (linkType === 'series') {
|
||||
series = linkedTo;
|
||||
}
|
||||
|
||||
if (group.visibility !== series.group.visibility) {
|
||||
group.attr({
|
||||
visibility: series.group.visibility
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Based on given options find annotation pixel position
|
||||
x = (defined(options.xValue) ? xAxis.toPixels(options.xValue + xAxis.minPointOffset) - xAxis.minPixelPadding : options.x);
|
||||
y = defined(options.yValue) ? yAxis.toPixels(options.yValue) : options.y;
|
||||
|
||||
if (!isNumber(x) || !isNumber(y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (title) {
|
||||
title.attr(options.title);
|
||||
title.css(options.title.style);
|
||||
}
|
||||
|
||||
if (shape) {
|
||||
shapeParams = extend({}, options.shape.params);
|
||||
|
||||
if (options.units === 'values') {
|
||||
for (param in shapeParams) {
|
||||
if (inArray(param, ['width', 'x']) > -1) {
|
||||
shapeParams[param] = xAxis.translate(shapeParams[param]);
|
||||
} else if (inArray(param, ['height', 'y']) > -1) {
|
||||
shapeParams[param] = yAxis.translate(shapeParams[param]);
|
||||
}
|
||||
}
|
||||
|
||||
if (shapeParams.width) {
|
||||
shapeParams.width -= xAxis.toPixels(0) - xAxis.left;
|
||||
}
|
||||
|
||||
if (shapeParams.x) {
|
||||
shapeParams.x += xAxis.minPixelPadding;
|
||||
}
|
||||
|
||||
if (options.shape.type === 'path') {
|
||||
translatePath(shapeParams.d, xAxis, yAxis, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// move the center of the circle to shape x/y
|
||||
if (options.shape.type === 'circle') {
|
||||
shapeParams.x += shapeParams.r;
|
||||
shapeParams.y += shapeParams.r;
|
||||
}
|
||||
|
||||
shape.attr(shapeParams);
|
||||
}
|
||||
|
||||
group.bBox = null;
|
||||
|
||||
// If annotation width or height is not defined in options use bounding box size
|
||||
if (!isNumber(width)) {
|
||||
bbox = group.getBBox();
|
||||
width = bbox.width;
|
||||
}
|
||||
|
||||
if (!isNumber(height)) {
|
||||
// get bbox only if it wasn't set before
|
||||
if (!bbox) {
|
||||
bbox = group.getBBox();
|
||||
}
|
||||
|
||||
height = bbox.height;
|
||||
}
|
||||
|
||||
// Calculate anchor point
|
||||
if (!isNumber(anchorX)) {
|
||||
anchorX = ALIGN_FACTOR.center;
|
||||
}
|
||||
|
||||
if (!isNumber(anchorY)) {
|
||||
anchorY = ALIGN_FACTOR.center;
|
||||
}
|
||||
|
||||
// Translate group according to its dimension and anchor point
|
||||
x = x - width * anchorX;
|
||||
y = y - height * anchorY;
|
||||
|
||||
if (defined(group.translateX) && defined(group.translateY)) {
|
||||
group.animate({
|
||||
translateX: x,
|
||||
translateY: y
|
||||
});
|
||||
} else {
|
||||
group.translate(x, y);
|
||||
}
|
||||
},
|
||||
|
||||
/*
|
||||
* Destroy the annotation
|
||||
*/
|
||||
destroy: function() {
|
||||
var annotation = this,
|
||||
chart = this.chart,
|
||||
allItems = chart.annotations.allItems,
|
||||
index = allItems.indexOf(annotation);
|
||||
|
||||
if (index > -1) {
|
||||
allItems.splice(index, 1);
|
||||
}
|
||||
|
||||
each(['title', 'shape', 'group'], function(element) {
|
||||
if (annotation[element]) {
|
||||
annotation[element].destroy();
|
||||
annotation[element] = null;
|
||||
}
|
||||
});
|
||||
|
||||
annotation.group = annotation.title = annotation.shape = annotation.chart = annotation.options = null;
|
||||
},
|
||||
|
||||
/*
|
||||
* Update the annotation with a given options
|
||||
*/
|
||||
update: function(options, redraw) {
|
||||
extend(this.options, options);
|
||||
|
||||
// update link to point or series
|
||||
this.linkObjects();
|
||||
|
||||
this.render(redraw);
|
||||
},
|
||||
|
||||
linkObjects: function() {
|
||||
var annotation = this,
|
||||
chart = annotation.chart,
|
||||
linkedTo = annotation.linkedObject,
|
||||
linkedId = linkedTo && (linkedTo.id || linkedTo.options.id),
|
||||
options = annotation.options,
|
||||
id = options.linkedTo;
|
||||
|
||||
if (!defined(id)) {
|
||||
annotation.linkedObject = null;
|
||||
} else if (!defined(linkedTo) || id !== linkedId) {
|
||||
annotation.linkedObject = chart.get(id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Add annotations methods to chart prototype
|
||||
extend(Chart.prototype, {
|
||||
annotations: {
|
||||
/*
|
||||
* Unified method for adding annotations to the chart
|
||||
*/
|
||||
add: function(options, redraw) {
|
||||
var annotations = this.allItems,
|
||||
chart = this.chart,
|
||||
item,
|
||||
len;
|
||||
|
||||
if (!isArray(options)) {
|
||||
options = [options];
|
||||
}
|
||||
|
||||
len = options.length;
|
||||
|
||||
while (len--) {
|
||||
item = new Annotation(chart, options[len]);
|
||||
annotations.push(item);
|
||||
item.render(redraw);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Redraw all annotations, method used in chart events
|
||||
*/
|
||||
redraw: function() {
|
||||
each(this.allItems, function(annotation) {
|
||||
annotation.redraw();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Initialize on chart load
|
||||
Chart.prototype.callbacks.push(function(chart) {
|
||||
var options = chart.options.annotations,
|
||||
group;
|
||||
|
||||
group = chart.renderer.g('annotations');
|
||||
group.attr({
|
||||
zIndex: 7
|
||||
});
|
||||
group.add();
|
||||
|
||||
// initialize empty array for annotations
|
||||
chart.annotations.allItems = [];
|
||||
|
||||
// link chart object to annotations
|
||||
chart.annotations.chart = chart;
|
||||
|
||||
// link annotations group element to the chart
|
||||
chart.annotations.group = group;
|
||||
|
||||
if (isArray(options) && options.length > 0) {
|
||||
chart.annotations.add(chart.options.annotations);
|
||||
}
|
||||
|
||||
// update annotations after chart redraw
|
||||
H.addEvent(chart, 'redraw', function() {
|
||||
chart.annotations.redraw();
|
||||
});
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
22
assets/plugin/chart/highcharts/code/js/modules/boost.js
Executable file
22
assets/plugin/chart/highcharts/code/js/modules/boost.js
Executable file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Boost module
|
||||
|
||||
(c) 2010-2016 Highsoft AS
|
||||
Author: Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(p){"object"===typeof module&&module.exports?module.exports=p:p(Highcharts)})(function(p){(function(f){function p(a,b,c,e,h){h=h||0;e=e||5E4;for(var k=h+e,f=!0;f&&h<k&&h<a.length;)f=b(a[h],h),h+=1;f&&(h<a.length?setTimeout(function(){p(a,b,c,e,h)}):c&&c())}var x=f.win.document,U=function(){},V=f.Color,n=f.Series,d=f.seriesTypes,q=f.each,y=f.extend,W=f.addEvent,X=f.fireEvent,z=f.grep,u=f.isNumber,Y=f.merge,Z=f.pick,l=f.wrap,v=f.getOptions().plotOptions,F;q(["area","arearange","column","line",
|
||||
"scatter"],function(a){v[a]&&(v[a].boostThreshold=5E3)});q(["translate","generatePoints","drawTracker","drawPoints","render"],function(a){function b(b){var c=this.options.stacking&&("translate"===a||"generatePoints"===a);if((this.processedXData||this.options.data).length<(this.options.boostThreshold||Number.MAX_VALUE)||c)"render"===a&&this.image&&(this.image.attr({href:""}),this.animate=null),b.call(this);else if(this[a+"Canvas"])this[a+"Canvas"]()}l(n.prototype,a,b);"translate"===a&&(d.column&&l(d.column.prototype,
|
||||
a,b),d.arearange&&l(d.arearange.prototype,a,b))});l(n.prototype,"getExtremes",function(a){this.hasExtremes()||a.apply(this,Array.prototype.slice.call(arguments,1))});l(n.prototype,"setData",function(a){this.hasExtremes(!0)||a.apply(this,Array.prototype.slice.call(arguments,1))});l(n.prototype,"processData",function(a){this.hasExtremes(!0)||a.apply(this,Array.prototype.slice.call(arguments,1))});f.extend(n.prototype,{pointRange:0,allowDG:!1,hasExtremes:function(a){var b=this.options,c=this.xAxis&&
|
||||
this.xAxis.options,e=this.yAxis&&this.yAxis.options;return b.data.length>(b.boostThreshold||Number.MAX_VALUE)&&u(e.min)&&u(e.max)&&(!a||u(c.min)&&u(c.max))},destroyGraphics:function(){var a=this,b=this.points,c,e;if(b)for(e=0;e<b.length;e+=1)(c=b[e])&&c.graphic&&(c.graphic=c.graphic.destroy());q(["graph","area","tracker"],function(b){a[b]&&(a[b]=a[b].destroy())})},getContext:function(){var a=this.chart,b=a.plotWidth,c=a.plotHeight,e=this.ctx,h=function(a,b,c,e,h,f,d){a.call(this,c,b,e,h,f,d)};this.canvas?
|
||||
e.clearRect(0,0,b,c):(this.canvas=x.createElement("canvas"),this.image=a.renderer.image("",0,0,b,c).add(this.group),this.ctx=e=this.canvas.getContext("2d"),a.inverted&&q(["moveTo","lineTo","rect","arc"],function(a){l(e,a,h)}));this.canvas.width=b;this.canvas.height=c;this.image.attr({width:b,height:c});return e},canvasToSVG:function(){this.image.attr({href:this.canvas.toDataURL("image/png")})},cvsLineTo:function(a,b,c){a.lineTo(b,c)},renderCanvas:function(){var a=this,b=a.options,c=a.chart,e=this.xAxis,
|
||||
h=this.yAxis,k,d=0,l=a.processedXData,n=a.processedYData,q=b.data,m=e.getExtremes(),v=m.min,x=m.max,m=h.getExtremes(),z=m.min,aa=m.max,G={},A,ba=!!a.sampling,H,I=b.marker&&b.marker.radius,J=this.cvsDrawPoint,B=b.lineWidth?this.cvsLineTo:!1,K=1>=I?this.cvsMarkerSquare:this.cvsMarkerCircle,ca=!1!==b.enableMouseTracking,L,m=b.threshold,r=h.getThreshold(m),M=u(m),N=r,da=this.fill,O=a.pointArrayMap&&"low,high"===a.pointArrayMap.join(","),P=!!b.stacking,ea=a.cropStart||0,m=c.options.loading,fa=a.requireSorting,
|
||||
Q,ga=b.connectNulls,R=!l,C,D,t,w,ha=a.fillOpacity?(new V(a.color)).setOpacity(Z(b.fillOpacity,.75)).get():a.color,S=function(){da?(k.fillStyle=ha,k.fill()):(k.strokeStyle=a.color,k.lineWidth=b.lineWidth,k.stroke())},T=function(a,b,c){0===d&&(k.beginPath(),B&&(k.lineJoin="round"));Q?k.moveTo(a,b):J?J(k,a,b,c,L):B?B(k,a,b):K&&K(k,a,b,I);d+=1;1E3===d&&(S(),d=0);L={clientX:a,plotY:b,yBottom:c}},E=function(a,b,f){ca&&!G[a+","+b]&&(G[a+","+b]=!0,c.inverted&&(a=e.len-a,b=h.len-b),H.push({clientX:a,plotX:a,
|
||||
plotY:b,i:ea+f}))};(this.points||this.graph)&&this.destroyGraphics();a.plotGroup("group","series",a.visible?"visible":"hidden",b.zIndex,c.seriesGroup);a.markerGroup=a.group;W(a,"destroy",function(){a.markerGroup=null});H=this.points=[];k=this.getContext();a.buildKDTree=U;99999<q.length&&(c.options.loading=Y(m,{labelStyle:{backgroundColor:f.color("#ffffff").setOpacity(.75).get(),padding:"1em",borderRadius:"0.5em"},style:{backgroundColor:"none",opacity:1}}),clearTimeout(F),c.showLoading("Drawing..."),
|
||||
c.options.loading=m);p(P?a.data:l||q,function(b,f){var d,g,k,l="undefined"===typeof c.index,m=!0;if(!l){R?(d=b[0],g=b[1]):(d=b,g=n[f]);O?(R&&(g=b.slice(1,3)),k=g[0],g=g[1]):P&&(d=b.x,g=b.stackY,k=g-b.y);b=null===g;fa||(m=g>=z&&g<=aa);if(!b&&d>=v&&d<=x&&m)if(d=Math.round(e.toPixels(d,!0)),ba){if(void 0===t||d===A){O||(k=g);if(void 0===w||g>D)D=g,w=f;if(void 0===t||k<C)C=k,t=f}d!==A&&(void 0!==t&&(g=h.toPixels(D,!0),r=h.toPixels(C,!0),T(d,M?Math.min(g,N):g,M?Math.max(r,N):r),E(d,g,w),r!==g&&E(d,r,t)),
|
||||
t=w=void 0,A=d)}else g=Math.round(h.toPixels(g,!0)),T(d,g,r),E(d,g,f);Q=b&&!ga;0===f%5E4&&a.canvasToSVG()}return!l},function(){var b=c.loadingDiv,e=c.loadingShown;S();a.canvasToSVG();X(a,"renderedCanvas");e&&(y(b.style,{transition:"opacity 250ms",opacity:0}),c.loadingShown=!1,F=setTimeout(function(){b.parentNode&&b.parentNode.removeChild(b);c.loadingDiv=c.loadingSpan=null},250));a.directTouch=!1;a.options.stickyTracking=!0;delete a.buildKDTree;a.buildKDTree()},c.renderer.forExport?Number.MAX_VALUE:
|
||||
void 0)}});d.scatter.prototype.cvsMarkerCircle=function(a,b,c,e){a.moveTo(b,c);a.arc(b,c,e,0,2*Math.PI,!1)};d.scatter.prototype.cvsMarkerSquare=function(a,b,c,e){a.rect(b-e,c-e,2*e,2*e)};d.scatter.prototype.fill=!0;y(d.area.prototype,{cvsDrawPoint:function(a,b,c,e,d){d&&b!==d.clientX&&(a.moveTo(d.clientX,d.yBottom),a.lineTo(d.clientX,d.plotY),a.lineTo(b,c),a.lineTo(b,e))},fill:!0,fillOpacity:!0,sampling:!0});y(d.column.prototype,{cvsDrawPoint:function(a,b,c,d){a.rect(b-1,c,1,d-c)},fill:!0,sampling:!0});
|
||||
n.prototype.getPoint=function(a){var b=a;!a||a instanceof this.pointClass||(b=(new this.pointClass).init(this,this.options.data[a.i]),b.category=b.x,b.dist=a.dist,b.distX=a.distX,b.plotX=a.plotX,b.plotY=a.plotY);return b};l(n.prototype,"destroy",function(a){var b=this,c=b.chart;c.hoverPoints&&(c.hoverPoints=z(c.hoverPoints,function(a){return a.series===b}));c.hoverPoint&&c.hoverPoint.series===b&&(c.hoverPoint=null);a.call(this)});l(n.prototype,"searchPoint",function(a){return this.getPoint(a.apply(this,
|
||||
[].slice.call(arguments,1)))})})(p)});
|
||||
636
assets/plugin/chart/highcharts/code/js/modules/boost.src.js
Executable file
636
assets/plugin/chart/highcharts/code/js/modules/boost.src.js
Executable file
@ -0,0 +1,636 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Boost module
|
||||
*
|
||||
* (c) 2010-2016 Highsoft AS
|
||||
* Author: Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* License: www.highcharts.com/license
|
||||
* Author: Torstein Honsi
|
||||
*
|
||||
* This is an experimental Highcharts module that draws long data series on a canvas
|
||||
* in order to increase performance of the initial load time and tooltip responsiveness.
|
||||
*
|
||||
* Compatible with HTML5 canvas compatible browsers (not IE < 9).
|
||||
*
|
||||
*
|
||||
*
|
||||
* Development plan
|
||||
* - Column range.
|
||||
* - Heatmap. Modify the heatmap-canvas demo so that it uses this module.
|
||||
* - Treemap.
|
||||
* - Check how it works with Highstock and data grouping. Currently it only works when navigator.adaptToUpdatedData
|
||||
* is false. It is also recommended to set scrollbar.liveRedraw to false.
|
||||
* - Check inverted charts.
|
||||
* - Check reversed axes.
|
||||
* - Chart callback should be async after last series is drawn. (But not necessarily, we don't do
|
||||
that with initial series animation).
|
||||
* - Cache full-size image so we don't have to redraw on hide/show and zoom up. But k-d-tree still
|
||||
* needs to be built.
|
||||
* - Test IE9 and IE10.
|
||||
* - Stacking is not perhaps not correct since it doesn't use the translation given in
|
||||
* the translate method. If this gets to complicated, a possible way out would be to
|
||||
* have a simplified renderCanvas method that simply draws the areaPath on a canvas.
|
||||
*
|
||||
* If this module is taken in as part of the core
|
||||
* - All the loading logic should be merged with core. Update styles in the core.
|
||||
* - Most of the method wraps should probably be added directly in parent methods.
|
||||
*
|
||||
* Notes for boost mode
|
||||
* - Area lines are not drawn
|
||||
* - Point markers are not drawn on line-type series
|
||||
* - Lines are not drawn on scatter charts
|
||||
* - Zones and negativeColor don't work
|
||||
* - Columns are always one pixel wide. Don't set the threshold too low.
|
||||
*
|
||||
* Optimizing tips for users
|
||||
* - For scatter plots, use a marker.radius of 1 or less. It results in a rectangle being drawn, which is
|
||||
* considerably faster than a circle.
|
||||
* - Set extremes (min, max) explicitly on the axes in order for Highcharts to avoid computing extremes.
|
||||
* - Set enableMouseTracking to false on the series to improve total rendering time.
|
||||
* - The default threshold is set based on one series. If you have multiple, dense series, the combined
|
||||
* number of points drawn gets higher, and you may want to set the threshold lower in order to
|
||||
* use optimizations.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var win = H.win,
|
||||
doc = win.document,
|
||||
noop = function() {},
|
||||
Color = H.Color,
|
||||
Series = H.Series,
|
||||
seriesTypes = H.seriesTypes,
|
||||
each = H.each,
|
||||
extend = H.extend,
|
||||
addEvent = H.addEvent,
|
||||
fireEvent = H.fireEvent,
|
||||
grep = H.grep,
|
||||
isNumber = H.isNumber,
|
||||
merge = H.merge,
|
||||
pick = H.pick,
|
||||
wrap = H.wrap,
|
||||
plotOptions = H.getOptions().plotOptions,
|
||||
CHUNK_SIZE = 50000,
|
||||
destroyLoadingDiv;
|
||||
|
||||
function eachAsync(arr, fn, finalFunc, chunkSize, i) {
|
||||
i = i || 0;
|
||||
chunkSize = chunkSize || CHUNK_SIZE;
|
||||
|
||||
var threshold = i + chunkSize,
|
||||
proceed = true;
|
||||
|
||||
while (proceed && i < threshold && i < arr.length) {
|
||||
proceed = fn(arr[i], i);
|
||||
i = i + 1;
|
||||
}
|
||||
if (proceed) {
|
||||
if (i < arr.length) {
|
||||
setTimeout(function() {
|
||||
eachAsync(arr, fn, finalFunc, chunkSize, i);
|
||||
});
|
||||
} else if (finalFunc) {
|
||||
finalFunc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set default options
|
||||
each(['area', 'arearange', 'column', 'line', 'scatter'], function(type) {
|
||||
if (plotOptions[type]) {
|
||||
plotOptions[type].boostThreshold = 5000;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Override a bunch of methods the same way. If the number of points is below the threshold,
|
||||
* run the original method. If not, check for a canvas version or do nothing.
|
||||
*/
|
||||
each(['translate', 'generatePoints', 'drawTracker', 'drawPoints', 'render'], function(method) {
|
||||
function branch(proceed) {
|
||||
var letItPass = this.options.stacking && (method === 'translate' || method === 'generatePoints');
|
||||
if ((this.processedXData || this.options.data).length < (this.options.boostThreshold || Number.MAX_VALUE) ||
|
||||
letItPass) {
|
||||
|
||||
// Clear image
|
||||
if (method === 'render' && this.image) {
|
||||
this.image.attr({
|
||||
href: ''
|
||||
});
|
||||
this.animate = null; // We're zooming in, don't run animation
|
||||
}
|
||||
|
||||
proceed.call(this);
|
||||
|
||||
// If a canvas version of the method exists, like renderCanvas(), run
|
||||
} else if (this[method + 'Canvas']) {
|
||||
|
||||
this[method + 'Canvas']();
|
||||
}
|
||||
}
|
||||
wrap(Series.prototype, method, branch);
|
||||
|
||||
// A special case for some types - its translate method is already wrapped
|
||||
if (method === 'translate') {
|
||||
if (seriesTypes.column) {
|
||||
wrap(seriesTypes.column.prototype, method, branch);
|
||||
}
|
||||
if (seriesTypes.arearange) {
|
||||
wrap(seriesTypes.arearange.prototype, method, branch);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Do not compute extremes when min and max are set.
|
||||
* If we use this in the core, we can add the hook to hasExtremes to the methods directly.
|
||||
*/
|
||||
wrap(Series.prototype, 'getExtremes', function(proceed) {
|
||||
if (!this.hasExtremes()) {
|
||||
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
});
|
||||
wrap(Series.prototype, 'setData', function(proceed) {
|
||||
if (!this.hasExtremes(true)) {
|
||||
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
});
|
||||
wrap(Series.prototype, 'processData', function(proceed) {
|
||||
if (!this.hasExtremes(true)) {
|
||||
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
H.extend(Series.prototype, {
|
||||
pointRange: 0,
|
||||
allowDG: false, // No data grouping, let boost handle large data
|
||||
hasExtremes: function(checkX) {
|
||||
var options = this.options,
|
||||
data = options.data,
|
||||
xAxis = this.xAxis && this.xAxis.options,
|
||||
yAxis = this.yAxis && this.yAxis.options;
|
||||
return data.length > (options.boostThreshold || Number.MAX_VALUE) && isNumber(yAxis.min) && isNumber(yAxis.max) &&
|
||||
(!checkX || (isNumber(xAxis.min) && isNumber(xAxis.max)));
|
||||
},
|
||||
|
||||
/**
|
||||
* If implemented in the core, parts of this can probably be shared with other similar
|
||||
* methods in Highcharts.
|
||||
*/
|
||||
destroyGraphics: function() {
|
||||
var series = this,
|
||||
points = this.points,
|
||||
point,
|
||||
i;
|
||||
|
||||
if (points) {
|
||||
for (i = 0; i < points.length; i = i + 1) {
|
||||
point = points[i];
|
||||
if (point && point.graphic) {
|
||||
point.graphic = point.graphic.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
each(['graph', 'area', 'tracker'], function(prop) {
|
||||
if (series[prop]) {
|
||||
series[prop] = series[prop].destroy();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a hidden canvas to draw the graph on. The contents is later copied over
|
||||
* to an SVG image element.
|
||||
*/
|
||||
getContext: function() {
|
||||
var chart = this.chart,
|
||||
width = chart.plotWidth,
|
||||
height = chart.plotHeight,
|
||||
ctx = this.ctx,
|
||||
swapXY = function(proceed, x, y, a, b, c, d) {
|
||||
proceed.call(this, y, x, a, b, c, d);
|
||||
};
|
||||
|
||||
if (!this.canvas) {
|
||||
this.canvas = doc.createElement('canvas');
|
||||
this.image = chart.renderer.image('', 0, 0, width, height).add(this.group);
|
||||
this.ctx = ctx = this.canvas.getContext('2d');
|
||||
if (chart.inverted) {
|
||||
each(['moveTo', 'lineTo', 'rect', 'arc'], function(fn) {
|
||||
wrap(ctx, fn, swapXY);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
}
|
||||
|
||||
this.canvas.width = width;
|
||||
this.canvas.height = height;
|
||||
this.image.attr({
|
||||
width: width,
|
||||
height: height
|
||||
});
|
||||
|
||||
return ctx;
|
||||
},
|
||||
|
||||
/**
|
||||
* Draw the canvas image inside an SVG image
|
||||
*/
|
||||
canvasToSVG: function() {
|
||||
this.image.attr({
|
||||
href: this.canvas.toDataURL('image/png')
|
||||
});
|
||||
},
|
||||
|
||||
cvsLineTo: function(ctx, clientX, plotY) {
|
||||
ctx.lineTo(clientX, plotY);
|
||||
},
|
||||
|
||||
renderCanvas: function() {
|
||||
var series = this,
|
||||
options = series.options,
|
||||
chart = series.chart,
|
||||
xAxis = this.xAxis,
|
||||
yAxis = this.yAxis,
|
||||
ctx,
|
||||
c = 0,
|
||||
xData = series.processedXData,
|
||||
yData = series.processedYData,
|
||||
rawData = options.data,
|
||||
xExtremes = xAxis.getExtremes(),
|
||||
xMin = xExtremes.min,
|
||||
xMax = xExtremes.max,
|
||||
yExtremes = yAxis.getExtremes(),
|
||||
yMin = yExtremes.min,
|
||||
yMax = yExtremes.max,
|
||||
pointTaken = {},
|
||||
lastClientX,
|
||||
sampling = !!series.sampling,
|
||||
points,
|
||||
r = options.marker && options.marker.radius,
|
||||
cvsDrawPoint = this.cvsDrawPoint,
|
||||
cvsLineTo = options.lineWidth ? this.cvsLineTo : false,
|
||||
cvsMarker = r <= 1 ? this.cvsMarkerSquare : this.cvsMarkerCircle,
|
||||
enableMouseTracking = options.enableMouseTracking !== false,
|
||||
lastPoint,
|
||||
threshold = options.threshold,
|
||||
yBottom = yAxis.getThreshold(threshold),
|
||||
hasThreshold = isNumber(threshold),
|
||||
translatedThreshold = yBottom,
|
||||
doFill = this.fill,
|
||||
isRange = series.pointArrayMap && series.pointArrayMap.join(',') === 'low,high',
|
||||
isStacked = !!options.stacking,
|
||||
cropStart = series.cropStart || 0,
|
||||
loadingOptions = chart.options.loading,
|
||||
requireSorting = series.requireSorting,
|
||||
wasNull,
|
||||
connectNulls = options.connectNulls,
|
||||
useRaw = !xData,
|
||||
minVal,
|
||||
maxVal,
|
||||
minI,
|
||||
maxI,
|
||||
fillColor = series.fillOpacity ?
|
||||
new Color(series.color).setOpacity(pick(options.fillOpacity, 0.75)).get() :
|
||||
series.color,
|
||||
stroke = function() {
|
||||
if (doFill) {
|
||||
ctx.fillStyle = fillColor;
|
||||
ctx.fill();
|
||||
} else {
|
||||
ctx.strokeStyle = series.color;
|
||||
ctx.lineWidth = options.lineWidth;
|
||||
ctx.stroke();
|
||||
}
|
||||
},
|
||||
drawPoint = function(clientX, plotY, yBottom) {
|
||||
if (c === 0) {
|
||||
ctx.beginPath();
|
||||
|
||||
if (cvsLineTo) {
|
||||
ctx.lineJoin = 'round';
|
||||
}
|
||||
}
|
||||
|
||||
if (wasNull) {
|
||||
ctx.moveTo(clientX, plotY);
|
||||
} else {
|
||||
if (cvsDrawPoint) {
|
||||
cvsDrawPoint(ctx, clientX, plotY, yBottom, lastPoint);
|
||||
} else if (cvsLineTo) {
|
||||
cvsLineTo(ctx, clientX, plotY);
|
||||
} else if (cvsMarker) {
|
||||
cvsMarker(ctx, clientX, plotY, r);
|
||||
}
|
||||
}
|
||||
|
||||
// We need to stroke the line for every 1000 pixels. It will crash the browser
|
||||
// memory use if we stroke too infrequently.
|
||||
c = c + 1;
|
||||
if (c === 1000) {
|
||||
stroke();
|
||||
c = 0;
|
||||
}
|
||||
|
||||
// Area charts need to keep track of the last point
|
||||
lastPoint = {
|
||||
clientX: clientX,
|
||||
plotY: plotY,
|
||||
yBottom: yBottom
|
||||
};
|
||||
},
|
||||
|
||||
addKDPoint = function(clientX, plotY, i) {
|
||||
|
||||
// The k-d tree requires series points. Reduce the amount of points, since the time to build the
|
||||
// tree increases exponentially.
|
||||
if (enableMouseTracking && !pointTaken[clientX + ',' + plotY]) {
|
||||
pointTaken[clientX + ',' + plotY] = true;
|
||||
|
||||
if (chart.inverted) {
|
||||
clientX = xAxis.len - clientX;
|
||||
plotY = yAxis.len - plotY;
|
||||
}
|
||||
|
||||
points.push({
|
||||
clientX: clientX,
|
||||
plotX: clientX,
|
||||
plotY: plotY,
|
||||
i: cropStart + i
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// If we are zooming out from SVG mode, destroy the graphics
|
||||
if (this.points || this.graph) {
|
||||
this.destroyGraphics();
|
||||
}
|
||||
|
||||
// The group
|
||||
series.plotGroup(
|
||||
'group',
|
||||
'series',
|
||||
series.visible ? 'visible' : 'hidden',
|
||||
options.zIndex,
|
||||
chart.seriesGroup
|
||||
);
|
||||
|
||||
series.markerGroup = series.group;
|
||||
addEvent(series, 'destroy', function() {
|
||||
series.markerGroup = null;
|
||||
});
|
||||
|
||||
points = this.points = [];
|
||||
ctx = this.getContext();
|
||||
series.buildKDTree = noop; // Do not start building while drawing
|
||||
|
||||
// Display a loading indicator
|
||||
if (rawData.length > 99999) {
|
||||
chart.options.loading = merge(loadingOptions, {
|
||||
labelStyle: {
|
||||
backgroundColor: H.color('#ffffff').setOpacity(0.75).get(),
|
||||
padding: '1em',
|
||||
borderRadius: '0.5em'
|
||||
},
|
||||
style: {
|
||||
backgroundColor: 'none',
|
||||
opacity: 1
|
||||
}
|
||||
});
|
||||
clearTimeout(destroyLoadingDiv);
|
||||
chart.showLoading('Drawing...');
|
||||
chart.options.loading = loadingOptions; // reset
|
||||
}
|
||||
|
||||
// Loop over the points
|
||||
eachAsync(isStacked ? series.data : (xData || rawData), function(d, i) {
|
||||
var x,
|
||||
y,
|
||||
clientX,
|
||||
plotY,
|
||||
isNull,
|
||||
low,
|
||||
chartDestroyed = typeof chart.index === 'undefined',
|
||||
isYInside = true;
|
||||
|
||||
if (!chartDestroyed) {
|
||||
if (useRaw) {
|
||||
x = d[0];
|
||||
y = d[1];
|
||||
} else {
|
||||
x = d;
|
||||
y = yData[i];
|
||||
}
|
||||
|
||||
// Resolve low and high for range series
|
||||
if (isRange) {
|
||||
if (useRaw) {
|
||||
y = d.slice(1, 3);
|
||||
}
|
||||
low = y[0];
|
||||
y = y[1];
|
||||
} else if (isStacked) {
|
||||
x = d.x;
|
||||
y = d.stackY;
|
||||
low = y - d.y;
|
||||
}
|
||||
|
||||
isNull = y === null;
|
||||
|
||||
// Optimize for scatter zooming
|
||||
if (!requireSorting) {
|
||||
isYInside = y >= yMin && y <= yMax;
|
||||
}
|
||||
|
||||
if (!isNull && x >= xMin && x <= xMax && isYInside) {
|
||||
|
||||
clientX = Math.round(xAxis.toPixels(x, true));
|
||||
|
||||
if (sampling) {
|
||||
if (minI === undefined || clientX === lastClientX) {
|
||||
if (!isRange) {
|
||||
low = y;
|
||||
}
|
||||
if (maxI === undefined || y > maxVal) {
|
||||
maxVal = y;
|
||||
maxI = i;
|
||||
}
|
||||
if (minI === undefined || low < minVal) {
|
||||
minVal = low;
|
||||
minI = i;
|
||||
}
|
||||
|
||||
}
|
||||
if (clientX !== lastClientX) { // Add points and reset
|
||||
if (minI !== undefined) { // then maxI is also a number
|
||||
plotY = yAxis.toPixels(maxVal, true);
|
||||
yBottom = yAxis.toPixels(minVal, true);
|
||||
drawPoint(
|
||||
clientX,
|
||||
hasThreshold ? Math.min(plotY, translatedThreshold) : plotY,
|
||||
hasThreshold ? Math.max(yBottom, translatedThreshold) : yBottom
|
||||
);
|
||||
addKDPoint(clientX, plotY, maxI);
|
||||
if (yBottom !== plotY) {
|
||||
addKDPoint(clientX, yBottom, minI);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
minI = maxI = undefined;
|
||||
lastClientX = clientX;
|
||||
}
|
||||
} else {
|
||||
plotY = Math.round(yAxis.toPixels(y, true));
|
||||
drawPoint(clientX, plotY, yBottom);
|
||||
addKDPoint(clientX, plotY, i);
|
||||
}
|
||||
}
|
||||
wasNull = isNull && !connectNulls;
|
||||
|
||||
if (i % CHUNK_SIZE === 0) {
|
||||
series.canvasToSVG();
|
||||
}
|
||||
}
|
||||
|
||||
return !chartDestroyed;
|
||||
}, function() {
|
||||
var loadingDiv = chart.loadingDiv,
|
||||
loadingShown = chart.loadingShown;
|
||||
stroke();
|
||||
series.canvasToSVG();
|
||||
|
||||
fireEvent(series, 'renderedCanvas');
|
||||
|
||||
// Do not use chart.hideLoading, as it runs JS animation and will be blocked by buildKDTree.
|
||||
// CSS animation looks good, but then it must be deleted in timeout. If we add the module to core,
|
||||
// change hideLoading so we can skip this block.
|
||||
if (loadingShown) {
|
||||
extend(loadingDiv.style, {
|
||||
transition: 'opacity 250ms',
|
||||
opacity: 0
|
||||
});
|
||||
chart.loadingShown = false;
|
||||
destroyLoadingDiv = setTimeout(function() {
|
||||
if (loadingDiv.parentNode) { // In exporting it is falsy
|
||||
loadingDiv.parentNode.removeChild(loadingDiv);
|
||||
}
|
||||
chart.loadingDiv = chart.loadingSpan = null;
|
||||
}, 250);
|
||||
}
|
||||
|
||||
// Pass tests in Pointer.
|
||||
// Replace this with a single property, and replace when zooming in
|
||||
// below boostThreshold.
|
||||
series.directTouch = false;
|
||||
series.options.stickyTracking = true;
|
||||
|
||||
delete series.buildKDTree; // Go back to prototype, ready to build
|
||||
series.buildKDTree();
|
||||
|
||||
// Don't do async on export, the exportChart, getSVGForExport and getSVG methods are not chained for it.
|
||||
}, chart.renderer.forExport ? Number.MAX_VALUE : undefined);
|
||||
}
|
||||
});
|
||||
|
||||
seriesTypes.scatter.prototype.cvsMarkerCircle = function(ctx, clientX, plotY, r) {
|
||||
ctx.moveTo(clientX, plotY);
|
||||
ctx.arc(clientX, plotY, r, 0, 2 * Math.PI, false);
|
||||
};
|
||||
|
||||
// Rect is twice as fast as arc, should be used for small markers
|
||||
seriesTypes.scatter.prototype.cvsMarkerSquare = function(ctx, clientX, plotY, r) {
|
||||
ctx.rect(clientX - r, plotY - r, r * 2, r * 2);
|
||||
};
|
||||
seriesTypes.scatter.prototype.fill = true;
|
||||
|
||||
extend(seriesTypes.area.prototype, {
|
||||
cvsDrawPoint: function(ctx, clientX, plotY, yBottom, lastPoint) {
|
||||
if (lastPoint && clientX !== lastPoint.clientX) {
|
||||
ctx.moveTo(lastPoint.clientX, lastPoint.yBottom);
|
||||
ctx.lineTo(lastPoint.clientX, lastPoint.plotY);
|
||||
ctx.lineTo(clientX, plotY);
|
||||
ctx.lineTo(clientX, yBottom);
|
||||
}
|
||||
},
|
||||
fill: true,
|
||||
fillOpacity: true,
|
||||
sampling: true
|
||||
});
|
||||
|
||||
extend(seriesTypes.column.prototype, {
|
||||
cvsDrawPoint: function(ctx, clientX, plotY, yBottom) {
|
||||
ctx.rect(clientX - 1, plotY, 1, yBottom - plotY);
|
||||
},
|
||||
fill: true,
|
||||
sampling: true
|
||||
});
|
||||
|
||||
/**
|
||||
* Return a full Point object based on the index. The boost module uses stripped point objects
|
||||
* for performance reasons.
|
||||
* @param {Number} boostPoint A stripped-down point object
|
||||
* @returns {Object} A Point object as per http://api.highcharts.com/highcharts#Point
|
||||
*/
|
||||
Series.prototype.getPoint = function(boostPoint) {
|
||||
var point = boostPoint;
|
||||
|
||||
if (boostPoint && !(boostPoint instanceof this.pointClass)) {
|
||||
point = (new this.pointClass()).init(this, this.options.data[boostPoint.i]); // eslint-disable-line new-cap
|
||||
point.category = point.x;
|
||||
|
||||
point.dist = boostPoint.dist;
|
||||
point.distX = boostPoint.distX;
|
||||
point.plotX = boostPoint.plotX;
|
||||
point.plotY = boostPoint.plotY;
|
||||
}
|
||||
|
||||
return point;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extend series.destroy to also remove the fake k-d-tree points (#5137). Normally
|
||||
* this is handled by Series.destroy that calls Point.destroy, but the fake
|
||||
* search points are not registered like that.
|
||||
*/
|
||||
wrap(Series.prototype, 'destroy', function(proceed) {
|
||||
var series = this,
|
||||
chart = series.chart;
|
||||
if (chart.hoverPoints) {
|
||||
chart.hoverPoints = grep(chart.hoverPoints, function(point) {
|
||||
return point.series === series;
|
||||
});
|
||||
}
|
||||
|
||||
if (chart.hoverPoint && chart.hoverPoint.series === series) {
|
||||
chart.hoverPoint = null;
|
||||
}
|
||||
proceed.call(this);
|
||||
});
|
||||
|
||||
/**
|
||||
* Return a point instance from the k-d-tree
|
||||
*/
|
||||
wrap(Series.prototype, 'searchPoint', function(proceed) {
|
||||
return this.getPoint(
|
||||
proceed.apply(this, [].slice.call(arguments, 1))
|
||||
);
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
14
assets/plugin/chart/highcharts/code/js/modules/broken-axis.js
Executable file
14
assets/plugin/chart/highcharts/code/js/modules/broken-axis.js
Executable file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
(c) 2009-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(h){"object"===typeof module&&module.exports?module.exports=h:h(Highcharts)})(function(h){(function(f){function h(){return Array.prototype.slice.call(arguments,1)}function u(g){g.apply(this);this.drawBreaks(this.xAxis,["x"]);this.drawBreaks(this.yAxis,r(this.pointArrayMap,["y"]))}var r=f.pick,p=f.wrap,t=f.each,x=f.extend,v=f.fireEvent,q=f.Axis,y=f.Series;x(q.prototype,{isInBreak:function(g,c){var d=g.repeat||Infinity,b=g.from,a=g.to-g.from;c=c>=b?(c-b)%d:d-(b-c)%d;return g.inclusive?c<=a:
|
||||
c<a&&0!==c},isInAnyBreak:function(g,c){var d=this.options.breaks,b=d&&d.length,a,e,m;if(b){for(;b--;)this.isInBreak(d[b],g)&&(a=!0,e||(e=r(d[b].showPoints,this.isXAxis?!1:!0)));m=a&&c?a&&!e:a}return m}});p(q.prototype,"setTickPositions",function(g){g.apply(this,Array.prototype.slice.call(arguments,1));if(this.options.breaks){var c=this.tickPositions,d=this.tickPositions.info,b=[],a;for(a=0;a<c.length;a++)this.isInAnyBreak(c[a])||b.push(c[a]);this.tickPositions=b;this.tickPositions.info=d}});p(q.prototype,
|
||||
"init",function(g,c,d){d.breaks&&d.breaks.length&&(d.ordinal=!1);g.call(this,c,d);if(this.options.breaks){var b=this;b.isBroken=!0;this.val2lin=function(a){var e=a,m,d;for(d=0;d<b.breakArray.length;d++)if(m=b.breakArray[d],m.to<=a)e-=m.len;else if(m.from>=a)break;else if(b.isInBreak(m,a)){e-=a-m.from;break}return e};this.lin2val=function(a){var e,d;for(d=0;d<b.breakArray.length&&!(e=b.breakArray[d],e.from>=a);d++)e.to<a?a+=e.len:b.isInBreak(e,a)&&(a+=e.len);return a};this.setExtremes=function(a,b,
|
||||
d,g,c){for(;this.isInAnyBreak(a);)a-=this.closestPointRange;for(;this.isInAnyBreak(b);)b-=this.closestPointRange;q.prototype.setExtremes.call(this,a,b,d,g,c)};this.setAxisTranslation=function(a){q.prototype.setAxisTranslation.call(this,a);var e=b.options.breaks;a=[];var d=[],g=0,c,k,n=b.userMin||b.min,f=b.userMax||b.max,l,h;for(h in e)k=e[h],c=k.repeat||Infinity,b.isInBreak(k,n)&&(n+=k.to%c-n%c),b.isInBreak(k,f)&&(f-=f%c-k.from%c);for(h in e){k=e[h];l=k.from;for(c=k.repeat||Infinity;l-c>n;)l-=c;for(;l<
|
||||
n;)l+=c;for(;l<f;l+=c)a.push({value:l,move:"in"}),a.push({value:l+(k.to-k.from),move:"out",size:k.breakSize})}a.sort(function(a,b){return a.value===b.value?("in"===a.move?0:1)-("in"===b.move?0:1):a.value-b.value});e=0;l=n;for(h in a)k=a[h],e+="in"===k.move?1:-1,1===e&&"in"===k.move&&(l=k.value),0===e&&(d.push({from:l,to:k.value,len:k.value-l-(k.size||0)}),g+=k.value-l-(k.size||0));b.breakArray=d;v(b,"afterBreaks");b.transA*=(f-b.min)/(f-n-g);b.min=n;b.max=f}}});p(y.prototype,"generatePoints",function(g){g.apply(this,
|
||||
h(arguments));var c=this.xAxis,d=this.yAxis,b=this.points,a,e=b.length,f=this.options.connectNulls,w;if(c&&d&&(c.options.breaks||d.options.breaks))for(;e--;)a=b[e],w=null===a.y&&!1===f,w||!c.isInAnyBreak(a.x,!0)&&!d.isInAnyBreak(a.y,!0)||(b.splice(e,1),this.data[e]&&this.data[e].destroyElements())});f.Series.prototype.drawBreaks=function(g,c){var d=this,b=d.points,a,e,f,h;t(c,function(c){a=g.breakArray||[];e=g.isXAxis?g.min:r(d.options.threshold,g.min);t(b,function(b){h=r(b["stack"+c.toUpperCase()],
|
||||
b[c]);t(a,function(a){f=!1;if(e<a.from&&h>a.to||e>a.from&&h<a.from)f="pointBreak";else if(e<a.from&&h>a.from&&h<a.to||e>a.from&&h>a.to&&h<a.from)f="pointInBreak";f&&v(g,f,{point:b,brk:a})})})})};p(f.seriesTypes.column.prototype,"drawPoints",u);p(f.Series.prototype,"drawPoints",u)})(h)});
|
||||
334
assets/plugin/chart/highcharts/code/js/modules/broken-axis.src.js
Executable file
334
assets/plugin/chart/highcharts/code/js/modules/broken-axis.src.js
Executable file
@ -0,0 +1,334 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
*
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var pick = H.pick,
|
||||
wrap = H.wrap,
|
||||
each = H.each,
|
||||
extend = H.extend,
|
||||
fireEvent = H.fireEvent,
|
||||
Axis = H.Axis,
|
||||
Series = H.Series;
|
||||
|
||||
function stripArguments() {
|
||||
return Array.prototype.slice.call(arguments, 1);
|
||||
}
|
||||
|
||||
extend(Axis.prototype, {
|
||||
isInBreak: function(brk, val) {
|
||||
var ret,
|
||||
repeat = brk.repeat || Infinity,
|
||||
from = brk.from,
|
||||
length = brk.to - brk.from,
|
||||
test = (val >= from ? (val - from) % repeat : repeat - ((from - val) % repeat));
|
||||
|
||||
if (!brk.inclusive) {
|
||||
ret = test < length && test !== 0;
|
||||
} else {
|
||||
ret = test <= length;
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
||||
isInAnyBreak: function(val, testKeep) {
|
||||
|
||||
var breaks = this.options.breaks,
|
||||
i = breaks && breaks.length,
|
||||
inbrk,
|
||||
keep,
|
||||
ret;
|
||||
|
||||
|
||||
if (i) {
|
||||
|
||||
while (i--) {
|
||||
if (this.isInBreak(breaks[i], val)) {
|
||||
inbrk = true;
|
||||
if (!keep) {
|
||||
keep = pick(breaks[i].showPoints, this.isXAxis ? false : true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inbrk && testKeep) {
|
||||
ret = inbrk && !keep;
|
||||
} else {
|
||||
ret = inbrk;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
});
|
||||
|
||||
wrap(Axis.prototype, 'setTickPositions', function(proceed) {
|
||||
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
|
||||
if (this.options.breaks) {
|
||||
var axis = this,
|
||||
tickPositions = this.tickPositions,
|
||||
info = this.tickPositions.info,
|
||||
newPositions = [],
|
||||
i;
|
||||
|
||||
for (i = 0; i < tickPositions.length; i++) {
|
||||
if (!axis.isInAnyBreak(tickPositions[i])) {
|
||||
newPositions.push(tickPositions[i]);
|
||||
}
|
||||
}
|
||||
|
||||
this.tickPositions = newPositions;
|
||||
this.tickPositions.info = info;
|
||||
}
|
||||
});
|
||||
|
||||
wrap(Axis.prototype, 'init', function(proceed, chart, userOptions) {
|
||||
// Force Axis to be not-ordinal when breaks are defined
|
||||
if (userOptions.breaks && userOptions.breaks.length) {
|
||||
userOptions.ordinal = false;
|
||||
}
|
||||
|
||||
proceed.call(this, chart, userOptions);
|
||||
|
||||
if (this.options.breaks) {
|
||||
|
||||
var axis = this;
|
||||
|
||||
axis.isBroken = true;
|
||||
|
||||
this.val2lin = function(val) {
|
||||
var nval = val,
|
||||
brk,
|
||||
i;
|
||||
|
||||
for (i = 0; i < axis.breakArray.length; i++) {
|
||||
brk = axis.breakArray[i];
|
||||
if (brk.to <= val) {
|
||||
nval -= brk.len;
|
||||
} else if (brk.from >= val) {
|
||||
break;
|
||||
} else if (axis.isInBreak(brk, val)) {
|
||||
nval -= (val - brk.from);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nval;
|
||||
};
|
||||
|
||||
this.lin2val = function(val) {
|
||||
var nval = val,
|
||||
brk,
|
||||
i;
|
||||
|
||||
for (i = 0; i < axis.breakArray.length; i++) {
|
||||
brk = axis.breakArray[i];
|
||||
if (brk.from >= nval) {
|
||||
break;
|
||||
} else if (brk.to < nval) {
|
||||
nval += brk.len;
|
||||
} else if (axis.isInBreak(brk, nval)) {
|
||||
nval += brk.len;
|
||||
}
|
||||
}
|
||||
return nval;
|
||||
};
|
||||
|
||||
this.setExtremes = function(newMin, newMax, redraw, animation, eventArguments) {
|
||||
// If trying to set extremes inside a break, extend it to before and after the break ( #3857 )
|
||||
while (this.isInAnyBreak(newMin)) {
|
||||
newMin -= this.closestPointRange;
|
||||
}
|
||||
while (this.isInAnyBreak(newMax)) {
|
||||
newMax -= this.closestPointRange;
|
||||
}
|
||||
Axis.prototype.setExtremes.call(this, newMin, newMax, redraw, animation, eventArguments);
|
||||
};
|
||||
|
||||
this.setAxisTranslation = function(saveOld) {
|
||||
Axis.prototype.setAxisTranslation.call(this, saveOld);
|
||||
|
||||
var breaks = axis.options.breaks,
|
||||
breakArrayT = [], // Temporary one
|
||||
breakArray = [],
|
||||
length = 0,
|
||||
inBrk,
|
||||
repeat,
|
||||
brk,
|
||||
min = axis.userMin || axis.min,
|
||||
max = axis.userMax || axis.max,
|
||||
start,
|
||||
i,
|
||||
j;
|
||||
|
||||
// Min & max check (#4247)
|
||||
for (i in breaks) {
|
||||
brk = breaks[i];
|
||||
repeat = brk.repeat || Infinity;
|
||||
if (axis.isInBreak(brk, min)) {
|
||||
min += (brk.to % repeat) - (min % repeat);
|
||||
}
|
||||
if (axis.isInBreak(brk, max)) {
|
||||
max -= (max % repeat) - (brk.from % repeat);
|
||||
}
|
||||
}
|
||||
|
||||
// Construct an array holding all breaks in the axis
|
||||
for (i in breaks) {
|
||||
brk = breaks[i];
|
||||
start = brk.from;
|
||||
repeat = brk.repeat || Infinity;
|
||||
|
||||
while (start - repeat > min) {
|
||||
start -= repeat;
|
||||
}
|
||||
while (start < min) {
|
||||
start += repeat;
|
||||
}
|
||||
|
||||
for (j = start; j < max; j += repeat) {
|
||||
breakArrayT.push({
|
||||
value: j,
|
||||
move: 'in'
|
||||
});
|
||||
breakArrayT.push({
|
||||
value: j + (brk.to - brk.from),
|
||||
move: 'out',
|
||||
size: brk.breakSize
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
breakArrayT.sort(function(a, b) {
|
||||
var ret;
|
||||
if (a.value === b.value) {
|
||||
ret = (a.move === 'in' ? 0 : 1) - (b.move === 'in' ? 0 : 1);
|
||||
} else {
|
||||
ret = a.value - b.value;
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
// Simplify the breaks
|
||||
inBrk = 0;
|
||||
start = min;
|
||||
|
||||
for (i in breakArrayT) {
|
||||
brk = breakArrayT[i];
|
||||
inBrk += (brk.move === 'in' ? 1 : -1);
|
||||
|
||||
if (inBrk === 1 && brk.move === 'in') {
|
||||
start = brk.value;
|
||||
}
|
||||
if (inBrk === 0) {
|
||||
breakArray.push({
|
||||
from: start,
|
||||
to: brk.value,
|
||||
len: brk.value - start - (brk.size || 0)
|
||||
});
|
||||
length += brk.value - start - (brk.size || 0);
|
||||
}
|
||||
}
|
||||
|
||||
axis.breakArray = breakArray;
|
||||
|
||||
fireEvent(axis, 'afterBreaks');
|
||||
|
||||
axis.transA *= ((max - axis.min) / (max - min - length));
|
||||
|
||||
axis.min = min;
|
||||
axis.max = max;
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
wrap(Series.prototype, 'generatePoints', function(proceed) {
|
||||
|
||||
proceed.apply(this, stripArguments(arguments));
|
||||
|
||||
var series = this,
|
||||
xAxis = series.xAxis,
|
||||
yAxis = series.yAxis,
|
||||
points = series.points,
|
||||
point,
|
||||
i = points.length,
|
||||
connectNulls = series.options.connectNulls,
|
||||
nullGap;
|
||||
|
||||
|
||||
if (xAxis && yAxis && (xAxis.options.breaks || yAxis.options.breaks)) {
|
||||
while (i--) {
|
||||
point = points[i];
|
||||
|
||||
nullGap = point.y === null && connectNulls === false; // respect nulls inside the break (#4275)
|
||||
if (!nullGap && (xAxis.isInAnyBreak(point.x, true) || yAxis.isInAnyBreak(point.y, true))) {
|
||||
points.splice(i, 1);
|
||||
if (this.data[i]) {
|
||||
this.data[i].destroyElements(); // removes the graphics for this point if they exist
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function drawPointsWrapped(proceed) {
|
||||
proceed.apply(this);
|
||||
this.drawBreaks(this.xAxis, ['x']);
|
||||
this.drawBreaks(this.yAxis, pick(this.pointArrayMap, ['y']));
|
||||
}
|
||||
|
||||
H.Series.prototype.drawBreaks = function(axis, keys) {
|
||||
var series = this,
|
||||
points = series.points,
|
||||
breaks,
|
||||
threshold,
|
||||
eventName,
|
||||
y;
|
||||
|
||||
each(keys, function(key) {
|
||||
breaks = axis.breakArray || [];
|
||||
threshold = axis.isXAxis ? axis.min : pick(series.options.threshold, axis.min);
|
||||
each(points, function(point) {
|
||||
y = pick(point['stack' + key.toUpperCase()], point[key]);
|
||||
each(breaks, function(brk) {
|
||||
eventName = false;
|
||||
|
||||
if ((threshold < brk.from && y > brk.to) || (threshold > brk.from && y < brk.from)) {
|
||||
eventName = 'pointBreak';
|
||||
} else if ((threshold < brk.from && y > brk.from && y < brk.to) || (threshold > brk.from && y > brk.to && y < brk.from)) { // point falls inside the break
|
||||
eventName = 'pointInBreak';
|
||||
}
|
||||
if (eventName) {
|
||||
fireEvent(axis, eventName, {
|
||||
point: point,
|
||||
brk: brk
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
wrap(H.seriesTypes.column.prototype, 'drawPoints', drawPointsWrapped);
|
||||
wrap(H.Series.prototype, 'drawPoints', drawPointsWrapped);
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
26
assets/plugin/chart/highcharts/code/js/modules/data.js
Executable file
26
assets/plugin/chart/highcharts/code/js/modules/data.js
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Data module
|
||||
|
||||
(c) 2012-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(p){"object"===typeof module&&module.exports?module.exports=p:p(Highcharts)})(function(p){(function(g){var p=g.win.document,m=g.each,z=g.pick,w=g.inArray,x=g.isNumber,A=g.splat,n,u=function(b,a){this.init(b,a)};g.extend(u.prototype,{init:function(b,a){this.options=b;this.chartOptions=a;this.columns=b.columns||this.rowsToColumns(b.rows)||[];this.firstRowAsNames=z(b.firstRowAsNames,!0);this.decimalRegex=b.decimalPoint&&new RegExp("^(-?[0-9]+)"+b.decimalPoint+"([0-9]+)$");this.rawColumns=[];
|
||||
this.columns.length?this.dataFound():(this.parseCSV(),this.parseTable(),this.parseGoogleSpreadsheet())},getColumnDistribution:function(){var b=this.chartOptions,a=this.options,d=[],f=function(b){return(g.seriesTypes[b||"line"].prototype.pointArrayMap||[0]).length},e=b&&b.chart&&b.chart.type,c=[],k=[],t=0,h;m(b&&b.series||[],function(b){c.push(f(b.type||e))});m(a&&a.seriesMapping||[],function(b){d.push(b.x||0)});0===d.length&&d.push(0);m(a&&a.seriesMapping||[],function(a){var d=new n,r,v=c[t]||f(e),
|
||||
q=g.seriesTypes[((b&&b.series||[])[t]||{}).type||e||"line"].prototype.pointArrayMap||["y"];d.addColumnReader(a.x,"x");for(r in a)a.hasOwnProperty(r)&&"x"!==r&&d.addColumnReader(a[r],r);for(h=0;h<v;h++)d.hasReader(q[h])||d.addColumnReader(void 0,q[h]);k.push(d);t++});a=g.seriesTypes[e||"line"].prototype.pointArrayMap;void 0===a&&(a=["y"]);this.valueCount={global:f(e),xColumns:d,individual:c,seriesBuilders:k,globalPointArrayMap:a}},dataFound:function(){this.options.switchRowsAndColumns&&(this.columns=
|
||||
this.rowsToColumns(this.columns));this.getColumnDistribution();this.parseTypes();!1!==this.parsed()&&this.complete()},parseCSV:function(){var b=this,a=this.options,d=a.csv,f=this.columns,e=a.startRow||0,c=a.endRow||Number.MAX_VALUE,k=a.startColumn||0,t=a.endColumn||Number.MAX_VALUE,h,g,y=0;d&&(g=d.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split(a.lineDelimiter||"\n"),h=a.itemDelimiter||(-1!==d.indexOf("\t")?"\t":","),m(g,function(a,d){var g=b.trim(a),r=0===g.indexOf("#");d>=e&&d<=c&&!r&&""!==g&&(a=
|
||||
a.split(h),m(a,function(b,a){a>=k&&a<=t&&(f[a-k]||(f[a-k]=[]),f[a-k][y]=b)}),y+=1)}),this.dataFound())},parseTable:function(){var b=this.options,a=b.table,d=this.columns,f=b.startRow||0,e=b.endRow||Number.MAX_VALUE,c=b.startColumn||0,k=b.endColumn||Number.MAX_VALUE;a&&("string"===typeof a&&(a=p.getElementById(a)),m(a.getElementsByTagName("tr"),function(b,a){a>=f&&a<=e&&m(b.children,function(b,e){("TD"===b.tagName||"TH"===b.tagName)&&e>=c&&e<=k&&(d[e-c]||(d[e-c]=[]),d[e-c][a-f]=b.innerHTML)})}),this.dataFound())},
|
||||
parseGoogleSpreadsheet:function(){var b=this,a=this.options,d=a.googleSpreadsheetKey,f=this.columns,e=a.startRow||0,c=a.endRow||Number.MAX_VALUE,k=a.startColumn||0,g=a.endColumn||Number.MAX_VALUE,h,v;d&&jQuery.ajax({dataType:"json",url:"https://spreadsheets.google.com/feeds/cells/"+d+"/"+(a.googleSpreadsheetWorksheet||"od6")+"/public/values?alt\x3djson-in-script\x26callback\x3d?",error:a.error,success:function(a){a=a.feed.entry;var d,t=a.length,q=0,n=0,l;for(l=0;l<t;l++)d=a[l],q=Math.max(q,d.gs$cell.col),
|
||||
n=Math.max(n,d.gs$cell.row);for(l=0;l<q;l++)l>=k&&l<=g&&(f[l-k]=[],f[l-k].length=Math.min(n,c-e));for(l=0;l<t;l++)d=a[l],h=d.gs$cell.row-1,v=d.gs$cell.col-1,v>=k&&v<=g&&h>=e&&h<=c&&(f[v-k][h-e]=d.content.$t);m(f,function(a){for(l=0;l<a.length;l++)void 0===a[l]&&(a[l]=null)});b.dataFound()}})},trim:function(b,a){"string"===typeof b&&(b=b.replace(/^\s+|\s+$/g,""),a&&/^[0-9\s]+$/.test(b)&&(b=b.replace(/\s/g,"")),this.decimalRegex&&(b=b.replace(this.decimalRegex,"$1.$2")));return b},parseTypes:function(){for(var b=
|
||||
this.columns,a=b.length;a--;)this.parseColumn(b[a],a)},parseColumn:function(b,a){var d=this.rawColumns,f=this.columns,e=b.length,c,k,g,h,n=this.firstRowAsNames,m=-1!==w(a,this.valueCount.xColumns),r=[],p=this.chartOptions,q,u=(this.options.columnTypes||[])[a],p=m&&(p&&p.xAxis&&"category"===A(p.xAxis)[0].type||"string"===u);for(d[a]||(d[a]=[]);e--;)c=r[e]||b[e],g=this.trim(c),h=this.trim(c,!0),k=parseFloat(h),void 0===d[a][e]&&(d[a][e]=g),p||0===e&&n?b[e]=g:+h===k?(b[e]=k,31536E6<k&&"float"!==u?b.isDatetime=
|
||||
!0:b.isNumeric=!0,void 0!==b[e+1]&&(q=k>b[e+1])):(k=this.parseDate(c),m&&x(k)&&"float"!==u?(r[e]=c,b[e]=k,b.isDatetime=!0,void 0!==b[e+1]&&(c=k>b[e+1],c!==q&&void 0!==q&&(this.alternativeFormat?(this.dateFormat=this.alternativeFormat,e=b.length,this.alternativeFormat=this.dateFormats[this.dateFormat].alternative):b.unsorted=!0),q=c)):(b[e]=""===g?null:g,0!==e&&(b.isDatetime||b.isNumeric)&&(b.mixed=!0)));m&&b.mixed&&(f[a]=d[a]);if(m&&q&&this.options.sort)for(a=0;a<f.length;a++)f[a].reverse(),n&&f[a].unshift(f[a].pop())},
|
||||
dateFormats:{"YYYY-mm-dd":{regex:/^([0-9]{4})[\-\/\.]([0-9]{2})[\-\/\.]([0-9]{2})$/,parser:function(b){return Date.UTC(+b[1],b[2]-1,+b[3])}},"dd/mm/YYYY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/,parser:function(b){return Date.UTC(+b[3],b[2]-1,+b[1])},alternative:"mm/dd/YYYY"},"mm/dd/YYYY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/,parser:function(b){return Date.UTC(+b[3],b[1]-1,+b[2])}},"dd/mm/YY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/,
|
||||
parser:function(b){return Date.UTC(+b[3]+2E3,b[2]-1,+b[1])},alternative:"mm/dd/YY"},"mm/dd/YY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/,parser:function(b){return Date.UTC(+b[3]+2E3,b[1]-1,+b[2])}}},parseDate:function(b){var a=this.options.parseDate,d,f,e=this.options.dateFormat||this.dateFormat,c;if(a)d=a(b);else if("string"===typeof b){if(e)a=this.dateFormats[e],(c=b.match(a.regex))&&(d=a.parser(c));else for(f in this.dateFormats)if(a=this.dateFormats[f],c=b.match(a.regex)){this.dateFormat=
|
||||
f;this.alternativeFormat=a.alternative;d=a.parser(c);break}c||(c=Date.parse(b),"object"===typeof c&&null!==c&&c.getTime?d=c.getTime()-6E4*c.getTimezoneOffset():x(c)&&(d=c-6E4*(new Date(c)).getTimezoneOffset()))}return d},rowsToColumns:function(b){var a,d,f,e,c;if(b)for(c=[],d=b.length,a=0;a<d;a++)for(e=b[a].length,f=0;f<e;f++)c[f]||(c[f]=[]),c[f][a]=b[a][f];return c},parsed:function(){if(this.options.parsed)return this.options.parsed.call(this,this.columns)},getFreeIndexes:function(b,a){var d,f=[],
|
||||
e=[],c;for(d=0;d<b;d+=1)f.push(!0);for(b=0;b<a.length;b+=1)for(c=a[b].getReferencedColumnIndexes(),d=0;d<c.length;d+=1)f[c[d]]=!1;for(d=0;d<f.length;d+=1)f[d]&&e.push(d);return e},complete:function(){var b=this.columns,a,d=this.options,f,e,c,k,g=[],h;if(d.complete||d.afterComplete){for(c=0;c<b.length;c++)this.firstRowAsNames&&(b[c].name=b[c].shift());f=[];e=this.getFreeIndexes(b.length,this.valueCount.seriesBuilders);for(c=0;c<this.valueCount.seriesBuilders.length;c++)h=this.valueCount.seriesBuilders[c],
|
||||
h.populateColumns(e)&&g.push(h);for(;0<e.length;){h=new n;h.addColumnReader(0,"x");c=w(0,e);-1!==c&&e.splice(c,1);for(c=0;c<this.valueCount.global;c++)h.addColumnReader(void 0,this.valueCount.globalPointArrayMap[c]);h.populateColumns(e)&&g.push(h)}0<g.length&&0<g[0].readers.length&&(h=b[g[0].readers[0].columnIndex],void 0!==h&&(h.isDatetime?a="datetime":h.isNumeric||(a="category")));if("category"===a)for(c=0;c<g.length;c++)for(h=g[c],e=0;e<h.readers.length;e++)"x"===h.readers[e].configName&&(h.readers[e].configName=
|
||||
"name");for(c=0;c<g.length;c++){h=g[c];e=[];for(k=0;k<b[0].length;k++)e[k]=h.read(b,k);f[c]={data:e};h.name&&(f[c].name=h.name);"category"===a&&(f[c].turboThreshold=0)}b={series:f};a&&(b.xAxis={type:a},"category"===a&&(b.xAxis.uniqueNames=!1));d.complete&&d.complete(b);d.afterComplete&&d.afterComplete(b)}}});g.Data=u;g.data=function(b,a){return new u(b,a)};g.wrap(g.Chart.prototype,"init",function(b,a,d){var f=this;a&&a.data?g.data(g.extend(a.data,{afterComplete:function(e){var c,k;if(a.hasOwnProperty("series"))if("object"===
|
||||
typeof a.series)for(c=Math.max(a.series.length,e.series.length);c--;)k=a.series[c]||{},a.series[c]=g.merge(k,e.series[c]);else delete a.series;a=g.merge(e,a);b.call(f,a,d)}}),a):b.call(f,a,d)});n=function(){this.readers=[];this.pointIsArray=!0};n.prototype.populateColumns=function(b){var a=!0;m(this.readers,function(a){void 0===a.columnIndex&&(a.columnIndex=b.shift())});m(this.readers,function(b){void 0===b.columnIndex&&(a=!1)});return a};n.prototype.read=function(b,a){var d=this.pointIsArray,f=d?
|
||||
[]:{},e;m(this.readers,function(c){var e=b[c.columnIndex][a];d?f.push(e):f[c.configName]=e});void 0===this.name&&2<=this.readers.length&&(e=this.getReferencedColumnIndexes(),2<=e.length&&(e.shift(),e.sort(),this.name=b[e.shift()].name));return f};n.prototype.addColumnReader=function(b,a){this.readers.push({columnIndex:b,configName:a});"x"!==a&&"y"!==a&&void 0!==a&&(this.pointIsArray=!1)};n.prototype.getReferencedColumnIndexes=function(){var b,a=[],d;for(b=0;b<this.readers.length;b+=1)d=this.readers[b],
|
||||
void 0!==d.columnIndex&&a.push(d.columnIndex);return a};n.prototype.hasReader=function(b){var a,d;for(a=0;a<this.readers.length;a+=1)if(d=this.readers[a],d.configName===b)return!0}})(p)});
|
||||
981
assets/plugin/chart/highcharts/code/js/modules/data.src.js
Executable file
981
assets/plugin/chart/highcharts/code/js/modules/data.src.js
Executable file
@ -0,0 +1,981 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Data module
|
||||
*
|
||||
* (c) 2012-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(Highcharts) {
|
||||
/**
|
||||
* Data module
|
||||
*
|
||||
* (c) 2012-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
/* global jQuery */
|
||||
'use strict';
|
||||
|
||||
// Utilities
|
||||
var win = Highcharts.win,
|
||||
doc = win.document,
|
||||
each = Highcharts.each,
|
||||
pick = Highcharts.pick,
|
||||
inArray = Highcharts.inArray,
|
||||
isNumber = Highcharts.isNumber,
|
||||
splat = Highcharts.splat,
|
||||
SeriesBuilder;
|
||||
|
||||
|
||||
// The Data constructor
|
||||
var Data = function(dataOptions, chartOptions) {
|
||||
this.init(dataOptions, chartOptions);
|
||||
};
|
||||
|
||||
// Set the prototype properties
|
||||
Highcharts.extend(Data.prototype, {
|
||||
|
||||
/**
|
||||
* Initialize the Data object with the given options
|
||||
*/
|
||||
init: function(options, chartOptions) {
|
||||
this.options = options;
|
||||
this.chartOptions = chartOptions;
|
||||
this.columns = options.columns || this.rowsToColumns(options.rows) || [];
|
||||
this.firstRowAsNames = pick(options.firstRowAsNames, true);
|
||||
this.decimalRegex = options.decimalPoint && new RegExp('^(-?[0-9]+)' + options.decimalPoint + '([0-9]+)$');
|
||||
|
||||
// This is a two-dimensional array holding the raw, trimmed string values
|
||||
// with the same organisation as the columns array. It makes it possible
|
||||
// for example to revert from interpreted timestamps to string-based
|
||||
// categories.
|
||||
this.rawColumns = [];
|
||||
|
||||
// No need to parse or interpret anything
|
||||
if (this.columns.length) {
|
||||
this.dataFound();
|
||||
|
||||
// Parse and interpret
|
||||
} else {
|
||||
|
||||
// Parse a CSV string if options.csv is given
|
||||
this.parseCSV();
|
||||
|
||||
// Parse a HTML table if options.table is given
|
||||
this.parseTable();
|
||||
|
||||
// Parse a Google Spreadsheet
|
||||
this.parseGoogleSpreadsheet();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the column distribution. For example, a line series takes a single column for
|
||||
* Y values. A range series takes two columns for low and high values respectively,
|
||||
* and an OHLC series takes four columns.
|
||||
*/
|
||||
getColumnDistribution: function() {
|
||||
var chartOptions = this.chartOptions,
|
||||
options = this.options,
|
||||
xColumns = [],
|
||||
getValueCount = function(type) {
|
||||
return (Highcharts.seriesTypes[type || 'line'].prototype.pointArrayMap || [0]).length;
|
||||
},
|
||||
getPointArrayMap = function(type) {
|
||||
return Highcharts.seriesTypes[type || 'line'].prototype.pointArrayMap;
|
||||
},
|
||||
globalType = chartOptions && chartOptions.chart && chartOptions.chart.type,
|
||||
individualCounts = [],
|
||||
seriesBuilders = [],
|
||||
seriesIndex = 0,
|
||||
i;
|
||||
|
||||
each((chartOptions && chartOptions.series) || [], function(series) {
|
||||
individualCounts.push(getValueCount(series.type || globalType));
|
||||
});
|
||||
|
||||
// Collect the x-column indexes from seriesMapping
|
||||
each((options && options.seriesMapping) || [], function(mapping) {
|
||||
xColumns.push(mapping.x || 0);
|
||||
});
|
||||
|
||||
// If there are no defined series with x-columns, use the first column as x column
|
||||
if (xColumns.length === 0) {
|
||||
xColumns.push(0);
|
||||
}
|
||||
|
||||
// Loop all seriesMappings and constructs SeriesBuilders from
|
||||
// the mapping options.
|
||||
each((options && options.seriesMapping) || [], function(mapping) {
|
||||
var builder = new SeriesBuilder(),
|
||||
name,
|
||||
numberOfValueColumnsNeeded = individualCounts[seriesIndex] || getValueCount(globalType),
|
||||
seriesArr = (chartOptions && chartOptions.series) || [],
|
||||
series = seriesArr[seriesIndex] || {},
|
||||
pointArrayMap = getPointArrayMap(series.type || globalType) || ['y'];
|
||||
|
||||
// Add an x reader from the x property or from an undefined column
|
||||
// if the property is not set. It will then be auto populated later.
|
||||
builder.addColumnReader(mapping.x, 'x');
|
||||
|
||||
// Add all column mappings
|
||||
for (name in mapping) {
|
||||
if (mapping.hasOwnProperty(name) && name !== 'x') {
|
||||
builder.addColumnReader(mapping[name], name);
|
||||
}
|
||||
}
|
||||
|
||||
// Add missing columns
|
||||
for (i = 0; i < numberOfValueColumnsNeeded; i++) {
|
||||
if (!builder.hasReader(pointArrayMap[i])) {
|
||||
//builder.addNextColumnReader(pointArrayMap[i]);
|
||||
// Create and add a column reader for the next free column index
|
||||
builder.addColumnReader(undefined, pointArrayMap[i]);
|
||||
}
|
||||
}
|
||||
|
||||
seriesBuilders.push(builder);
|
||||
seriesIndex++;
|
||||
});
|
||||
|
||||
var globalPointArrayMap = getPointArrayMap(globalType);
|
||||
if (globalPointArrayMap === undefined) {
|
||||
globalPointArrayMap = ['y'];
|
||||
}
|
||||
|
||||
this.valueCount = {
|
||||
global: getValueCount(globalType),
|
||||
xColumns: xColumns,
|
||||
individual: individualCounts,
|
||||
seriesBuilders: seriesBuilders,
|
||||
globalPointArrayMap: globalPointArrayMap
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* When the data is parsed into columns, either by CSV, table, GS or direct input,
|
||||
* continue with other operations.
|
||||
*/
|
||||
dataFound: function() {
|
||||
|
||||
if (this.options.switchRowsAndColumns) {
|
||||
this.columns = this.rowsToColumns(this.columns);
|
||||
}
|
||||
|
||||
// Interpret the info about series and columns
|
||||
this.getColumnDistribution();
|
||||
|
||||
// Interpret the values into right types
|
||||
this.parseTypes();
|
||||
|
||||
// Handle columns if a handleColumns callback is given
|
||||
if (this.parsed() !== false) {
|
||||
|
||||
// Complete if a complete callback is given
|
||||
this.complete();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse a CSV input string
|
||||
*/
|
||||
parseCSV: function() {
|
||||
var self = this,
|
||||
options = this.options,
|
||||
csv = options.csv,
|
||||
columns = this.columns,
|
||||
startRow = options.startRow || 0,
|
||||
endRow = options.endRow || Number.MAX_VALUE,
|
||||
startColumn = options.startColumn || 0,
|
||||
endColumn = options.endColumn || Number.MAX_VALUE,
|
||||
itemDelimiter,
|
||||
lines,
|
||||
activeRowNo = 0;
|
||||
|
||||
if (csv) {
|
||||
|
||||
lines = csv
|
||||
.replace(/\r\n/g, '\n') // Unix
|
||||
.replace(/\r/g, '\n') // Mac
|
||||
.split(options.lineDelimiter || '\n');
|
||||
|
||||
itemDelimiter = options.itemDelimiter || (csv.indexOf('\t') !== -1 ? '\t' : ',');
|
||||
|
||||
each(lines, function(line, rowNo) {
|
||||
var trimmed = self.trim(line),
|
||||
isComment = trimmed.indexOf('#') === 0,
|
||||
isBlank = trimmed === '',
|
||||
items;
|
||||
|
||||
if (rowNo >= startRow && rowNo <= endRow && !isComment && !isBlank) {
|
||||
items = line.split(itemDelimiter);
|
||||
each(items, function(item, colNo) {
|
||||
if (colNo >= startColumn && colNo <= endColumn) {
|
||||
if (!columns[colNo - startColumn]) {
|
||||
columns[colNo - startColumn] = [];
|
||||
}
|
||||
|
||||
columns[colNo - startColumn][activeRowNo] = item;
|
||||
}
|
||||
});
|
||||
activeRowNo += 1;
|
||||
}
|
||||
});
|
||||
|
||||
this.dataFound();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse a HTML table
|
||||
*/
|
||||
parseTable: function() {
|
||||
var options = this.options,
|
||||
table = options.table,
|
||||
columns = this.columns,
|
||||
startRow = options.startRow || 0,
|
||||
endRow = options.endRow || Number.MAX_VALUE,
|
||||
startColumn = options.startColumn || 0,
|
||||
endColumn = options.endColumn || Number.MAX_VALUE;
|
||||
|
||||
if (table) {
|
||||
|
||||
if (typeof table === 'string') {
|
||||
table = doc.getElementById(table);
|
||||
}
|
||||
|
||||
each(table.getElementsByTagName('tr'), function(tr, rowNo) {
|
||||
if (rowNo >= startRow && rowNo <= endRow) {
|
||||
each(tr.children, function(item, colNo) {
|
||||
if ((item.tagName === 'TD' || item.tagName === 'TH') && colNo >= startColumn && colNo <= endColumn) {
|
||||
if (!columns[colNo - startColumn]) {
|
||||
columns[colNo - startColumn] = [];
|
||||
}
|
||||
|
||||
columns[colNo - startColumn][rowNo - startRow] = item.innerHTML;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.dataFound(); // continue
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
*/
|
||||
parseGoogleSpreadsheet: function() {
|
||||
var self = this,
|
||||
options = this.options,
|
||||
googleSpreadsheetKey = options.googleSpreadsheetKey,
|
||||
columns = this.columns,
|
||||
startRow = options.startRow || 0,
|
||||
endRow = options.endRow || Number.MAX_VALUE,
|
||||
startColumn = options.startColumn || 0,
|
||||
endColumn = options.endColumn || Number.MAX_VALUE,
|
||||
gr, // google row
|
||||
gc; // google column
|
||||
|
||||
if (googleSpreadsheetKey) {
|
||||
jQuery.ajax({
|
||||
dataType: 'json',
|
||||
url: 'https://spreadsheets.google.com/feeds/cells/' +
|
||||
googleSpreadsheetKey + '/' + (options.googleSpreadsheetWorksheet || 'od6') +
|
||||
'/public/values?alt=json-in-script&callback=?',
|
||||
error: options.error,
|
||||
success: function(json) {
|
||||
// Prepare the data from the spreadsheat
|
||||
var cells = json.feed.entry,
|
||||
cell,
|
||||
cellCount = cells.length,
|
||||
colCount = 0,
|
||||
rowCount = 0,
|
||||
i;
|
||||
|
||||
// First, find the total number of columns and rows that
|
||||
// are actually filled with data
|
||||
for (i = 0; i < cellCount; i++) {
|
||||
cell = cells[i];
|
||||
colCount = Math.max(colCount, cell.gs$cell.col);
|
||||
rowCount = Math.max(rowCount, cell.gs$cell.row);
|
||||
}
|
||||
|
||||
// Set up arrays containing the column data
|
||||
for (i = 0; i < colCount; i++) {
|
||||
if (i >= startColumn && i <= endColumn) {
|
||||
// Create new columns with the length of either end-start or rowCount
|
||||
columns[i - startColumn] = [];
|
||||
|
||||
// Setting the length to avoid jslint warning
|
||||
columns[i - startColumn].length = Math.min(rowCount, endRow - startRow);
|
||||
}
|
||||
}
|
||||
|
||||
// Loop over the cells and assign the value to the right
|
||||
// place in the column arrays
|
||||
for (i = 0; i < cellCount; i++) {
|
||||
cell = cells[i];
|
||||
gr = cell.gs$cell.row - 1; // rows start at 1
|
||||
gc = cell.gs$cell.col - 1; // columns start at 1
|
||||
|
||||
// If both row and col falls inside start and end
|
||||
// set the transposed cell value in the newly created columns
|
||||
if (gc >= startColumn && gc <= endColumn &&
|
||||
gr >= startRow && gr <= endRow) {
|
||||
columns[gc - startColumn][gr - startRow] = cell.content.$t;
|
||||
}
|
||||
}
|
||||
|
||||
// Insert null for empty spreadsheet cells (#5298)
|
||||
each(columns, function(column) {
|
||||
for (i = 0; i < column.length; i++) {
|
||||
if (column[i] === undefined) {
|
||||
column[i] = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self.dataFound();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Trim a string from whitespace
|
||||
*/
|
||||
trim: function(str, inside) {
|
||||
if (typeof str === 'string') {
|
||||
str = str.replace(/^\s+|\s+$/g, '');
|
||||
|
||||
// Clear white space insdie the string, like thousands separators
|
||||
if (inside && /^[0-9\s]+$/.test(str)) {
|
||||
str = str.replace(/\s/g, '');
|
||||
}
|
||||
|
||||
if (this.decimalRegex) {
|
||||
str = str.replace(this.decimalRegex, '$1.$2');
|
||||
}
|
||||
}
|
||||
return str;
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse numeric cells in to number types and date types in to true dates.
|
||||
*/
|
||||
parseTypes: function() {
|
||||
var columns = this.columns,
|
||||
col = columns.length;
|
||||
|
||||
while (col--) {
|
||||
this.parseColumn(columns[col], col);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse a single column. Set properties like .isDatetime and .isNumeric.
|
||||
*/
|
||||
parseColumn: function(column, col) {
|
||||
var rawColumns = this.rawColumns,
|
||||
columns = this.columns,
|
||||
row = column.length,
|
||||
val,
|
||||
floatVal,
|
||||
trimVal,
|
||||
trimInsideVal,
|
||||
firstRowAsNames = this.firstRowAsNames,
|
||||
isXColumn = inArray(col, this.valueCount.xColumns) !== -1,
|
||||
dateVal,
|
||||
backup = [],
|
||||
diff,
|
||||
chartOptions = this.chartOptions,
|
||||
descending,
|
||||
columnTypes = this.options.columnTypes || [],
|
||||
columnType = columnTypes[col],
|
||||
forceCategory = isXColumn && ((chartOptions && chartOptions.xAxis && splat(chartOptions.xAxis)[0].type === 'category') || columnType === 'string');
|
||||
|
||||
if (!rawColumns[col]) {
|
||||
rawColumns[col] = [];
|
||||
}
|
||||
while (row--) {
|
||||
val = backup[row] || column[row];
|
||||
|
||||
trimVal = this.trim(val);
|
||||
trimInsideVal = this.trim(val, true);
|
||||
floatVal = parseFloat(trimInsideVal);
|
||||
|
||||
// Set it the first time
|
||||
if (rawColumns[col][row] === undefined) {
|
||||
rawColumns[col][row] = trimVal;
|
||||
}
|
||||
|
||||
// Disable number or date parsing by setting the X axis type to category
|
||||
if (forceCategory || (row === 0 && firstRowAsNames)) {
|
||||
column[row] = trimVal;
|
||||
|
||||
} else if (+trimInsideVal === floatVal) { // is numeric
|
||||
|
||||
column[row] = floatVal;
|
||||
|
||||
// If the number is greater than milliseconds in a year, assume datetime
|
||||
if (floatVal > 365 * 24 * 3600 * 1000 && columnType !== 'float') {
|
||||
column.isDatetime = true;
|
||||
} else {
|
||||
column.isNumeric = true;
|
||||
}
|
||||
|
||||
if (column[row + 1] !== undefined) {
|
||||
descending = floatVal > column[row + 1];
|
||||
}
|
||||
|
||||
// String, continue to determine if it is a date string or really a string
|
||||
} else {
|
||||
dateVal = this.parseDate(val);
|
||||
// Only allow parsing of dates if this column is an x-column
|
||||
if (isXColumn && isNumber(dateVal) && columnType !== 'float') { // is date
|
||||
backup[row] = val;
|
||||
column[row] = dateVal;
|
||||
column.isDatetime = true;
|
||||
|
||||
// Check if the dates are uniformly descending or ascending. If they
|
||||
// are not, chances are that they are a different time format, so check
|
||||
// for alternative.
|
||||
if (column[row + 1] !== undefined) {
|
||||
diff = dateVal > column[row + 1];
|
||||
if (diff !== descending && descending !== undefined) {
|
||||
if (this.alternativeFormat) {
|
||||
this.dateFormat = this.alternativeFormat;
|
||||
row = column.length;
|
||||
this.alternativeFormat = this.dateFormats[this.dateFormat].alternative;
|
||||
} else {
|
||||
column.unsorted = true;
|
||||
}
|
||||
}
|
||||
descending = diff;
|
||||
}
|
||||
|
||||
} else { // string
|
||||
column[row] = trimVal === '' ? null : trimVal;
|
||||
if (row !== 0 && (column.isDatetime || column.isNumeric)) {
|
||||
column.mixed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If strings are intermixed with numbers or dates in a parsed column, it is an indication
|
||||
// that parsing went wrong or the data was not intended to display as numbers or dates and
|
||||
// parsing is too aggressive. Fall back to categories. Demonstrated in the
|
||||
// highcharts/demo/column-drilldown sample.
|
||||
if (isXColumn && column.mixed) {
|
||||
columns[col] = rawColumns[col];
|
||||
}
|
||||
|
||||
// If the 0 column is date or number and descending, reverse all columns.
|
||||
if (isXColumn && descending && this.options.sort) {
|
||||
for (col = 0; col < columns.length; col++) {
|
||||
columns[col].reverse();
|
||||
if (firstRowAsNames) {
|
||||
columns[col].unshift(columns[col].pop());
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* A collection of available date formats, extendable from the outside to support
|
||||
* custom date formats.
|
||||
*/
|
||||
dateFormats: {
|
||||
'YYYY-mm-dd': {
|
||||
regex: /^([0-9]{4})[\-\/\.]([0-9]{2})[\-\/\.]([0-9]{2})$/,
|
||||
parser: function(match) {
|
||||
return Date.UTC(+match[1], match[2] - 1, +match[3]);
|
||||
}
|
||||
},
|
||||
'dd/mm/YYYY': {
|
||||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/,
|
||||
parser: function(match) {
|
||||
return Date.UTC(+match[3], match[2] - 1, +match[1]);
|
||||
},
|
||||
alternative: 'mm/dd/YYYY' // different format with the same regex
|
||||
},
|
||||
'mm/dd/YYYY': {
|
||||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/,
|
||||
parser: function(match) {
|
||||
return Date.UTC(+match[3], match[1] - 1, +match[2]);
|
||||
}
|
||||
},
|
||||
'dd/mm/YY': {
|
||||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/,
|
||||
parser: function(match) {
|
||||
return Date.UTC(+match[3] + 2000, match[2] - 1, +match[1]);
|
||||
},
|
||||
alternative: 'mm/dd/YY' // different format with the same regex
|
||||
},
|
||||
'mm/dd/YY': {
|
||||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/,
|
||||
parser: function(match) {
|
||||
return Date.UTC(+match[3] + 2000, match[1] - 1, +match[2]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Parse a date and return it as a number. Overridable through options.parseDate.
|
||||
*/
|
||||
parseDate: function(val) {
|
||||
var parseDate = this.options.parseDate,
|
||||
ret,
|
||||
key,
|
||||
format,
|
||||
dateFormat = this.options.dateFormat || this.dateFormat,
|
||||
match;
|
||||
|
||||
if (parseDate) {
|
||||
ret = parseDate(val);
|
||||
|
||||
} else if (typeof val === 'string') {
|
||||
// Auto-detect the date format the first time
|
||||
if (!dateFormat) {
|
||||
for (key in this.dateFormats) {
|
||||
format = this.dateFormats[key];
|
||||
match = val.match(format.regex);
|
||||
if (match) {
|
||||
this.dateFormat = dateFormat = key;
|
||||
this.alternativeFormat = format.alternative;
|
||||
ret = format.parser(match);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Next time, use the one previously found
|
||||
} else {
|
||||
format = this.dateFormats[dateFormat];
|
||||
match = val.match(format.regex);
|
||||
if (match) {
|
||||
ret = format.parser(match);
|
||||
}
|
||||
}
|
||||
// Fall back to Date.parse
|
||||
if (!match) {
|
||||
match = Date.parse(val);
|
||||
// External tools like Date.js and MooTools extend Date object and
|
||||
// returns a date.
|
||||
if (typeof match === 'object' && match !== null && match.getTime) {
|
||||
ret = match.getTime() - match.getTimezoneOffset() * 60000;
|
||||
|
||||
// Timestamp
|
||||
} else if (isNumber(match)) {
|
||||
ret = match - (new Date(match)).getTimezoneOffset() * 60000;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
* Reorganize rows into columns
|
||||
*/
|
||||
rowsToColumns: function(rows) {
|
||||
var row,
|
||||
rowsLength,
|
||||
col,
|
||||
colsLength,
|
||||
columns;
|
||||
|
||||
if (rows) {
|
||||
columns = [];
|
||||
rowsLength = rows.length;
|
||||
for (row = 0; row < rowsLength; row++) {
|
||||
colsLength = rows[row].length;
|
||||
for (col = 0; col < colsLength; col++) {
|
||||
if (!columns[col]) {
|
||||
columns[col] = [];
|
||||
}
|
||||
columns[col][row] = rows[row][col];
|
||||
}
|
||||
}
|
||||
}
|
||||
return columns;
|
||||
},
|
||||
|
||||
/**
|
||||
* A hook for working directly on the parsed columns
|
||||
*/
|
||||
parsed: function() {
|
||||
if (this.options.parsed) {
|
||||
return this.options.parsed.call(this, this.columns);
|
||||
}
|
||||
},
|
||||
|
||||
getFreeIndexes: function(numberOfColumns, seriesBuilders) {
|
||||
var s,
|
||||
i,
|
||||
freeIndexes = [],
|
||||
freeIndexValues = [],
|
||||
referencedIndexes;
|
||||
|
||||
// Add all columns as free
|
||||
for (i = 0; i < numberOfColumns; i = i + 1) {
|
||||
freeIndexes.push(true);
|
||||
}
|
||||
|
||||
// Loop all defined builders and remove their referenced columns
|
||||
for (s = 0; s < seriesBuilders.length; s = s + 1) {
|
||||
referencedIndexes = seriesBuilders[s].getReferencedColumnIndexes();
|
||||
|
||||
for (i = 0; i < referencedIndexes.length; i = i + 1) {
|
||||
freeIndexes[referencedIndexes[i]] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Collect the values for the free indexes
|
||||
for (i = 0; i < freeIndexes.length; i = i + 1) {
|
||||
if (freeIndexes[i]) {
|
||||
freeIndexValues.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
return freeIndexValues;
|
||||
},
|
||||
|
||||
/**
|
||||
* If a complete callback function is provided in the options, interpret the
|
||||
* columns into a Highcharts options object.
|
||||
*/
|
||||
complete: function() {
|
||||
|
||||
var columns = this.columns,
|
||||
xColumns = [],
|
||||
type,
|
||||
options = this.options,
|
||||
series,
|
||||
data,
|
||||
i,
|
||||
j,
|
||||
r,
|
||||
seriesIndex,
|
||||
chartOptions,
|
||||
allSeriesBuilders = [],
|
||||
builder,
|
||||
freeIndexes,
|
||||
typeCol,
|
||||
index;
|
||||
|
||||
xColumns.length = columns.length;
|
||||
if (options.complete || options.afterComplete) {
|
||||
|
||||
// Get the names and shift the top row
|
||||
for (i = 0; i < columns.length; i++) {
|
||||
if (this.firstRowAsNames) {
|
||||
columns[i].name = columns[i].shift();
|
||||
}
|
||||
}
|
||||
|
||||
// Use the next columns for series
|
||||
series = [];
|
||||
freeIndexes = this.getFreeIndexes(columns.length, this.valueCount.seriesBuilders);
|
||||
|
||||
// Populate defined series
|
||||
for (seriesIndex = 0; seriesIndex < this.valueCount.seriesBuilders.length; seriesIndex++) {
|
||||
builder = this.valueCount.seriesBuilders[seriesIndex];
|
||||
|
||||
// If the builder can be populated with remaining columns, then add it to allBuilders
|
||||
if (builder.populateColumns(freeIndexes)) {
|
||||
allSeriesBuilders.push(builder);
|
||||
}
|
||||
}
|
||||
|
||||
// Populate dynamic series
|
||||
while (freeIndexes.length > 0) {
|
||||
builder = new SeriesBuilder();
|
||||
builder.addColumnReader(0, 'x');
|
||||
|
||||
// Mark index as used (not free)
|
||||
index = inArray(0, freeIndexes);
|
||||
if (index !== -1) {
|
||||
freeIndexes.splice(index, 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < this.valueCount.global; i++) {
|
||||
// Create and add a column reader for the next free column index
|
||||
builder.addColumnReader(undefined, this.valueCount.globalPointArrayMap[i]);
|
||||
}
|
||||
|
||||
// If the builder can be populated with remaining columns, then add it to allBuilders
|
||||
if (builder.populateColumns(freeIndexes)) {
|
||||
allSeriesBuilders.push(builder);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the data-type from the first series x column
|
||||
if (allSeriesBuilders.length > 0 && allSeriesBuilders[0].readers.length > 0) {
|
||||
typeCol = columns[allSeriesBuilders[0].readers[0].columnIndex];
|
||||
if (typeCol !== undefined) {
|
||||
if (typeCol.isDatetime) {
|
||||
type = 'datetime';
|
||||
} else if (!typeCol.isNumeric) {
|
||||
type = 'category';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Axis type is category, then the "x" column should be called "name"
|
||||
if (type === 'category') {
|
||||
for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) {
|
||||
builder = allSeriesBuilders[seriesIndex];
|
||||
for (r = 0; r < builder.readers.length; r++) {
|
||||
if (builder.readers[r].configName === 'x') {
|
||||
builder.readers[r].configName = 'name';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read data for all builders
|
||||
for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) {
|
||||
builder = allSeriesBuilders[seriesIndex];
|
||||
|
||||
// Iterate down the cells of each column and add data to the series
|
||||
data = [];
|
||||
for (j = 0; j < columns[0].length; j++) {
|
||||
data[j] = builder.read(columns, j);
|
||||
}
|
||||
|
||||
// Add the series
|
||||
series[seriesIndex] = {
|
||||
data: data
|
||||
};
|
||||
if (builder.name) {
|
||||
series[seriesIndex].name = builder.name;
|
||||
}
|
||||
if (type === 'category') {
|
||||
series[seriesIndex].turboThreshold = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Do the callback
|
||||
chartOptions = {
|
||||
series: series
|
||||
};
|
||||
if (type) {
|
||||
chartOptions.xAxis = {
|
||||
type: type
|
||||
};
|
||||
if (type === 'category') {
|
||||
chartOptions.xAxis.uniqueNames = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.complete) {
|
||||
options.complete(chartOptions);
|
||||
}
|
||||
|
||||
// The afterComplete hook is used internally to avoid conflict with the externally
|
||||
// available complete option.
|
||||
if (options.afterComplete) {
|
||||
options.afterComplete(chartOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Register the Data prototype and data function on Highcharts
|
||||
Highcharts.Data = Data;
|
||||
Highcharts.data = function(options, chartOptions) {
|
||||
return new Data(options, chartOptions);
|
||||
};
|
||||
|
||||
// Extend Chart.init so that the Chart constructor accepts a new configuration
|
||||
// option group, data.
|
||||
Highcharts.wrap(Highcharts.Chart.prototype, 'init', function(proceed, userOptions, callback) {
|
||||
var chart = this;
|
||||
|
||||
if (userOptions && userOptions.data) {
|
||||
Highcharts.data(Highcharts.extend(userOptions.data, {
|
||||
|
||||
afterComplete: function(dataOptions) {
|
||||
var i, series;
|
||||
|
||||
// Merge series configs
|
||||
if (userOptions.hasOwnProperty('series')) {
|
||||
if (typeof userOptions.series === 'object') {
|
||||
i = Math.max(userOptions.series.length, dataOptions.series.length);
|
||||
while (i--) {
|
||||
series = userOptions.series[i] || {};
|
||||
userOptions.series[i] = Highcharts.merge(series, dataOptions.series[i]);
|
||||
}
|
||||
} else { // Allow merging in dataOptions.series (#2856)
|
||||
delete userOptions.series;
|
||||
}
|
||||
}
|
||||
|
||||
// Do the merge
|
||||
userOptions = Highcharts.merge(dataOptions, userOptions);
|
||||
|
||||
proceed.call(chart, userOptions, callback);
|
||||
}
|
||||
}), userOptions);
|
||||
} else {
|
||||
proceed.call(chart, userOptions, callback);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Creates a new SeriesBuilder. A SeriesBuilder consists of a number
|
||||
* of ColumnReaders that reads columns and give them a name.
|
||||
* Ex: A series builder can be constructed to read column 3 as 'x' and
|
||||
* column 7 and 8 as 'y1' and 'y2'.
|
||||
* The output would then be points/rows of the form {x: 11, y1: 22, y2: 33}
|
||||
*
|
||||
* The name of the builder is taken from the second column. In the above
|
||||
* example it would be the column with index 7.
|
||||
* @constructor
|
||||
*/
|
||||
SeriesBuilder = function() {
|
||||
this.readers = [];
|
||||
this.pointIsArray = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Populates readers with column indexes. A reader can be added without
|
||||
* a specific index and for those readers the index is taken sequentially
|
||||
* from the free columns (this is handled by the ColumnCursor instance).
|
||||
* @returns {boolean}
|
||||
*/
|
||||
SeriesBuilder.prototype.populateColumns = function(freeIndexes) {
|
||||
var builder = this,
|
||||
enoughColumns = true;
|
||||
|
||||
// Loop each reader and give it an index if its missing.
|
||||
// The freeIndexes.shift() will return undefined if there
|
||||
// are no more columns.
|
||||
each(builder.readers, function(reader) {
|
||||
if (reader.columnIndex === undefined) {
|
||||
reader.columnIndex = freeIndexes.shift();
|
||||
}
|
||||
});
|
||||
|
||||
// Now, all readers should have columns mapped. If not
|
||||
// then return false to signal that this series should
|
||||
// not be added.
|
||||
each(builder.readers, function(reader) {
|
||||
if (reader.columnIndex === undefined) {
|
||||
enoughColumns = false;
|
||||
}
|
||||
});
|
||||
|
||||
return enoughColumns;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reads a row from the dataset and returns a point or array depending
|
||||
* on the names of the readers.
|
||||
* @param columns
|
||||
* @param rowIndex
|
||||
* @returns {Array | Object}
|
||||
*/
|
||||
SeriesBuilder.prototype.read = function(columns, rowIndex) {
|
||||
var builder = this,
|
||||
pointIsArray = builder.pointIsArray,
|
||||
point = pointIsArray ? [] : {},
|
||||
columnIndexes;
|
||||
|
||||
// Loop each reader and ask it to read its value.
|
||||
// Then, build an array or point based on the readers names.
|
||||
each(builder.readers, function(reader) {
|
||||
var value = columns[reader.columnIndex][rowIndex];
|
||||
if (pointIsArray) {
|
||||
point.push(value);
|
||||
} else {
|
||||
point[reader.configName] = value;
|
||||
}
|
||||
});
|
||||
|
||||
// The name comes from the first column (excluding the x column)
|
||||
if (this.name === undefined && builder.readers.length >= 2) {
|
||||
columnIndexes = builder.getReferencedColumnIndexes();
|
||||
if (columnIndexes.length >= 2) {
|
||||
// remove the first one (x col)
|
||||
columnIndexes.shift();
|
||||
|
||||
// Sort the remaining
|
||||
columnIndexes.sort();
|
||||
|
||||
// Now use the lowest index as name column
|
||||
this.name = columns[columnIndexes.shift()].name;
|
||||
}
|
||||
}
|
||||
|
||||
return point;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates and adds ColumnReader from the given columnIndex and configName.
|
||||
* ColumnIndex can be undefined and in that case the reader will be given
|
||||
* an index when columns are populated.
|
||||
* @param columnIndex {Number | undefined}
|
||||
* @param configName
|
||||
*/
|
||||
SeriesBuilder.prototype.addColumnReader = function(columnIndex, configName) {
|
||||
this.readers.push({
|
||||
columnIndex: columnIndex,
|
||||
configName: configName
|
||||
});
|
||||
|
||||
if (!(configName === 'x' || configName === 'y' || configName === undefined)) {
|
||||
this.pointIsArray = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns an array of column indexes that the builder will use when
|
||||
* reading data.
|
||||
* @returns {Array}
|
||||
*/
|
||||
SeriesBuilder.prototype.getReferencedColumnIndexes = function() {
|
||||
var i,
|
||||
referencedColumnIndexes = [],
|
||||
columnReader;
|
||||
|
||||
for (i = 0; i < this.readers.length; i = i + 1) {
|
||||
columnReader = this.readers[i];
|
||||
if (columnReader.columnIndex !== undefined) {
|
||||
referencedColumnIndexes.push(columnReader.columnIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return referencedColumnIndexes;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the builder has a reader for the given configName.
|
||||
* @param configName
|
||||
* @returns {boolean}
|
||||
*/
|
||||
SeriesBuilder.prototype.hasReader = function(configName) {
|
||||
var i, columnReader;
|
||||
for (i = 0; i < this.readers.length; i = i + 1) {
|
||||
columnReader = this.readers[i];
|
||||
if (columnReader.configName === configName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Else return undefined
|
||||
};
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
25
assets/plugin/chart/highcharts/code/js/modules/drilldown.js
Executable file
25
assets/plugin/chart/highcharts/code/js/modules/drilldown.js
Executable file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Highcharts Drilldown module
|
||||
|
||||
Author: Torstein Honsi
|
||||
License: www.highcharts.com/license
|
||||
|
||||
*/
|
||||
(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(f){function n(a,b,d){var c;b.rgba.length&&a.rgba.length?(a=a.rgba,b=b.rgba,c=1!==b[3]||1!==a[3],a=(c?"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))+(c?","+(b[3]+(a[3]-b[3])*(1-d)):"")+")"):a=b.input||"none";return a}var C=f.noop,v=f.color,w=f.defaultOptions,l=f.each,p=f.extend,H=f.format,y=f.pick,x=f.wrap,q=f.Chart,
|
||||
t=f.seriesTypes,D=t.pie,r=t.column,E=f.Tick,z=f.fireEvent,F=f.inArray,G=1;l(["fill","stroke"],function(a){f.Fx.prototype[a+"Setter"]=function(){this.elem.attr(a,n(v(this.start),v(this.end),this.pos))}});p(w.lang,{drillUpText:"\u25c1 Back to {series.name}"});w.drilldown={animation:{duration:500},drillUpButton:{position:{align:"right",x:-10,y:10}}};f.SVGRenderer.prototype.Element.prototype.fadeIn=function(a){this.attr({opacity:.1,visibility:"inherit"}).animate({opacity:y(this.newOpacity,1)},a||{duration:250})};
|
||||
q.prototype.addSeriesAsDrilldown=function(a,b){this.addSingleSeriesAsDrilldown(a,b);this.applyDrilldown()};q.prototype.addSingleSeriesAsDrilldown=function(a,b){var d=a.series,c=d.xAxis,e=d.yAxis,h,g=[],k=[],u,m,A;A={colorIndex:y(a.colorIndex,d.colorIndex)};this.drilldownLevels||(this.drilldownLevels=[]);u=d.options._levelNumber||0;(m=this.drilldownLevels[this.drilldownLevels.length-1])&&m.levelNumber!==u&&(m=void 0);b=p(p({_ddSeriesId:G++},A),b);h=F(a,d.points);l(d.chart.series,function(a){a.xAxis!==
|
||||
c||a.isDrilling||(a.options._ddSeriesId=a.options._ddSeriesId||G++,a.options._colorIndex=a.userOptions._colorIndex,a.options._levelNumber=a.options._levelNumber||u,m?(g=m.levelSeries,k=m.levelSeriesOptions):(g.push(a),k.push(a.options)))});a=p({levelNumber:u,seriesOptions:d.options,levelSeriesOptions:k,levelSeries:g,shapeArgs:a.shapeArgs,bBox:a.graphic?a.graphic.getBBox():{},color:a.isNull?(new f.Color(v)).setOpacity(0).get():v,lowerSeriesOptions:b,pointOptions:d.options.data[h],pointIndex:h,oldExtremes:{xMin:c&&
|
||||
c.userMin,xMax:c&&c.userMax,yMin:e&&e.userMin,yMax:e&&e.userMax}},A);this.drilldownLevels.push(a);b=a.lowerSeries=this.addSeries(b,!1);b.options._levelNumber=u+1;c&&(c.oldPos=c.pos,c.userMin=c.userMax=null,e.userMin=e.userMax=null);d.type===b.type&&(b.animate=b.animateDrilldown||C,b.options.animation=!0)};q.prototype.applyDrilldown=function(){var a=this.drilldownLevels,b;a&&0<a.length&&(b=a[a.length-1].levelNumber,l(this.drilldownLevels,function(a){a.levelNumber===b&&l(a.levelSeries,function(a){a.options&&
|
||||
a.options._levelNumber===b&&a.remove(!1)})}));this.redraw();this.showDrillUpButton()};q.prototype.getDrilldownBackText=function(){var a=this.drilldownLevels;if(a&&0<a.length)return a=a[a.length-1],a.series=a.seriesOptions,H(this.options.lang.drillUpText,a)};q.prototype.showDrillUpButton=function(){var a=this,b=this.getDrilldownBackText(),d=a.options.drilldown.drillUpButton,c,e;this.drillUpButton?this.drillUpButton.attr({text:b}).align():(e=(c=d.theme)&&c.states,this.drillUpButton=this.renderer.button(b,
|
||||
null,null,function(){a.drillUp()},c,e&&e.hover,e&&e.select).addClass("highcharts-drillup-button").attr({align:d.position.align,zIndex:7}).add().align(d.position,!1,d.relativeTo||"plotBox"))};q.prototype.drillUp=function(){for(var a=this,b=a.drilldownLevels,d=b[b.length-1].levelNumber,c=b.length,e=a.series,h,g,k,f,m=function(c){var b;l(e,function(a){a.options._ddSeriesId===c._ddSeriesId&&(b=a)});b=b||a.addSeries(c,!1);b.type===k.type&&b.animateDrillupTo&&(b.animate=b.animateDrillupTo);c===g.seriesOptions&&
|
||||
(f=b)};c--;)if(g=b[c],g.levelNumber===d){b.pop();k=g.lowerSeries;if(!k.chart)for(h=e.length;h--;)if(e[h].options.id===g.lowerSeriesOptions.id&&e[h].options._levelNumber===d+1){k=e[h];break}k.xData=[];l(g.levelSeriesOptions,m);z(a,"drillup",{seriesOptions:g.seriesOptions});f.type===k.type&&(f.drilldownLevel=g,f.options.animation=a.options.drilldown.animation,k.animateDrillupFrom&&k.chart&&k.animateDrillupFrom(g));f.options._levelNumber=d;k.remove(!1);f.xAxis&&(h=g.oldExtremes,f.xAxis.setExtremes(h.xMin,
|
||||
h.xMax,!1),f.yAxis.setExtremes(h.yMin,h.yMax,!1))}z(a,"drillupall");this.redraw();0===this.drilldownLevels.length?this.drillUpButton=this.drillUpButton.destroy():this.drillUpButton.attr({text:this.getDrilldownBackText()}).align();this.ddDupes.length=[]};r.prototype.supportsDrilldown=!0;r.prototype.animateDrillupTo=function(a){if(!a){var b=this,d=b.drilldownLevel;l(this.points,function(a){a.graphic&&a.graphic.hide();a.dataLabel&&a.dataLabel.hide();a.connector&&a.connector.hide()});setTimeout(function(){b.points&&
|
||||
l(b.points,function(a,b){b=b===(d&&d.pointIndex)?"show":"fadeIn";var c="show"===b?!0:void 0;if(a.graphic)a.graphic[b](c);if(a.dataLabel)a.dataLabel[b](c);if(a.connector)a.connector[b](c)})},Math.max(this.chart.options.drilldown.animation.duration-50,0));this.animate=C}};r.prototype.animateDrilldown=function(a){var b=this,d=this.chart.drilldownLevels,c,e=this.chart.options.drilldown.animation,h=this.xAxis;a||(l(d,function(a){b.options._ddSeriesId===a.lowerSeriesOptions._ddSeriesId&&(c=a.shapeArgs)}),
|
||||
c.x+=y(h.oldPos,h.pos)-h.pos,l(this.points,function(a){a.graphic&&a.graphic.attr(c).animate(p(a.shapeArgs,{fill:a.color||b.color}),e);a.dataLabel&&a.dataLabel.fadeIn(e)}),this.animate=null)};r.prototype.animateDrillupFrom=function(a){var b=this.chart.options.drilldown.animation,d=this.group,c=this;l(c.trackerGroups,function(a){if(c[a])c[a].on("mouseover")});delete this.group;l(this.points,function(c){var e=c.graphic,g=a.shapeArgs,k=function(){e.destroy();d&&(d=d.destroy())};e&&(delete c.graphic,b?
|
||||
e.animate(g,f.merge(b,{complete:k})):(e.attr(g),k()))})};D&&p(D.prototype,{supportsDrilldown:!0,animateDrillupTo:r.prototype.animateDrillupTo,animateDrillupFrom:r.prototype.animateDrillupFrom,animateDrilldown:function(a){var b=this.chart.options.drilldown.animation,d=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1].shapeArgs,c=d.start,e=(d.end-c)/this.points.length;a||(l(this.points,function(a,g){var h=a.shapeArgs;if(a.graphic)a.graphic.attr(f.merge(d,{start:c+g*e,end:c+(g+1)*e}))[b?
|
||||
"animate":"attr"](h,b)}),this.animate=null)}});f.Point.prototype.doDrilldown=function(a,b,d){var c=this.series.chart,e=c.options.drilldown,f=(e.series||[]).length,g;c.ddDupes||(c.ddDupes=[]);for(;f--&&!g;)e.series[f].id===this.drilldown&&-1===F(this.drilldown,c.ddDupes)&&(g=e.series[f],c.ddDupes.push(this.drilldown));z(c,"drilldown",{point:this,seriesOptions:g,category:b,originalEvent:d,points:void 0!==b&&this.series.xAxis.getDDPoints(b).slice(0)},function(b){var c=b.point.series&&b.point.series.chart,
|
||||
d=b.seriesOptions;c&&d&&(a?c.addSingleSeriesAsDrilldown(b.point,d):c.addSeriesAsDrilldown(b.point,d))})};f.Axis.prototype.drilldownCategory=function(a,b){var d,c,e=this.getDDPoints(a);for(d in e)(c=e[d])&&c.series&&c.series.visible&&c.doDrilldown&&c.doDrilldown(!0,a,b);this.chart.applyDrilldown()};f.Axis.prototype.getDDPoints=function(a){var b=[];l(this.series,function(d){var c,e=d.xData,f=d.points;for(c=0;c<e.length;c++)if(e[c]===a&&d.options.data[c]&&d.options.data[c].drilldown){b.push(f?f[c]:!0);
|
||||
break}});return b};E.prototype.drillable=function(){var a=this.pos,b=this.label,d=this.axis,c="xAxis"===d.coll&&d.getDDPoints,e=c&&d.getDDPoints(a);c&&(b&&e.length?(b.drillable=!0,b.addClass("highcharts-drilldown-axis-label").on("click",function(b){d.drilldownCategory(a,b)})):b&&b.drillable&&(b.on("click",null),b.removeClass("highcharts-drilldown-axis-label")))};x(E.prototype,"addLabel",function(a){a.call(this);this.drillable()});x(f.Point.prototype,"init",function(a,b,d,c){var e=a.call(this,b,d,
|
||||
c);c=(a=b.xAxis)&&a.ticks[c];e.drilldown&&f.addEvent(e,"click",function(a){b.xAxis&&!1===b.chart.options.drilldown.allowPointDrilldown?b.xAxis.drilldownCategory(e.x,a):e.doDrilldown(void 0,void 0,a)});c&&c.drillable();return e});x(f.Series.prototype,"drawDataLabels",function(a){var b=this.chart.options.drilldown.activeDataLabelStyle,d=this.chart.renderer;a.call(this);l(this.points,function(a){a.drilldown&&a.dataLabel&&("contrast"===b.color&&d.getContrast(a.color||this.color),a.dataLabel.addClass("highcharts-drilldown-data-label"))},
|
||||
this)});var B,w=function(a){a.call(this);l(this.points,function(a){a.drilldown&&a.graphic&&a.graphic.addClass("highcharts-drilldown-point")})};for(B in t)t[B].prototype.supportsDrilldown&&x(t[B].prototype,"drawTracker",w)})(n)});
|
||||
751
assets/plugin/chart/highcharts/code/js/modules/drilldown.src.js
Executable file
751
assets/plugin/chart/highcharts/code/js/modules/drilldown.src.js
Executable file
@ -0,0 +1,751 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Highcharts Drilldown module
|
||||
*
|
||||
* Author: Torstein Honsi
|
||||
* License: www.highcharts.com/license
|
||||
*
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* Highcharts Drilldown module
|
||||
*
|
||||
* Author: Torstein Honsi
|
||||
* License: www.highcharts.com/license
|
||||
*
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var noop = H.noop,
|
||||
color = H.color,
|
||||
defaultOptions = H.defaultOptions,
|
||||
each = H.each,
|
||||
extend = H.extend,
|
||||
format = H.format,
|
||||
pick = H.pick,
|
||||
wrap = H.wrap,
|
||||
Chart = H.Chart,
|
||||
seriesTypes = H.seriesTypes,
|
||||
PieSeries = seriesTypes.pie,
|
||||
ColumnSeries = seriesTypes.column,
|
||||
Tick = H.Tick,
|
||||
fireEvent = H.fireEvent,
|
||||
inArray = H.inArray,
|
||||
ddSeriesId = 1;
|
||||
|
||||
// Utilities
|
||||
/*
|
||||
* Return an intermediate color between two colors, according to pos where 0
|
||||
* is the from color and 1 is the to color. This method is copied from ColorAxis.js
|
||||
* and should always be kept updated, until we get AMD support.
|
||||
*/
|
||||
function tweenColors(from, to, pos) {
|
||||
// Check for has alpha, because rgba colors perform worse due to lack of
|
||||
// support in WebKit.
|
||||
var hasAlpha,
|
||||
ret;
|
||||
|
||||
// Unsupported color, return to-color (#3920)
|
||||
if (!to.rgba.length || !from.rgba.length) {
|
||||
ret = to.input || 'none';
|
||||
|
||||
// Interpolate
|
||||
} else {
|
||||
from = from.rgba;
|
||||
to = to.rgba;
|
||||
hasAlpha = (to[3] !== 1 || from[3] !== 1);
|
||||
ret = (hasAlpha ? 'rgba(' : 'rgb(') +
|
||||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
|
||||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
|
||||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
|
||||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* Handle animation of the color attributes directly
|
||||
*/
|
||||
each(['fill', 'stroke'], function(prop) {
|
||||
H.Fx.prototype[prop + 'Setter'] = function() {
|
||||
this.elem.attr(prop, tweenColors(color(this.start), color(this.end), this.pos));
|
||||
};
|
||||
});
|
||||
|
||||
// Add language
|
||||
extend(defaultOptions.lang, {
|
||||
drillUpText: '◁ Back to {series.name}'
|
||||
});
|
||||
defaultOptions.drilldown = {
|
||||
|
||||
animation: {
|
||||
duration: 500
|
||||
},
|
||||
drillUpButton: {
|
||||
position: {
|
||||
align: 'right',
|
||||
x: -10,
|
||||
y: 10
|
||||
}
|
||||
// relativeTo: 'plotBox'
|
||||
// theme
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A general fadeIn method
|
||||
*/
|
||||
H.SVGRenderer.prototype.Element.prototype.fadeIn = function(animation) {
|
||||
this
|
||||
.attr({
|
||||
opacity: 0.1,
|
||||
visibility: 'inherit'
|
||||
})
|
||||
.animate({
|
||||
opacity: pick(this.newOpacity, 1) // newOpacity used in maps
|
||||
}, animation || {
|
||||
duration: 250
|
||||
});
|
||||
};
|
||||
|
||||
Chart.prototype.addSeriesAsDrilldown = function(point, ddOptions) {
|
||||
this.addSingleSeriesAsDrilldown(point, ddOptions);
|
||||
this.applyDrilldown();
|
||||
};
|
||||
Chart.prototype.addSingleSeriesAsDrilldown = function(point, ddOptions) {
|
||||
var oldSeries = point.series,
|
||||
xAxis = oldSeries.xAxis,
|
||||
yAxis = oldSeries.yAxis,
|
||||
newSeries,
|
||||
pointIndex,
|
||||
levelSeries = [],
|
||||
levelSeriesOptions = [],
|
||||
level,
|
||||
levelNumber,
|
||||
last,
|
||||
colorProp;
|
||||
|
||||
|
||||
|
||||
colorProp = {
|
||||
colorIndex: pick(point.colorIndex, oldSeries.colorIndex)
|
||||
};
|
||||
|
||||
|
||||
if (!this.drilldownLevels) {
|
||||
this.drilldownLevels = [];
|
||||
}
|
||||
|
||||
levelNumber = oldSeries.options._levelNumber || 0;
|
||||
|
||||
// See if we can reuse the registered series from last run
|
||||
last = this.drilldownLevels[this.drilldownLevels.length - 1];
|
||||
if (last && last.levelNumber !== levelNumber) {
|
||||
last = undefined;
|
||||
}
|
||||
|
||||
ddOptions = extend(extend({
|
||||
_ddSeriesId: ddSeriesId++
|
||||
}, colorProp), ddOptions);
|
||||
pointIndex = inArray(point, oldSeries.points);
|
||||
|
||||
// Record options for all current series
|
||||
each(oldSeries.chart.series, function(series) {
|
||||
if (series.xAxis === xAxis && !series.isDrilling) {
|
||||
series.options._ddSeriesId = series.options._ddSeriesId || ddSeriesId++;
|
||||
series.options._colorIndex = series.userOptions._colorIndex;
|
||||
series.options._levelNumber = series.options._levelNumber || levelNumber; // #3182
|
||||
|
||||
if (last) {
|
||||
levelSeries = last.levelSeries;
|
||||
levelSeriesOptions = last.levelSeriesOptions;
|
||||
} else {
|
||||
levelSeries.push(series);
|
||||
levelSeriesOptions.push(series.options);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Add a record of properties for each drilldown level
|
||||
level = extend({
|
||||
levelNumber: levelNumber,
|
||||
seriesOptions: oldSeries.options,
|
||||
levelSeriesOptions: levelSeriesOptions,
|
||||
levelSeries: levelSeries,
|
||||
shapeArgs: point.shapeArgs,
|
||||
bBox: point.graphic ? point.graphic.getBBox() : {}, // no graphic in line series with markers disabled
|
||||
color: point.isNull ? new H.Color(color).setOpacity(0).get() : color,
|
||||
lowerSeriesOptions: ddOptions,
|
||||
pointOptions: oldSeries.options.data[pointIndex],
|
||||
pointIndex: pointIndex,
|
||||
oldExtremes: {
|
||||
xMin: xAxis && xAxis.userMin,
|
||||
xMax: xAxis && xAxis.userMax,
|
||||
yMin: yAxis && yAxis.userMin,
|
||||
yMax: yAxis && yAxis.userMax
|
||||
}
|
||||
}, colorProp);
|
||||
|
||||
// Push it to the lookup array
|
||||
this.drilldownLevels.push(level);
|
||||
|
||||
newSeries = level.lowerSeries = this.addSeries(ddOptions, false);
|
||||
newSeries.options._levelNumber = levelNumber + 1;
|
||||
if (xAxis) {
|
||||
xAxis.oldPos = xAxis.pos;
|
||||
xAxis.userMin = xAxis.userMax = null;
|
||||
yAxis.userMin = yAxis.userMax = null;
|
||||
}
|
||||
|
||||
// Run fancy cross-animation on supported and equal types
|
||||
if (oldSeries.type === newSeries.type) {
|
||||
newSeries.animate = newSeries.animateDrilldown || noop;
|
||||
newSeries.options.animation = true;
|
||||
}
|
||||
};
|
||||
|
||||
Chart.prototype.applyDrilldown = function() {
|
||||
var drilldownLevels = this.drilldownLevels,
|
||||
levelToRemove;
|
||||
|
||||
if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading
|
||||
levelToRemove = drilldownLevels[drilldownLevels.length - 1].levelNumber;
|
||||
each(this.drilldownLevels, function(level) {
|
||||
if (level.levelNumber === levelToRemove) {
|
||||
each(level.levelSeries, function(series) {
|
||||
if (series.options && series.options._levelNumber === levelToRemove) { // Not removed, not added as part of a multi-series drilldown
|
||||
series.remove(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.redraw();
|
||||
this.showDrillUpButton();
|
||||
};
|
||||
|
||||
Chart.prototype.getDrilldownBackText = function() {
|
||||
var drilldownLevels = this.drilldownLevels,
|
||||
lastLevel;
|
||||
if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading
|
||||
lastLevel = drilldownLevels[drilldownLevels.length - 1];
|
||||
lastLevel.series = lastLevel.seriesOptions;
|
||||
return format(this.options.lang.drillUpText, lastLevel);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Chart.prototype.showDrillUpButton = function() {
|
||||
var chart = this,
|
||||
backText = this.getDrilldownBackText(),
|
||||
buttonOptions = chart.options.drilldown.drillUpButton,
|
||||
attr,
|
||||
states;
|
||||
|
||||
|
||||
if (!this.drillUpButton) {
|
||||
attr = buttonOptions.theme;
|
||||
states = attr && attr.states;
|
||||
|
||||
this.drillUpButton = this.renderer.button(
|
||||
backText,
|
||||
null,
|
||||
null,
|
||||
function() {
|
||||
chart.drillUp();
|
||||
},
|
||||
attr,
|
||||
states && states.hover,
|
||||
states && states.select
|
||||
)
|
||||
.addClass('highcharts-drillup-button')
|
||||
.attr({
|
||||
align: buttonOptions.position.align,
|
||||
zIndex: 7
|
||||
})
|
||||
.add()
|
||||
.align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox');
|
||||
} else {
|
||||
this.drillUpButton.attr({
|
||||
text: backText
|
||||
})
|
||||
.align();
|
||||
}
|
||||
};
|
||||
|
||||
Chart.prototype.drillUp = function() {
|
||||
var chart = this,
|
||||
drilldownLevels = chart.drilldownLevels,
|
||||
levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber,
|
||||
i = drilldownLevels.length,
|
||||
chartSeries = chart.series,
|
||||
seriesI,
|
||||
level,
|
||||
oldSeries,
|
||||
newSeries,
|
||||
oldExtremes,
|
||||
addSeries = function(seriesOptions) {
|
||||
var addedSeries;
|
||||
each(chartSeries, function(series) {
|
||||
if (series.options._ddSeriesId === seriesOptions._ddSeriesId) {
|
||||
addedSeries = series;
|
||||
}
|
||||
});
|
||||
|
||||
addedSeries = addedSeries || chart.addSeries(seriesOptions, false);
|
||||
if (addedSeries.type === oldSeries.type && addedSeries.animateDrillupTo) {
|
||||
addedSeries.animate = addedSeries.animateDrillupTo;
|
||||
}
|
||||
if (seriesOptions === level.seriesOptions) {
|
||||
newSeries = addedSeries;
|
||||
}
|
||||
};
|
||||
|
||||
while (i--) {
|
||||
|
||||
level = drilldownLevels[i];
|
||||
if (level.levelNumber === levelNumber) {
|
||||
drilldownLevels.pop();
|
||||
|
||||
// Get the lower series by reference or id
|
||||
oldSeries = level.lowerSeries;
|
||||
if (!oldSeries.chart) { // #2786
|
||||
seriesI = chartSeries.length; // #2919
|
||||
while (seriesI--) {
|
||||
if (chartSeries[seriesI].options.id === level.lowerSeriesOptions.id &&
|
||||
chartSeries[seriesI].options._levelNumber === levelNumber + 1) { // #3867
|
||||
oldSeries = chartSeries[seriesI];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
oldSeries.xData = []; // Overcome problems with minRange (#2898)
|
||||
|
||||
each(level.levelSeriesOptions, addSeries);
|
||||
|
||||
fireEvent(chart, 'drillup', {
|
||||
seriesOptions: level.seriesOptions
|
||||
});
|
||||
|
||||
if (newSeries.type === oldSeries.type) {
|
||||
newSeries.drilldownLevel = level;
|
||||
newSeries.options.animation = chart.options.drilldown.animation;
|
||||
|
||||
if (oldSeries.animateDrillupFrom && oldSeries.chart) { // #2919
|
||||
oldSeries.animateDrillupFrom(level);
|
||||
}
|
||||
}
|
||||
newSeries.options._levelNumber = levelNumber;
|
||||
|
||||
oldSeries.remove(false);
|
||||
|
||||
// Reset the zoom level of the upper series
|
||||
if (newSeries.xAxis) {
|
||||
oldExtremes = level.oldExtremes;
|
||||
newSeries.xAxis.setExtremes(oldExtremes.xMin, oldExtremes.xMax, false);
|
||||
newSeries.yAxis.setExtremes(oldExtremes.yMin, oldExtremes.yMax, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fire a once-off event after all series have been drilled up (#5158)
|
||||
fireEvent(chart, 'drillupall');
|
||||
|
||||
this.redraw();
|
||||
|
||||
if (this.drilldownLevels.length === 0) {
|
||||
this.drillUpButton = this.drillUpButton.destroy();
|
||||
} else {
|
||||
this.drillUpButton.attr({
|
||||
text: this.getDrilldownBackText()
|
||||
})
|
||||
.align();
|
||||
}
|
||||
|
||||
this.ddDupes.length = []; // #3315
|
||||
};
|
||||
|
||||
|
||||
ColumnSeries.prototype.supportsDrilldown = true;
|
||||
|
||||
/**
|
||||
* When drilling up, keep the upper series invisible until the lower series has
|
||||
* moved into place
|
||||
*/
|
||||
ColumnSeries.prototype.animateDrillupTo = function(init) {
|
||||
if (!init) {
|
||||
var newSeries = this,
|
||||
level = newSeries.drilldownLevel;
|
||||
|
||||
each(this.points, function(point) {
|
||||
if (point.graphic) { // #3407
|
||||
point.graphic.hide();
|
||||
}
|
||||
if (point.dataLabel) {
|
||||
point.dataLabel.hide();
|
||||
}
|
||||
if (point.connector) {
|
||||
point.connector.hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Do dummy animation on first point to get to complete
|
||||
setTimeout(function() {
|
||||
if (newSeries.points) { // May be destroyed in the meantime, #3389
|
||||
each(newSeries.points, function(point, i) {
|
||||
// Fade in other points
|
||||
var verb = i === (level && level.pointIndex) ? 'show' : 'fadeIn',
|
||||
inherit = verb === 'show' ? true : undefined;
|
||||
if (point.graphic) { // #3407
|
||||
point.graphic[verb](inherit);
|
||||
}
|
||||
if (point.dataLabel) {
|
||||
point.dataLabel[verb](inherit);
|
||||
}
|
||||
if (point.connector) {
|
||||
point.connector[verb](inherit);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, Math.max(this.chart.options.drilldown.animation.duration - 50, 0));
|
||||
|
||||
// Reset
|
||||
this.animate = noop;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ColumnSeries.prototype.animateDrilldown = function(init) {
|
||||
var series = this,
|
||||
drilldownLevels = this.chart.drilldownLevels,
|
||||
animateFrom,
|
||||
animationOptions = this.chart.options.drilldown.animation,
|
||||
xAxis = this.xAxis;
|
||||
|
||||
if (!init) {
|
||||
each(drilldownLevels, function(level) {
|
||||
if (series.options._ddSeriesId === level.lowerSeriesOptions._ddSeriesId) {
|
||||
animateFrom = level.shapeArgs;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
animateFrom.x += (pick(xAxis.oldPos, xAxis.pos) - xAxis.pos);
|
||||
|
||||
each(this.points, function(point) {
|
||||
var animateTo = point.shapeArgs;
|
||||
|
||||
|
||||
|
||||
if (point.graphic) {
|
||||
point.graphic
|
||||
.attr(animateFrom)
|
||||
.animate(
|
||||
extend(point.shapeArgs, {
|
||||
fill: point.color || series.color
|
||||
}),
|
||||
animationOptions
|
||||
);
|
||||
}
|
||||
if (point.dataLabel) {
|
||||
point.dataLabel.fadeIn(animationOptions);
|
||||
}
|
||||
});
|
||||
this.animate = null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* When drilling up, pull out the individual point graphics from the lower series
|
||||
* and animate them into the origin point in the upper series.
|
||||
*/
|
||||
ColumnSeries.prototype.animateDrillupFrom = function(level) {
|
||||
var animationOptions = this.chart.options.drilldown.animation,
|
||||
group = this.group,
|
||||
series = this;
|
||||
|
||||
// Cancel mouse events on the series group (#2787)
|
||||
each(series.trackerGroups, function(key) {
|
||||
if (series[key]) { // we don't always have dataLabelsGroup
|
||||
series[key].on('mouseover');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
delete this.group;
|
||||
each(this.points, function(point) {
|
||||
var graphic = point.graphic,
|
||||
animateTo = level.shapeArgs,
|
||||
complete = function() {
|
||||
graphic.destroy();
|
||||
if (group) {
|
||||
group = group.destroy();
|
||||
}
|
||||
};
|
||||
|
||||
if (graphic) {
|
||||
|
||||
delete point.graphic;
|
||||
|
||||
|
||||
|
||||
if (animationOptions) {
|
||||
graphic.animate(
|
||||
animateTo,
|
||||
H.merge(animationOptions, {
|
||||
complete: complete
|
||||
})
|
||||
);
|
||||
} else {
|
||||
graphic.attr(animateTo);
|
||||
complete();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (PieSeries) {
|
||||
extend(PieSeries.prototype, {
|
||||
supportsDrilldown: true,
|
||||
animateDrillupTo: ColumnSeries.prototype.animateDrillupTo,
|
||||
animateDrillupFrom: ColumnSeries.prototype.animateDrillupFrom,
|
||||
|
||||
animateDrilldown: function(init) {
|
||||
var level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
|
||||
animationOptions = this.chart.options.drilldown.animation,
|
||||
animateFrom = level.shapeArgs,
|
||||
start = animateFrom.start,
|
||||
angle = animateFrom.end - start,
|
||||
startAngle = angle / this.points.length;
|
||||
|
||||
if (!init) {
|
||||
each(this.points, function(point, i) {
|
||||
var animateTo = point.shapeArgs;
|
||||
|
||||
|
||||
|
||||
if (point.graphic) {
|
||||
point.graphic
|
||||
.attr(H.merge(animateFrom, {
|
||||
start: start + i * startAngle,
|
||||
end: start + (i + 1) * startAngle
|
||||
}))[animationOptions ? 'animate' : 'attr'](
|
||||
animateTo,
|
||||
animationOptions
|
||||
);
|
||||
}
|
||||
});
|
||||
this.animate = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
H.Point.prototype.doDrilldown = function(_holdRedraw, category, originalEvent) {
|
||||
var series = this.series,
|
||||
chart = series.chart,
|
||||
drilldown = chart.options.drilldown,
|
||||
i = (drilldown.series || []).length,
|
||||
seriesOptions;
|
||||
|
||||
if (!chart.ddDupes) {
|
||||
chart.ddDupes = [];
|
||||
}
|
||||
|
||||
while (i-- && !seriesOptions) {
|
||||
if (drilldown.series[i].id === this.drilldown && inArray(this.drilldown, chart.ddDupes) === -1) {
|
||||
seriesOptions = drilldown.series[i];
|
||||
chart.ddDupes.push(this.drilldown);
|
||||
}
|
||||
}
|
||||
|
||||
// Fire the event. If seriesOptions is undefined, the implementer can check for
|
||||
// seriesOptions, and call addSeriesAsDrilldown async if necessary.
|
||||
fireEvent(chart, 'drilldown', {
|
||||
point: this,
|
||||
seriesOptions: seriesOptions,
|
||||
category: category,
|
||||
originalEvent: originalEvent,
|
||||
points: category !== undefined && this.series.xAxis.getDDPoints(category).slice(0)
|
||||
}, function(e) {
|
||||
var chart = e.point.series && e.point.series.chart,
|
||||
seriesOptions = e.seriesOptions;
|
||||
if (chart && seriesOptions) {
|
||||
if (_holdRedraw) {
|
||||
chart.addSingleSeriesAsDrilldown(e.point, seriesOptions);
|
||||
} else {
|
||||
chart.addSeriesAsDrilldown(e.point, seriesOptions);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Drill down to a given category. This is the same as clicking on an axis label.
|
||||
*/
|
||||
H.Axis.prototype.drilldownCategory = function(x, e) {
|
||||
var key,
|
||||
point,
|
||||
ddPointsX = this.getDDPoints(x);
|
||||
for (key in ddPointsX) {
|
||||
point = ddPointsX[key];
|
||||
if (point && point.series && point.series.visible && point.doDrilldown) { // #3197
|
||||
point.doDrilldown(true, x, e);
|
||||
}
|
||||
}
|
||||
this.chart.applyDrilldown();
|
||||
};
|
||||
|
||||
/**
|
||||
* Return drillable points for this specific X value
|
||||
*/
|
||||
H.Axis.prototype.getDDPoints = function(x) {
|
||||
var ret = [];
|
||||
each(this.series, function(series) {
|
||||
var i,
|
||||
xData = series.xData,
|
||||
points = series.points;
|
||||
|
||||
for (i = 0; i < xData.length; i++) {
|
||||
if (xData[i] === x && series.options.data[i] && series.options.data[i].drilldown) {
|
||||
ret.push(points ? points[i] : true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Make a tick label drillable, or remove drilling on update
|
||||
*/
|
||||
Tick.prototype.drillable = function() {
|
||||
var pos = this.pos,
|
||||
label = this.label,
|
||||
axis = this.axis,
|
||||
isDrillable = axis.coll === 'xAxis' && axis.getDDPoints,
|
||||
ddPointsX = isDrillable && axis.getDDPoints(pos);
|
||||
|
||||
if (isDrillable) {
|
||||
if (label && ddPointsX.length) {
|
||||
label.drillable = true;
|
||||
|
||||
|
||||
|
||||
label
|
||||
.addClass('highcharts-drilldown-axis-label')
|
||||
|
||||
.on('click', function(e) {
|
||||
axis.drilldownCategory(pos, e);
|
||||
});
|
||||
|
||||
} else if (label && label.drillable) {
|
||||
|
||||
|
||||
|
||||
label.on('click', null); // #3806
|
||||
label.removeClass('highcharts-drilldown-axis-label');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Always keep the drillability updated (#3951)
|
||||
*/
|
||||
wrap(Tick.prototype, 'addLabel', function(proceed) {
|
||||
proceed.call(this);
|
||||
this.drillable();
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* On initialization of each point, identify its label and make it clickable. Also, provide a
|
||||
* list of points associated to that label.
|
||||
*/
|
||||
wrap(H.Point.prototype, 'init', function(proceed, series, options, x) {
|
||||
var point = proceed.call(this, series, options, x),
|
||||
xAxis = series.xAxis,
|
||||
tick = xAxis && xAxis.ticks[x];
|
||||
|
||||
if (point.drilldown) {
|
||||
|
||||
// Add the click event to the point
|
||||
H.addEvent(point, 'click', function(e) {
|
||||
if (series.xAxis && series.chart.options.drilldown.allowPointDrilldown === false) {
|
||||
series.xAxis.drilldownCategory(point.x, e); // #5822, x changed
|
||||
} else {
|
||||
point.doDrilldown(undefined, undefined, e);
|
||||
}
|
||||
});
|
||||
/*wrap(point, 'importEvents', function (proceed) { // wrapping importEvents makes point.click event work
|
||||
if (!this.hasImportedEvents) {
|
||||
proceed.call(this);
|
||||
H.addEvent(this, 'click', function () {
|
||||
this.doDrilldown();
|
||||
});
|
||||
}
|
||||
});*/
|
||||
|
||||
}
|
||||
|
||||
// Add or remove click handler and style on the tick label
|
||||
if (tick) {
|
||||
tick.drillable();
|
||||
}
|
||||
|
||||
return point;
|
||||
});
|
||||
|
||||
wrap(H.Series.prototype, 'drawDataLabels', function(proceed) {
|
||||
var css = this.chart.options.drilldown.activeDataLabelStyle,
|
||||
renderer = this.chart.renderer;
|
||||
|
||||
proceed.call(this);
|
||||
|
||||
each(this.points, function(point) {
|
||||
var pointCSS = {};
|
||||
if (point.drilldown && point.dataLabel) {
|
||||
if (css.color === 'contrast') {
|
||||
pointCSS.color = renderer.getContrast(point.color || this.color);
|
||||
}
|
||||
point.dataLabel
|
||||
.addClass('highcharts-drilldown-data-label');
|
||||
|
||||
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
|
||||
// Mark the trackers with a pointer
|
||||
var type,
|
||||
drawTrackerWrapper = function(proceed) {
|
||||
proceed.call(this);
|
||||
each(this.points, function(point) {
|
||||
if (point.drilldown && point.graphic) {
|
||||
point.graphic.addClass('highcharts-drilldown-point');
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
for (type in seriesTypes) {
|
||||
if (seriesTypes[type].prototype.supportsDrilldown) {
|
||||
wrap(seriesTypes[type].prototype, 'drawTracker', drawTrackerWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
26
assets/plugin/chart/highcharts/code/js/modules/exporting.js
Executable file
26
assets/plugin/chart/highcharts/code/js/modules/exporting.js
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Exporting module
|
||||
|
||||
(c) 2010-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(q){"object"===typeof module&&module.exports?module.exports=q:q(Highcharts)})(function(q){(function(f){var q=f.defaultOptions,v=f.doc,A=f.Chart,x=f.addEvent,F=f.removeEvent,G=f.fireEvent,w=f.createElement,B=f.discardElement,H=f.css,p=f.merge,C=f.pick,u=f.each,y=f.extend,I=f.splat,z=f.win,D=f.SVGRenderer,J=f.Renderer.prototype.symbols;y(q.lang,{printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",
|
||||
contextButtonTitle:"Chart context menu"});q.navigation={buttonOptions:{theme:{},symbolSize:14,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,verticalAlign:"top",width:24}};q.exporting={type:"image/png",url:"https://export.highcharts.com/",printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton",menuClassName:"highcharts-contextmenu",symbol:"menu",_titleKey:"contextButtonTitle",menuItems:[{textKey:"printChart",onclick:function(){this.print()}},{separator:!0},
|
||||
{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}]}}};f.post=function(a,b,d){var e;a=w("form",p({method:"post",action:a,enctype:"multipart/form-data"},d),{display:"none"},v.body);for(e in b)w("input",{type:"hidden",name:e,value:b[e]},
|
||||
null,a);a.submit();B(a)};y(A.prototype,{sanitizeSVG:function(a){return a=a.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|")(\S+)("|")\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'\x3csvg xmlns:xlink\x3d"http://www.w3.org/1999/xlink" ').replace(/ (NS[0-9]+\:)?href=/g," xlink:href\x3d").replace(/\n/," ").replace(/<\/svg>.*?$/,"\x3c/svg\x3e").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g,
|
||||
'$1\x3d"rgb($2)" $1-opacity\x3d"$3"').replace(/ /g,"\u00a0").replace(/­/g,"\u00ad")},getChartHTML:function(){this.inlineStyles();return this.container.innerHTML},getSVG:function(a){var b=this,d,e,g,E,k,c=p(b.options,a),n=c.exporting.allowHTML;v.createElementNS||(v.createElementNS=function(a,b){return v.createElement(b)});e=w("div",null,{position:"absolute",top:"-9999em",width:b.chartWidth+"px",height:b.chartHeight+"px"},v.body);g=b.renderTo.style.width;k=b.renderTo.style.height;g=c.exporting.sourceWidth||
|
||||
c.chart.width||/px$/.test(g)&&parseInt(g,10)||600;k=c.exporting.sourceHeight||c.chart.height||/px$/.test(k)&&parseInt(k,10)||400;y(c.chart,{animation:!1,renderTo:e,forExport:!0,renderer:"SVGRenderer",width:g,height:k});c.exporting.enabled=!1;delete c.data;c.series=[];u(b.series,function(a){E=p(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});E.isInternal||c.series.push(E)});a&&u(["xAxis","yAxis"],function(b){u(I(a[b]),function(a,e){c[b][e]=p(c[b][e],a)})});d=
|
||||
new f.Chart(c,b.callback);u(["xAxis","yAxis"],function(a){u(b[a],function(b,e){e=d[a][e];var c=b.getExtremes();b=c.userMin;c=c.userMax;!e||void 0===b&&void 0===c||e.setExtremes(b,c,!0,!1)})});g=d.getChartHTML();c=null;d.destroy();B(e);n&&(e=g.match(/<\/svg>(.*?$)/))&&(e='\x3cforeignObject x\x3d"0" y\x3d"0" width\x3d"200" height\x3d"200"\x3e\x3cbody xmlns\x3d"http://www.w3.org/1999/xhtml"\x3e'+e[1]+"\x3c/body\x3e\x3c/foreignObject\x3e",g=g.replace("\x3c/svg\x3e",e+"\x3c/svg\x3e"));g=this.sanitizeSVG(g);
|
||||
return g=g.replace(/(url\(#highcharts-[0-9]+)"/g,"$1").replace(/"/g,"'")},getSVGForExport:function(a,b){var d=this.options.exporting;return this.getSVG(p({chart:{borderRadius:0}},d.chartOptions,b,{exporting:{sourceWidth:a&&a.sourceWidth||d.sourceWidth,sourceHeight:a&&a.sourceHeight||d.sourceHeight}}))},exportChart:function(a,b){b=this.getSVGForExport(a,b);a=p(this.options.exporting,a);f.post(a.url,{filename:a.filename||"chart",type:a.type,width:a.width||0,scale:a.scale,svg:b},a.formAttributes)},
|
||||
print:function(){var a=this,b=a.container,d=[],e=b.parentNode,g=v.body,f=g.childNodes,k=a.options.exporting.printMaxWidth,c,n;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null,0);G(a,"beforePrint");if(n=k&&a.chartWidth>k)c=[a.options.chart.width,void 0,!1],a.setSize(k,void 0,!1);u(f,function(a,b){1===a.nodeType&&(d[b]=a.style.display,a.style.display="none")});g.appendChild(b);z.focus();z.print();setTimeout(function(){e.appendChild(b);u(f,function(a,b){1===a.nodeType&&(a.style.display=d[b])});
|
||||
a.isPrinting=!1;n&&a.setSize.apply(a,c);G(a,"afterPrint")},1E3)}},contextMenu:function(a,b,d,e,g,f,k){var c=this,n=c.chartWidth,h=c.chartHeight,l="cache-"+a,m=c[l],r=Math.max(g,f),t,p,q=function(b){c.pointer.inClass(b.target,a)||p()};m||(c[l]=m=w("div",{className:a},{position:"absolute",zIndex:1E3,padding:r+"px"},c.container),t=w("div",{className:"highcharts-menu"},null,m),p=function(){H(m,{display:"none"});k&&k.setState(0);c.openMenu=!1},x(m,"mouseleave",function(){m.hideTimer=setTimeout(p,500)}),
|
||||
x(m,"mouseenter",function(){clearTimeout(m.hideTimer)}),x(v,"mouseup",q),x(c,"destroy",function(){F(v,"mouseup",q)}),u(b,function(a){if(a){var b;b=a.separator?w("hr",null,null,t):w("div",{className:"highcharts-menu-item",onclick:function(b){b&&b.stopPropagation();p();a.onclick&&a.onclick.apply(c,arguments)},innerHTML:a.text||c.options.lang[a.textKey]},null,t);c.exportDivElements.push(b)}}),c.exportDivElements.push(t,m),c.exportMenuWidth=m.offsetWidth,c.exportMenuHeight=m.offsetHeight);b={display:"block"};
|
||||
d+c.exportMenuWidth>n?b.right=n-d-g-r+"px":b.left=d-r+"px";e+f+c.exportMenuHeight>h&&"top"!==k.alignOptions.verticalAlign?b.bottom=h-e-r+"px":b.top=e+f-r+"px";H(m,b);c.openMenu=!0},addButton:function(a){var b=this,d=b.renderer,e=p(b.options.navigation.buttonOptions,a),g=e.onclick,f=e.menuItems,k,c,n=e.symbolSize||12;b.btnCount||(b.btnCount=0);b.exportDivElements||(b.exportDivElements=[],b.exportSVGElements=[]);if(!1!==e.enabled){var h=e.theme,l=h.states,m=l&&l.hover,l=l&&l.select,r;delete h.states;
|
||||
g?r=function(a){a.stopPropagation();g.call(b,a)}:f&&(r=function(){b.contextMenu(c.menuClassName,f,c.translateX,c.translateY,c.width,c.height,c);c.setState(2)});e.text&&e.symbol?h.paddingLeft=C(h.paddingLeft,25):e.text||y(h,{width:e.width,height:e.height,padding:0});c=d.button(e.text,0,0,r,h,m,l).addClass(a.className).attr({title:b.options.lang[e._titleKey],zIndex:3});c.menuClassName=a.menuClassName||"highcharts-menu-"+b.btnCount++;e.symbol&&(k=d.symbol(e.symbol,e.symbolX-n/2,e.symbolY-n/2,n,n).addClass("highcharts-button-symbol").attr({zIndex:1}).add(c));
|
||||
c.add().align(y(e,{width:c.width,x:C(e.x,b.buttonOffset)}),!0,"spacingBox");b.buttonOffset+=(c.width+e.buttonSpacing)*("right"===e.align?-1:1);b.exportSVGElements.push(c,k)}},destroyExport:function(a){var b=a?a.target:this;a=b.exportSVGElements;var d=b.exportDivElements;a&&(u(a,function(a,d){a&&(a.onclick=a.ontouchstart=null,b.exportSVGElements[d]=a.destroy())}),a.length=0);d&&(u(d,function(a,d){clearTimeout(a.hideTimer);F(a,"mouseleave");b.exportDivElements[d]=a.onmouseout=a.onmouseover=a.ontouchstart=
|
||||
a.onclick=null;B(a)}),d.length=0)}});D.prototype.inlineToAttributes="fill stroke strokeLinecap strokeLinejoin strokeWidth textAnchor x y".split(" ");D.prototype.inlineBlacklist=[/-/,/^(clipPath|cssText|d|height|width)$/,/^font$/,/[lL]ogical(Width|Height)$/,/perspective/,/TapHighlightColor/,/^transition/];D.prototype.unstyledElements=["clipPath","defs","desc"];A.prototype.inlineStyles=function(){function a(a){return a.replace(/([A-Z])/g,function(a,b){return"-"+b.toLowerCase()})}function b(d){var h,
|
||||
l,m,r="",t,n;if(1===d.nodeType&&-1===q.indexOf(d.nodeName)){l=z.getComputedStyle(d,null);m="svg"===d.nodeName?{}:z.getComputedStyle(d.parentNode,null);k[d.nodeName]||(c||(c=v.createElementNS(f.SVG_NS,"svg"),c.setAttribute("version","1.1"),v.body.appendChild(c)),t=v.createElementNS(d.namespaceURI,d.nodeName),c.appendChild(t),k[d.nodeName]=p(z.getComputedStyle(t,null)),c.removeChild(t));for(h in l){t=!1;for(n=g.length;n--&&!t;)t=g[n].test(h)||"function"===typeof l[h];t||m[h]!==l[h]&&k[d.nodeName][h]!==
|
||||
l[h]&&(-1!==e.indexOf(h)?d.setAttribute(a(h),l[h]):r+=a(h)+":"+l[h]+";")}r&&(h=d.getAttribute("style"),d.setAttribute("style",(h?h+";":"")+r));"text"!==d.nodeName&&u(d.children||d.childNodes,b)}}var d=this.renderer,e=d.inlineToAttributes,g=d.inlineBlacklist,q=d.unstyledElements,k={},c;b(this.container.querySelector("svg"));c.parentNode.removeChild(c)};J.menu=function(a,b,d,e){return["M",a,b+2.5,"L",a+d,b+2.5,"M",a,b+e/2+.5,"L",a+d,b+e/2+.5,"M",a,b+e-1.5,"L",a+d,b+e-1.5]};A.prototype.renderExporting=
|
||||
function(){var a,b=this.options.exporting,d=b.buttons,e=this.isDirtyExporting||!this.exportSVGElements;this.buttonOffset=0;this.isDirtyExporting&&this.destroyExport();if(e&&!1!==b.enabled){for(a in d)this.addButton(d[a]);this.isDirtyExporting=!1}x(this,"destroy",this.destroyExport)};A.prototype.callbacks.push(function(a){a.renderExporting();x(a,"redraw",a.renderExporting);u(["exporting","navigation"],function(b){a[b]={update:function(d,e){a.isDirtyExporting=!0;p(!0,a.options[b],d);C(e,!0)&&a.redraw()}}})})})(q)});
|
||||
948
assets/plugin/chart/highcharts/code/js/modules/exporting.src.js
Executable file
948
assets/plugin/chart/highcharts/code/js/modules/exporting.src.js
Executable file
@ -0,0 +1,948 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Exporting module
|
||||
*
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* Exporting module
|
||||
*
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
/* eslint indent:0 */
|
||||
'use strict';
|
||||
|
||||
// create shortcuts
|
||||
var defaultOptions = H.defaultOptions,
|
||||
doc = H.doc,
|
||||
Chart = H.Chart,
|
||||
addEvent = H.addEvent,
|
||||
removeEvent = H.removeEvent,
|
||||
fireEvent = H.fireEvent,
|
||||
createElement = H.createElement,
|
||||
discardElement = H.discardElement,
|
||||
css = H.css,
|
||||
merge = H.merge,
|
||||
pick = H.pick,
|
||||
each = H.each,
|
||||
extend = H.extend,
|
||||
splat = H.splat,
|
||||
isTouchDevice = H.isTouchDevice,
|
||||
win = H.win,
|
||||
SVGRenderer = H.SVGRenderer;
|
||||
|
||||
var symbols = H.Renderer.prototype.symbols;
|
||||
|
||||
// Add language
|
||||
extend(defaultOptions.lang, {
|
||||
printChart: 'Print chart',
|
||||
downloadPNG: 'Download PNG image',
|
||||
downloadJPEG: 'Download JPEG image',
|
||||
downloadPDF: 'Download PDF document',
|
||||
downloadSVG: 'Download SVG vector image',
|
||||
contextButtonTitle: 'Chart context menu'
|
||||
});
|
||||
|
||||
// Buttons and menus are collected in a separate config option set called 'navigation'.
|
||||
// This can be extended later to add control buttons like zoom and pan right click menus.
|
||||
defaultOptions.navigation = {
|
||||
buttonOptions: {
|
||||
theme: {},
|
||||
symbolSize: 14,
|
||||
symbolX: 12.5,
|
||||
symbolY: 10.5,
|
||||
align: 'right',
|
||||
buttonSpacing: 3,
|
||||
height: 22,
|
||||
// text: null,
|
||||
verticalAlign: 'top',
|
||||
width: 24
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// Add the export related options
|
||||
defaultOptions.exporting = {
|
||||
//enabled: true,
|
||||
//filename: 'chart',
|
||||
type: 'image/png',
|
||||
url: 'https://export.highcharts.com/',
|
||||
//width: undefined,
|
||||
printMaxWidth: 780,
|
||||
scale: 2,
|
||||
buttons: {
|
||||
contextButton: {
|
||||
className: 'highcharts-contextbutton',
|
||||
menuClassName: 'highcharts-contextmenu',
|
||||
//x: -10,
|
||||
symbol: 'menu',
|
||||
_titleKey: 'contextButtonTitle',
|
||||
menuItems: [{
|
||||
textKey: 'printChart',
|
||||
onclick: function() {
|
||||
this.print();
|
||||
}
|
||||
}, {
|
||||
separator: true
|
||||
}, {
|
||||
textKey: 'downloadPNG',
|
||||
onclick: function() {
|
||||
this.exportChart();
|
||||
}
|
||||
}, {
|
||||
textKey: 'downloadJPEG',
|
||||
onclick: function() {
|
||||
this.exportChart({
|
||||
type: 'image/jpeg'
|
||||
});
|
||||
}
|
||||
}, {
|
||||
textKey: 'downloadPDF',
|
||||
onclick: function() {
|
||||
this.exportChart({
|
||||
type: 'application/pdf'
|
||||
});
|
||||
}
|
||||
}, {
|
||||
textKey: 'downloadSVG',
|
||||
onclick: function() {
|
||||
this.exportChart({
|
||||
type: 'image/svg+xml'
|
||||
});
|
||||
}
|
||||
}
|
||||
// Enable this block to add "View SVG" to the dropdown menu
|
||||
/*
|
||||
,{
|
||||
|
||||
text: 'View SVG',
|
||||
onclick: function () {
|
||||
var svg = this.getSVG()
|
||||
.replace(/</g, '\n<')
|
||||
.replace(/>/g, '>');
|
||||
|
||||
doc.body.innerHTML = '<pre>' + svg + '</pre>';
|
||||
}
|
||||
} // */
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Add the H.post utility
|
||||
H.post = function(url, data, formAttributes) {
|
||||
var name,
|
||||
form;
|
||||
|
||||
// create the form
|
||||
form = createElement('form', merge({
|
||||
method: 'post',
|
||||
action: url,
|
||||
enctype: 'multipart/form-data'
|
||||
}, formAttributes), {
|
||||
display: 'none'
|
||||
}, doc.body);
|
||||
|
||||
// add the data
|
||||
for (name in data) {
|
||||
createElement('input', {
|
||||
type: 'hidden',
|
||||
name: name,
|
||||
value: data[name]
|
||||
}, null, form);
|
||||
}
|
||||
|
||||
// submit
|
||||
form.submit();
|
||||
|
||||
// clean up
|
||||
discardElement(form);
|
||||
};
|
||||
|
||||
extend(Chart.prototype, {
|
||||
|
||||
/**
|
||||
* A collection of regex fixes on the produces SVG to account for expando properties,
|
||||
* browser bugs, VML problems and other. Returns a cleaned SVG.
|
||||
*/
|
||||
sanitizeSVG: function(svg) {
|
||||
svg = svg
|
||||
.replace(/zIndex="[^"]+"/g, '')
|
||||
.replace(/isShadow="[^"]+"/g, '')
|
||||
.replace(/symbolName="[^"]+"/g, '')
|
||||
.replace(/jQuery[0-9]+="[^"]+"/g, '')
|
||||
.replace(/url\(("|")(\S+)("|")\)/g, 'url($2)')
|
||||
.replace(/url\([^#]+#/g, 'url(#')
|
||||
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
|
||||
.replace(/ (NS[0-9]+\:)?href=/g, ' xlink:href=') // #3567
|
||||
.replace(/\n/, ' ')
|
||||
// Any HTML added to the container after the SVG (#894)
|
||||
.replace(/<\/svg>.*?$/, '</svg>')
|
||||
// Batik doesn't support rgba fills and strokes (#3095)
|
||||
.replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"')
|
||||
/* This fails in IE < 8
|
||||
.replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight
|
||||
return s2 +'.'+ s3[0];
|
||||
})*/
|
||||
|
||||
// Replace HTML entities, issue #347
|
||||
.replace(/ /g, '\u00A0') // no-break space
|
||||
.replace(/­/g, '\u00AD'); // soft hyphen
|
||||
|
||||
|
||||
|
||||
return svg;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return innerHTML of chart. Used as hook for plugins.
|
||||
*/
|
||||
getChartHTML: function() {
|
||||
|
||||
this.inlineStyles();
|
||||
|
||||
return this.container.innerHTML;
|
||||
},
|
||||
|
||||
/**
|
||||
* Return an SVG representation of the chart
|
||||
*
|
||||
* @param additionalOptions {Object} Additional chart options for the generated SVG representation
|
||||
*/
|
||||
getSVG: function(additionalOptions) {
|
||||
var chart = this,
|
||||
chartCopy,
|
||||
sandbox,
|
||||
svg,
|
||||
seriesOptions,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
cssWidth,
|
||||
cssHeight,
|
||||
html,
|
||||
options = merge(chart.options, additionalOptions), // copy the options and add extra options
|
||||
allowHTML = options.exporting.allowHTML;
|
||||
|
||||
|
||||
// IE compatibility hack for generating SVG content that it doesn't really understand
|
||||
if (!doc.createElementNS) {
|
||||
doc.createElementNS = function(ns, tagName) {
|
||||
return doc.createElement(tagName);
|
||||
};
|
||||
}
|
||||
|
||||
// create a sandbox where a new chart will be generated
|
||||
sandbox = createElement('div', null, {
|
||||
position: 'absolute',
|
||||
top: '-9999em',
|
||||
width: chart.chartWidth + 'px',
|
||||
height: chart.chartHeight + 'px'
|
||||
}, doc.body);
|
||||
|
||||
// get the source size
|
||||
cssWidth = chart.renderTo.style.width;
|
||||
cssHeight = chart.renderTo.style.height;
|
||||
sourceWidth = options.exporting.sourceWidth ||
|
||||
options.chart.width ||
|
||||
(/px$/.test(cssWidth) && parseInt(cssWidth, 10)) ||
|
||||
600;
|
||||
sourceHeight = options.exporting.sourceHeight ||
|
||||
options.chart.height ||
|
||||
(/px$/.test(cssHeight) && parseInt(cssHeight, 10)) ||
|
||||
400;
|
||||
|
||||
// override some options
|
||||
extend(options.chart, {
|
||||
animation: false,
|
||||
renderTo: sandbox,
|
||||
forExport: true,
|
||||
renderer: 'SVGRenderer',
|
||||
width: sourceWidth,
|
||||
height: sourceHeight
|
||||
});
|
||||
options.exporting.enabled = false; // hide buttons in print
|
||||
delete options.data; // #3004
|
||||
|
||||
// prepare for replicating the chart
|
||||
options.series = [];
|
||||
each(chart.series, function(serie) {
|
||||
seriesOptions = merge(serie.userOptions, { // #4912
|
||||
animation: false, // turn off animation
|
||||
enableMouseTracking: false,
|
||||
showCheckbox: false,
|
||||
visible: serie.visible
|
||||
});
|
||||
|
||||
if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set
|
||||
options.series.push(seriesOptions);
|
||||
}
|
||||
});
|
||||
|
||||
// Axis options must be merged in one by one, since it may be an array or an object (#2022, #3900)
|
||||
if (additionalOptions) {
|
||||
each(['xAxis', 'yAxis'], function(axisType) {
|
||||
each(splat(additionalOptions[axisType]), function(axisOptions, i) {
|
||||
options[axisType][i] = merge(options[axisType][i], axisOptions);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// generate the chart copy
|
||||
chartCopy = new H.Chart(options, chart.callback);
|
||||
|
||||
// reflect axis extremes in the export
|
||||
each(['xAxis', 'yAxis'], function(axisType) {
|
||||
each(chart[axisType], function(axis, i) {
|
||||
var axisCopy = chartCopy[axisType][i],
|
||||
extremes = axis.getExtremes(),
|
||||
userMin = extremes.userMin,
|
||||
userMax = extremes.userMax;
|
||||
|
||||
if (axisCopy && (userMin !== undefined || userMax !== undefined)) {
|
||||
axisCopy.setExtremes(userMin, userMax, true, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// get the SVG from the container's innerHTML
|
||||
svg = chartCopy.getChartHTML();
|
||||
|
||||
// free up memory
|
||||
options = null;
|
||||
chartCopy.destroy();
|
||||
discardElement(sandbox);
|
||||
|
||||
// Move HTML into a foreignObject
|
||||
if (allowHTML) {
|
||||
html = svg.match(/<\/svg>(.*?$)/);
|
||||
if (html) {
|
||||
html = '<foreignObject x="0" y="0" width="200" height="200">' +
|
||||
'<body xmlns="http://www.w3.org/1999/xhtml">' +
|
||||
html[1] +
|
||||
'</body>' +
|
||||
'</foreignObject>';
|
||||
svg = svg.replace('</svg>', html + '</svg>');
|
||||
}
|
||||
}
|
||||
|
||||
// sanitize
|
||||
svg = this.sanitizeSVG(svg);
|
||||
|
||||
// IE9 beta bugs with innerHTML. Test again with final IE9.
|
||||
svg = svg.replace(/(url\(#highcharts-[0-9]+)"/g, '$1')
|
||||
.replace(/"/g, '\'');
|
||||
|
||||
return svg;
|
||||
},
|
||||
|
||||
getSVGForExport: function(options, chartOptions) {
|
||||
var chartExportingOptions = this.options.exporting;
|
||||
|
||||
return this.getSVG(merge({
|
||||
chart: {
|
||||
borderRadius: 0
|
||||
}
|
||||
},
|
||||
chartExportingOptions.chartOptions,
|
||||
chartOptions, {
|
||||
exporting: {
|
||||
sourceWidth: (options && options.sourceWidth) || chartExportingOptions.sourceWidth,
|
||||
sourceHeight: (options && options.sourceHeight) || chartExportingOptions.sourceHeight
|
||||
}
|
||||
}
|
||||
));
|
||||
},
|
||||
|
||||
/**
|
||||
* Submit the SVG representation of the chart to the server
|
||||
* @param {Object} options Exporting options. Possible members are url, type, width and formAttributes.
|
||||
* @param {Object} chartOptions Additional chart options for the SVG representation of the chart
|
||||
*/
|
||||
exportChart: function(options, chartOptions) {
|
||||
|
||||
var svg = this.getSVGForExport(options, chartOptions);
|
||||
|
||||
// merge the options
|
||||
options = merge(this.options.exporting, options);
|
||||
|
||||
// do the post
|
||||
H.post(options.url, {
|
||||
filename: options.filename || 'chart',
|
||||
type: options.type,
|
||||
width: options.width || 0, // IE8 fails to post undefined correctly, so use 0
|
||||
scale: options.scale,
|
||||
svg: svg
|
||||
}, options.formAttributes);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Print the chart
|
||||
*/
|
||||
print: function() {
|
||||
|
||||
var chart = this,
|
||||
container = chart.container,
|
||||
origDisplay = [],
|
||||
origParent = container.parentNode,
|
||||
body = doc.body,
|
||||
childNodes = body.childNodes,
|
||||
printMaxWidth = chart.options.exporting.printMaxWidth,
|
||||
resetParams,
|
||||
handleMaxWidth;
|
||||
|
||||
if (chart.isPrinting) { // block the button while in printing mode
|
||||
return;
|
||||
}
|
||||
|
||||
chart.isPrinting = true;
|
||||
chart.pointer.reset(null, 0);
|
||||
|
||||
fireEvent(chart, 'beforePrint');
|
||||
|
||||
// Handle printMaxWidth
|
||||
handleMaxWidth = printMaxWidth && chart.chartWidth > printMaxWidth;
|
||||
if (handleMaxWidth) {
|
||||
resetParams = [chart.options.chart.width, undefined, false];
|
||||
chart.setSize(printMaxWidth, undefined, false);
|
||||
}
|
||||
|
||||
// hide all body content
|
||||
each(childNodes, function(node, i) {
|
||||
if (node.nodeType === 1) {
|
||||
origDisplay[i] = node.style.display;
|
||||
node.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
// pull out the chart
|
||||
body.appendChild(container);
|
||||
|
||||
// print
|
||||
win.focus(); // #1510
|
||||
win.print();
|
||||
|
||||
// allow the browser to prepare before reverting
|
||||
setTimeout(function() {
|
||||
|
||||
// put the chart back in
|
||||
origParent.appendChild(container);
|
||||
|
||||
// restore all body content
|
||||
each(childNodes, function(node, i) {
|
||||
if (node.nodeType === 1) {
|
||||
node.style.display = origDisplay[i];
|
||||
}
|
||||
});
|
||||
|
||||
chart.isPrinting = false;
|
||||
|
||||
// Reset printMaxWidth
|
||||
if (handleMaxWidth) {
|
||||
chart.setSize.apply(chart, resetParams);
|
||||
}
|
||||
|
||||
fireEvent(chart, 'afterPrint');
|
||||
|
||||
}, 1000);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Display a popup menu for choosing the export type
|
||||
*
|
||||
* @param {String} className An identifier for the menu
|
||||
* @param {Array} items A collection with text and onclicks for the items
|
||||
* @param {Number} x The x position of the opener button
|
||||
* @param {Number} y The y position of the opener button
|
||||
* @param {Number} width The width of the opener button
|
||||
* @param {Number} height The height of the opener button
|
||||
*/
|
||||
contextMenu: function(className, items, x, y, width, height, button) {
|
||||
var chart = this,
|
||||
navOptions = chart.options.navigation,
|
||||
chartWidth = chart.chartWidth,
|
||||
chartHeight = chart.chartHeight,
|
||||
cacheName = 'cache-' + className,
|
||||
menu = chart[cacheName],
|
||||
menuPadding = Math.max(width, height), // for mouse leave detection
|
||||
innerMenu,
|
||||
hide,
|
||||
menuStyle,
|
||||
docMouseUpHandler = function(e) {
|
||||
if (!chart.pointer.inClass(e.target, className)) {
|
||||
hide();
|
||||
}
|
||||
};
|
||||
|
||||
// create the menu only the first time
|
||||
if (!menu) {
|
||||
|
||||
// create a HTML element above the SVG
|
||||
chart[cacheName] = menu = createElement('div', {
|
||||
className: className
|
||||
}, {
|
||||
position: 'absolute',
|
||||
zIndex: 1000,
|
||||
padding: menuPadding + 'px'
|
||||
}, chart.container);
|
||||
|
||||
innerMenu = createElement('div', {
|
||||
className: 'highcharts-menu'
|
||||
}, null, menu);
|
||||
|
||||
|
||||
|
||||
// hide on mouse out
|
||||
hide = function() {
|
||||
css(menu, {
|
||||
display: 'none'
|
||||
});
|
||||
if (button) {
|
||||
button.setState(0);
|
||||
}
|
||||
chart.openMenu = false;
|
||||
};
|
||||
|
||||
// Hide the menu some time after mouse leave (#1357)
|
||||
addEvent(menu, 'mouseleave', function() {
|
||||
menu.hideTimer = setTimeout(hide, 500);
|
||||
});
|
||||
addEvent(menu, 'mouseenter', function() {
|
||||
clearTimeout(menu.hideTimer);
|
||||
});
|
||||
|
||||
|
||||
// Hide it on clicking or touching outside the menu (#2258, #2335, #2407)
|
||||
addEvent(doc, 'mouseup', docMouseUpHandler);
|
||||
addEvent(chart, 'destroy', function() {
|
||||
removeEvent(doc, 'mouseup', docMouseUpHandler);
|
||||
});
|
||||
|
||||
|
||||
// create the items
|
||||
each(items, function(item) {
|
||||
if (item) {
|
||||
var element;
|
||||
|
||||
if (item.separator) {
|
||||
element = createElement('hr', null, null, innerMenu);
|
||||
|
||||
} else {
|
||||
element = createElement('div', {
|
||||
className: 'highcharts-menu-item',
|
||||
onclick: function(e) {
|
||||
if (e) { // IE7
|
||||
e.stopPropagation();
|
||||
}
|
||||
hide();
|
||||
if (item.onclick) {
|
||||
item.onclick.apply(chart, arguments);
|
||||
}
|
||||
},
|
||||
innerHTML: item.text || chart.options.lang[item.textKey]
|
||||
}, null, innerMenu);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Keep references to menu divs to be able to destroy them
|
||||
chart.exportDivElements.push(element);
|
||||
}
|
||||
});
|
||||
|
||||
// Keep references to menu and innerMenu div to be able to destroy them
|
||||
chart.exportDivElements.push(innerMenu, menu);
|
||||
|
||||
chart.exportMenuWidth = menu.offsetWidth;
|
||||
chart.exportMenuHeight = menu.offsetHeight;
|
||||
}
|
||||
|
||||
menuStyle = {
|
||||
display: 'block'
|
||||
};
|
||||
|
||||
// if outside right, right align it
|
||||
if (x + chart.exportMenuWidth > chartWidth) {
|
||||
menuStyle.right = (chartWidth - x - width - menuPadding) + 'px';
|
||||
} else {
|
||||
menuStyle.left = (x - menuPadding) + 'px';
|
||||
}
|
||||
// if outside bottom, bottom align it
|
||||
if (y + height + chart.exportMenuHeight > chartHeight && button.alignOptions.verticalAlign !== 'top') {
|
||||
menuStyle.bottom = (chartHeight - y - menuPadding) + 'px';
|
||||
} else {
|
||||
menuStyle.top = (y + height - menuPadding) + 'px';
|
||||
}
|
||||
|
||||
css(menu, menuStyle);
|
||||
chart.openMenu = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Add the export button to the chart
|
||||
*/
|
||||
addButton: function(options) {
|
||||
var chart = this,
|
||||
renderer = chart.renderer,
|
||||
btnOptions = merge(chart.options.navigation.buttonOptions, options),
|
||||
onclick = btnOptions.onclick,
|
||||
menuItems = btnOptions.menuItems,
|
||||
symbol,
|
||||
button,
|
||||
symbolSize = btnOptions.symbolSize || 12;
|
||||
if (!chart.btnCount) {
|
||||
chart.btnCount = 0;
|
||||
}
|
||||
|
||||
// Keeps references to the button elements
|
||||
if (!chart.exportDivElements) {
|
||||
chart.exportDivElements = [];
|
||||
chart.exportSVGElements = [];
|
||||
}
|
||||
|
||||
if (btnOptions.enabled === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var attr = btnOptions.theme,
|
||||
states = attr.states,
|
||||
hover = states && states.hover,
|
||||
select = states && states.select,
|
||||
callback;
|
||||
|
||||
delete attr.states;
|
||||
|
||||
if (onclick) {
|
||||
callback = function(e) {
|
||||
e.stopPropagation();
|
||||
onclick.call(chart, e);
|
||||
};
|
||||
|
||||
} else if (menuItems) {
|
||||
callback = function() {
|
||||
chart.contextMenu(
|
||||
button.menuClassName,
|
||||
menuItems,
|
||||
button.translateX,
|
||||
button.translateY,
|
||||
button.width,
|
||||
button.height,
|
||||
button
|
||||
);
|
||||
button.setState(2);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (btnOptions.text && btnOptions.symbol) {
|
||||
attr.paddingLeft = pick(attr.paddingLeft, 25);
|
||||
|
||||
} else if (!btnOptions.text) {
|
||||
extend(attr, {
|
||||
width: btnOptions.width,
|
||||
height: btnOptions.height,
|
||||
padding: 0
|
||||
});
|
||||
}
|
||||
|
||||
button = renderer.button(btnOptions.text, 0, 0, callback, attr, hover, select)
|
||||
.addClass(options.className)
|
||||
.attr({
|
||||
|
||||
title: chart.options.lang[btnOptions._titleKey],
|
||||
zIndex: 3 // #4955
|
||||
});
|
||||
button.menuClassName = options.menuClassName || 'highcharts-menu-' + chart.btnCount++;
|
||||
|
||||
if (btnOptions.symbol) {
|
||||
symbol = renderer.symbol(
|
||||
btnOptions.symbol,
|
||||
btnOptions.symbolX - (symbolSize / 2),
|
||||
btnOptions.symbolY - (symbolSize / 2),
|
||||
symbolSize,
|
||||
symbolSize
|
||||
)
|
||||
.addClass('highcharts-button-symbol')
|
||||
.attr({
|
||||
zIndex: 1
|
||||
}).add(button);
|
||||
|
||||
|
||||
}
|
||||
|
||||
button.add()
|
||||
.align(extend(btnOptions, {
|
||||
width: button.width,
|
||||
x: pick(btnOptions.x, chart.buttonOffset) // #1654
|
||||
}), true, 'spacingBox');
|
||||
|
||||
chart.buttonOffset += (button.width + btnOptions.buttonSpacing) * (btnOptions.align === 'right' ? -1 : 1);
|
||||
|
||||
chart.exportSVGElements.push(button, symbol);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroy the buttons.
|
||||
*/
|
||||
destroyExport: function(e) {
|
||||
var chart = e ? e.target : this,
|
||||
exportSVGElements = chart.exportSVGElements,
|
||||
exportDivElements = chart.exportDivElements;
|
||||
|
||||
// Destroy the extra buttons added
|
||||
if (exportSVGElements) {
|
||||
each(exportSVGElements, function(elem, i) {
|
||||
|
||||
// Destroy and null the svg/vml elements
|
||||
if (elem) { // #1822
|
||||
elem.onclick = elem.ontouchstart = null;
|
||||
chart.exportSVGElements[i] = elem.destroy();
|
||||
}
|
||||
});
|
||||
exportSVGElements.length = 0;
|
||||
}
|
||||
|
||||
// Destroy the divs for the menu
|
||||
if (exportDivElements) {
|
||||
each(exportDivElements, function(elem, i) {
|
||||
|
||||
// Remove the event handler
|
||||
clearTimeout(elem.hideTimer); // #5427
|
||||
removeEvent(elem, 'mouseleave');
|
||||
|
||||
// Remove inline events
|
||||
chart.exportDivElements[i] = elem.onmouseout = elem.onmouseover = elem.ontouchstart = elem.onclick = null;
|
||||
|
||||
// Destroy the div by moving to garbage bin
|
||||
discardElement(elem);
|
||||
});
|
||||
exportDivElements.length = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// These ones are translated to attributes rather than styles
|
||||
SVGRenderer.prototype.inlineToAttributes = [
|
||||
'fill',
|
||||
'stroke',
|
||||
'strokeLinecap',
|
||||
'strokeLinejoin',
|
||||
'strokeWidth',
|
||||
'textAnchor',
|
||||
'x',
|
||||
'y'
|
||||
];
|
||||
// These CSS properties are not inlined. Remember camelCase.
|
||||
SVGRenderer.prototype.inlineBlacklist = [
|
||||
/-/, // In Firefox, both hyphened and camelCased names are listed
|
||||
/^(clipPath|cssText|d|height|width)$/, // Full words
|
||||
/^font$/, // more specific props are set
|
||||
/[lL]ogical(Width|Height)$/,
|
||||
/perspective/,
|
||||
/TapHighlightColor/,
|
||||
/^transition/
|
||||
// /^text (border|color|cursor|height|webkitBorder)/
|
||||
];
|
||||
SVGRenderer.prototype.unstyledElements = [
|
||||
'clipPath',
|
||||
'defs',
|
||||
'desc'
|
||||
];
|
||||
|
||||
/**
|
||||
* Analyze inherited styles from stylesheets and add them inline
|
||||
*
|
||||
* @todo: What are the border styles for text about? In general, text has a lot of properties.
|
||||
* @todo: Make it work with IE9 and IE10.
|
||||
*/
|
||||
Chart.prototype.inlineStyles = function() {
|
||||
var renderer = this.renderer,
|
||||
inlineToAttributes = renderer.inlineToAttributes,
|
||||
blacklist = renderer.inlineBlacklist,
|
||||
unstyledElements = renderer.unstyledElements,
|
||||
defaultStyles = {},
|
||||
dummySVG;
|
||||
|
||||
/**
|
||||
* Make hyphenated property names out of camelCase
|
||||
*/
|
||||
function hyphenate(prop) {
|
||||
return prop.replace(
|
||||
/([A-Z])/g,
|
||||
function(a, b) {
|
||||
return '-' + b.toLowerCase();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this on all elements and recurse to children
|
||||
*/
|
||||
function recurse(node) {
|
||||
var prop,
|
||||
styles,
|
||||
parentStyles,
|
||||
cssText = '',
|
||||
dummy,
|
||||
styleAttr,
|
||||
blacklisted,
|
||||
i;
|
||||
|
||||
if (node.nodeType === 1 && unstyledElements.indexOf(node.nodeName) === -1) {
|
||||
styles = win.getComputedStyle(node, null);
|
||||
parentStyles = node.nodeName === 'svg' ? {} : win.getComputedStyle(node.parentNode, null);
|
||||
|
||||
// Get default styles from the browser so that we don't have to add these
|
||||
if (!defaultStyles[node.nodeName]) {
|
||||
if (!dummySVG) {
|
||||
dummySVG = doc.createElementNS(H.SVG_NS, 'svg');
|
||||
dummySVG.setAttribute('version', '1.1');
|
||||
doc.body.appendChild(dummySVG);
|
||||
}
|
||||
dummy = doc.createElementNS(node.namespaceURI, node.nodeName);
|
||||
dummySVG.appendChild(dummy);
|
||||
defaultStyles[node.nodeName] = merge(win.getComputedStyle(dummy, null)); // Copy, so we can remove the node
|
||||
dummySVG.removeChild(dummy);
|
||||
}
|
||||
|
||||
// Loop over all the computed styles and check whether they are in the
|
||||
// white list for styles or atttributes.
|
||||
for (prop in styles) {
|
||||
|
||||
// Check against blacklist
|
||||
blacklisted = false;
|
||||
i = blacklist.length;
|
||||
while (i-- && !blacklisted) {
|
||||
blacklisted = blacklist[i].test(prop) || typeof styles[prop] === 'function';
|
||||
}
|
||||
|
||||
if (!blacklisted) {
|
||||
|
||||
// If parent node has the same style, it gets inherited, no need to inline it
|
||||
if (parentStyles[prop] !== styles[prop] && defaultStyles[node.nodeName][prop] !== styles[prop]) {
|
||||
|
||||
// Attributes
|
||||
if (inlineToAttributes.indexOf(prop) !== -1) {
|
||||
node.setAttribute(hyphenate(prop), styles[prop]);
|
||||
|
||||
// Styles
|
||||
} else {
|
||||
cssText += hyphenate(prop) + ':' + styles[prop] + ';';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply styles
|
||||
if (cssText) {
|
||||
styleAttr = node.getAttribute('style');
|
||||
node.setAttribute('style', (styleAttr ? styleAttr + ';' : '') + cssText);
|
||||
}
|
||||
|
||||
if (node.nodeName === 'text') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Recurse
|
||||
each(node.children || node.childNodes, recurse);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the dummy objects used to get defaults
|
||||
*/
|
||||
function tearDown() {
|
||||
dummySVG.parentNode.removeChild(dummySVG);
|
||||
}
|
||||
|
||||
recurse(this.container.querySelector('svg'));
|
||||
tearDown();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
symbols.menu = function(x, y, width, height) {
|
||||
var arr = [
|
||||
'M', x, y + 2.5,
|
||||
'L', x + width, y + 2.5,
|
||||
'M', x, y + height / 2 + 0.5,
|
||||
'L', x + width, y + height / 2 + 0.5,
|
||||
'M', x, y + height - 1.5,
|
||||
'L', x + width, y + height - 1.5
|
||||
];
|
||||
return arr;
|
||||
};
|
||||
|
||||
// Add the buttons on chart load
|
||||
Chart.prototype.renderExporting = function() {
|
||||
var n,
|
||||
exportingOptions = this.options.exporting,
|
||||
buttons = exportingOptions.buttons,
|
||||
isDirty = this.isDirtyExporting || !this.exportSVGElements;
|
||||
|
||||
this.buttonOffset = 0;
|
||||
if (this.isDirtyExporting) {
|
||||
this.destroyExport();
|
||||
}
|
||||
|
||||
if (isDirty && exportingOptions.enabled !== false) {
|
||||
|
||||
for (n in buttons) {
|
||||
this.addButton(buttons[n]);
|
||||
}
|
||||
|
||||
this.isDirtyExporting = false;
|
||||
}
|
||||
|
||||
// Destroy the export elements at chart destroy
|
||||
addEvent(this, 'destroy', this.destroyExport);
|
||||
};
|
||||
|
||||
Chart.prototype.callbacks.push(function(chart) {
|
||||
|
||||
function update(prop, options, redraw) {
|
||||
chart.isDirtyExporting = true;
|
||||
merge(true, chart.options[prop], options);
|
||||
if (pick(redraw, true)) {
|
||||
chart.redraw();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
chart.renderExporting();
|
||||
|
||||
addEvent(chart, 'redraw', chart.renderExporting);
|
||||
|
||||
// Add update methods to handle chart.update and chart.exporting.update
|
||||
// and chart.navigation.update.
|
||||
each(['exporting', 'navigation'], function(prop) {
|
||||
chart[prop] = {
|
||||
update: function(options, redraw) {
|
||||
update(prop, options, redraw);
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
12
assets/plugin/chart/highcharts/code/js/modules/funnel.js
Executable file
12
assets/plugin/chart/highcharts/code/js/modules/funnel.js
Executable file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Highcharts funnel module
|
||||
|
||||
(c) 2010-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(c){"object"===typeof module&&module.exports?module.exports=c:c(Highcharts)})(function(c){(function(c){var n=c.seriesType,z=c.seriesTypes,F=c.noop,G=c.each;n("funnel","pie",{animation:!1,center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",reversed:!1,size:!0},{animate:F,translate:function(){var b=function(a,b){return/%$/.test(a)?b*parseInt(a,10)/100:parseInt(a,10)},c=0,e=this.chart,d=this.options,r=d.reversed,H=d.ignoreHiddenPoint,t=e.plotWidth,e=e.plotHeight,
|
||||
p=0,n=d.center,f=b(n[0],t),q=b(n[1],e),z=b(d.width,t),h,v,k=b(d.height,e),w=b(d.neckWidth,t),D=b(d.neckHeight,e),x=q-k/2+k-D,b=this.data,A,B,I="left"===d.dataLabels.position?1:0,C,l,E,u,g,y,m;this.getWidthAt=v=function(a){var b=q-k/2;return a>x||k===D?w:w+(z-w)*(1-(a-b)/(k-D))};this.getX=function(a,b){return f+(b?-1:1)*(v(r?2*q-a:a)/2+d.dataLabels.distance)};this.center=[f,q,k];this.centerX=f;G(b,function(a){H&&!1===a.visible||(c+=a.y)});G(b,function(a){m=null;B=c?a.y/c:0;l=q-k/2+p*k;g=l+B*k;h=v(l);
|
||||
C=f-h/2;E=C+h;h=v(g);u=f-h/2;y=u+h;l>x?(C=u=f-w/2,E=y=f+w/2):g>x&&(m=g,h=v(x),u=f-h/2,y=u+h,g=x);r&&(l=2*q-l,g=2*q-g,m=m?2*q-m:null);A=["M",C,l,"L",E,l,y,g];m&&A.push(y,m,u,m);A.push(u,g,"Z");a.shapeType="path";a.shapeArgs={d:A};a.percentage=100*B;a.plotX=f;a.plotY=(l+(m||g))/2;a.tooltipPos=[f,a.plotY];a.slice=F;a.half=I;H&&!1===a.visible||(p+=B)})},drawPoints:z.column.prototype.drawPoints,sortByAngle:function(b){b.sort(function(b,c){return b.plotY-c.plotY})},drawDataLabels:function(){var b=this.data,
|
||||
c=this.options.dataLabels.distance,e,d,r,n=b.length,t,p;for(this.center[2]-=2*c;n--;)r=b[n],d=(e=r.half)?1:-1,p=r.plotY,t=this.getX(p,e),r.labelPos=[0,p,t+(c-5)*d,p,t+c*d,p,e?"right":"left",0];z.pie.prototype.drawDataLabels.call(this)}});n("pyramid","funnel",{neckWidth:"0%",neckHeight:"0%",reversed:!0})})(c)});
|
||||
290
assets/plugin/chart/highcharts/code/js/modules/funnel.src.js
Executable file
290
assets/plugin/chart/highcharts/code/js/modules/funnel.src.js
Executable file
@ -0,0 +1,290 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Highcharts funnel module
|
||||
*
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(Highcharts) {
|
||||
/**
|
||||
* Highcharts funnel module
|
||||
*
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
/* eslint indent:0 */
|
||||
'use strict';
|
||||
|
||||
// create shortcuts
|
||||
var seriesType = Highcharts.seriesType,
|
||||
seriesTypes = Highcharts.seriesTypes,
|
||||
noop = Highcharts.noop,
|
||||
each = Highcharts.each;
|
||||
|
||||
|
||||
seriesType('funnel', 'pie', {
|
||||
animation: false,
|
||||
center: ['50%', '50%'],
|
||||
width: '90%',
|
||||
neckWidth: '30%',
|
||||
height: '100%',
|
||||
neckHeight: '25%',
|
||||
reversed: false,
|
||||
size: true, // to avoid adapting to data label size in Pie.drawDataLabels
|
||||
|
||||
|
||||
},
|
||||
|
||||
// Properties
|
||||
{
|
||||
animate: noop,
|
||||
|
||||
/**
|
||||
* Overrides the pie translate method
|
||||
*/
|
||||
translate: function() {
|
||||
|
||||
var
|
||||
// Get positions - either an integer or a percentage string must be given
|
||||
getLength = function(length, relativeTo) {
|
||||
return (/%$/).test(length) ?
|
||||
relativeTo * parseInt(length, 10) / 100 :
|
||||
parseInt(length, 10);
|
||||
},
|
||||
|
||||
sum = 0,
|
||||
series = this,
|
||||
chart = series.chart,
|
||||
options = series.options,
|
||||
reversed = options.reversed,
|
||||
ignoreHiddenPoint = options.ignoreHiddenPoint,
|
||||
plotWidth = chart.plotWidth,
|
||||
plotHeight = chart.plotHeight,
|
||||
cumulative = 0, // start at top
|
||||
center = options.center,
|
||||
centerX = getLength(center[0], plotWidth),
|
||||
centerY = getLength(center[1], plotHeight),
|
||||
width = getLength(options.width, plotWidth),
|
||||
tempWidth,
|
||||
getWidthAt,
|
||||
height = getLength(options.height, plotHeight),
|
||||
neckWidth = getLength(options.neckWidth, plotWidth),
|
||||
neckHeight = getLength(options.neckHeight, plotHeight),
|
||||
neckY = (centerY - height / 2) + height - neckHeight,
|
||||
data = series.data,
|
||||
path,
|
||||
fraction,
|
||||
half = options.dataLabels.position === 'left' ? 1 : 0,
|
||||
|
||||
x1,
|
||||
y1,
|
||||
x2,
|
||||
x3,
|
||||
y3,
|
||||
x4,
|
||||
y5;
|
||||
|
||||
// Return the width at a specific y coordinate
|
||||
series.getWidthAt = getWidthAt = function(y) {
|
||||
var top = (centerY - height / 2);
|
||||
|
||||
return y > neckY || height === neckHeight ?
|
||||
neckWidth :
|
||||
neckWidth + (width - neckWidth) * (1 - (y - top) / (height - neckHeight));
|
||||
};
|
||||
series.getX = function(y, half) {
|
||||
return centerX + (half ? -1 : 1) * ((getWidthAt(reversed ? 2 * centerY - y : y) / 2) + options.dataLabels.distance);
|
||||
};
|
||||
|
||||
// Expose
|
||||
series.center = [centerX, centerY, height];
|
||||
series.centerX = centerX;
|
||||
|
||||
/*
|
||||
* Individual point coordinate naming:
|
||||
*
|
||||
* x1,y1 _________________ x2,y1
|
||||
* \ /
|
||||
* \ /
|
||||
* \ /
|
||||
* \ /
|
||||
* \ /
|
||||
* x3,y3 _________ x4,y3
|
||||
*
|
||||
* Additional for the base of the neck:
|
||||
*
|
||||
* | |
|
||||
* | |
|
||||
* | |
|
||||
* x3,y5 _________ x4,y5
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
// get the total sum
|
||||
each(data, function(point) {
|
||||
if (!ignoreHiddenPoint || point.visible !== false) {
|
||||
sum += point.y;
|
||||
}
|
||||
});
|
||||
|
||||
each(data, function(point) {
|
||||
// set start and end positions
|
||||
y5 = null;
|
||||
fraction = sum ? point.y / sum : 0;
|
||||
y1 = centerY - height / 2 + cumulative * height;
|
||||
y3 = y1 + fraction * height;
|
||||
//tempWidth = neckWidth + (width - neckWidth) * ((height - neckHeight - y1) / (height - neckHeight));
|
||||
tempWidth = getWidthAt(y1);
|
||||
x1 = centerX - tempWidth / 2;
|
||||
x2 = x1 + tempWidth;
|
||||
tempWidth = getWidthAt(y3);
|
||||
x3 = centerX - tempWidth / 2;
|
||||
x4 = x3 + tempWidth;
|
||||
|
||||
// the entire point is within the neck
|
||||
if (y1 > neckY) {
|
||||
x1 = x3 = centerX - neckWidth / 2;
|
||||
x2 = x4 = centerX + neckWidth / 2;
|
||||
|
||||
// the base of the neck
|
||||
} else if (y3 > neckY) {
|
||||
y5 = y3;
|
||||
|
||||
tempWidth = getWidthAt(neckY);
|
||||
x3 = centerX - tempWidth / 2;
|
||||
x4 = x3 + tempWidth;
|
||||
|
||||
y3 = neckY;
|
||||
}
|
||||
|
||||
if (reversed) {
|
||||
y1 = 2 * centerY - y1;
|
||||
y3 = 2 * centerY - y3;
|
||||
y5 = (y5 ? 2 * centerY - y5 : null);
|
||||
}
|
||||
// save the path
|
||||
path = [
|
||||
'M',
|
||||
x1, y1,
|
||||
'L',
|
||||
x2, y1,
|
||||
x4, y3
|
||||
];
|
||||
if (y5) {
|
||||
path.push(x4, y5, x3, y5);
|
||||
}
|
||||
path.push(x3, y3, 'Z');
|
||||
|
||||
// prepare for using shared dr
|
||||
point.shapeType = 'path';
|
||||
point.shapeArgs = {
|
||||
d: path
|
||||
};
|
||||
|
||||
|
||||
// for tooltips and data labels
|
||||
point.percentage = fraction * 100;
|
||||
point.plotX = centerX;
|
||||
point.plotY = (y1 + (y5 || y3)) / 2;
|
||||
|
||||
// Placement of tooltips and data labels
|
||||
point.tooltipPos = [
|
||||
centerX,
|
||||
point.plotY
|
||||
];
|
||||
|
||||
// Slice is a noop on funnel points
|
||||
point.slice = noop;
|
||||
|
||||
// Mimicking pie data label placement logic
|
||||
point.half = half;
|
||||
|
||||
if (!ignoreHiddenPoint || point.visible !== false) {
|
||||
cumulative += fraction;
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Draw a single point (wedge)
|
||||
* @param {Object} point The point object
|
||||
* @param {Object} color The color of the point
|
||||
* @param {Number} brightness The brightness relative to the color
|
||||
*/
|
||||
drawPoints: seriesTypes.column.prototype.drawPoints,
|
||||
|
||||
/**
|
||||
* Funnel items don't have angles (#2289)
|
||||
*/
|
||||
sortByAngle: function(points) {
|
||||
points.sort(function(a, b) {
|
||||
return a.plotY - b.plotY;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Extend the pie data label method
|
||||
*/
|
||||
drawDataLabels: function() {
|
||||
var data = this.data,
|
||||
labelDistance = this.options.dataLabels.distance,
|
||||
leftSide,
|
||||
sign,
|
||||
point,
|
||||
i = data.length,
|
||||
x,
|
||||
y;
|
||||
|
||||
// In the original pie label anticollision logic, the slots are distributed
|
||||
// from one labelDistance above to one labelDistance below the pie. In funnels
|
||||
// we don't want this.
|
||||
this.center[2] -= 2 * labelDistance;
|
||||
|
||||
// Set the label position array for each point.
|
||||
while (i--) {
|
||||
point = data[i];
|
||||
leftSide = point.half;
|
||||
sign = leftSide ? 1 : -1;
|
||||
y = point.plotY;
|
||||
x = this.getX(y, leftSide);
|
||||
|
||||
// set the anchor point for data labels
|
||||
point.labelPos = [
|
||||
0, // first break of connector
|
||||
y, // a/a
|
||||
x + (labelDistance - 5) * sign, // second break, right outside point shape
|
||||
y, // a/a
|
||||
x + labelDistance * sign, // landing point for connector
|
||||
y, // a/a
|
||||
leftSide ? 'right' : 'left', // alignment
|
||||
0 // center angle
|
||||
];
|
||||
}
|
||||
|
||||
seriesTypes.pie.prototype.drawDataLabels.call(this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Pyramid series type.
|
||||
* A pyramid series is a special type of funnel, without neck and reversed by default.
|
||||
*/
|
||||
seriesType('pyramid', 'funnel', {
|
||||
neckWidth: '0%',
|
||||
neckHeight: '0%',
|
||||
reversed: true
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
24
assets/plugin/chart/highcharts/code/js/modules/gantt.js
Executable file
24
assets/plugin/chart/highcharts/code/js/modules/gantt.js
Executable file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Gantt series
|
||||
|
||||
(c) 2016 Lars A. V. Cabrera
|
||||
|
||||
--- WORK IN PROGRESS ---
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(m){"object"===typeof module&&module.exports?module.exports=m:m(Highcharts)})(function(m){(function(c){var m=c.dateFormat,p=c.each,q=c.isObject,u=c.pick,l=c.wrap,n=c.Axis,v=c.Chart,r=c.Tick;n.prototype.isOuterAxis=function(){var a=this,f=-1,b=!0;p(this.chart.axes,function(d,g){d.side===a.side&&(d===a?f=g:0<=f&&g>f&&(b=!1))});return b};r.prototype.getLabelWidth=function(){return this.label.getBBox().width};n.prototype.getMaxLabelLength=function(a){var f=this.tickPositions,b=this.ticks,d=0;
|
||||
if(!this.maxLabelLength||a)p(f,function(a){(a=b[a])&&a.labelLength>d&&(d=a.labelLength)}),this.maxLabelLength=d;return this.maxLabelLength};n.prototype.addTitle=function(){var a=this.chart.renderer,f=this.axisParent,b=this.horiz,d=this.opposite,g=this.options,e=g.title,h;this.showAxis=h=this.hasData()||u(g.showEmpty,!0);g.title="";this.axisTitle||((g=e.textAlign)||(g=(b?{low:"left",middle:"center",high:"right"}:{low:d?"right":"left",middle:"center",high:d?"left":"right"})[e.align]),this.axisTitle=
|
||||
a.text(e.text,0,0,e.useHTML).attr({zIndex:7,rotation:e.rotation||0,align:g}).addClass("highcharts-axis-title").add(f),this.axisTitle.isNew=!0);this.axisTitle[h?"show":"hide"](!0)};c.dateFormats={W:function(a){a=new Date(a);var f=0===a.getUTCDay()?7:a.getUTCDay(),b=a.getTime(),d=new Date(a.getUTCFullYear(),0,1,-6);a.setDate(a.getUTCDate()+4-f);return 1+Math.floor(Math.floor((b-d)/864E5)/7)},E:function(a){return m("%a",a,!0).charAt(0)}};l(r.prototype,"addLabel",function(a){var f=this.axis,b=void 0!==
|
||||
f.options.categories,d=f.tickPositions,d=this.pos!==d[d.length-1];(!f.options.grid||b||d)&&a.apply(this)});l(r.prototype,"getLabelPosition",function(a,f,b,d){var g=a.apply(this,Array.prototype.slice.call(arguments,1)),e=this.axis,h=e.options,k=h.tickInterval||1,c,t;h.grid&&(c=h.labels.style.fontSize,t=e.chart.renderer.fontMetrics(c,d),c=t.b,t=t.h,e.horiz&&void 0===h.categories?(h=e.axisGroup.getBBox().height,k=this.pos+k/2,g.x=e.translate(k)+e.left,k=h/2+t/2-Math.abs(t-c),g.y=0===e.side?b-k:b+k):
|
||||
(void 0===h.categories&&(k=this.pos+k/2,g.y=e.translate(k)+e.top+c/2),k=this.getLabelWidth()/2-e.maxLabelLength/2,g.x=3===e.side?g.x+k:g.x-k));return g});l(n.prototype,"tickSize",function(a){var f=a.apply(this,Array.prototype.slice.call(arguments,1)),b;this.options.grid&&!this.horiz&&(b=2*Math.abs(this.defaultLeftAxisOptions.labels.x),this.maxLabelLength||(this.maxLabelLength=this.getMaxLabelLength()),b=this.maxLabelLength+b,f[0]=b);return f});l(n.prototype,"getOffset",function(a){var f=this.chart.axisOffset,
|
||||
b=this.side,d,g,e=this.options,h=e.title,k=h&&h.text&&!1!==h.enabled;this.options.grid&&q(this.options.title)?(g=this.tickSize("tick")[0],f[b]&&g&&(d=f[b]+g),k&&this.addTitle(),a.apply(this,Array.prototype.slice.call(arguments,1)),f[b]=u(d,f[b]),e.title=h):a.apply(this,Array.prototype.slice.call(arguments,1))});l(n.prototype,"renderUnsquish",function(a){this.options.grid&&(this.labelRotation=0,this.options.labels.rotation=0);a.apply(this)});l(n.prototype,"setOptions",function(a,f){f.grid&&this.horiz&&
|
||||
(f.startOnTick=!0,f.minPadding=0,f.endOnTick=!0);a.apply(this,Array.prototype.slice.call(arguments,1))});l(n.prototype,"render",function(a){var f=this.options,b,d,g,e,h,k,c=this.chart.renderer;if(f.grid){if(b=2*Math.abs(this.defaultLeftAxisOptions.labels.x),b=this.maxLabelLength+b,d=f.lineWidth,this.rightWall&&this.rightWall.destroy(),a.apply(this),a=this.axisGroup.getBBox(),this.horiz&&(this.rightWall=c.path(["M",a.x+this.width+1,a.y,"L",a.x+this.width+1,a.y+a.height]).attr({stroke:f.tickColor||
|
||||
"#ccd6eb","stroke-width":f.tickWidth||1,zIndex:7,class:"grid-wall"}).add(this.axisGroup)),this.isOuterAxis()&&this.axisLine&&(this.horiz&&(b=a.height-1),d)){a=this.getLinePath(d);h=a.indexOf("M")+1;k=a.indexOf("L")+1;g=a.indexOf("M")+2;e=a.indexOf("L")+2;if(0===this.side||3===this.side)b=-b;this.horiz?(a[g]+=b,a[e]+=b):(a[h]+=b,a[k]+=b);this.axisLineExtra?this.axisLineExtra.animate({d:a}):this.axisLineExtra=c.path(a).attr({stroke:f.lineColor,"stroke-width":d,zIndex:7}).add(this.axisGroup);this.axisLine[this.showAxis?
|
||||
"show":"hide"](!0)}}else a.apply(this)});l(v.prototype,"render",function(a){var f=25/11,b,c;p(this.axes,function(a){var e=a.options;e.grid&&(c=e.labels.style.fontSize,b=a.chart.renderer.fontMetrics(c),"datetime"===e.type&&(e.units=[["millisecond",[1]],["second",[1]],["minute",[1]],["hour",[1]],["day",[1]],["week",[1]],["month",[1]],["year",null]]),a.horiz?e.tickLength=e.cellHeight||b.h*f:(e.tickWidth=1,e.lineWidth||(e.lineWidth=1)))});a.apply(this)})})(m);(function(c){var m=c.getOptions().plotOptions,
|
||||
p=c.seriesTypes.column,q=c.each,u=c.extendClass,l=c.isNumber,n=c.isObject,v=c.merge,r=c.pick,a=c.seriesTypes,f=c.stop,b=c.wrap,d=c.Axis,g=c.Point,e=c.Series;m.xrange=v(m.column,{tooltip:{pointFormat:'\x3cspan style\x3d"color:{point.color}"\x3e\u25cf\x3c/span\x3e {series.name}: \x3cb\x3e{point.yCategory}\x3c/b\x3e\x3cbr/\x3e'}});a.xrange=u(p,{pointClass:u(g,{getLabelConfig:function(){var a=g.prototype.getLabelConfig.call(this);a.x2=this.x2;a.yCategory=this.yCategory=this.series.yAxis.categories&&this.series.yAxis.categories[this.y];
|
||||
return a}}),type:"xrange",forceDL:!0,parallelArrays:["x","x2","y"],requireSorting:!1,animate:a.line.prototype.animate,getColumnMetrics:function(){function a(){q(f.series,function(a){var b=a.xAxis;a.xAxis=a.yAxis;a.yAxis=b})}var b,f=this.chart;a();this.yAxis.closestPointRange=1;b=p.prototype.getColumnMetrics.call(this);a();return b},cropData:function(a,b,f,c){b=e.prototype.cropData.call(this,this.x2Data,b,f,c);b.xData=a.slice(b.start,b.end);return b},translate:function(){p.prototype.translate.apply(this,
|
||||
arguments);var a=this.xAxis,b=this.columnMetrics,f=this.options.minPointLength||0;q(this.points,function(c){var e=c.plotX,d=r(c.x2,c.x+(c.len||0)),d=a.toPixels(d,!0),g=d-e,h;f&&(h=f-g,0>h&&(h=0),e-=h/2,d+=h/2);e=Math.max(e,-10);d=Math.min(Math.max(d,-10),a.len+10);c.shapeArgs={x:e,y:c.plotY+b.offset,width:d-e,height:b.width};c.tooltipPos[0]+=g/2;c.tooltipPos[1]-=b.width/2;if(d=c.partialFill)n(d)&&(d=d.amount),l(d)||(d=0),e=c.shapeArgs,c.partShapeArgs={x:e.x,y:e.y+1,width:e.width*d,height:e.height-
|
||||
2}})},drawPoints:function(){var a=this,b=this.chart,c=b.renderer,e=b.pointCount<(a.options.animationLimit||250)?"animate":"attr";q(a.points,function(b){var d=b.graphic,g=b.shapeType,h=b.shapeArgs,k=b.partShapeArgs;if(l(b.plotY)&&null!==b.y)if(d){if(f(d),b.graphicOriginal[e](v(h)),k)b.graphicOverlay[e](v(k))}else b.graphic=d=c.g("point").attr({"class":b.getClassName()}).add(b.group||a.group),b.graphicOriginal=c[g](h).addClass("highcharts-partfill-original").add(d),k&&(b.graphicOverlay=c[g](k).addClass("highcharts-partfill-overlay").add(d));
|
||||
else d&&(b.graphic=d.destroy())})}});b(d.prototype,"getSeriesExtremes",function(a){var b=this.series,c,d;a.call(this);this.isXAxis&&"xrange"===b.type&&(c=r(this.dataMax,Number.MIN_VALUE),q(this.series,function(a){q(a.x2Data||[],function(a){a>c&&(c=a,d=!0)})}),d&&(this.dataMax=c))})})(m)});
|
||||
793
assets/plugin/chart/highcharts/code/js/modules/gantt.src.js
Executable file
793
assets/plugin/chart/highcharts/code/js/modules/gantt.src.js
Executable file
@ -0,0 +1,793 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Gantt series
|
||||
*
|
||||
* (c) 2016 Lars A. V. Cabrera
|
||||
*
|
||||
* --- WORK IN PROGRESS ---
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2016 Highsoft AS
|
||||
* Authors: Lars A. V. Cabrera
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var dateFormat = H.dateFormat,
|
||||
each = H.each,
|
||||
isObject = H.isObject,
|
||||
pick = H.pick,
|
||||
wrap = H.wrap,
|
||||
Axis = H.Axis,
|
||||
Chart = H.Chart,
|
||||
Tick = H.Tick;
|
||||
|
||||
|
||||
// Enum for which side the axis is on.
|
||||
// Maps to axis.side
|
||||
var axisSide = {
|
||||
top: 0,
|
||||
right: 1,
|
||||
bottom: 2,
|
||||
left: 3,
|
||||
0: 'top',
|
||||
1: 'right',
|
||||
2: 'bottom',
|
||||
3: 'left'
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if an axis is the outer axis in its dimension. Since
|
||||
* axes are placed outwards in order, the axis with the highest
|
||||
* index is the outermost axis.
|
||||
*
|
||||
* Example: If there are multiple x-axes at the top of the chart,
|
||||
* this function returns true if the axis supplied is the last
|
||||
* of the x-axes.
|
||||
*
|
||||
* @return true if the axis is the outermost axis in its dimension;
|
||||
* false if not
|
||||
*/
|
||||
Axis.prototype.isOuterAxis = function() {
|
||||
var axis = this,
|
||||
thisIndex = -1,
|
||||
isOuter = true;
|
||||
|
||||
each(this.chart.axes, function(otherAxis, index) {
|
||||
if (otherAxis.side === axis.side) {
|
||||
if (otherAxis === axis) {
|
||||
// Get the index of the axis in question
|
||||
thisIndex = index;
|
||||
|
||||
// Check thisIndex >= 0 in case thisIndex has
|
||||
// not been found yet
|
||||
} else if (thisIndex >= 0 && index > thisIndex) {
|
||||
// There was an axis on the same side with a
|
||||
// higher index. Exit the loop.
|
||||
isOuter = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
// There were either no other axes on the same side,
|
||||
// or the other axes were not farther from the chart
|
||||
return isOuter;
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut function to Tick.label.getBBox().width.
|
||||
*
|
||||
* @return {number} width - the width of the tick label
|
||||
*/
|
||||
Tick.prototype.getLabelWidth = function() {
|
||||
return this.label.getBBox().width;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the maximum label length.
|
||||
* This function can be used in states where the axis.maxLabelLength has not
|
||||
* been set.
|
||||
*
|
||||
* @param {boolean} force - Optional parameter to force a new calculation, even
|
||||
* if a value has already been set
|
||||
* @return {number} maxLabelLength - the maximum label length of the axis
|
||||
*/
|
||||
Axis.prototype.getMaxLabelLength = function(force) {
|
||||
var tickPositions = this.tickPositions,
|
||||
ticks = this.ticks,
|
||||
maxLabelLength = 0;
|
||||
|
||||
if (!this.maxLabelLength || force) {
|
||||
each(tickPositions, function(tick) {
|
||||
tick = ticks[tick];
|
||||
if (tick && tick.labelLength > maxLabelLength) {
|
||||
maxLabelLength = tick.labelLength;
|
||||
}
|
||||
});
|
||||
this.maxLabelLength = maxLabelLength;
|
||||
}
|
||||
return this.maxLabelLength;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds the axis defined in axis.options.title
|
||||
*/
|
||||
Axis.prototype.addTitle = function() {
|
||||
var axis = this,
|
||||
renderer = axis.chart.renderer,
|
||||
axisParent = axis.axisParent,
|
||||
horiz = axis.horiz,
|
||||
opposite = axis.opposite,
|
||||
options = axis.options,
|
||||
axisTitleOptions = options.title,
|
||||
hasData,
|
||||
showAxis,
|
||||
textAlign;
|
||||
|
||||
// For reuse in Axis.render
|
||||
hasData = axis.hasData();
|
||||
axis.showAxis = showAxis = hasData || pick(options.showEmpty, true);
|
||||
|
||||
// Disregard title generation in original Axis.getOffset()
|
||||
options.title = '';
|
||||
|
||||
if (!axis.axisTitle) {
|
||||
textAlign = axisTitleOptions.textAlign;
|
||||
if (!textAlign) {
|
||||
textAlign = (horiz ? {
|
||||
low: 'left',
|
||||
middle: 'center',
|
||||
high: 'right'
|
||||
} : {
|
||||
low: opposite ? 'right' : 'left',
|
||||
middle: 'center',
|
||||
high: opposite ? 'left' : 'right'
|
||||
})[axisTitleOptions.align];
|
||||
}
|
||||
axis.axisTitle = renderer.text(
|
||||
axisTitleOptions.text,
|
||||
0,
|
||||
0,
|
||||
axisTitleOptions.useHTML
|
||||
)
|
||||
.attr({
|
||||
zIndex: 7,
|
||||
rotation: axisTitleOptions.rotation || 0,
|
||||
align: textAlign
|
||||
})
|
||||
.addClass('highcharts-axis-title')
|
||||
|
||||
// Add to axisParent instead of axisGroup, to ignore the space
|
||||
// it takes
|
||||
.add(axisParent);
|
||||
axis.axisTitle.isNew = true;
|
||||
}
|
||||
|
||||
|
||||
// hide or show the title depending on whether showEmpty is set
|
||||
axis.axisTitle[showAxis ? 'show' : 'hide'](true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Add custom date formats
|
||||
*/
|
||||
H.dateFormats = {
|
||||
// Week number
|
||||
W: function(timestamp) {
|
||||
var date = new Date(timestamp),
|
||||
day = date.getUTCDay() === 0 ? 7 : date.getUTCDay(),
|
||||
time = date.getTime(),
|
||||
startOfYear = new Date(date.getUTCFullYear(), 0, 1, -6),
|
||||
dayNumber;
|
||||
date.setDate(date.getUTCDate() + 4 - day);
|
||||
dayNumber = Math.floor((time - startOfYear) / 86400000);
|
||||
return 1 + Math.floor(dayNumber / 7);
|
||||
},
|
||||
// First letter of the day of the week, e.g. 'M' for 'Monday'.
|
||||
E: function(timestamp) {
|
||||
return dateFormat('%a', timestamp, true).charAt(0);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Prevents adding the last tick label if the axis is not a category axis.
|
||||
*
|
||||
* Since numeric labels are normally placed at starts and ends of a range of
|
||||
* value, and this module makes the label point at the value, an "extra" label
|
||||
* would appear.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Tick.prototype, 'addLabel', function(proceed) {
|
||||
var axis = this.axis,
|
||||
isCategoryAxis = axis.options.categories !== undefined,
|
||||
tickPositions = axis.tickPositions,
|
||||
lastTick = tickPositions[tickPositions.length - 1],
|
||||
isLastTick = this.pos !== lastTick;
|
||||
|
||||
if (!axis.options.grid || isCategoryAxis || isLastTick) {
|
||||
proceed.apply(this);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Center tick labels vertically and horizontally between ticks
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*
|
||||
* @return {object} object - an object containing x and y positions
|
||||
* for the tick
|
||||
*/
|
||||
wrap(Tick.prototype, 'getLabelPosition', function(proceed, x, y, label) {
|
||||
var retVal = proceed.apply(this, Array.prototype.slice.call(arguments, 1)),
|
||||
axis = this.axis,
|
||||
options = axis.options,
|
||||
tickInterval = options.tickInterval || 1,
|
||||
newX,
|
||||
newPos,
|
||||
axisHeight,
|
||||
fontSize,
|
||||
labelMetrics,
|
||||
lblB,
|
||||
lblH,
|
||||
labelCenter;
|
||||
|
||||
// Only center tick labels if axis has option grid: true
|
||||
if (options.grid) {
|
||||
fontSize = options.labels.style.fontSize;
|
||||
labelMetrics = axis.chart.renderer.fontMetrics(fontSize, label);
|
||||
lblB = labelMetrics.b;
|
||||
lblH = labelMetrics.h;
|
||||
|
||||
if (axis.horiz && options.categories === undefined) {
|
||||
// Center x position
|
||||
axisHeight = axis.axisGroup.getBBox().height;
|
||||
newPos = this.pos + tickInterval / 2;
|
||||
retVal.x = axis.translate(newPos) + axis.left;
|
||||
labelCenter = (axisHeight / 2) + (lblH / 2) - Math.abs(lblH - lblB);
|
||||
|
||||
// Center y position
|
||||
if (axis.side === axisSide.top) {
|
||||
retVal.y = y - labelCenter;
|
||||
} else {
|
||||
retVal.y = y + labelCenter;
|
||||
}
|
||||
} else {
|
||||
// Center y position
|
||||
if (options.categories === undefined) {
|
||||
newPos = this.pos + (tickInterval / 2);
|
||||
retVal.y = axis.translate(newPos) + axis.top + (lblB / 2);
|
||||
}
|
||||
|
||||
// Center x position
|
||||
newX = (this.getLabelWidth() / 2) - (axis.maxLabelLength / 2);
|
||||
if (axis.side === axisSide.left) {
|
||||
retVal.x += newX;
|
||||
} else {
|
||||
retVal.x -= newX;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Draw vertical ticks extra long to create cell floors and roofs.
|
||||
* Overrides the tickLength for vertical axes.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
* @returns {array} retVal -
|
||||
*/
|
||||
wrap(Axis.prototype, 'tickSize', function(proceed) {
|
||||
var axis = this,
|
||||
retVal = proceed.apply(axis, Array.prototype.slice.call(arguments, 1)),
|
||||
labelPadding,
|
||||
distance;
|
||||
|
||||
if (axis.options.grid && !axis.horiz) {
|
||||
labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
|
||||
if (!axis.maxLabelLength) {
|
||||
axis.maxLabelLength = axis.getMaxLabelLength();
|
||||
}
|
||||
distance = axis.maxLabelLength + labelPadding;
|
||||
|
||||
retVal[0] = distance;
|
||||
}
|
||||
return retVal;
|
||||
});
|
||||
|
||||
/**
|
||||
* Disregards space required by axisTitle, by adding axisTitle to axisParent
|
||||
* instead of axisGroup, and disregarding margins and offsets related to
|
||||
* axisTitle.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Axis.prototype, 'getOffset', function(proceed) {
|
||||
var axis = this,
|
||||
axisOffset = axis.chart.axisOffset,
|
||||
side = axis.side,
|
||||
axisHeight,
|
||||
tickSize,
|
||||
options = axis.options,
|
||||
axisTitleOptions = options.title,
|
||||
addTitle = axisTitleOptions &&
|
||||
axisTitleOptions.text &&
|
||||
axisTitleOptions.enabled !== false;
|
||||
|
||||
if (axis.options.grid && isObject(axis.options.title)) {
|
||||
|
||||
tickSize = axis.tickSize('tick')[0];
|
||||
if (axisOffset[side] && tickSize) {
|
||||
axisHeight = axisOffset[side] + tickSize;
|
||||
}
|
||||
|
||||
if (addTitle) {
|
||||
// Use the custom addTitle() to add it, while preventing making room
|
||||
// for it
|
||||
axis.addTitle();
|
||||
}
|
||||
|
||||
proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
|
||||
|
||||
axisOffset[side] = pick(axisHeight, axisOffset[side]);
|
||||
|
||||
|
||||
// Put axis options back after original Axis.getOffset() has been called
|
||||
options.title = axisTitleOptions;
|
||||
|
||||
} else {
|
||||
proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Prevents rotation of labels when squished, as rotating them would not
|
||||
* help.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Axis.prototype, 'renderUnsquish', function(proceed) {
|
||||
if (this.options.grid) {
|
||||
this.labelRotation = 0;
|
||||
this.options.labels.rotation = 0;
|
||||
}
|
||||
proceed.apply(this);
|
||||
});
|
||||
|
||||
/**
|
||||
* Places leftmost tick at the start of the axis, to create a left wall.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Axis.prototype, 'setOptions', function(proceed, userOptions) {
|
||||
var axis = this;
|
||||
if (userOptions.grid && axis.horiz) {
|
||||
userOptions.startOnTick = true;
|
||||
userOptions.minPadding = 0;
|
||||
userOptions.endOnTick = true;
|
||||
}
|
||||
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
});
|
||||
|
||||
/**
|
||||
* Draw an extra line on the far side of the the axisLine,
|
||||
* creating cell roofs of a grid.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Axis.prototype, 'render', function(proceed) {
|
||||
var axis = this,
|
||||
options = axis.options,
|
||||
labelPadding,
|
||||
distance,
|
||||
lineWidth,
|
||||
linePath,
|
||||
yStartIndex,
|
||||
yEndIndex,
|
||||
xStartIndex,
|
||||
xEndIndex,
|
||||
renderer = axis.chart.renderer,
|
||||
axisGroupBox;
|
||||
|
||||
if (options.grid) {
|
||||
labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
|
||||
distance = axis.maxLabelLength + labelPadding;
|
||||
lineWidth = options.lineWidth;
|
||||
|
||||
// Remove right wall before rendering
|
||||
if (axis.rightWall) {
|
||||
axis.rightWall.destroy();
|
||||
}
|
||||
|
||||
// Call original Axis.render() to obtain axis.axisLine and
|
||||
// axis.axisGroup
|
||||
proceed.apply(axis);
|
||||
|
||||
axisGroupBox = axis.axisGroup.getBBox();
|
||||
|
||||
// Add right wall on horizontal axes
|
||||
if (axis.horiz) {
|
||||
axis.rightWall = renderer.path([
|
||||
'M',
|
||||
axisGroupBox.x + axis.width + 1, // account for left wall
|
||||
axisGroupBox.y,
|
||||
'L',
|
||||
axisGroupBox.x + axis.width + 1, // account for left wall
|
||||
axisGroupBox.y + axisGroupBox.height
|
||||
])
|
||||
.attr({
|
||||
stroke: options.tickColor || '#ccd6eb',
|
||||
'stroke-width': options.tickWidth || 1,
|
||||
zIndex: 7,
|
||||
class: 'grid-wall'
|
||||
})
|
||||
.add(axis.axisGroup);
|
||||
}
|
||||
|
||||
if (axis.isOuterAxis() && axis.axisLine) {
|
||||
if (axis.horiz) {
|
||||
// -1 to avoid adding distance each time the chart updates
|
||||
distance = axisGroupBox.height - 1;
|
||||
}
|
||||
|
||||
if (lineWidth) {
|
||||
linePath = axis.getLinePath(lineWidth);
|
||||
xStartIndex = linePath.indexOf('M') + 1;
|
||||
xEndIndex = linePath.indexOf('L') + 1;
|
||||
yStartIndex = linePath.indexOf('M') + 2;
|
||||
yEndIndex = linePath.indexOf('L') + 2;
|
||||
|
||||
// Negate distance if top or left axis
|
||||
if (axis.side === axisSide.top || axis.side === axisSide.left) {
|
||||
distance = -distance;
|
||||
}
|
||||
|
||||
// If axis is horizontal, reposition line path vertically
|
||||
if (axis.horiz) {
|
||||
linePath[yStartIndex] = linePath[yStartIndex] + distance;
|
||||
linePath[yEndIndex] = linePath[yEndIndex] + distance;
|
||||
} else {
|
||||
// If axis is vertical, reposition line path horizontally
|
||||
linePath[xStartIndex] = linePath[xStartIndex] + distance;
|
||||
linePath[xEndIndex] = linePath[xEndIndex] + distance;
|
||||
}
|
||||
|
||||
if (!axis.axisLineExtra) {
|
||||
axis.axisLineExtra = renderer.path(linePath)
|
||||
.attr({
|
||||
stroke: options.lineColor,
|
||||
'stroke-width': lineWidth,
|
||||
zIndex: 7
|
||||
})
|
||||
.add(axis.axisGroup);
|
||||
} else {
|
||||
axis.axisLineExtra.animate({
|
||||
d: linePath
|
||||
});
|
||||
}
|
||||
|
||||
// show or hide the line depending on options.showEmpty
|
||||
axis.axisLine[axis.showAxis ? 'show' : 'hide'](true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
proceed.apply(axis);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Wraps chart rendering with the following customizations:
|
||||
* 1. Prohibit timespans of multitudes of a time unit
|
||||
* 2. Draw cell walls on vertical axes
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Chart.prototype, 'render', function(proceed) {
|
||||
// 25 is optimal height for default fontSize (11px)
|
||||
// 25 / 11 ≈ 2.28
|
||||
var fontSizeToCellHeightRatio = 25 / 11,
|
||||
fontMetrics,
|
||||
fontSize;
|
||||
|
||||
each(this.axes, function(axis) {
|
||||
var options = axis.options;
|
||||
if (options.grid) {
|
||||
fontSize = options.labels.style.fontSize;
|
||||
fontMetrics = axis.chart.renderer.fontMetrics(fontSize);
|
||||
|
||||
// Prohibit timespans of multitudes of a time unit,
|
||||
// e.g. two days, three weeks, etc.
|
||||
if (options.type === 'datetime') {
|
||||
options.units = [
|
||||
['millisecond', [1]],
|
||||
['second', [1]],
|
||||
['minute', [1]],
|
||||
['hour', [1]],
|
||||
['day', [1]],
|
||||
['week', [1]],
|
||||
['month', [1]],
|
||||
['year', null]
|
||||
];
|
||||
}
|
||||
|
||||
// Make tick marks taller, creating cell walls of a grid.
|
||||
// Use cellHeight axis option if set
|
||||
if (axis.horiz) {
|
||||
options.tickLength = options.cellHeight ||
|
||||
fontMetrics.h * fontSizeToCellHeightRatio;
|
||||
} else {
|
||||
options.tickWidth = 1;
|
||||
if (!options.lineWidth) {
|
||||
options.lineWidth = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Call original Chart.render()
|
||||
proceed.apply(this);
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2014-2016 Highsoft AS
|
||||
* Authors: Torstein Honsi, Lars A. V. Cabrera
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var defaultPlotOptions = H.getOptions().plotOptions,
|
||||
color = H.Color,
|
||||
columnType = H.seriesTypes.column,
|
||||
each = H.each,
|
||||
extendClass = H.extendClass,
|
||||
isNumber = H.isNumber,
|
||||
isObject = H.isObject,
|
||||
merge = H.merge,
|
||||
pick = H.pick,
|
||||
seriesTypes = H.seriesTypes,
|
||||
stop = H.stop,
|
||||
wrap = H.wrap,
|
||||
Axis = H.Axis,
|
||||
Point = H.Point,
|
||||
Series = H.Series,
|
||||
pointFormat = '<span style="color:{point.color}">' +
|
||||
'\u25CF' +
|
||||
'</span> {series.name}: <b>{point.yCategory}</b><br/>',
|
||||
xrange = 'xrange';
|
||||
|
||||
defaultPlotOptions.xrange = merge(defaultPlotOptions.column, {
|
||||
tooltip: {
|
||||
pointFormat: pointFormat
|
||||
}
|
||||
});
|
||||
seriesTypes.xrange = extendClass(columnType, {
|
||||
pointClass: extendClass(Point, {
|
||||
// Add x2 and yCategory to the available properties for tooltip formats
|
||||
getLabelConfig: function() {
|
||||
var cfg = Point.prototype.getLabelConfig.call(this);
|
||||
|
||||
cfg.x2 = this.x2;
|
||||
cfg.yCategory = this.yCategory = this.series.yAxis.categories && this.series.yAxis.categories[this.y];
|
||||
return cfg;
|
||||
}
|
||||
}),
|
||||
type: xrange,
|
||||
forceDL: true,
|
||||
parallelArrays: ['x', 'x2', 'y'],
|
||||
requireSorting: false,
|
||||
animate: seriesTypes.line.prototype.animate,
|
||||
|
||||
/**
|
||||
* Borrow the column series metrics, but with swapped axes. This gives free access
|
||||
* to features like groupPadding, grouping, pointWidth etc.
|
||||
*/
|
||||
getColumnMetrics: function() {
|
||||
var metrics,
|
||||
chart = this.chart;
|
||||
|
||||
function swapAxes() {
|
||||
each(chart.series, function(s) {
|
||||
var xAxis = s.xAxis;
|
||||
s.xAxis = s.yAxis;
|
||||
s.yAxis = xAxis;
|
||||
});
|
||||
}
|
||||
|
||||
swapAxes();
|
||||
|
||||
this.yAxis.closestPointRange = 1;
|
||||
metrics = columnType.prototype.getColumnMetrics.call(this);
|
||||
|
||||
swapAxes();
|
||||
|
||||
return metrics;
|
||||
},
|
||||
|
||||
/**
|
||||
* Override cropData to show a point where x is outside visible range
|
||||
* but x2 is outside.
|
||||
*/
|
||||
cropData: function(xData, yData, min, max) {
|
||||
|
||||
// Replace xData with x2Data to find the appropriate cropStart
|
||||
var cropData = Series.prototype.cropData,
|
||||
crop = cropData.call(this, this.x2Data, yData, min, max);
|
||||
|
||||
// Re-insert the cropped xData
|
||||
crop.xData = xData.slice(crop.start, crop.end);
|
||||
|
||||
return crop;
|
||||
},
|
||||
|
||||
translate: function() {
|
||||
columnType.prototype.translate.apply(this, arguments);
|
||||
var series = this,
|
||||
xAxis = series.xAxis,
|
||||
metrics = series.columnMetrics,
|
||||
minPointLength = series.options.minPointLength || 0;
|
||||
|
||||
each(series.points, function(point) {
|
||||
var plotX = point.plotX,
|
||||
posX = pick(point.x2, point.x + (point.len || 0)),
|
||||
plotX2 = xAxis.toPixels(posX, true),
|
||||
width = plotX2 - plotX,
|
||||
widthDifference,
|
||||
shapeArgs,
|
||||
partialFill;
|
||||
|
||||
if (minPointLength) {
|
||||
widthDifference = minPointLength - width;
|
||||
if (widthDifference < 0) {
|
||||
widthDifference = 0;
|
||||
}
|
||||
plotX -= widthDifference / 2;
|
||||
plotX2 += widthDifference / 2;
|
||||
}
|
||||
|
||||
plotX = Math.max(plotX, -10);
|
||||
plotX2 = Math.min(Math.max(plotX2, -10), xAxis.len + 10);
|
||||
|
||||
point.shapeArgs = {
|
||||
x: plotX,
|
||||
y: point.plotY + metrics.offset,
|
||||
width: plotX2 - plotX,
|
||||
height: metrics.width
|
||||
};
|
||||
point.tooltipPos[0] += width / 2;
|
||||
point.tooltipPos[1] -= metrics.width / 2;
|
||||
|
||||
// Add a partShapeArgs to the point, based on the shapeArgs property
|
||||
partialFill = point.partialFill;
|
||||
if (partialFill) {
|
||||
// Get the partial fill amount
|
||||
if (isObject(partialFill)) {
|
||||
partialFill = partialFill.amount;
|
||||
}
|
||||
// If it was not a number, assume 0
|
||||
if (!isNumber(partialFill)) {
|
||||
partialFill = 0;
|
||||
}
|
||||
shapeArgs = point.shapeArgs;
|
||||
point.partShapeArgs = {
|
||||
x: shapeArgs.x,
|
||||
y: shapeArgs.y + 1,
|
||||
width: shapeArgs.width * partialFill,
|
||||
height: shapeArgs.height - 2
|
||||
};
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
drawPoints: function() {
|
||||
var series = this,
|
||||
chart = this.chart,
|
||||
options = series.options,
|
||||
renderer = chart.renderer,
|
||||
animationLimit = options.animationLimit || 250,
|
||||
verb = chart.pointCount < animationLimit ? 'animate' : 'attr';
|
||||
|
||||
// draw the columns
|
||||
each(series.points, function(point) {
|
||||
var plotY = point.plotY,
|
||||
graphic = point.graphic,
|
||||
type = point.shapeType,
|
||||
shapeArgs = point.shapeArgs,
|
||||
partShapeArgs = point.partShapeArgs,
|
||||
seriesOpts = series.options,
|
||||
pfOptions = point.partialFill,
|
||||
fill,
|
||||
state = point.selected && 'select',
|
||||
cutOff = options.stacking && !options.borderRadius;
|
||||
|
||||
if (isNumber(plotY) && point.y !== null) {
|
||||
if (graphic) { // update
|
||||
stop(graphic);
|
||||
point.graphicOriginal[verb](
|
||||
merge(shapeArgs)
|
||||
);
|
||||
if (partShapeArgs) {
|
||||
point.graphicOverlay[verb](
|
||||
merge(partShapeArgs)
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
point.graphic = graphic = renderer.g('point')
|
||||
.attr({
|
||||
'class': point.getClassName()
|
||||
})
|
||||
.add(point.group || series.group);
|
||||
|
||||
point.graphicOriginal = renderer[type](shapeArgs)
|
||||
.addClass('highcharts-partfill-original')
|
||||
.add(graphic);
|
||||
if (partShapeArgs) {
|
||||
point.graphicOverlay = renderer[type](partShapeArgs)
|
||||
.addClass('highcharts-partfill-overlay')
|
||||
.add(graphic);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (graphic) {
|
||||
point.graphic = graphic.destroy(); // #1269
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Max x2 should be considered in xAxis extremes
|
||||
*/
|
||||
wrap(Axis.prototype, 'getSeriesExtremes', function(proceed) {
|
||||
var axis = this,
|
||||
series = axis.series,
|
||||
dataMax,
|
||||
modMax;
|
||||
|
||||
proceed.call(this);
|
||||
if (axis.isXAxis && series.type === xrange) {
|
||||
dataMax = pick(axis.dataMax, Number.MIN_VALUE);
|
||||
each(this.series, function(series) {
|
||||
each(series.x2Data || [], function(val) {
|
||||
if (val > dataMax) {
|
||||
dataMax = val;
|
||||
modMax = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
if (modMax) {
|
||||
axis.dataMax = dataMax;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2016 Highsoft AS
|
||||
* Authors: Lars A. V. Cabrera
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
//
|
||||
}(Highcharts));
|
||||
}));
|
||||
19
assets/plugin/chart/highcharts/code/js/modules/grid-axis.js
Executable file
19
assets/plugin/chart/highcharts/code/js/modules/grid-axis.js
Executable file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
GridAxis
|
||||
|
||||
(c) 2016 Lars A. V. Cabrera
|
||||
|
||||
--- WORK IN PROGRESS ---
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(h){var n=h.dateFormat,p=h.each,t=h.isObject,r=h.pick,l=h.wrap,m=h.Axis,u=h.Chart,q=h.Tick;m.prototype.isOuterAxis=function(){var a=this,c=-1,b=!0;p(this.chart.axes,function(e,f){e.side===a.side&&(e===a?c=f:0<=c&&f>c&&(b=!1))});return b};q.prototype.getLabelWidth=function(){return this.label.getBBox().width};m.prototype.getMaxLabelLength=function(a){var c=this.tickPositions,b=this.ticks,e=0;
|
||||
if(!this.maxLabelLength||a)p(c,function(a){(a=b[a])&&a.labelLength>e&&(e=a.labelLength)}),this.maxLabelLength=e;return this.maxLabelLength};m.prototype.addTitle=function(){var a=this.chart.renderer,c=this.axisParent,b=this.horiz,e=this.opposite,f=this.options,d=f.title,g;this.showAxis=g=this.hasData()||r(f.showEmpty,!0);f.title="";this.axisTitle||((f=d.textAlign)||(f=(b?{low:"left",middle:"center",high:"right"}:{low:e?"right":"left",middle:"center",high:e?"left":"right"})[d.align]),this.axisTitle=
|
||||
a.text(d.text,0,0,d.useHTML).attr({zIndex:7,rotation:d.rotation||0,align:f}).addClass("highcharts-axis-title").add(c),this.axisTitle.isNew=!0);this.axisTitle[g?"show":"hide"](!0)};h.dateFormats={W:function(a){a=new Date(a);var c=0===a.getUTCDay()?7:a.getUTCDay(),b=a.getTime(),e=new Date(a.getUTCFullYear(),0,1,-6);a.setDate(a.getUTCDate()+4-c);return 1+Math.floor(Math.floor((b-e)/864E5)/7)},E:function(a){return n("%a",a,!0).charAt(0)}};l(q.prototype,"addLabel",function(a){var c=this.axis,b=void 0!==
|
||||
c.options.categories,e=c.tickPositions,e=this.pos!==e[e.length-1];(!c.options.grid||b||e)&&a.apply(this)});l(q.prototype,"getLabelPosition",function(a,c,b,e){var f=a.apply(this,Array.prototype.slice.call(arguments,1)),d=this.axis,g=d.options,k=g.tickInterval||1,h,l;g.grid&&(h=g.labels.style.fontSize,l=d.chart.renderer.fontMetrics(h,e),h=l.b,l=l.h,d.horiz&&void 0===g.categories?(g=d.axisGroup.getBBox().height,k=this.pos+k/2,f.x=d.translate(k)+d.left,k=g/2+l/2-Math.abs(l-h),f.y=0===d.side?b-k:b+k):
|
||||
(void 0===g.categories&&(k=this.pos+k/2,f.y=d.translate(k)+d.top+h/2),k=this.getLabelWidth()/2-d.maxLabelLength/2,f.x=3===d.side?f.x+k:f.x-k));return f});l(m.prototype,"tickSize",function(a){var c=a.apply(this,Array.prototype.slice.call(arguments,1)),b;this.options.grid&&!this.horiz&&(b=2*Math.abs(this.defaultLeftAxisOptions.labels.x),this.maxLabelLength||(this.maxLabelLength=this.getMaxLabelLength()),b=this.maxLabelLength+b,c[0]=b);return c});l(m.prototype,"getOffset",function(a){var c=this.chart.axisOffset,
|
||||
b=this.side,e,f,d=this.options,g=d.title,k=g&&g.text&&!1!==g.enabled;this.options.grid&&t(this.options.title)?(f=this.tickSize("tick")[0],c[b]&&f&&(e=c[b]+f),k&&this.addTitle(),a.apply(this,Array.prototype.slice.call(arguments,1)),c[b]=r(e,c[b]),d.title=g):a.apply(this,Array.prototype.slice.call(arguments,1))});l(m.prototype,"renderUnsquish",function(a){this.options.grid&&(this.labelRotation=0,this.options.labels.rotation=0);a.apply(this)});l(m.prototype,"setOptions",function(a,c){c.grid&&this.horiz&&
|
||||
(c.startOnTick=!0,c.minPadding=0,c.endOnTick=!0);a.apply(this,Array.prototype.slice.call(arguments,1))});l(m.prototype,"render",function(a){var c=this.options,b,e,f,d,g,k,h=this.chart.renderer;if(c.grid){if(b=2*Math.abs(this.defaultLeftAxisOptions.labels.x),b=this.maxLabelLength+b,e=c.lineWidth,this.rightWall&&this.rightWall.destroy(),a.apply(this),a=this.axisGroup.getBBox(),this.horiz&&(this.rightWall=h.path(["M",a.x+this.width+1,a.y,"L",a.x+this.width+1,a.y+a.height]).attr({stroke:c.tickColor||
|
||||
"#ccd6eb","stroke-width":c.tickWidth||1,zIndex:7,class:"grid-wall"}).add(this.axisGroup)),this.isOuterAxis()&&this.axisLine&&(this.horiz&&(b=a.height-1),e)){a=this.getLinePath(e);g=a.indexOf("M")+1;k=a.indexOf("L")+1;f=a.indexOf("M")+2;d=a.indexOf("L")+2;if(0===this.side||3===this.side)b=-b;this.horiz?(a[f]+=b,a[d]+=b):(a[g]+=b,a[k]+=b);this.axisLineExtra?this.axisLineExtra.animate({d:a}):this.axisLineExtra=h.path(a).attr({stroke:c.lineColor,"stroke-width":e,zIndex:7}).add(this.axisGroup);this.axisLine[this.showAxis?
|
||||
"show":"hide"](!0)}}else a.apply(this)});l(u.prototype,"render",function(a){var c=25/11,b,e;p(this.axes,function(a){var d=a.options;d.grid&&(e=d.labels.style.fontSize,b=a.chart.renderer.fontMetrics(e),"datetime"===d.type&&(d.units=[["millisecond",[1]],["second",[1]],["minute",[1]],["hour",[1]],["day",[1]],["week",[1]],["month",[1]],["year",null]]),a.horiz?d.tickLength=d.cellHeight||b.h*c:(d.tickWidth=1,d.lineWidth||(d.lineWidth=1)))});a.apply(this)})})(n)});
|
||||
545
assets/plugin/chart/highcharts/code/js/modules/grid-axis.src.js
Executable file
545
assets/plugin/chart/highcharts/code/js/modules/grid-axis.src.js
Executable file
@ -0,0 +1,545 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* GridAxis
|
||||
*
|
||||
* (c) 2016 Lars A. V. Cabrera
|
||||
*
|
||||
* --- WORK IN PROGRESS ---
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2016 Highsoft AS
|
||||
* Authors: Lars A. V. Cabrera
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var dateFormat = H.dateFormat,
|
||||
each = H.each,
|
||||
isObject = H.isObject,
|
||||
pick = H.pick,
|
||||
wrap = H.wrap,
|
||||
Axis = H.Axis,
|
||||
Chart = H.Chart,
|
||||
Tick = H.Tick;
|
||||
|
||||
|
||||
// Enum for which side the axis is on.
|
||||
// Maps to axis.side
|
||||
var axisSide = {
|
||||
top: 0,
|
||||
right: 1,
|
||||
bottom: 2,
|
||||
left: 3,
|
||||
0: 'top',
|
||||
1: 'right',
|
||||
2: 'bottom',
|
||||
3: 'left'
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if an axis is the outer axis in its dimension. Since
|
||||
* axes are placed outwards in order, the axis with the highest
|
||||
* index is the outermost axis.
|
||||
*
|
||||
* Example: If there are multiple x-axes at the top of the chart,
|
||||
* this function returns true if the axis supplied is the last
|
||||
* of the x-axes.
|
||||
*
|
||||
* @return true if the axis is the outermost axis in its dimension;
|
||||
* false if not
|
||||
*/
|
||||
Axis.prototype.isOuterAxis = function() {
|
||||
var axis = this,
|
||||
thisIndex = -1,
|
||||
isOuter = true;
|
||||
|
||||
each(this.chart.axes, function(otherAxis, index) {
|
||||
if (otherAxis.side === axis.side) {
|
||||
if (otherAxis === axis) {
|
||||
// Get the index of the axis in question
|
||||
thisIndex = index;
|
||||
|
||||
// Check thisIndex >= 0 in case thisIndex has
|
||||
// not been found yet
|
||||
} else if (thisIndex >= 0 && index > thisIndex) {
|
||||
// There was an axis on the same side with a
|
||||
// higher index. Exit the loop.
|
||||
isOuter = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
// There were either no other axes on the same side,
|
||||
// or the other axes were not farther from the chart
|
||||
return isOuter;
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut function to Tick.label.getBBox().width.
|
||||
*
|
||||
* @return {number} width - the width of the tick label
|
||||
*/
|
||||
Tick.prototype.getLabelWidth = function() {
|
||||
return this.label.getBBox().width;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the maximum label length.
|
||||
* This function can be used in states where the axis.maxLabelLength has not
|
||||
* been set.
|
||||
*
|
||||
* @param {boolean} force - Optional parameter to force a new calculation, even
|
||||
* if a value has already been set
|
||||
* @return {number} maxLabelLength - the maximum label length of the axis
|
||||
*/
|
||||
Axis.prototype.getMaxLabelLength = function(force) {
|
||||
var tickPositions = this.tickPositions,
|
||||
ticks = this.ticks,
|
||||
maxLabelLength = 0;
|
||||
|
||||
if (!this.maxLabelLength || force) {
|
||||
each(tickPositions, function(tick) {
|
||||
tick = ticks[tick];
|
||||
if (tick && tick.labelLength > maxLabelLength) {
|
||||
maxLabelLength = tick.labelLength;
|
||||
}
|
||||
});
|
||||
this.maxLabelLength = maxLabelLength;
|
||||
}
|
||||
return this.maxLabelLength;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds the axis defined in axis.options.title
|
||||
*/
|
||||
Axis.prototype.addTitle = function() {
|
||||
var axis = this,
|
||||
renderer = axis.chart.renderer,
|
||||
axisParent = axis.axisParent,
|
||||
horiz = axis.horiz,
|
||||
opposite = axis.opposite,
|
||||
options = axis.options,
|
||||
axisTitleOptions = options.title,
|
||||
hasData,
|
||||
showAxis,
|
||||
textAlign;
|
||||
|
||||
// For reuse in Axis.render
|
||||
hasData = axis.hasData();
|
||||
axis.showAxis = showAxis = hasData || pick(options.showEmpty, true);
|
||||
|
||||
// Disregard title generation in original Axis.getOffset()
|
||||
options.title = '';
|
||||
|
||||
if (!axis.axisTitle) {
|
||||
textAlign = axisTitleOptions.textAlign;
|
||||
if (!textAlign) {
|
||||
textAlign = (horiz ? {
|
||||
low: 'left',
|
||||
middle: 'center',
|
||||
high: 'right'
|
||||
} : {
|
||||
low: opposite ? 'right' : 'left',
|
||||
middle: 'center',
|
||||
high: opposite ? 'left' : 'right'
|
||||
})[axisTitleOptions.align];
|
||||
}
|
||||
axis.axisTitle = renderer.text(
|
||||
axisTitleOptions.text,
|
||||
0,
|
||||
0,
|
||||
axisTitleOptions.useHTML
|
||||
)
|
||||
.attr({
|
||||
zIndex: 7,
|
||||
rotation: axisTitleOptions.rotation || 0,
|
||||
align: textAlign
|
||||
})
|
||||
.addClass('highcharts-axis-title')
|
||||
|
||||
// Add to axisParent instead of axisGroup, to ignore the space
|
||||
// it takes
|
||||
.add(axisParent);
|
||||
axis.axisTitle.isNew = true;
|
||||
}
|
||||
|
||||
|
||||
// hide or show the title depending on whether showEmpty is set
|
||||
axis.axisTitle[showAxis ? 'show' : 'hide'](true);
|
||||
};
|
||||
|
||||
/**
|
||||
* Add custom date formats
|
||||
*/
|
||||
H.dateFormats = {
|
||||
// Week number
|
||||
W: function(timestamp) {
|
||||
var date = new Date(timestamp),
|
||||
day = date.getUTCDay() === 0 ? 7 : date.getUTCDay(),
|
||||
time = date.getTime(),
|
||||
startOfYear = new Date(date.getUTCFullYear(), 0, 1, -6),
|
||||
dayNumber;
|
||||
date.setDate(date.getUTCDate() + 4 - day);
|
||||
dayNumber = Math.floor((time - startOfYear) / 86400000);
|
||||
return 1 + Math.floor(dayNumber / 7);
|
||||
},
|
||||
// First letter of the day of the week, e.g. 'M' for 'Monday'.
|
||||
E: function(timestamp) {
|
||||
return dateFormat('%a', timestamp, true).charAt(0);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Prevents adding the last tick label if the axis is not a category axis.
|
||||
*
|
||||
* Since numeric labels are normally placed at starts and ends of a range of
|
||||
* value, and this module makes the label point at the value, an "extra" label
|
||||
* would appear.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Tick.prototype, 'addLabel', function(proceed) {
|
||||
var axis = this.axis,
|
||||
isCategoryAxis = axis.options.categories !== undefined,
|
||||
tickPositions = axis.tickPositions,
|
||||
lastTick = tickPositions[tickPositions.length - 1],
|
||||
isLastTick = this.pos !== lastTick;
|
||||
|
||||
if (!axis.options.grid || isCategoryAxis || isLastTick) {
|
||||
proceed.apply(this);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Center tick labels vertically and horizontally between ticks
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*
|
||||
* @return {object} object - an object containing x and y positions
|
||||
* for the tick
|
||||
*/
|
||||
wrap(Tick.prototype, 'getLabelPosition', function(proceed, x, y, label) {
|
||||
var retVal = proceed.apply(this, Array.prototype.slice.call(arguments, 1)),
|
||||
axis = this.axis,
|
||||
options = axis.options,
|
||||
tickInterval = options.tickInterval || 1,
|
||||
newX,
|
||||
newPos,
|
||||
axisHeight,
|
||||
fontSize,
|
||||
labelMetrics,
|
||||
lblB,
|
||||
lblH,
|
||||
labelCenter;
|
||||
|
||||
// Only center tick labels if axis has option grid: true
|
||||
if (options.grid) {
|
||||
fontSize = options.labels.style.fontSize;
|
||||
labelMetrics = axis.chart.renderer.fontMetrics(fontSize, label);
|
||||
lblB = labelMetrics.b;
|
||||
lblH = labelMetrics.h;
|
||||
|
||||
if (axis.horiz && options.categories === undefined) {
|
||||
// Center x position
|
||||
axisHeight = axis.axisGroup.getBBox().height;
|
||||
newPos = this.pos + tickInterval / 2;
|
||||
retVal.x = axis.translate(newPos) + axis.left;
|
||||
labelCenter = (axisHeight / 2) + (lblH / 2) - Math.abs(lblH - lblB);
|
||||
|
||||
// Center y position
|
||||
if (axis.side === axisSide.top) {
|
||||
retVal.y = y - labelCenter;
|
||||
} else {
|
||||
retVal.y = y + labelCenter;
|
||||
}
|
||||
} else {
|
||||
// Center y position
|
||||
if (options.categories === undefined) {
|
||||
newPos = this.pos + (tickInterval / 2);
|
||||
retVal.y = axis.translate(newPos) + axis.top + (lblB / 2);
|
||||
}
|
||||
|
||||
// Center x position
|
||||
newX = (this.getLabelWidth() / 2) - (axis.maxLabelLength / 2);
|
||||
if (axis.side === axisSide.left) {
|
||||
retVal.x += newX;
|
||||
} else {
|
||||
retVal.x -= newX;
|
||||
}
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Draw vertical ticks extra long to create cell floors and roofs.
|
||||
* Overrides the tickLength for vertical axes.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
* @returns {array} retVal -
|
||||
*/
|
||||
wrap(Axis.prototype, 'tickSize', function(proceed) {
|
||||
var axis = this,
|
||||
retVal = proceed.apply(axis, Array.prototype.slice.call(arguments, 1)),
|
||||
labelPadding,
|
||||
distance;
|
||||
|
||||
if (axis.options.grid && !axis.horiz) {
|
||||
labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
|
||||
if (!axis.maxLabelLength) {
|
||||
axis.maxLabelLength = axis.getMaxLabelLength();
|
||||
}
|
||||
distance = axis.maxLabelLength + labelPadding;
|
||||
|
||||
retVal[0] = distance;
|
||||
}
|
||||
return retVal;
|
||||
});
|
||||
|
||||
/**
|
||||
* Disregards space required by axisTitle, by adding axisTitle to axisParent
|
||||
* instead of axisGroup, and disregarding margins and offsets related to
|
||||
* axisTitle.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Axis.prototype, 'getOffset', function(proceed) {
|
||||
var axis = this,
|
||||
axisOffset = axis.chart.axisOffset,
|
||||
side = axis.side,
|
||||
axisHeight,
|
||||
tickSize,
|
||||
options = axis.options,
|
||||
axisTitleOptions = options.title,
|
||||
addTitle = axisTitleOptions &&
|
||||
axisTitleOptions.text &&
|
||||
axisTitleOptions.enabled !== false;
|
||||
|
||||
if (axis.options.grid && isObject(axis.options.title)) {
|
||||
|
||||
tickSize = axis.tickSize('tick')[0];
|
||||
if (axisOffset[side] && tickSize) {
|
||||
axisHeight = axisOffset[side] + tickSize;
|
||||
}
|
||||
|
||||
if (addTitle) {
|
||||
// Use the custom addTitle() to add it, while preventing making room
|
||||
// for it
|
||||
axis.addTitle();
|
||||
}
|
||||
|
||||
proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
|
||||
|
||||
axisOffset[side] = pick(axisHeight, axisOffset[side]);
|
||||
|
||||
|
||||
// Put axis options back after original Axis.getOffset() has been called
|
||||
options.title = axisTitleOptions;
|
||||
|
||||
} else {
|
||||
proceed.apply(axis, Array.prototype.slice.call(arguments, 1));
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Prevents rotation of labels when squished, as rotating them would not
|
||||
* help.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Axis.prototype, 'renderUnsquish', function(proceed) {
|
||||
if (this.options.grid) {
|
||||
this.labelRotation = 0;
|
||||
this.options.labels.rotation = 0;
|
||||
}
|
||||
proceed.apply(this);
|
||||
});
|
||||
|
||||
/**
|
||||
* Places leftmost tick at the start of the axis, to create a left wall.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Axis.prototype, 'setOptions', function(proceed, userOptions) {
|
||||
var axis = this;
|
||||
if (userOptions.grid && axis.horiz) {
|
||||
userOptions.startOnTick = true;
|
||||
userOptions.minPadding = 0;
|
||||
userOptions.endOnTick = true;
|
||||
}
|
||||
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
});
|
||||
|
||||
/**
|
||||
* Draw an extra line on the far side of the the axisLine,
|
||||
* creating cell roofs of a grid.
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Axis.prototype, 'render', function(proceed) {
|
||||
var axis = this,
|
||||
options = axis.options,
|
||||
labelPadding,
|
||||
distance,
|
||||
lineWidth,
|
||||
linePath,
|
||||
yStartIndex,
|
||||
yEndIndex,
|
||||
xStartIndex,
|
||||
xEndIndex,
|
||||
renderer = axis.chart.renderer,
|
||||
axisGroupBox;
|
||||
|
||||
if (options.grid) {
|
||||
labelPadding = (Math.abs(axis.defaultLeftAxisOptions.labels.x) * 2);
|
||||
distance = axis.maxLabelLength + labelPadding;
|
||||
lineWidth = options.lineWidth;
|
||||
|
||||
// Remove right wall before rendering
|
||||
if (axis.rightWall) {
|
||||
axis.rightWall.destroy();
|
||||
}
|
||||
|
||||
// Call original Axis.render() to obtain axis.axisLine and
|
||||
// axis.axisGroup
|
||||
proceed.apply(axis);
|
||||
|
||||
axisGroupBox = axis.axisGroup.getBBox();
|
||||
|
||||
// Add right wall on horizontal axes
|
||||
if (axis.horiz) {
|
||||
axis.rightWall = renderer.path([
|
||||
'M',
|
||||
axisGroupBox.x + axis.width + 1, // account for left wall
|
||||
axisGroupBox.y,
|
||||
'L',
|
||||
axisGroupBox.x + axis.width + 1, // account for left wall
|
||||
axisGroupBox.y + axisGroupBox.height
|
||||
])
|
||||
.attr({
|
||||
stroke: options.tickColor || '#ccd6eb',
|
||||
'stroke-width': options.tickWidth || 1,
|
||||
zIndex: 7,
|
||||
class: 'grid-wall'
|
||||
})
|
||||
.add(axis.axisGroup);
|
||||
}
|
||||
|
||||
if (axis.isOuterAxis() && axis.axisLine) {
|
||||
if (axis.horiz) {
|
||||
// -1 to avoid adding distance each time the chart updates
|
||||
distance = axisGroupBox.height - 1;
|
||||
}
|
||||
|
||||
if (lineWidth) {
|
||||
linePath = axis.getLinePath(lineWidth);
|
||||
xStartIndex = linePath.indexOf('M') + 1;
|
||||
xEndIndex = linePath.indexOf('L') + 1;
|
||||
yStartIndex = linePath.indexOf('M') + 2;
|
||||
yEndIndex = linePath.indexOf('L') + 2;
|
||||
|
||||
// Negate distance if top or left axis
|
||||
if (axis.side === axisSide.top || axis.side === axisSide.left) {
|
||||
distance = -distance;
|
||||
}
|
||||
|
||||
// If axis is horizontal, reposition line path vertically
|
||||
if (axis.horiz) {
|
||||
linePath[yStartIndex] = linePath[yStartIndex] + distance;
|
||||
linePath[yEndIndex] = linePath[yEndIndex] + distance;
|
||||
} else {
|
||||
// If axis is vertical, reposition line path horizontally
|
||||
linePath[xStartIndex] = linePath[xStartIndex] + distance;
|
||||
linePath[xEndIndex] = linePath[xEndIndex] + distance;
|
||||
}
|
||||
|
||||
if (!axis.axisLineExtra) {
|
||||
axis.axisLineExtra = renderer.path(linePath)
|
||||
.attr({
|
||||
stroke: options.lineColor,
|
||||
'stroke-width': lineWidth,
|
||||
zIndex: 7
|
||||
})
|
||||
.add(axis.axisGroup);
|
||||
} else {
|
||||
axis.axisLineExtra.animate({
|
||||
d: linePath
|
||||
});
|
||||
}
|
||||
|
||||
// show or hide the line depending on options.showEmpty
|
||||
axis.axisLine[axis.showAxis ? 'show' : 'hide'](true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
proceed.apply(axis);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Wraps chart rendering with the following customizations:
|
||||
* 1. Prohibit timespans of multitudes of a time unit
|
||||
* 2. Draw cell walls on vertical axes
|
||||
*
|
||||
* @param {function} proceed - the original function
|
||||
*/
|
||||
wrap(Chart.prototype, 'render', function(proceed) {
|
||||
// 25 is optimal height for default fontSize (11px)
|
||||
// 25 / 11 ≈ 2.28
|
||||
var fontSizeToCellHeightRatio = 25 / 11,
|
||||
fontMetrics,
|
||||
fontSize;
|
||||
|
||||
each(this.axes, function(axis) {
|
||||
var options = axis.options;
|
||||
if (options.grid) {
|
||||
fontSize = options.labels.style.fontSize;
|
||||
fontMetrics = axis.chart.renderer.fontMetrics(fontSize);
|
||||
|
||||
// Prohibit timespans of multitudes of a time unit,
|
||||
// e.g. two days, three weeks, etc.
|
||||
if (options.type === 'datetime') {
|
||||
options.units = [
|
||||
['millisecond', [1]],
|
||||
['second', [1]],
|
||||
['minute', [1]],
|
||||
['hour', [1]],
|
||||
['day', [1]],
|
||||
['week', [1]],
|
||||
['month', [1]],
|
||||
['year', null]
|
||||
];
|
||||
}
|
||||
|
||||
// Make tick marks taller, creating cell walls of a grid.
|
||||
// Use cellHeight axis option if set
|
||||
if (axis.horiz) {
|
||||
options.tickLength = options.cellHeight ||
|
||||
fontMetrics.h * fontSizeToCellHeightRatio;
|
||||
} else {
|
||||
options.tickWidth = 1;
|
||||
if (!options.lineWidth) {
|
||||
options.lineWidth = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Call original Chart.render()
|
||||
proceed.apply(this);
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
24
assets/plugin/chart/highcharts/code/js/modules/heatmap.js
Executable file
24
assets/plugin/chart/highcharts/code/js/modules/heatmap.js
Executable file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
(c) 2009-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(p){"object"===typeof module&&module.exports?module.exports=p:p(Highcharts)})(function(p){(function(b){var g=b.Axis,t=b.Chart,l=b.color,n,e=b.each,w=b.extend,x=b.isNumber,m=b.Legend,h=b.LegendSymbolMixin,y=b.noop,r=b.merge,v=b.pick,u=b.wrap;n=b.ColorAxis=function(){this.init.apply(this,arguments)};w(n.prototype,g.prototype);w(n.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"},minColor:"#e6ebf5",maxColor:"#003399",tickLength:5,showInLegend:!0},init:function(a,c){var d="vertical"!==a.options.legend.layout,f;this.coll="colorAxis";f=r(this.defaultColorAxisOptions,{side:d?2:1,reversed:!d},c,{opposite:!d,showEmpty:!1,title:null});g.prototype.init.call(this,a,f);c.dataClasses&&this.initDataClasses(c);this.initStops(c);this.horiz=d;this.zoomEnabled=!1;this.defaultLegendLength=200},tweenColors:function(a,c,d){var f;c.rgba.length&&a.rgba.length?
|
||||
(a=a.rgba,c=c.rgba,f=1!==c[3]||1!==a[3],a=(f?"rgba(":"rgb(")+Math.round(c[0]+(a[0]-c[0])*(1-d))+","+Math.round(c[1]+(a[1]-c[1])*(1-d))+","+Math.round(c[2]+(a[2]-c[2])*(1-d))+(f?","+(c[3]+(a[3]-c[3])*(1-d)):"")+")"):a=c.input||"none";return a},initDataClasses:function(a){var c=this,d,f=0,q=this.chart.options.chart.colorCount,b=this.options,k=a.dataClasses.length;this.dataClasses=d=[];this.legendItems=[];e(a.dataClasses,function(a,e){a=r(a);d.push(a);a.color||("category"===b.dataClassColor?(a.colorIndex=
|
||||
f,f++,f===q&&(f=0)):a.color=c.tweenColors(l(b.minColor),l(b.maxColor),2>k?.5:e/(k-1)))})},initStops:function(a){this.stops=a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];e(this.stops,function(a){a.color=l(a[1])})},setOptions:function(a){g.prototype.setOptions.call(this,a);this.options.crosshair=this.options.marker},setAxisSize:function(){var a=this.legendSymbol,c=this.chart,d=c.options.legend||{},f,q;a?(this.left=d=a.attr("x"),this.top=f=a.attr("y"),this.width=q=a.attr("width"),this.height=
|
||||
a=a.attr("height"),this.right=c.chartWidth-d-q,this.bottom=c.chartHeight-f-a,this.len=this.horiz?q:a,this.pos=this.horiz?d:f):this.len=(this.horiz?d.symbolWidth:d.symbolHeight)||this.defaultLegendLength},toColor:function(a,c){var d=this.stops,f,q,b=this.dataClasses,k,e;if(b)for(e=b.length;e--;){if(k=b[e],f=k.from,d=k.to,(void 0===f||a>=f)&&(void 0===d||a<=d)){q=k.color;c&&(c.dataClass=e,c.colorIndex=k.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);q=this.tweenColors(f.color,d.color,a)}return q},getOffset:function(){var a=this.legendGroup,c=this.chart.axisOffset[this.side];a&&(this.axisParent=a,g.prototype.getOffset.call(this),this.added||(this.added=!0,this.labelLeft=0,this.labelRight=this.width),this.chart.axisOffset[this.side]=c)},setLegendColor:function(){var a,c=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:c.stops||[[0,c.minColor],[1,c.maxColor]]}},drawLegendSymbol:function(a,c){var d=a.padding,f=a.options,b=this.horiz,e=v(f.symbolWidth,b?this.defaultLegendLength:12),k=v(f.symbolHeight,b?12:this.defaultLegendLength),h=v(f.labelPadding,b?16:30),f=v(f.itemDistance,10);this.setLegendColor();c.legendSymbol=this.chart.renderer.rect(0,a.baseline-11,e,k).attr({zIndex:1}).add(c.legendGroup);this.legendItemWidth=e+d+(b?f:h);this.legendItemHeight=k+d+(b?
|
||||
h:0)},setState:y,visible:!0,setVisible:y,getSeriesExtremes:function(){var a;this.series.length&&(a=this.series[0],this.dataMin=a.valueMin,this.dataMax=a.valueMax)},drawCrosshair:function(a,c){var d=c&&c.plotX,b=c&&c.plotY,e,h=this.pos,k=this.len;c&&(e=this.toPixels(c[c.series.colorKey]),e<h?e=h-2:e>h+k&&(e=h+k+2),c.plotX=e,c.plotY=this.len-e,g.prototype.drawCrosshair.call(this,a,c),c.plotX=d,c.plotY=b,this.cross&&this.cross.addClass("highcharts-coloraxis-marker").add(this.legendGroup))},getPlotLinePath:function(a,
|
||||
c,d,b,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"]:g.prototype.getPlotLinePath.call(this,a,c,d,b)},update:function(a,c){var d=this.chart,b=d.legend;e(this.series,function(a){a.isDirtyData=!0});a.dataClasses&&b.allItems&&(e(b.allItems,function(a){a.isDataClass&&a.legendGroup.destroy()}),d.isDirtyLegend=!0);d.options[this.coll]=r(this.userOptions,a);g.prototype.update.call(this,a,c);this.legendItem&&(this.setLegendColor(),
|
||||
b.colorizeItem(this,!0))},getDataClassLegendSymbols:function(){var a=this,c=this.chart,d=this.legendItems,f=c.options.legend,n=f.valueDecimals,u=f.valueSuffix||"",k;d.length||e(this.dataClasses,function(f,m){var g=!0,r=f.from,l=f.to;k="";void 0===r?k="\x3c ":void 0===l&&(k="\x3e ");void 0!==r&&(k+=b.numberFormat(r,n)+u);void 0!==r&&void 0!==l&&(k+=" - ");void 0!==l&&(k+=b.numberFormat(l,n)+u);d.push(w({chart:c,name:k,options:{},drawLegendSymbol:h.drawRectangle,visible:!0,setState:y,isDataClass:!0,
|
||||
setVisible:function(){g=this.visible=!g;e(a.series,function(a){e(a.points,function(a){a.dataClass===m&&a.setVisible(g)})});c.legend.colorizeItem(this,g)}},f))});return d},name:""});e(["fill","stroke"],function(a){b.Fx.prototype[a+"Setter"]=function(){this.elem.attr(a,n.prototype.tweenColors(l(this.start),l(this.end),this.pos))}});u(t.prototype,"getAxes",function(a){var c=this.options.colorAxis;a.call(this);this.colorAxis=[];c&&new n(this,c)});u(m.prototype,"getAllItems",function(a){var c=[],d=this.chart.colorAxis[0];
|
||||
d&&d.options&&(d.options.showInLegend&&(d.options.dataClasses?c=c.concat(d.getDataClassLegendSymbols()):c.push(d)),e(d.series,function(a){a.options.showInLegend=!1}));return c.concat(a.call(this))});u(m.prototype,"colorizeItem",function(a,c,d){a.call(this,c,d);d&&c.legendColor&&c.legendSymbol.attr({fill:c.legendColor})})})(p);(function(b){var g=b.defined,t=b.each,l=b.noop;b.colorPointMixin={isValid:function(){return null!==this.value},setVisible:function(b){var e=this,g=b?"show":"hide";t(["graphic",
|
||||
"dataLabel"],function(b){if(e[b])e[b][g]()})}};b.colorSeriesMixin={pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:l,parallelArrays:["x","y","value"],colorKey:"value",translateColors:function(){var b=this,e=this.options.nullColor,g=this.colorAxis,l=this.colorKey;t(this.data,function(m){var h=m[l];if(h=m.options.color||(m.isNull?e:g&&void 0!==h?g.toColor(h,m):m.color||b.color))m.color=h})},colorAttribs:function(b){var e=
|
||||
{};g(b.color)&&(e[this.colorProp||"fill"]=b.color);return e}}})(p);(function(b){var g=b.colorPointMixin,t=b.each,l=b.merge,n=b.noop,e=b.pick,p=b.Series,x=b.seriesType,m=b.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}}},
|
||||
l(b.colorSeriesMixin,{pointArrayMap:["y","value"],hasPointSpecificOptions:!0,supportsDrilldown:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var b;m.scatter.prototype.init.apply(this,arguments);b=this.options;b.pointRange=e(b.pointRange,b.colsize||1);this.yAxis.axisPointRange=b.rowsize||1},translate:function(){var b=this.options,e=this.xAxis,g=this.yAxis,l=function(b,a,c){return Math.min(Math.max(a,b),c)};this.generatePoints();t(this.points,function(h){var a=(b.colsize||1)/2,c=(b.rowsize||
|
||||
1)/2,d=l(Math.round(e.len-e.translate(h.x-a,0,1,0,1)),-e.len,2*e.len),a=l(Math.round(e.len-e.translate(h.x+a,0,1,0,1)),-e.len,2*e.len),f=l(Math.round(g.translate(h.y-c,0,1,0,1)),-g.len,2*g.len),c=l(Math.round(g.translate(h.y+c,0,1,0,1)),-g.len,2*g.len);h.plotX=h.clientX=(d+a)/2;h.plotY=(f+c)/2;h.shapeType="rect";h.shapeArgs={x:Math.min(d,a),y:Math.min(f,c),width:Math.abs(a-d),height:Math.abs(c-f)}});this.translateColors()},drawPoints:function(){m.column.prototype.drawPoints.call(this);t(this.points,
|
||||
function(b){b.graphic.attr(this.colorAttribs(b,b.state))},this)},animate:n,getBox:n,drawLegendSymbol:b.LegendSymbolMixin.drawRectangle,alignDataLabel:m.column.prototype.alignDataLabel,getExtremes:function(){p.prototype.getExtremes.call(this,this.valueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;p.prototype.getExtremes.call(this)}}),g)})(p)});
|
||||
769
assets/plugin/chart/highcharts/code/js/modules/heatmap.src.js
Executable file
769
assets/plugin/chart/highcharts/code/js/modules/heatmap.src.js
Executable file
@ -0,0 +1,769 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
*
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
var Axis = H.Axis,
|
||||
Chart = H.Chart,
|
||||
color = H.color,
|
||||
ColorAxis,
|
||||
each = H.each,
|
||||
extend = H.extend,
|
||||
isNumber = H.isNumber,
|
||||
Legend = H.Legend,
|
||||
LegendSymbolMixin = H.LegendSymbolMixin,
|
||||
noop = H.noop,
|
||||
merge = H.merge,
|
||||
pick = H.pick,
|
||||
wrap = H.wrap;
|
||||
|
||||
/**
|
||||
* The ColorAxis object for inclusion in gradient legends
|
||||
*/
|
||||
ColorAxis = H.ColorAxis = function() {
|
||||
this.init.apply(this, arguments);
|
||||
};
|
||||
extend(ColorAxis.prototype, Axis.prototype);
|
||||
extend(ColorAxis.prototype, {
|
||||
defaultColorAxisOptions: {
|
||||
lineWidth: 0,
|
||||
minPadding: 0,
|
||||
maxPadding: 0,
|
||||
gridLineWidth: 1,
|
||||
tickPixelInterval: 72,
|
||||
startOnTick: true,
|
||||
endOnTick: true,
|
||||
offset: 0,
|
||||
marker: {
|
||||
animation: {
|
||||
duration: 50
|
||||
},
|
||||
width: 0.01
|
||||
|
||||
},
|
||||
labels: {
|
||||
overflow: 'justify'
|
||||
},
|
||||
minColor: '#e6ebf5',
|
||||
maxColor: '#003399',
|
||||
tickLength: 5,
|
||||
showInLegend: true
|
||||
},
|
||||
init: function(chart, userOptions) {
|
||||
var horiz = chart.options.legend.layout !== 'vertical',
|
||||
options;
|
||||
|
||||
this.coll = 'colorAxis';
|
||||
|
||||
// Build the options
|
||||
options = merge(this.defaultColorAxisOptions, {
|
||||
side: horiz ? 2 : 1,
|
||||
reversed: !horiz
|
||||
}, userOptions, {
|
||||
opposite: !horiz,
|
||||
showEmpty: false,
|
||||
title: null
|
||||
});
|
||||
|
||||
Axis.prototype.init.call(this, chart, options);
|
||||
|
||||
// Base init() pushes it to the xAxis array, now pop it again
|
||||
//chart[this.isXAxis ? 'xAxis' : 'yAxis'].pop();
|
||||
|
||||
// Prepare data classes
|
||||
if (userOptions.dataClasses) {
|
||||
this.initDataClasses(userOptions);
|
||||
}
|
||||
this.initStops(userOptions);
|
||||
|
||||
// Override original axis properties
|
||||
this.horiz = horiz;
|
||||
this.zoomEnabled = false;
|
||||
|
||||
// Add default values
|
||||
this.defaultLegendLength = 200;
|
||||
},
|
||||
|
||||
/*
|
||||
* Return an intermediate color between two colors, according to pos where 0
|
||||
* is the from color and 1 is the to color.
|
||||
* NOTE: Changes here should be copied
|
||||
* to the same function in drilldown.src.js and solid-gauge-src.js.
|
||||
*/
|
||||
tweenColors: function(from, to, pos) {
|
||||
// Check for has alpha, because rgba colors perform worse due to lack of
|
||||
// support in WebKit.
|
||||
var hasAlpha,
|
||||
ret;
|
||||
|
||||
// Unsupported color, return to-color (#3920)
|
||||
if (!to.rgba.length || !from.rgba.length) {
|
||||
ret = to.input || 'none';
|
||||
|
||||
// Interpolate
|
||||
} else {
|
||||
from = from.rgba;
|
||||
to = to.rgba;
|
||||
hasAlpha = (to[3] !== 1 || from[3] !== 1);
|
||||
ret = (hasAlpha ? 'rgba(' : 'rgb(') +
|
||||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
|
||||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
|
||||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
|
||||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
|
||||
initDataClasses: function(userOptions) {
|
||||
var axis = this,
|
||||
chart = this.chart,
|
||||
dataClasses,
|
||||
colorCounter = 0,
|
||||
colorCount = chart.options.chart.colorCount,
|
||||
options = this.options,
|
||||
len = userOptions.dataClasses.length;
|
||||
this.dataClasses = dataClasses = [];
|
||||
this.legendItems = [];
|
||||
|
||||
each(userOptions.dataClasses, function(dataClass, i) {
|
||||
var colors;
|
||||
|
||||
dataClass = merge(dataClass);
|
||||
dataClasses.push(dataClass);
|
||||
if (!dataClass.color) {
|
||||
if (options.dataClassColor === 'category') {
|
||||
|
||||
dataClass.colorIndex = colorCounter;
|
||||
|
||||
// increase and loop back to zero
|
||||
colorCounter++;
|
||||
if (colorCounter === colorCount) {
|
||||
colorCounter = 0;
|
||||
}
|
||||
} else {
|
||||
dataClass.color = axis.tweenColors(
|
||||
color(options.minColor),
|
||||
color(options.maxColor),
|
||||
len < 2 ? 0.5 : i / (len - 1) // #3219
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initStops: function(userOptions) {
|
||||
this.stops = userOptions.stops || [
|
||||
[0, this.options.minColor],
|
||||
[1, this.options.maxColor]
|
||||
];
|
||||
each(this.stops, function(stop) {
|
||||
stop.color = color(stop[1]);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Extend the setOptions method to process extreme colors and color
|
||||
* stops.
|
||||
*/
|
||||
setOptions: function(userOptions) {
|
||||
Axis.prototype.setOptions.call(this, userOptions);
|
||||
|
||||
this.options.crosshair = this.options.marker;
|
||||
},
|
||||
|
||||
setAxisSize: function() {
|
||||
var symbol = this.legendSymbol,
|
||||
chart = this.chart,
|
||||
legendOptions = chart.options.legend || {},
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height;
|
||||
|
||||
if (symbol) {
|
||||
this.left = x = symbol.attr('x');
|
||||
this.top = y = symbol.attr('y');
|
||||
this.width = width = symbol.attr('width');
|
||||
this.height = height = symbol.attr('height');
|
||||
this.right = chart.chartWidth - x - width;
|
||||
this.bottom = chart.chartHeight - y - height;
|
||||
|
||||
this.len = this.horiz ? width : height;
|
||||
this.pos = this.horiz ? x : y;
|
||||
} else {
|
||||
// Fake length for disabled legend to avoid tick issues and such (#5205)
|
||||
this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Translate from a value to a color
|
||||
*/
|
||||
toColor: function(value, point) {
|
||||
var pos,
|
||||
stops = this.stops,
|
||||
from,
|
||||
to,
|
||||
color,
|
||||
dataClasses = this.dataClasses,
|
||||
dataClass,
|
||||
i;
|
||||
|
||||
if (dataClasses) {
|
||||
i = dataClasses.length;
|
||||
while (i--) {
|
||||
dataClass = dataClasses[i];
|
||||
from = dataClass.from;
|
||||
to = dataClass.to;
|
||||
if ((from === undefined || value >= from) && (to === undefined || value <= to)) {
|
||||
color = dataClass.color;
|
||||
if (point) {
|
||||
point.dataClass = i;
|
||||
point.colorIndex = dataClass.colorIndex;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (this.isLog) {
|
||||
value = this.val2lin(value);
|
||||
}
|
||||
pos = 1 - ((this.max - value) / ((this.max - this.min) || 1));
|
||||
i = stops.length;
|
||||
while (i--) {
|
||||
if (pos > stops[i][0]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
from = stops[i] || stops[i + 1];
|
||||
to = stops[i + 1] || from;
|
||||
|
||||
// The position within the gradient
|
||||
pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
|
||||
|
||||
color = this.tweenColors(
|
||||
from.color,
|
||||
to.color,
|
||||
pos
|
||||
);
|
||||
}
|
||||
return color;
|
||||
},
|
||||
|
||||
/**
|
||||
* Override the getOffset method to add the whole axis groups inside the legend.
|
||||
*/
|
||||
getOffset: function() {
|
||||
var group = this.legendGroup,
|
||||
sideOffset = this.chart.axisOffset[this.side];
|
||||
|
||||
if (group) {
|
||||
|
||||
// Hook for the getOffset method to add groups to this parent group
|
||||
this.axisParent = group;
|
||||
|
||||
// Call the base
|
||||
Axis.prototype.getOffset.call(this);
|
||||
|
||||
// First time only
|
||||
if (!this.added) {
|
||||
|
||||
this.added = true;
|
||||
|
||||
this.labelLeft = 0;
|
||||
this.labelRight = this.width;
|
||||
}
|
||||
// Reset it to avoid color axis reserving space
|
||||
this.chart.axisOffset[this.side] = sideOffset;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Create the color gradient
|
||||
*/
|
||||
setLegendColor: function() {
|
||||
var grad,
|
||||
horiz = this.horiz,
|
||||
options = this.options,
|
||||
reversed = this.reversed,
|
||||
one = reversed ? 1 : 0,
|
||||
zero = reversed ? 0 : 1;
|
||||
|
||||
grad = horiz ? [one, 0, zero, 0] : [0, zero, 0, one]; // #3190
|
||||
this.legendColor = {
|
||||
linearGradient: {
|
||||
x1: grad[0],
|
||||
y1: grad[1],
|
||||
x2: grad[2],
|
||||
y2: grad[3]
|
||||
},
|
||||
stops: options.stops || [
|
||||
[0, options.minColor],
|
||||
[1, options.maxColor]
|
||||
]
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* The color axis appears inside the legend and has its own legend symbol
|
||||
*/
|
||||
drawLegendSymbol: function(legend, item) {
|
||||
var padding = legend.padding,
|
||||
legendOptions = legend.options,
|
||||
horiz = this.horiz,
|
||||
width = pick(legendOptions.symbolWidth, horiz ? this.defaultLegendLength : 12),
|
||||
height = pick(legendOptions.symbolHeight, horiz ? 12 : this.defaultLegendLength),
|
||||
labelPadding = pick(legendOptions.labelPadding, horiz ? 16 : 30),
|
||||
itemDistance = pick(legendOptions.itemDistance, 10);
|
||||
|
||||
this.setLegendColor();
|
||||
|
||||
// Create the gradient
|
||||
item.legendSymbol = this.chart.renderer.rect(
|
||||
0,
|
||||
legend.baseline - 11,
|
||||
width,
|
||||
height
|
||||
).attr({
|
||||
zIndex: 1
|
||||
}).add(item.legendGroup);
|
||||
|
||||
// Set how much space this legend item takes up
|
||||
this.legendItemWidth = width + padding + (horiz ? itemDistance : labelPadding);
|
||||
this.legendItemHeight = height + padding + (horiz ? labelPadding : 0);
|
||||
},
|
||||
/**
|
||||
* Fool the legend
|
||||
*/
|
||||
setState: noop,
|
||||
visible: true,
|
||||
setVisible: noop,
|
||||
getSeriesExtremes: function() {
|
||||
var series;
|
||||
if (this.series.length) {
|
||||
series = this.series[0];
|
||||
this.dataMin = series.valueMin;
|
||||
this.dataMax = series.valueMax;
|
||||
}
|
||||
},
|
||||
drawCrosshair: function(e, point) {
|
||||
var plotX = point && point.plotX,
|
||||
plotY = point && point.plotY,
|
||||
crossPos,
|
||||
axisPos = this.pos,
|
||||
axisLen = this.len;
|
||||
|
||||
if (point) {
|
||||
crossPos = this.toPixels(point[point.series.colorKey]);
|
||||
if (crossPos < axisPos) {
|
||||
crossPos = axisPos - 2;
|
||||
} else if (crossPos > axisPos + axisLen) {
|
||||
crossPos = axisPos + axisLen + 2;
|
||||
}
|
||||
|
||||
point.plotX = crossPos;
|
||||
point.plotY = this.len - crossPos;
|
||||
Axis.prototype.drawCrosshair.call(this, e, point);
|
||||
point.plotX = plotX;
|
||||
point.plotY = plotY;
|
||||
|
||||
if (this.cross) {
|
||||
this.cross
|
||||
.addClass('highcharts-coloraxis-marker')
|
||||
.add(this.legendGroup);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
getPlotLinePath: function(a, b, c, d, pos) {
|
||||
return isNumber(pos) ? // crosshairs only // #3969 pos can be 0 !!
|
||||
(this.horiz ? ['M', pos - 4, this.top - 6, 'L', pos + 4, this.top - 6, pos, this.top, 'Z'] : ['M', this.left, pos, 'L', this.left - 6, pos + 6, this.left - 6, pos - 6, 'Z']) :
|
||||
Axis.prototype.getPlotLinePath.call(this, a, b, c, d);
|
||||
},
|
||||
|
||||
update: function(newOptions, redraw) {
|
||||
var chart = this.chart,
|
||||
legend = chart.legend;
|
||||
|
||||
each(this.series, function(series) {
|
||||
series.isDirtyData = true; // Needed for Axis.update when choropleth colors change
|
||||
});
|
||||
|
||||
// When updating data classes, destroy old items and make sure new ones are created (#3207)
|
||||
if (newOptions.dataClasses && legend.allItems) {
|
||||
each(legend.allItems, function(item) {
|
||||
if (item.isDataClass) {
|
||||
item.legendGroup.destroy();
|
||||
}
|
||||
});
|
||||
chart.isDirtyLegend = true;
|
||||
}
|
||||
|
||||
// Keep the options structure updated for export. Unlike xAxis and yAxis, the colorAxis is
|
||||
// not an array. (#3207)
|
||||
chart.options[this.coll] = merge(this.userOptions, newOptions);
|
||||
|
||||
Axis.prototype.update.call(this, newOptions, redraw);
|
||||
if (this.legendItem) {
|
||||
this.setLegendColor();
|
||||
legend.colorizeItem(this, true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the legend item symbols for data classes
|
||||
*/
|
||||
getDataClassLegendSymbols: function() {
|
||||
var axis = this,
|
||||
chart = this.chart,
|
||||
legendItems = this.legendItems,
|
||||
legendOptions = chart.options.legend,
|
||||
valueDecimals = legendOptions.valueDecimals,
|
||||
valueSuffix = legendOptions.valueSuffix || '',
|
||||
name;
|
||||
|
||||
if (!legendItems.length) {
|
||||
each(this.dataClasses, function(dataClass, i) {
|
||||
var vis = true,
|
||||
from = dataClass.from,
|
||||
to = dataClass.to;
|
||||
|
||||
// Assemble the default name. This can be overridden by legend.options.labelFormatter
|
||||
name = '';
|
||||
if (from === undefined) {
|
||||
name = '< ';
|
||||
} else if (to === undefined) {
|
||||
name = '> ';
|
||||
}
|
||||
if (from !== undefined) {
|
||||
name += H.numberFormat(from, valueDecimals) + valueSuffix;
|
||||
}
|
||||
if (from !== undefined && to !== undefined) {
|
||||
name += ' - ';
|
||||
}
|
||||
if (to !== undefined) {
|
||||
name += H.numberFormat(to, valueDecimals) + valueSuffix;
|
||||
}
|
||||
// Add a mock object to the legend items
|
||||
legendItems.push(extend({
|
||||
chart: chart,
|
||||
name: name,
|
||||
options: {},
|
||||
drawLegendSymbol: LegendSymbolMixin.drawRectangle,
|
||||
visible: true,
|
||||
setState: noop,
|
||||
isDataClass: true,
|
||||
setVisible: function() {
|
||||
vis = this.visible = !vis;
|
||||
each(axis.series, function(series) {
|
||||
each(series.points, function(point) {
|
||||
if (point.dataClass === i) {
|
||||
point.setVisible(vis);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
chart.legend.colorizeItem(this, vis);
|
||||
}
|
||||
}, dataClass));
|
||||
});
|
||||
}
|
||||
return legendItems;
|
||||
},
|
||||
name: '' // Prevents 'undefined' in legend in IE8
|
||||
});
|
||||
|
||||
/**
|
||||
* Handle animation of the color attributes directly
|
||||
*/
|
||||
each(['fill', 'stroke'], function(prop) {
|
||||
H.Fx.prototype[prop + 'Setter'] = function() {
|
||||
this.elem.attr(prop, ColorAxis.prototype.tweenColors(color(this.start), color(this.end), this.pos));
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Extend the chart getAxes method to also get the color axis
|
||||
*/
|
||||
wrap(Chart.prototype, 'getAxes', function(proceed) {
|
||||
|
||||
var options = this.options,
|
||||
colorAxisOptions = options.colorAxis;
|
||||
|
||||
proceed.call(this);
|
||||
|
||||
this.colorAxis = [];
|
||||
if (colorAxisOptions) {
|
||||
new ColorAxis(this, colorAxisOptions); // eslint-disable-line no-new
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Wrap the legend getAllItems method to add the color axis. This also removes the
|
||||
* axis' own series to prevent them from showing up individually.
|
||||
*/
|
||||
wrap(Legend.prototype, 'getAllItems', function(proceed) {
|
||||
var allItems = [],
|
||||
colorAxis = this.chart.colorAxis[0];
|
||||
|
||||
if (colorAxis && colorAxis.options) {
|
||||
if (colorAxis.options.showInLegend) {
|
||||
// Data classes
|
||||
if (colorAxis.options.dataClasses) {
|
||||
allItems = allItems.concat(colorAxis.getDataClassLegendSymbols());
|
||||
// Gradient legend
|
||||
} else {
|
||||
// Add this axis on top
|
||||
allItems.push(colorAxis);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't add the color axis' series
|
||||
each(colorAxis.series, function(series) {
|
||||
series.options.showInLegend = false;
|
||||
});
|
||||
}
|
||||
|
||||
return allItems.concat(proceed.call(this));
|
||||
});
|
||||
|
||||
wrap(Legend.prototype, 'colorizeItem', function(proceed, item, visible) {
|
||||
proceed.call(this, item, visible);
|
||||
if (visible && item.legendColor) {
|
||||
item.legendSymbol.attr({
|
||||
fill: item.legendColor
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
var defined = H.defined,
|
||||
each = H.each,
|
||||
noop = H.noop,
|
||||
seriesTypes = H.seriesTypes;
|
||||
|
||||
/**
|
||||
* Mixin for maps and heatmaps
|
||||
*/
|
||||
H.colorPointMixin = {
|
||||
/**
|
||||
* Color points have a value option that determines whether or not it is a null point
|
||||
*/
|
||||
isValid: function() {
|
||||
return this.value !== null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the visibility of a single point
|
||||
*/
|
||||
setVisible: function(vis) {
|
||||
var point = this,
|
||||
method = vis ? 'show' : 'hide';
|
||||
|
||||
// Show and hide associated elements
|
||||
each(['graphic', 'dataLabel'], function(key) {
|
||||
if (point[key]) {
|
||||
point[key][method]();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
H.colorSeriesMixin = {
|
||||
pointArrayMap: ['value'],
|
||||
axisTypes: ['xAxis', 'yAxis', 'colorAxis'],
|
||||
optionalAxis: 'colorAxis',
|
||||
trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
|
||||
getSymbol: noop,
|
||||
parallelArrays: ['x', 'y', 'value'],
|
||||
colorKey: 'value',
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* In choropleth maps, the color is a result of the value, so this needs translation too
|
||||
*/
|
||||
translateColors: function() {
|
||||
var series = this,
|
||||
nullColor = this.options.nullColor,
|
||||
colorAxis = this.colorAxis,
|
||||
colorKey = this.colorKey;
|
||||
|
||||
each(this.data, function(point) {
|
||||
var value = point[colorKey],
|
||||
color;
|
||||
|
||||
color = point.options.color ||
|
||||
(point.isNull ? nullColor : (colorAxis && value !== undefined) ? colorAxis.toColor(value, point) : point.color || series.color);
|
||||
|
||||
if (color) {
|
||||
point.color = color;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the color attibutes to apply on the graphic
|
||||
*/
|
||||
colorAttribs: function(point) {
|
||||
var ret = {};
|
||||
if (defined(point.color)) {
|
||||
ret[this.colorProp || 'fill'] = point.color;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
}(Highcharts));
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
var colorPointMixin = H.colorPointMixin,
|
||||
colorSeriesMixin = H.colorSeriesMixin,
|
||||
each = H.each,
|
||||
LegendSymbolMixin = H.LegendSymbolMixin,
|
||||
merge = H.merge,
|
||||
noop = H.noop,
|
||||
pick = H.pick,
|
||||
Series = H.Series,
|
||||
seriesType = H.seriesType,
|
||||
seriesTypes = H.seriesTypes;
|
||||
|
||||
// The Heatmap series type
|
||||
seriesType('heatmap', 'scatter', {
|
||||
animation: false,
|
||||
borderWidth: 0,
|
||||
|
||||
dataLabels: {
|
||||
formatter: function() { // #2945
|
||||
return this.point.value;
|
||||
},
|
||||
inside: true,
|
||||
verticalAlign: 'middle',
|
||||
crop: false,
|
||||
overflow: false,
|
||||
padding: 0 // #3837
|
||||
},
|
||||
marker: null,
|
||||
pointRange: null, // dynamically set to colsize by default
|
||||
tooltip: {
|
||||
pointFormat: '{point.x}, {point.y}: {point.value}<br/>'
|
||||
},
|
||||
states: {
|
||||
normal: {
|
||||
animation: true
|
||||
},
|
||||
hover: {
|
||||
halo: false, // #3406, halo is not required on heatmaps
|
||||
brightness: 0.2
|
||||
}
|
||||
}
|
||||
}, merge(colorSeriesMixin, {
|
||||
pointArrayMap: ['y', 'value'],
|
||||
hasPointSpecificOptions: true,
|
||||
supportsDrilldown: true,
|
||||
getExtremesFromAll: true,
|
||||
directTouch: true,
|
||||
|
||||
/**
|
||||
* Override the init method to add point ranges on both axes.
|
||||
*/
|
||||
init: function() {
|
||||
var options;
|
||||
seriesTypes.scatter.prototype.init.apply(this, arguments);
|
||||
|
||||
options = this.options;
|
||||
options.pointRange = pick(options.pointRange, options.colsize || 1); // #3758, prevent resetting in setData
|
||||
this.yAxis.axisPointRange = options.rowsize || 1; // general point range
|
||||
},
|
||||
translate: function() {
|
||||
var series = this,
|
||||
options = series.options,
|
||||
xAxis = series.xAxis,
|
||||
yAxis = series.yAxis,
|
||||
between = function(x, a, b) {
|
||||
return Math.min(Math.max(a, x), b);
|
||||
};
|
||||
|
||||
series.generatePoints();
|
||||
|
||||
each(series.points, function(point) {
|
||||
var xPad = (options.colsize || 1) / 2,
|
||||
yPad = (options.rowsize || 1) / 2,
|
||||
x1 = between(Math.round(xAxis.len - xAxis.translate(point.x - xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len),
|
||||
x2 = between(Math.round(xAxis.len - xAxis.translate(point.x + xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len),
|
||||
y1 = between(Math.round(yAxis.translate(point.y - yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len),
|
||||
y2 = between(Math.round(yAxis.translate(point.y + yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len);
|
||||
|
||||
// Set plotX and plotY for use in K-D-Tree and more
|
||||
point.plotX = point.clientX = (x1 + x2) / 2;
|
||||
point.plotY = (y1 + y2) / 2;
|
||||
|
||||
point.shapeType = 'rect';
|
||||
point.shapeArgs = {
|
||||
x: Math.min(x1, x2),
|
||||
y: Math.min(y1, y2),
|
||||
width: Math.abs(x2 - x1),
|
||||
height: Math.abs(y2 - y1)
|
||||
};
|
||||
});
|
||||
|
||||
series.translateColors();
|
||||
},
|
||||
drawPoints: function() {
|
||||
seriesTypes.column.prototype.drawPoints.call(this);
|
||||
|
||||
each(this.points, function(point) {
|
||||
point.graphic.attr(this.colorAttribs(point, point.state));
|
||||
}, this);
|
||||
},
|
||||
animate: noop,
|
||||
getBox: noop,
|
||||
drawLegendSymbol: LegendSymbolMixin.drawRectangle,
|
||||
alignDataLabel: seriesTypes.column.prototype.alignDataLabel,
|
||||
getExtremes: function() {
|
||||
// Get the extremes from the value data
|
||||
Series.prototype.getExtremes.call(this, this.valueData);
|
||||
this.valueMin = this.dataMin;
|
||||
this.valueMax = this.dataMax;
|
||||
|
||||
// Get the extremes from the y data
|
||||
Series.prototype.getExtremes.call(this);
|
||||
}
|
||||
|
||||
}), colorPointMixin);
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
12
assets/plugin/chart/highcharts/code/js/modules/no-data-to-display.js
Executable file
12
assets/plugin/chart/highcharts/code/js/modules/no-data-to-display.js
Executable file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Plugin for displaying a message when there is no data visible in chart.
|
||||
|
||||
(c) 2010-2016 Highsoft AS
|
||||
Author: Oystein Moseng
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(d){"object"===typeof module&&module.exports?module.exports=d:d(Highcharts)})(function(d){(function(c){function d(){return!!this.points.length}function f(){this.hasData()?this.hideNoData():this.showNoData()}var g=c.seriesTypes,e=c.Chart.prototype,h=c.getOptions(),k=c.extend,l=c.each;k(h.lang,{noData:"No data to display"});h.noData={position:{x:0,y:0,align:"center",verticalAlign:"middle"}};l(["pie","gauge","waterfall","bubble","treemap"],function(a){g[a]&&(g[a].prototype.hasData=d)});c.Series.prototype.hasData=
|
||||
function(){return this.visible&&void 0!==this.dataMax&&void 0!==this.dataMin};e.showNoData=function(a){var b=this.options;a=a||b.lang.noData;b=b.noData;this.noDataLabel||(this.noDataLabel=this.renderer.label(a,0,0,null,null,null,b.useHTML,null,"no-data"),this.noDataLabel.add(),this.noDataLabel.align(k(this.noDataLabel.getBBox(),b.position),!1,"plotBox"))};e.hideNoData=function(){this.noDataLabel&&(this.noDataLabel=this.noDataLabel.destroy())};e.hasData=function(){for(var a=this.series,b=a.length;b--;)if(a[b].hasData()&&
|
||||
!a[b].options.isInternal)return!0;return!1};e.callbacks.push(function(a){c.addEvent(a,"load",f);c.addEvent(a,"redraw",f)})})(d)});
|
||||
150
assets/plugin/chart/highcharts/code/js/modules/no-data-to-display.src.js
Executable file
150
assets/plugin/chart/highcharts/code/js/modules/no-data-to-display.src.js
Executable file
@ -0,0 +1,150 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Plugin for displaying a message when there is no data visible in chart.
|
||||
*
|
||||
* (c) 2010-2016 Highsoft AS
|
||||
* Author: Oystein Moseng
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* Plugin for displaying a message when there is no data visible in chart.
|
||||
*
|
||||
* (c) 2010-2016 Highsoft AS
|
||||
* Author: Oystein Moseng
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var seriesTypes = H.seriesTypes,
|
||||
chartPrototype = H.Chart.prototype,
|
||||
defaultOptions = H.getOptions(),
|
||||
extend = H.extend,
|
||||
each = H.each;
|
||||
|
||||
// Add language option
|
||||
extend(defaultOptions.lang, {
|
||||
noData: 'No data to display'
|
||||
});
|
||||
|
||||
// Add default display options for message
|
||||
defaultOptions.noData = {
|
||||
position: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
align: 'center',
|
||||
verticalAlign: 'middle'
|
||||
}
|
||||
// useHTML: false
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Define hasData functions for series. These return true if there are data points on this series within the plot area
|
||||
*/
|
||||
function hasDataPie() {
|
||||
return !!this.points.length; /* != 0 */
|
||||
}
|
||||
|
||||
each(['pie', 'gauge', 'waterfall', 'bubble', 'treemap'], function(type) {
|
||||
if (seriesTypes[type]) {
|
||||
seriesTypes[type].prototype.hasData = hasDataPie;
|
||||
}
|
||||
});
|
||||
|
||||
H.Series.prototype.hasData = function() {
|
||||
return this.visible && this.dataMax !== undefined && this.dataMin !== undefined; // #3703
|
||||
};
|
||||
|
||||
/**
|
||||
* Display a no-data message.
|
||||
*
|
||||
* @param {String} str An optional message to show in place of the default one
|
||||
*/
|
||||
chartPrototype.showNoData = function(str) {
|
||||
var chart = this,
|
||||
options = chart.options,
|
||||
text = str || options.lang.noData,
|
||||
noDataOptions = options.noData;
|
||||
|
||||
if (!chart.noDataLabel) {
|
||||
chart.noDataLabel = chart.renderer
|
||||
.label(
|
||||
text,
|
||||
0,
|
||||
0,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
noDataOptions.useHTML,
|
||||
null,
|
||||
'no-data'
|
||||
);
|
||||
|
||||
|
||||
|
||||
chart.noDataLabel.add();
|
||||
|
||||
chart.noDataLabel.align(extend(chart.noDataLabel.getBBox(), noDataOptions.position), false, 'plotBox');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Hide no-data message
|
||||
*/
|
||||
chartPrototype.hideNoData = function() {
|
||||
var chart = this;
|
||||
if (chart.noDataLabel) {
|
||||
chart.noDataLabel = chart.noDataLabel.destroy();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if there are data points within the plot area now
|
||||
*/
|
||||
chartPrototype.hasData = function() {
|
||||
var chart = this,
|
||||
series = chart.series,
|
||||
i = series.length;
|
||||
|
||||
while (i--) {
|
||||
if (series[i].hasData() && !series[i].options.isInternal) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Show no-data message if there is no data in sight. Otherwise, hide it.
|
||||
*/
|
||||
function handleNoData() {
|
||||
var chart = this;
|
||||
if (chart.hasData()) {
|
||||
chart.hideNoData();
|
||||
} else {
|
||||
chart.showNoData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add event listener to handle automatic display of no-data message
|
||||
*/
|
||||
chartPrototype.callbacks.push(function(chart) {
|
||||
H.addEvent(chart, 'load', handleNoData);
|
||||
H.addEvent(chart, 'redraw', handleNoData);
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
18
assets/plugin/chart/highcharts/code/js/modules/offline-exporting.js
Executable file
18
assets/plugin/chart/highcharts/code/js/modules/offline-exporting.js
Executable file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Client side exporting module
|
||||
|
||||
(c) 2015 Torstein Honsi / Oystein Moseng
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(g){"object"===typeof module&&module.exports?module.exports=g:g(Highcharts)})(function(g){(function(b){function v(d,b){var c=r.getElementsByTagName("head")[0],a=r.createElement("script");a.type="text/javascript";a.src=d;a.onload=b;a.onerror=function(){console.error("Error loading script",d)};c.appendChild(a)}var g=b.merge,e=b.win,t=e.navigator,r=e.document,z=b.each,A=e.URL||e.webkitURL||e,B=/Edge\/|Trident\/|MSIE /.test(t.userAgent),C=B?150:0;b.CanVGRenderer={};b.downloadURL=function(d,b){var c=
|
||||
r.createElement("a"),a;if(t.msSaveOrOpenBlob)t.msSaveOrOpenBlob(d,b);else if(void 0!==c.download)c.href=d,c.download=b,c.target="_blank",r.body.appendChild(c),c.click(),r.body.removeChild(c);else try{if(a=e.open(d,"chart"),void 0===a||null===a)throw"Failed to open window";}catch(u){e.location.href=d}};b.svgToDataUrl=function(d){var b=-1<t.userAgent.indexOf("WebKit")&&0>t.userAgent.indexOf("Chrome");try{if(!b&&0>t.userAgent.toLowerCase().indexOf("firefox"))return A.createObjectURL(new e.Blob([d],{type:"image/svg+xml;charset-utf-16"}))}catch(c){}return"data:image/svg+xml;charset\x3dUTF-8,"+
|
||||
encodeURIComponent(d)};b.imageToDataUrl=function(b,f,c,a,u,l,k,m,p){var d=new e.Image,h,q=function(){setTimeout(function(){var e=r.createElement("canvas"),n=e.getContext&&e.getContext("2d"),w;try{if(n){e.height=d.height*a;e.width=d.width*a;n.drawImage(d,0,0,e.width,e.height);try{w=e.toDataURL(f),u(w,f,c,a)}catch(D){h(b,f,c,a)}}else k(b,f,c,a)}finally{p&&p(b,f,c,a)}},C)},n=function(){m(b,f,c,a);p&&p(b,f,c,a)};h=function(){d=new e.Image;h=l;d.crossOrigin="Anonymous";d.onload=q;d.onerror=n;d.src=b};
|
||||
d.onload=q;d.onerror=n;d.src=b};b.downloadSVGLocal=function(d,f,c,a){function u(b,a){a=new e.jsPDF("l","pt",[b.width.baseVal.value+2*a,b.height.baseVal.value+2*a]);e.svgElementToPdf(b,a,{removeInvalid:!0});return a.output("datauristring")}function l(){q.innerHTML=d;var c=q.getElementsByTagName("text"),e=q.getElementsByTagName("svg")[0].style;z(c,function(a){z(["font-family","font-size"],function(b){!a.style[b]&&e[b]&&(a.style[b]=e[b])});a.style["font-family"]=a.style["font-family"]&&a.style["font-family"].split(" ").splice(-1)});
|
||||
c=u(q.firstChild,0);b.downloadURL(c,g);a&&a()}var k,m,p=!0,x,h=f.libURL||b.getOptions().exporting.libURL,q=r.createElement("div"),n=f.type||"image/png",g=(f.filename||"chart")+"."+("image/svg+xml"===n?"svg":n.split("/")[1]),y=f.scale||1,h="/"!==h.slice(-1)?h+"/":h;if("image/svg+xml"===n)try{t.msSaveOrOpenBlob?(m=new MSBlobBuilder,m.append(d),k=m.getBlob("image/svg+xml")):k=b.svgToDataUrl(d),b.downloadURL(k,g),a&&a()}catch(w){c()}else"application/pdf"===n?e.jsPDF&&e.svgElementToPdf?l():(p=!0,v(h+"jspdf.js",
|
||||
function(){v(h+"rgbcolor.js",function(){v(h+"svg2pdf.js",function(){l()})})})):(k=b.svgToDataUrl(d),x=function(){try{A.revokeObjectURL(k)}catch(w){}},b.imageToDataUrl(k,n,{},y,function(d){try{b.downloadURL(d,g),a&&a()}catch(D){c()}},function(){var f=r.createElement("canvas"),u=f.getContext("2d"),l=d.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1]*y,k=d.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1]*y,m=function(){u.drawSvg(d,0,0,l,k);try{b.downloadURL(t.msSaveOrOpenBlob?f.msToBlob():f.toDataURL(n),
|
||||
g),a&&a()}catch(E){c()}finally{x()}};f.width=l;f.height=k;e.canvg?m():(p=!0,v(h+"rgbcolor.js",function(){v(h+"canvg.js",function(){m()})}))},c,c,function(){p&&x()}))};b.Chart.prototype.getSVGForLocalExport=function(d,e,c,a){var f=this,l,k=0,m,p,g,h,q=function(b,d,c){++k;c.imageElement.setAttributeNS("http://www.w3.org/1999/xlink","href",b);k===l.length&&a(f.sanitizeSVG(m.innerHTML))};b.wrap(b.Chart.prototype,"getChartHTML",function(a){m=this.container.cloneNode(!0);return a.apply(this,Array.prototype.slice.call(arguments,
|
||||
1))});f.getSVGForExport(d,e);l=m.getElementsByTagName("image");try{if(l.length)for(g=0,h=l.length;g<h;++g)p=l[g],b.imageToDataUrl(p.getAttributeNS("http://www.w3.org/1999/xlink","href"),"image/png",{imageElement:p},d.scale,q,c,c,c);else a(f.sanitizeSVG(m.innerHTML))}catch(n){c()}};b.Chart.prototype.exportChartLocal=function(d,e){var c=this,a=b.merge(c.options.exporting,d),f=function(){if(!1===a.fallbackToExportServer)if(a.error)a.error();else throw"Fallback to export server disabled";else c.exportChart(a)};
|
||||
(B&&"image/svg+xml"!==a.imageType||"application/pdf"!==a.imageType)&&c.container.getElementsByTagName("image").length?f():c.getSVGForLocalExport(a,e,f,function(c){b.downloadSVGLocal(c,a,f)})};g(!0,b.getOptions().exporting,{libURL:"http://code.highcharts.com/5.0.2/lib/",buttons:{contextButton:{menuItems:[{textKey:"printChart",onclick:function(){this.print()}},{separator:!0},{textKey:"downloadPNG",onclick:function(){this.exportChartLocal()}},{textKey:"downloadJPEG",onclick:function(){this.exportChartLocal({type:"image/jpeg"})}},
|
||||
{textKey:"downloadSVG",onclick:function(){this.exportChartLocal({type:"image/svg+xml"})}},{textKey:"downloadPDF",onclick:function(){this.exportChartLocal({type:"application/pdf"})}}]}}})})(g)});
|
||||
457
assets/plugin/chart/highcharts/code/js/modules/offline-exporting.src.js
Executable file
457
assets/plugin/chart/highcharts/code/js/modules/offline-exporting.src.js
Executable file
@ -0,0 +1,457 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Client side exporting module
|
||||
*
|
||||
* (c) 2015 Torstein Honsi / Oystein Moseng
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(Highcharts) {
|
||||
/**
|
||||
* Client side exporting module
|
||||
*
|
||||
* (c) 2015 Torstein Honsi / Oystein Moseng
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
/*global MSBlobBuilder */
|
||||
|
||||
var merge = Highcharts.merge,
|
||||
win = Highcharts.win,
|
||||
nav = win.navigator,
|
||||
doc = win.document,
|
||||
each = Highcharts.each,
|
||||
domurl = win.URL || win.webkitURL || win,
|
||||
isMSBrowser = /Edge\/|Trident\/|MSIE /.test(nav.userAgent),
|
||||
loadEventDeferDelay = isMSBrowser ? 150 : 0; // Milliseconds to defer image load event handlers to offset IE bug
|
||||
|
||||
// Dummy object so we can reuse our canvas-tools.js without errors
|
||||
Highcharts.CanVGRenderer = {};
|
||||
|
||||
|
||||
/**
|
||||
* Downloads a script and executes a callback when done.
|
||||
* @param {String} scriptLocation
|
||||
* @param {Function} callback
|
||||
*/
|
||||
function getScript(scriptLocation, callback) {
|
||||
var head = doc.getElementsByTagName('head')[0],
|
||||
script = doc.createElement('script');
|
||||
|
||||
script.type = 'text/javascript';
|
||||
script.src = scriptLocation;
|
||||
script.onload = callback;
|
||||
script.onerror = function() {
|
||||
console.error('Error loading script', scriptLocation); // eslint-disable-line no-console
|
||||
};
|
||||
|
||||
head.appendChild(script);
|
||||
}
|
||||
|
||||
// Download contents by dataURL/blob
|
||||
Highcharts.downloadURL = function(dataURL, filename) {
|
||||
var a = doc.createElement('a'),
|
||||
windowRef;
|
||||
|
||||
// IE specific blob implementation
|
||||
if (nav.msSaveOrOpenBlob) {
|
||||
nav.msSaveOrOpenBlob(dataURL, filename);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try HTML5 download attr if supported
|
||||
if (a.download !== undefined) {
|
||||
a.href = dataURL;
|
||||
a.download = filename; // HTML5 download attribute
|
||||
a.target = '_blank';
|
||||
doc.body.appendChild(a);
|
||||
a.click();
|
||||
doc.body.removeChild(a);
|
||||
} else {
|
||||
// No download attr, just opening data URI
|
||||
try {
|
||||
windowRef = win.open(dataURL, 'chart');
|
||||
if (windowRef === undefined || windowRef === null) {
|
||||
throw 'Failed to open window';
|
||||
}
|
||||
} catch (e) {
|
||||
// window.open failed, trying location.href
|
||||
win.location.href = dataURL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Get blob URL from SVG code. Falls back to normal data URI.
|
||||
Highcharts.svgToDataUrl = function(svg) {
|
||||
var webKit = nav.userAgent.indexOf('WebKit') > -1 && nav.userAgent.indexOf('Chrome') < 0; // Webkit and not chrome
|
||||
try {
|
||||
// Safari requires data URI since it doesn't allow navigation to blob URLs
|
||||
// Firefox has an issue with Blobs and internal references, leading to gradients not working using Blobs (#4550)
|
||||
if (!webKit && nav.userAgent.toLowerCase().indexOf('firefox') < 0) {
|
||||
return domurl.createObjectURL(new win.Blob([svg], {
|
||||
type: 'image/svg+xml;charset-utf-16'
|
||||
}));
|
||||
}
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg);
|
||||
};
|
||||
|
||||
// Get data:URL from image URL
|
||||
// Pass in callbacks to handle results. finallyCallback is always called at the end of the process. Supplying this callback is optional.
|
||||
// All callbacks receive four arguments: imageURL, imageType, callbackArgs and scale. callbackArgs is used only by callbacks and can contain whatever.
|
||||
Highcharts.imageToDataUrl = function(imageURL, imageType, callbackArgs, scale, successCallback, taintedCallback, noCanvasSupportCallback, failedLoadCallback, finallyCallback) {
|
||||
var img = new win.Image(),
|
||||
taintedHandler,
|
||||
loadHandler = function() {
|
||||
setTimeout(function() {
|
||||
var canvas = doc.createElement('canvas'),
|
||||
ctx = canvas.getContext && canvas.getContext('2d'),
|
||||
dataURL;
|
||||
try {
|
||||
if (!ctx) {
|
||||
noCanvasSupportCallback(imageURL, imageType, callbackArgs, scale);
|
||||
} else {
|
||||
canvas.height = img.height * scale;
|
||||
canvas.width = img.width * scale;
|
||||
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Now we try to get the contents of the canvas.
|
||||
try {
|
||||
dataURL = canvas.toDataURL(imageType);
|
||||
successCallback(dataURL, imageType, callbackArgs, scale);
|
||||
} catch (e) {
|
||||
taintedHandler(imageURL, imageType, callbackArgs, scale);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (finallyCallback) {
|
||||
finallyCallback(imageURL, imageType, callbackArgs, scale);
|
||||
}
|
||||
}
|
||||
}, loadEventDeferDelay); // IE bug where image is not always ready despite calling load event.
|
||||
},
|
||||
// Image load failed (e.g. invalid URL)
|
||||
errorHandler = function() {
|
||||
failedLoadCallback(imageURL, imageType, callbackArgs, scale);
|
||||
if (finallyCallback) {
|
||||
finallyCallback(imageURL, imageType, callbackArgs, scale);
|
||||
}
|
||||
};
|
||||
|
||||
// This is called on load if the image drawing to canvas failed with a security error.
|
||||
// We retry the drawing with crossOrigin set to Anonymous.
|
||||
taintedHandler = function() {
|
||||
img = new win.Image();
|
||||
taintedHandler = taintedCallback;
|
||||
img.crossOrigin = 'Anonymous'; // Must be set prior to loading image source
|
||||
img.onload = loadHandler;
|
||||
img.onerror = errorHandler;
|
||||
img.src = imageURL;
|
||||
};
|
||||
|
||||
img.onload = loadHandler;
|
||||
img.onerror = errorHandler;
|
||||
img.src = imageURL;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get data URL to an image of an SVG and call download on it
|
||||
*
|
||||
* options object:
|
||||
* filename: Name of resulting downloaded file without extension
|
||||
* type: File type of resulting download
|
||||
* scale: Scaling factor of downloaded image compared to source
|
||||
* libURL: URL pointing to location of dependency scripts to download on demand
|
||||
*/
|
||||
Highcharts.downloadSVGLocal = function(svg, options, failCallback, successCallback) {
|
||||
var svgurl,
|
||||
blob,
|
||||
objectURLRevoke = true,
|
||||
finallyHandler,
|
||||
libURL = options.libURL || Highcharts.getOptions().exporting.libURL,
|
||||
dummySVGContainer = doc.createElement('div'),
|
||||
imageType = options.type || 'image/png',
|
||||
filename = (options.filename || 'chart') + '.' + (imageType === 'image/svg+xml' ? 'svg' : imageType.split('/')[1]),
|
||||
scale = options.scale || 1;
|
||||
|
||||
libURL = libURL.slice(-1) !== '/' ? libURL + '/' : libURL; // Allow libURL to end with or without fordward slash
|
||||
|
||||
function svgToPdf(svgElement, margin) {
|
||||
var width = svgElement.width.baseVal.value + 2 * margin,
|
||||
height = svgElement.height.baseVal.value + 2 * margin,
|
||||
pdf = new win.jsPDF('l', 'pt', [width, height]); // eslint-disable-line new-cap
|
||||
win.svgElementToPdf(svgElement, pdf, {
|
||||
removeInvalid: true
|
||||
});
|
||||
return pdf.output('datauristring');
|
||||
}
|
||||
|
||||
function downloadPDF() {
|
||||
dummySVGContainer.innerHTML = svg;
|
||||
var textElements = dummySVGContainer.getElementsByTagName('text'),
|
||||
svgElementStyle = dummySVGContainer.getElementsByTagName('svg')[0].style;
|
||||
// Workaround for the text styling. Making sure it does pick up the root element
|
||||
each(textElements, function(el) {
|
||||
each(['font-family', 'font-size'], function(property) {
|
||||
if (!el.style[property] && svgElementStyle[property]) {
|
||||
el.style[property] = svgElementStyle[property];
|
||||
}
|
||||
});
|
||||
el.style['font-family'] = el.style['font-family'] && el.style['font-family'].split(' ').splice(-1);
|
||||
});
|
||||
var svgData = svgToPdf(dummySVGContainer.firstChild, 0);
|
||||
Highcharts.downloadURL(svgData, filename);
|
||||
if (successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
}
|
||||
|
||||
// Initiate download depending on file type
|
||||
if (imageType === 'image/svg+xml') {
|
||||
// SVG download. In this case, we want to use Microsoft specific Blob if available
|
||||
try {
|
||||
if (nav.msSaveOrOpenBlob) {
|
||||
blob = new MSBlobBuilder();
|
||||
blob.append(svg);
|
||||
svgurl = blob.getBlob('image/svg+xml');
|
||||
} else {
|
||||
svgurl = Highcharts.svgToDataUrl(svg);
|
||||
}
|
||||
Highcharts.downloadURL(svgurl, filename);
|
||||
if (successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
} catch (e) {
|
||||
failCallback();
|
||||
}
|
||||
} else if (imageType === 'application/pdf') {
|
||||
if (win.jsPDF && win.svgElementToPdf) {
|
||||
downloadPDF();
|
||||
} else {
|
||||
// Must load pdf libraries first
|
||||
objectURLRevoke = true; // Don't destroy the object URL yet since we are doing things asynchronously. A cleaner solution would be nice, but this will do for now.
|
||||
getScript(libURL + 'jspdf.js', function() {
|
||||
getScript(libURL + 'rgbcolor.js', function() {
|
||||
getScript(libURL + 'svg2pdf.js', function() {
|
||||
downloadPDF();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// PNG/JPEG download - create bitmap from SVG
|
||||
|
||||
svgurl = Highcharts.svgToDataUrl(svg);
|
||||
finallyHandler = function() {
|
||||
try {
|
||||
domurl.revokeObjectURL(svgurl);
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
};
|
||||
// First, try to get PNG by rendering on canvas
|
||||
Highcharts.imageToDataUrl(svgurl, imageType, { /* args */ }, scale, function(imageURL) {
|
||||
// Success
|
||||
try {
|
||||
Highcharts.downloadURL(imageURL, filename);
|
||||
if (successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
} catch (e) {
|
||||
failCallback();
|
||||
}
|
||||
}, function() {
|
||||
// Failed due to tainted canvas
|
||||
// Create new and untainted canvas
|
||||
var canvas = doc.createElement('canvas'),
|
||||
ctx = canvas.getContext('2d'),
|
||||
imageWidth = svg.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale,
|
||||
imageHeight = svg.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale,
|
||||
downloadWithCanVG = function() {
|
||||
ctx.drawSvg(svg, 0, 0, imageWidth, imageHeight);
|
||||
try {
|
||||
Highcharts.downloadURL(nav.msSaveOrOpenBlob ? canvas.msToBlob() : canvas.toDataURL(imageType), filename);
|
||||
if (successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
} catch (e) {
|
||||
failCallback();
|
||||
} finally {
|
||||
finallyHandler();
|
||||
}
|
||||
};
|
||||
|
||||
canvas.width = imageWidth;
|
||||
canvas.height = imageHeight;
|
||||
if (win.canvg) {
|
||||
// Use preloaded canvg
|
||||
downloadWithCanVG();
|
||||
} else {
|
||||
// Must load canVG first
|
||||
objectURLRevoke = true; // Don't destroy the object URL yet since we are doing things asynchronously. A cleaner solution would be nice, but this will do for now.
|
||||
getScript(libURL + 'rgbcolor.js', function() { // Get RGBColor.js first
|
||||
getScript(libURL + 'canvg.js', function() {
|
||||
downloadWithCanVG();
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
// No canvas support
|
||||
failCallback,
|
||||
// Failed to load image
|
||||
failCallback,
|
||||
// Finally
|
||||
function() {
|
||||
if (objectURLRevoke) {
|
||||
finallyHandler();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Get SVG of chart prepared for client side export. This converts embedded images in the SVG to data URIs.
|
||||
// The options and chartOptions arguments are passed to the getSVGForExport function.
|
||||
Highcharts.Chart.prototype.getSVGForLocalExport = function(options, chartOptions, failCallback, successCallback) {
|
||||
var chart = this,
|
||||
images,
|
||||
imagesEmbedded = 0,
|
||||
chartCopyContainer,
|
||||
el,
|
||||
i,
|
||||
l,
|
||||
// Success handler, we converted image to base64!
|
||||
embeddedSuccess = function(imageURL, imageType, callbackArgs) {
|
||||
++imagesEmbedded;
|
||||
|
||||
// Change image href in chart copy
|
||||
callbackArgs.imageElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageURL);
|
||||
|
||||
// When done with last image we have our SVG
|
||||
if (imagesEmbedded === images.length) {
|
||||
successCallback(chart.sanitizeSVG(chartCopyContainer.innerHTML));
|
||||
}
|
||||
};
|
||||
|
||||
// Hook into getSVG to get a copy of the chart copy's container
|
||||
Highcharts.wrap(Highcharts.Chart.prototype, 'getChartHTML', function(proceed) {
|
||||
chartCopyContainer = this.container.cloneNode(true);
|
||||
return proceed.apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
});
|
||||
|
||||
// Trigger hook to get chart copy
|
||||
chart.getSVGForExport(options, chartOptions);
|
||||
images = chartCopyContainer.getElementsByTagName('image');
|
||||
|
||||
try {
|
||||
// If there are no images to embed, the SVG is okay now.
|
||||
if (!images.length) {
|
||||
successCallback(chart.sanitizeSVG(chartCopyContainer.innerHTML)); // Use SVG of chart copy
|
||||
return;
|
||||
}
|
||||
|
||||
// Go through the images we want to embed
|
||||
for (i = 0, l = images.length; i < l; ++i) {
|
||||
el = images[i];
|
||||
Highcharts.imageToDataUrl(el.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), 'image/png', {
|
||||
imageElement: el
|
||||
}, options.scale,
|
||||
embeddedSuccess,
|
||||
// Tainted canvas
|
||||
failCallback,
|
||||
// No canvas support
|
||||
failCallback,
|
||||
// Failed to load source
|
||||
failCallback
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
failCallback();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a new method to the Chart object to perform a local download
|
||||
*/
|
||||
Highcharts.Chart.prototype.exportChartLocal = function(exportingOptions, chartOptions) {
|
||||
var chart = this,
|
||||
options = Highcharts.merge(chart.options.exporting, exportingOptions),
|
||||
fallbackToExportServer = function() {
|
||||
if (options.fallbackToExportServer === false) {
|
||||
if (options.error) {
|
||||
options.error();
|
||||
} else {
|
||||
throw 'Fallback to export server disabled';
|
||||
}
|
||||
} else {
|
||||
chart.exportChart(options);
|
||||
}
|
||||
},
|
||||
svgSuccess = function(svg) {
|
||||
Highcharts.downloadSVGLocal(svg, options, fallbackToExportServer);
|
||||
};
|
||||
|
||||
// If we have embedded images and are exporting to JPEG/PNG, Microsoft browsers won't handle it, so fall back
|
||||
if ((isMSBrowser && options.imageType !== 'image/svg+xml' || options.imageType !== 'application/pdf') && chart.container.getElementsByTagName('image').length) {
|
||||
fallbackToExportServer();
|
||||
return;
|
||||
}
|
||||
|
||||
chart.getSVGForLocalExport(options, chartOptions, fallbackToExportServer, svgSuccess);
|
||||
};
|
||||
|
||||
// Extend the default options to use the local exporter logic
|
||||
merge(true, Highcharts.getOptions().exporting, {
|
||||
libURL: 'http://code.highcharts.com/5.0.2/lib/',
|
||||
buttons: {
|
||||
contextButton: {
|
||||
menuItems: [{
|
||||
textKey: 'printChart',
|
||||
onclick: function() {
|
||||
this.print();
|
||||
}
|
||||
}, {
|
||||
separator: true
|
||||
}, {
|
||||
textKey: 'downloadPNG',
|
||||
onclick: function() {
|
||||
this.exportChartLocal();
|
||||
}
|
||||
}, {
|
||||
textKey: 'downloadJPEG',
|
||||
onclick: function() {
|
||||
this.exportChartLocal({
|
||||
type: 'image/jpeg'
|
||||
});
|
||||
}
|
||||
}, {
|
||||
textKey: 'downloadSVG',
|
||||
onclick: function() {
|
||||
this.exportChartLocal({
|
||||
type: 'image/svg+xml'
|
||||
});
|
||||
}
|
||||
}, {
|
||||
textKey: 'downloadPDF',
|
||||
onclick: function() {
|
||||
this.exportChartLocal({
|
||||
type: 'application/pdf'
|
||||
});
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
10
assets/plugin/chart/highcharts/code/js/modules/overlapping-datalabels.js
Executable file
10
assets/plugin/chart/highcharts/code/js/modules/overlapping-datalabels.js
Executable file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
(c) 2009-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(a){"object"===typeof module&&module.exports?module.exports=a:a(Highcharts)})(function(a){(function(a){var h=a.Chart,k=a.each,q=a.pick,r=a.addEvent;h.prototype.callbacks.push(function(f){function a(){var a=[];k(f.series,function(b){var c=b.options.dataLabels,d=b.dataLabelCollections||["dataLabel"];(c.enabled||b._hasPointLabels)&&!c.allowOverlap&&b.visible&&k(d,function(c){k(b.points,function(b){b[c]&&(b[c].labelrank=q(b.labelrank,b.shapeArgs&&b.shapeArgs.height),a.push(b[c]))})})});f.hideOverlappingLabels(a)}
|
||||
a();r(f,"redraw",a)});h.prototype.hideOverlappingLabels=function(a){var f=a.length,e,b,c,d,l,m,n,p,g,h=function(a,b,c,d,e,f,g,h){return!(e>a+c||e+g<a||f>b+d||f+h<b)};for(b=0;b<f;b++)if(e=a[b])e.oldOpacity=e.opacity,e.newOpacity=1;a.sort(function(a,b){return(b.labelrank||0)-(a.labelrank||0)});for(b=0;b<f;b++)for(c=a[b],e=b+1;e<f;++e)if(d=a[e],c&&d&&c.placed&&d.placed&&0!==c.newOpacity&&0!==d.newOpacity&&(l=c.alignAttr,m=d.alignAttr,n=c.parentGroup,p=d.parentGroup,g=2*(c.box?0:c.padding),l=h(l.x+n.translateX,
|
||||
l.y+n.translateY,c.width-g,c.height-g,m.x+p.translateX,m.y+p.translateY,d.width-g,d.height-g)))(c.labelrank<d.labelrank?c:d).newOpacity=0;k(a,function(a){var b,c;a&&(c=a.newOpacity,a.oldOpacity!==c&&a.placed&&(c?a.show(!0):b=function(){a.hide()},a.alignAttr.opacity=c,a[a.isOld?"animate":"attr"](a.alignAttr,null,b)),a.isOld=!0)})}})(a)});
|
||||
164
assets/plugin/chart/highcharts/code/js/modules/overlapping-datalabels.src.js
Executable file
164
assets/plugin/chart/highcharts/code/js/modules/overlapping-datalabels.src.js
Executable file
@ -0,0 +1,164 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
*
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
/**
|
||||
* Highcharts module to hide overlapping data labels. This module is included in Highcharts.
|
||||
*/
|
||||
var Chart = H.Chart,
|
||||
each = H.each,
|
||||
pick = H.pick,
|
||||
addEvent = H.addEvent;
|
||||
|
||||
// Collect potensial overlapping data labels. Stack labels probably don't need to be
|
||||
// considered because they are usually accompanied by data labels that lie inside the columns.
|
||||
Chart.prototype.callbacks.push(function(chart) {
|
||||
function collectAndHide() {
|
||||
var labels = [];
|
||||
|
||||
each(chart.series, function(series) {
|
||||
var dlOptions = series.options.dataLabels,
|
||||
collections = series.dataLabelCollections || ['dataLabel']; // Range series have two collections
|
||||
if ((dlOptions.enabled || series._hasPointLabels) && !dlOptions.allowOverlap && series.visible) { // #3866
|
||||
each(collections, function(coll) {
|
||||
each(series.points, function(point) {
|
||||
if (point[coll]) {
|
||||
point[coll].labelrank = pick(point.labelrank, point.shapeArgs && point.shapeArgs.height); // #4118
|
||||
labels.push(point[coll]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
chart.hideOverlappingLabels(labels);
|
||||
}
|
||||
|
||||
// Do it now ...
|
||||
collectAndHide();
|
||||
|
||||
// ... and after each chart redraw
|
||||
addEvent(chart, 'redraw', collectAndHide);
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Hide overlapping labels. Labels are moved and faded in and out on zoom to provide a smooth
|
||||
* visual imression.
|
||||
*/
|
||||
Chart.prototype.hideOverlappingLabels = function(labels) {
|
||||
|
||||
var len = labels.length,
|
||||
label,
|
||||
i,
|
||||
j,
|
||||
label1,
|
||||
label2,
|
||||
isIntersecting,
|
||||
pos1,
|
||||
pos2,
|
||||
parent1,
|
||||
parent2,
|
||||
padding,
|
||||
intersectRect = function(x1, y1, w1, h1, x2, y2, w2, h2) {
|
||||
return !(
|
||||
x2 > x1 + w1 ||
|
||||
x2 + w2 < x1 ||
|
||||
y2 > y1 + h1 ||
|
||||
y2 + h2 < y1
|
||||
);
|
||||
};
|
||||
|
||||
// Mark with initial opacity
|
||||
for (i = 0; i < len; i++) {
|
||||
label = labels[i];
|
||||
if (label) {
|
||||
label.oldOpacity = label.opacity;
|
||||
label.newOpacity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent a situation in a gradually rising slope, that each label
|
||||
// will hide the previous one because the previous one always has
|
||||
// lower rank.
|
||||
labels.sort(function(a, b) {
|
||||
return (b.labelrank || 0) - (a.labelrank || 0);
|
||||
});
|
||||
|
||||
// Detect overlapping labels
|
||||
for (i = 0; i < len; i++) {
|
||||
label1 = labels[i];
|
||||
|
||||
for (j = i + 1; j < len; ++j) {
|
||||
label2 = labels[j];
|
||||
if (label1 && label2 && label1.placed && label2.placed && label1.newOpacity !== 0 && label2.newOpacity !== 0) {
|
||||
pos1 = label1.alignAttr;
|
||||
pos2 = label2.alignAttr;
|
||||
parent1 = label1.parentGroup; // Different panes have different positions
|
||||
parent2 = label2.parentGroup;
|
||||
padding = 2 * (label1.box ? 0 : label1.padding); // Substract the padding if no background or border (#4333)
|
||||
isIntersecting = intersectRect(
|
||||
pos1.x + parent1.translateX,
|
||||
pos1.y + parent1.translateY,
|
||||
label1.width - padding,
|
||||
label1.height - padding,
|
||||
pos2.x + parent2.translateX,
|
||||
pos2.y + parent2.translateY,
|
||||
label2.width - padding,
|
||||
label2.height - padding
|
||||
);
|
||||
|
||||
if (isIntersecting) {
|
||||
(label1.labelrank < label2.labelrank ? label1 : label2).newOpacity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hide or show
|
||||
each(labels, function(label) {
|
||||
var complete,
|
||||
newOpacity;
|
||||
|
||||
if (label) {
|
||||
newOpacity = label.newOpacity;
|
||||
|
||||
if (label.oldOpacity !== newOpacity && label.placed) {
|
||||
|
||||
// Make sure the label is completely hidden to avoid catching clicks (#4362)
|
||||
if (newOpacity) {
|
||||
label.show(true);
|
||||
} else {
|
||||
complete = function() {
|
||||
label.hide();
|
||||
};
|
||||
}
|
||||
|
||||
// Animate or set the opacity
|
||||
label.alignAttr.opacity = newOpacity;
|
||||
label[label.isOld ? 'animate' : 'attr'](label.alignAttr, null, complete);
|
||||
|
||||
}
|
||||
label.isOld = true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
18
assets/plugin/chart/highcharts/code/js/modules/series-label.js
Executable file
18
assets/plugin/chart/highcharts/code/js/modules/series-label.js
Executable file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
(c) 2009-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(t){"object"===typeof module&&module.exports?module.exports=t:t(Highcharts)})(function(t){(function(u){function t(d,b,a,m,c,e){d=(e-b)*(a-d)-(m-b)*(c-d);return 0<d?!0:0>d?!1:!0}function v(d,b,a,m,c,e,f,l){return t(d,b,c,e,f,l)!==t(a,m,c,e,f,l)&&t(d,b,a,m,c,e)!==t(d,b,a,m,f,l)}function y(d,b,a,m,c,e,f,l){return v(d,b,d+a,b,c,e,f,l)||v(d+a,b,d+a,b+m,c,e,f,l)||v(d,b+m,d+a,b+m,c,e,f,l)||v(d,b,d,b+m,c,e,f,l)}function z(d){var b=this;d.call(b);clearTimeout(b.seriesLabelTimer);b.seriesLabelTimer=
|
||||
setTimeout(function(){b.boxesToAvoid=[];w(b.series,function(a){var d=a.options.label;d.enabled&&a.visible&&(a.graph||a.area)&&(a.interpolatedPoints=a.getPointsOnGraph(),w(d.boxesToAvoid||[],function(a){b.boxesToAvoid.push(a)}))});w(b.series,function(a){function d(a,b,c){return a>p&&a<=p+r-c.width&&b>=g&&b<=g+h-c.height}var c,e,f,l=[],k,n,p=(c=b.inverted)?a.yAxis.pos:a.xAxis.pos,g=c?a.xAxis.pos:a.yAxis.pos,r=b.inverted?a.yAxis.len:a.xAxis.len,h=b.inverted?a.xAxis.len:a.yAxis.len,q=a.interpolatedPoints;
|
||||
if(a.visible&&q){a.labelBySeries||(a.labelBySeries=b.renderer.label(a.name,0,-9999,"connector").css(D({color:a.color},a.options.label.styles)).attr({padding:0,opacity:0,stroke:a.color,"stroke-width":1}).add(a.group).animate({opacity:1},{duration:200}));c=a.labelBySeries.getBBox();c.width=Math.round(c.width);for(n=q.length-1;0<n;--n)e=q[n].chartX+3,f=q[n].chartY-c.height-3,d(e,f,c)&&(k=a.checkClearPoint(e,f,c)),k&&l.push(k),e=q[n].chartX+3,f=q[n].chartY+3,d(e,f,c)&&(k=a.checkClearPoint(e,f,c)),k&&
|
||||
l.push(k),e=q[n].chartX-c.width-3,f=q[n].chartY+3,d(e,f,c)&&(k=a.checkClearPoint(e,f,c)),k&&l.push(k),e=q[n].chartX-c.width-3,f=q[n].chartY-c.height-3,d(e,f,c)&&(k=a.checkClearPoint(e,f,c)),k&&l.push(k);if(!l.length)for(e=p+r-c.width;e>=p;e-=16)for(f=g;f<g+h-c.height;f+=16)(k=a.checkClearPoint(e,f,c,!0))&&l.push(k);l.length?(l.sort(function(a,b){return b.weight-a.weight}),k=l[0],b.boxesToAvoid.push({left:k.x,right:k.x+c.width,top:k.y,bottom:k.y+c.height}),Math.round(k.x)===Math.round(a.labelBySeries.x)&&
|
||||
Math.round(k.y)===Math.round(a.labelBySeries.y)||a.labelBySeries.attr({x:k.x-p,y:k.y-g,anchorX:k.connectorPoint&&k.connectorPoint.plotX,anchorY:k.connectorPoint&&k.connectorPoint.plotY,opacity:0}).animate({opacity:1})):a.labelBySeries&&(a.labelBySeries=a.labelBySeries.destroy())}})},350)}var A=u.wrap,w=u.each,D=u.extend,x=u.isNumber,B=u.Series,E=u.SVGRenderer,C=u.Chart;u.setOptions({plotOptions:{series:{label:{enabled:!0,connectorAllowed:!0,connectorNeighbourDistance:24,styles:{fontWeight:"bold"}}}}});
|
||||
E.prototype.symbols.connector=function(d,b,a,m,c){var e=c&&c.anchorX;c=c&&c.anchorY;var f,l,k=a/2;x(e)&&x(c)&&(f=["M",e,c],l=b-c,0>l&&(l=-m-l),l<a&&(k=e<d+a/2?l:a-l),c>b+m?f.push("L",d+k,b+m):c<b?f.push("L",d+k,b):e<d?f.push("L",d,b+m/2):e>d+a&&f.push("L",d+a,b+m/2));return f||[]};B.prototype.getPointsOnGraph=function(){var d=this.points,b,a,m=[],c,e,f,l;e=this.graph||this.area;f=e.element;var k=(b=this.chart.inverted)?this.yAxis.pos:this.xAxis.pos,n=b?this.xAxis.pos:this.yAxis.pos;if(this.getPointSpline&&
|
||||
f.getPointAtLength){e.toD&&(a=e.attr("d"),e.attr({d:e.toD}));l=f.getTotalLength();for(c=0;c<l;c+=16)b=f.getPointAtLength(c),m.push({chartX:k+b.x,chartY:n+b.y,plotX:b.x,plotY:b.y});a&&e.attr({d:a});b=d[d.length-1];b.chartX=k+b.plotX;b.chartY=n+b.plotY;m.push(b)}else for(l=d.length,c=0;c<l;c+=1){b=d[c];a=d[c-1];b.chartX=k+b.plotX;b.chartY=n+b.plotY;if(0<c&&(e=Math.abs(b.chartX-a.chartX),f=Math.abs(b.chartY-a.chartY),e=Math.max(e,f),16<e))for(e=Math.ceil(e/16),f=1;f<e;f+=1)m.push({chartX:a.chartX+f/
|
||||
e*(b.chartX-a.chartX),chartY:a.chartY+f/e*(b.chartY-a.chartY),plotX:a.plotX+f/e*(b.plotX-a.plotX),plotY:a.plotY+f/e*(b.plotY-a.plotY)});x(b.plotY)&&m.push(b)}return m};B.prototype.checkClearPoint=function(d,b,a,m){var c=Number.MAX_VALUE,e=Number.MAX_VALUE,f,l,k=this.options.label.connectorAllowed,n=this.chart,p,g,r,h;for(r=0;r<n.boxesToAvoid.length;r+=1){g=n.boxesToAvoid[r];h=d+a.width;p=b;var q=b+a.height;if(!(d>g.right||h<g.left||p>g.bottom||q<g.top))return!1}for(r=0;r<n.series.length;r+=1)if(p=
|
||||
n.series[r],g=p.interpolatedPoints,p.visible&&g){for(h=1;h<g.length;h+=1){if(y(d,b,a.width,a.height,g[h-1].chartX,g[h-1].chartY,g[h].chartX,g[h].chartY))return!1;this===p&&!f&&m&&(f=y(d-16,b-16,a.width+32,a.height+32,g[h-1].chartX,g[h-1].chartY,g[h].chartX,g[h].chartY));this!==p&&(c=Math.min(c,Math.pow(d+a.width/2-g[h].chartX,2)+Math.pow(b+a.height/2-g[h].chartY,2),Math.pow(d-g[h].chartX,2)+Math.pow(b-g[h].chartY,2),Math.pow(d+a.width-g[h].chartX,2)+Math.pow(b-g[h].chartY,2),Math.pow(d+a.width-g[h].chartX,
|
||||
2)+Math.pow(b+a.height-g[h].chartY,2),Math.pow(d-g[h].chartX,2)+Math.pow(b+a.height-g[h].chartY,2)))}if(k&&this===p&&(m&&!f||c<Math.pow(this.options.label.connectorNeighbourDistance,2))){for(h=1;h<g.length;h+=1)f=Math.min(Math.pow(d+a.width/2-g[h].chartX,2)+Math.pow(b+a.height/2-g[h].chartY,2),Math.pow(d-g[h].chartX,2)+Math.pow(b-g[h].chartY,2),Math.pow(d+a.width-g[h].chartX,2)+Math.pow(b-g[h].chartY,2),Math.pow(d+a.width-g[h].chartX,2)+Math.pow(b+a.height-g[h].chartY,2),Math.pow(d-g[h].chartX,2)+
|
||||
Math.pow(b+a.height-g[h].chartY,2)),f<e&&(e=f,l=g[h]);f=!0}}return!m||f?{x:d,y:b,weight:c-(l?e:0),connectorPoint:l}:!1};A(C.prototype,"render",z);A(C.prototype,"redraw",z)})(t)});
|
||||
544
assets/plugin/chart/highcharts/code/js/modules/series-label.src.js
Executable file
544
assets/plugin/chart/highcharts/code/js/modules/series-label.src.js
Executable file
@ -0,0 +1,544 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
*
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
/**
|
||||
* EXPERIMENTAL Highcharts module to place labels next to a series in a natural position.
|
||||
*
|
||||
* TODO:
|
||||
* - add column support (box collision detection, boxesToAvoid logic)
|
||||
* - other series types, area etc.
|
||||
* - avoid data labels, when data labels above, show series label below.
|
||||
* - add more options (connector, format, formatter)
|
||||
*
|
||||
* http://jsfiddle.net/highcharts/L2u9rpwr/
|
||||
* http://jsfiddle.net/highcharts/y5A37/
|
||||
* http://jsfiddle.net/highcharts/264Nm/
|
||||
* http://jsfiddle.net/highcharts/y5A37/
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var labelDistance = 3,
|
||||
wrap = H.wrap,
|
||||
each = H.each,
|
||||
extend = H.extend,
|
||||
isNumber = H.isNumber,
|
||||
Series = H.Series,
|
||||
SVGRenderer = H.SVGRenderer,
|
||||
Chart = H.Chart;
|
||||
|
||||
H.setOptions({
|
||||
plotOptions: {
|
||||
series: {
|
||||
label: {
|
||||
enabled: true,
|
||||
// Allow labels to be placed distant to the graph if necessary, and
|
||||
// draw a connector line to the graph
|
||||
connectorAllowed: true,
|
||||
connectorNeighbourDistance: 24, // If the label is closer than this to a neighbour graph, draw a connector
|
||||
styles: {
|
||||
fontWeight: 'bold'
|
||||
}
|
||||
// boxesToAvoid: []
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Counter-clockwise, part of the fast line intersection logic
|
||||
*/
|
||||
function ccw(x1, y1, x2, y2, x3, y3) {
|
||||
var cw = ((y3 - y1) * (x2 - x1)) - ((y2 - y1) * (x3 - x1));
|
||||
return cw > 0 ? true : cw < 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if two lines intersect
|
||||
*/
|
||||
function intersectLine(x1, y1, x2, y2, x3, y3, x4, y4) {
|
||||
return ccw(x1, y1, x3, y3, x4, y4) !== ccw(x2, y2, x3, y3, x4, y4) &&
|
||||
ccw(x1, y1, x2, y2, x3, y3) !== ccw(x1, y1, x2, y2, x4, y4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if a box intersects with a line
|
||||
*/
|
||||
function boxIntersectLine(x, y, w, h, x1, y1, x2, y2) {
|
||||
return (
|
||||
intersectLine(x, y, x + w, y, x1, y1, x2, y2) || // top of label
|
||||
intersectLine(x + w, y, x + w, y + h, x1, y1, x2, y2) || // right of label
|
||||
intersectLine(x, y + h, x + w, y + h, x1, y1, x2, y2) || // bottom of label
|
||||
intersectLine(x, y, x, y + h, x1, y1, x2, y2) // left of label
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* General symbol definition for labels with connector
|
||||
*/
|
||||
SVGRenderer.prototype.symbols.connector = function(x, y, w, h, options) {
|
||||
var anchorX = options && options.anchorX,
|
||||
anchorY = options && options.anchorY,
|
||||
path,
|
||||
yOffset,
|
||||
lateral = w / 2;
|
||||
|
||||
if (isNumber(anchorX) && isNumber(anchorY)) {
|
||||
|
||||
path = ['M', anchorX, anchorY];
|
||||
|
||||
// Prefer 45 deg connectors
|
||||
yOffset = y - anchorY;
|
||||
if (yOffset < 0) {
|
||||
yOffset = -h - yOffset;
|
||||
}
|
||||
if (yOffset < w) {
|
||||
lateral = anchorX < x + (w / 2) ? yOffset : w - yOffset;
|
||||
}
|
||||
|
||||
// Anchor below label
|
||||
if (anchorY > y + h) {
|
||||
path.push('L', x + lateral, y + h);
|
||||
|
||||
// Anchor above label
|
||||
} else if (anchorY < y) {
|
||||
path.push('L', x + lateral, y);
|
||||
|
||||
// Anchor left of label
|
||||
} else if (anchorX < x) {
|
||||
path.push('L', x, y + h / 2);
|
||||
|
||||
// Anchor right of label
|
||||
} else if (anchorX > x + w) {
|
||||
path.push('L', x + w, y + h / 2);
|
||||
}
|
||||
}
|
||||
return path || [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Points to avoid. In addition to actual data points, the label should avoid
|
||||
* interpolated positions.
|
||||
*/
|
||||
Series.prototype.getPointsOnGraph = function() {
|
||||
var distance = 16,
|
||||
points = this.points,
|
||||
point,
|
||||
last,
|
||||
interpolated = [],
|
||||
i,
|
||||
deltaX,
|
||||
deltaY,
|
||||
delta,
|
||||
len,
|
||||
n,
|
||||
j,
|
||||
d,
|
||||
graph = this.graph || this.area,
|
||||
node = graph.element,
|
||||
inverted = this.chart.inverted,
|
||||
paneLeft = inverted ? this.yAxis.pos : this.xAxis.pos,
|
||||
paneTop = inverted ? this.xAxis.pos : this.yAxis.pos;
|
||||
|
||||
// For splines, get the point at length (possible caveat: peaks are not correctly detected)
|
||||
if (this.getPointSpline && node.getPointAtLength) {
|
||||
// If it is animating towards a path definition, use that briefly, and reset
|
||||
if (graph.toD) {
|
||||
d = graph.attr('d');
|
||||
graph.attr({
|
||||
d: graph.toD
|
||||
});
|
||||
}
|
||||
len = node.getTotalLength();
|
||||
for (i = 0; i < len; i += distance) {
|
||||
point = node.getPointAtLength(i);
|
||||
interpolated.push({
|
||||
chartX: paneLeft + point.x,
|
||||
chartY: paneTop + point.y,
|
||||
plotX: point.x,
|
||||
plotY: point.y
|
||||
});
|
||||
}
|
||||
if (d) {
|
||||
graph.attr({
|
||||
d: d
|
||||
});
|
||||
}
|
||||
// Last point
|
||||
point = points[points.length - 1];
|
||||
point.chartX = paneLeft + point.plotX;
|
||||
point.chartY = paneTop + point.plotY;
|
||||
interpolated.push(point);
|
||||
|
||||
// Interpolate
|
||||
} else {
|
||||
len = points.length;
|
||||
for (i = 0; i < len; i += 1) {
|
||||
|
||||
point = points[i];
|
||||
last = points[i - 1];
|
||||
|
||||
// Absolute coordinates so we can compare different panes
|
||||
point.chartX = paneLeft + point.plotX;
|
||||
point.chartY = paneTop + point.plotY;
|
||||
|
||||
// Add interpolated points
|
||||
if (i > 0) {
|
||||
deltaX = Math.abs(point.chartX - last.chartX);
|
||||
deltaY = Math.abs(point.chartY - last.chartY);
|
||||
delta = Math.max(deltaX, deltaY);
|
||||
if (delta > distance) {
|
||||
|
||||
n = Math.ceil(delta / distance);
|
||||
|
||||
for (j = 1; j < n; j += 1) {
|
||||
interpolated.push({
|
||||
chartX: last.chartX + (point.chartX - last.chartX) * (j / n),
|
||||
chartY: last.chartY + (point.chartY - last.chartY) * (j / n),
|
||||
plotX: last.plotX + (point.plotX - last.plotX) * (j / n),
|
||||
plotY: last.plotY + (point.plotY - last.plotY) * (j / n)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the real point in order to find positive and negative peaks
|
||||
if (isNumber(point.plotY)) {
|
||||
interpolated.push(point);
|
||||
}
|
||||
}
|
||||
}
|
||||
return interpolated;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check whether a proposed label position is clear of other elements
|
||||
*/
|
||||
Series.prototype.checkClearPoint = function(x, y, bBox, checkDistance) {
|
||||
var distToOthersSquared = Number.MAX_VALUE, // distance to other graphs
|
||||
distToPointSquared = Number.MAX_VALUE,
|
||||
dist,
|
||||
connectorPoint,
|
||||
connectorEnabled = this.options.label.connectorAllowed,
|
||||
|
||||
chart = this.chart,
|
||||
series,
|
||||
points,
|
||||
leastDistance = 16,
|
||||
withinRange,
|
||||
i,
|
||||
j;
|
||||
|
||||
function intersectRect(r1, r2) {
|
||||
return !(r2.left > r1.right ||
|
||||
r2.right < r1.left ||
|
||||
r2.top > r1.bottom ||
|
||||
r2.bottom < r1.top);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the weight in order to determine the ideal position. Larger distance to
|
||||
* other series gives more weight. Smaller distance to the actual point (connector points only)
|
||||
* gives more weight.
|
||||
*/
|
||||
function getWeight(distToOthersSquared, distToPointSquared) {
|
||||
return distToOthersSquared - distToPointSquared;
|
||||
}
|
||||
|
||||
// First check for collision with existing labels
|
||||
for (i = 0; i < chart.boxesToAvoid.length; i += 1) {
|
||||
if (intersectRect(chart.boxesToAvoid[i], {
|
||||
left: x,
|
||||
right: x + bBox.width,
|
||||
top: y,
|
||||
bottom: y + bBox.height
|
||||
})) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// For each position, check if the lines around the label intersect with any of the
|
||||
// graphs
|
||||
for (i = 0; i < chart.series.length; i += 1) {
|
||||
series = chart.series[i];
|
||||
points = series.interpolatedPoints;
|
||||
if (series.visible && points) {
|
||||
for (j = 1; j < points.length; j += 1) {
|
||||
// If any of the box sides intersect with the line, return
|
||||
if (boxIntersectLine(
|
||||
x,
|
||||
y,
|
||||
bBox.width,
|
||||
bBox.height,
|
||||
points[j - 1].chartX,
|
||||
points[j - 1].chartY,
|
||||
points[j].chartX,
|
||||
points[j].chartY
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// But if it is too far away (a padded box doesn't intersect), also return
|
||||
if (this === series && !withinRange && checkDistance) {
|
||||
withinRange = boxIntersectLine(
|
||||
x - leastDistance,
|
||||
y - leastDistance,
|
||||
bBox.width + 2 * leastDistance,
|
||||
bBox.height + 2 * leastDistance,
|
||||
points[j - 1].chartX,
|
||||
points[j - 1].chartY,
|
||||
points[j].chartX,
|
||||
points[j].chartY
|
||||
);
|
||||
}
|
||||
|
||||
// Find the squared distance from the center of the label
|
||||
if (this !== series) {
|
||||
distToOthersSquared = Math.min(
|
||||
distToOthersSquared,
|
||||
Math.pow(x + bBox.width / 2 - points[j].chartX, 2) + Math.pow(y + bBox.height / 2 - points[j].chartY, 2),
|
||||
Math.pow(x - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2),
|
||||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2),
|
||||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2),
|
||||
Math.pow(x - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Do we need a connector?
|
||||
if (connectorEnabled && this === series && ((checkDistance && !withinRange) ||
|
||||
distToOthersSquared < Math.pow(this.options.label.connectorNeighbourDistance, 2))) {
|
||||
for (j = 1; j < points.length; j += 1) {
|
||||
dist = Math.min(
|
||||
Math.pow(x + bBox.width / 2 - points[j].chartX, 2) + Math.pow(y + bBox.height / 2 - points[j].chartY, 2),
|
||||
Math.pow(x - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2),
|
||||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2),
|
||||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2),
|
||||
Math.pow(x - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2)
|
||||
);
|
||||
if (dist < distToPointSquared) {
|
||||
distToPointSquared = dist;
|
||||
connectorPoint = points[j];
|
||||
}
|
||||
}
|
||||
withinRange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !checkDistance || withinRange ? {
|
||||
x: x,
|
||||
y: y,
|
||||
weight: getWeight(distToOthersSquared, connectorPoint ? distToPointSquared : 0),
|
||||
connectorPoint: connectorPoint
|
||||
} : false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The main initiator method that runs on chart level after initiation and redraw. It runs in
|
||||
* a timeout to prevent locking, and loops over all series, taking all series and labels into
|
||||
* account when placing the labels.
|
||||
*/
|
||||
function drawLabels(proceed) {
|
||||
|
||||
var chart = this;
|
||||
|
||||
proceed.call(chart);
|
||||
|
||||
clearTimeout(chart.seriesLabelTimer);
|
||||
|
||||
chart.seriesLabelTimer = setTimeout(function() {
|
||||
|
||||
chart.boxesToAvoid = [];
|
||||
|
||||
// Build the interpolated points
|
||||
each(chart.series, function(series) {
|
||||
var options = series.options.label;
|
||||
if (options.enabled && series.visible && (series.graph || series.area)) {
|
||||
series.interpolatedPoints = series.getPointsOnGraph();
|
||||
|
||||
each(options.boxesToAvoid || [], function(box) {
|
||||
chart.boxesToAvoid.push(box);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
each(chart.series, function(series) {
|
||||
var bBox,
|
||||
x,
|
||||
y,
|
||||
results = [],
|
||||
clearPoint,
|
||||
i,
|
||||
best,
|
||||
inverted = chart.inverted,
|
||||
paneLeft = inverted ? series.yAxis.pos : series.xAxis.pos,
|
||||
paneTop = inverted ? series.xAxis.pos : series.yAxis.pos,
|
||||
paneWidth = chart.inverted ? series.yAxis.len : series.xAxis.len,
|
||||
paneHeight = chart.inverted ? series.xAxis.len : series.yAxis.len,
|
||||
points = series.interpolatedPoints;
|
||||
|
||||
function insidePane(x, y, bBox) {
|
||||
return x > paneLeft && x <= paneLeft + paneWidth - bBox.width &&
|
||||
y >= paneTop && y <= paneTop + paneHeight - bBox.height;
|
||||
}
|
||||
|
||||
if (series.visible && points) {
|
||||
|
||||
if (!series.labelBySeries) {
|
||||
series.labelBySeries = chart.renderer.label(series.name, 0, -9999, 'connector')
|
||||
.css(extend({
|
||||
color: series.color
|
||||
}, series.options.label.styles))
|
||||
.attr({
|
||||
padding: 0,
|
||||
opacity: 0,
|
||||
stroke: series.color,
|
||||
'stroke-width': 1
|
||||
})
|
||||
.add(series.group)
|
||||
.animate({
|
||||
opacity: 1
|
||||
}, {
|
||||
duration: 200
|
||||
});
|
||||
}
|
||||
|
||||
bBox = series.labelBySeries.getBBox();
|
||||
bBox.width = Math.round(bBox.width);
|
||||
|
||||
// Ideal positions are centered above or below a point on right side of chart
|
||||
for (i = points.length - 1; i > 0; i -= 1) {
|
||||
|
||||
// Right - up
|
||||
x = points[i].chartX + labelDistance;
|
||||
y = points[i].chartY - bBox.height - labelDistance;
|
||||
if (insidePane(x, y, bBox)) {
|
||||
best = series.checkClearPoint(
|
||||
x,
|
||||
y,
|
||||
bBox
|
||||
);
|
||||
}
|
||||
if (best) {
|
||||
results.push(best);
|
||||
}
|
||||
|
||||
// Right - down
|
||||
x = points[i].chartX + labelDistance;
|
||||
y = points[i].chartY + labelDistance;
|
||||
if (insidePane(x, y, bBox)) {
|
||||
best = series.checkClearPoint(
|
||||
x,
|
||||
y,
|
||||
bBox
|
||||
);
|
||||
}
|
||||
if (best) {
|
||||
results.push(best);
|
||||
}
|
||||
|
||||
// Left - down
|
||||
x = points[i].chartX - bBox.width - labelDistance;
|
||||
y = points[i].chartY + labelDistance;
|
||||
if (insidePane(x, y, bBox)) {
|
||||
best = series.checkClearPoint(
|
||||
x,
|
||||
y,
|
||||
bBox
|
||||
);
|
||||
}
|
||||
if (best) {
|
||||
results.push(best);
|
||||
}
|
||||
|
||||
// Left - up
|
||||
x = points[i].chartX - bBox.width - labelDistance;
|
||||
y = points[i].chartY - bBox.height - labelDistance;
|
||||
if (insidePane(x, y, bBox)) {
|
||||
best = series.checkClearPoint(
|
||||
x,
|
||||
y,
|
||||
bBox
|
||||
);
|
||||
}
|
||||
if (best) {
|
||||
results.push(best);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Brute force, try all positions on the chart in a 16x16 grid
|
||||
if (!results.length) {
|
||||
for (x = paneLeft + paneWidth - bBox.width; x >= paneLeft; x -= 16) {
|
||||
for (y = paneTop; y < paneTop + paneHeight - bBox.height; y += 16) {
|
||||
clearPoint = series.checkClearPoint(x, y, bBox, true);
|
||||
if (clearPoint) {
|
||||
results.push(clearPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (results.length) {
|
||||
|
||||
results.sort(function(a, b) {
|
||||
return b.weight - a.weight;
|
||||
});
|
||||
|
||||
best = results[0];
|
||||
|
||||
chart.boxesToAvoid.push({
|
||||
left: best.x,
|
||||
right: best.x + bBox.width,
|
||||
top: best.y,
|
||||
bottom: best.y + bBox.height
|
||||
});
|
||||
|
||||
// Move it if needed
|
||||
if (Math.round(best.x) !== Math.round(series.labelBySeries.x) || Math.round(best.y) !== Math.round(series.labelBySeries.y)) {
|
||||
series.labelBySeries
|
||||
.attr({
|
||||
x: best.x - paneLeft,
|
||||
y: best.y - paneTop,
|
||||
anchorX: best.connectorPoint && best.connectorPoint.plotX,
|
||||
anchorY: best.connectorPoint && best.connectorPoint.plotY,
|
||||
opacity: 0
|
||||
})
|
||||
.animate({
|
||||
opacity: 1
|
||||
});
|
||||
}
|
||||
|
||||
} else if (series.labelBySeries) {
|
||||
series.labelBySeries = series.labelBySeries.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 350);
|
||||
|
||||
}
|
||||
wrap(Chart.prototype, 'render', drawLabels);
|
||||
wrap(Chart.prototype, 'redraw', drawLabels);
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
14
assets/plugin/chart/highcharts/code/js/modules/solid-gauge.js
Executable file
14
assets/plugin/chart/highcharts/code/js/modules/solid-gauge.js
Executable file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
Solid angular gauge module
|
||||
|
||||
(c) 2010-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(k){"object"===typeof module&&module.exports?module.exports=k:k(Highcharts)})(function(k){(function(d){var k=d.pInt,t=d.pick,l=d.each,u=d.isNumber,m;m={initDataClasses:function(a){var c=this,e=this.chart,h,r=0,f=this.options;this.dataClasses=h=[];l(a.dataClasses,function(g,b){g=d.merge(g);h.push(g);g.color||("category"===f.dataClassColor?(b=e.options.colors,g.color=b[r++],r===b.length&&(r=0)):g.color=c.tweenColors(d.color(f.minColor),d.color(f.maxColor),b/(a.dataClasses.length-1)))})},initStops:function(a){this.stops=
|
||||
a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];l(this.stops,function(a){a.color=d.color(a[1])})},toColor:function(a,c){var e=this.stops,h,d,f=this.dataClasses,g,b;if(f)for(b=f.length;b--;){if(g=f[b],h=g.from,e=g.to,(void 0===h||a>=h)&&(void 0===e||a<=e)){d=g.color;c&&(c.dataClass=b);break}}else{this.isLog&&(a=this.val2lin(a));a=1-(this.max-a)/(this.max-this.min);for(b=e.length;b--&&!(a>e[b][0]););h=e[b]||e[b+1];e=e[b+1]||h;a=1-(e[0]-a)/(e[0]-h[0]||1);d=this.tweenColors(h.color,e.color,
|
||||
a)}return d},tweenColors:function(a,c,e){var d;c.rgba.length&&a.rgba.length?(a=a.rgba,c=c.rgba,d=1!==c[3]||1!==a[3],a=(d?"rgba(":"rgb(")+Math.round(c[0]+(a[0]-c[0])*(1-e))+","+Math.round(c[1]+(a[1]-c[1])*(1-e))+","+Math.round(c[2]+(a[2]-c[2])*(1-e))+(d?","+(c[3]+(a[3]-c[3])*(1-e)):"")+")"):a=c.input||"none";return a}};l(["fill","stroke"],function(a){d.Fx.prototype[a+"Setter"]=function(){this.elem.attr(a,m.tweenColors(d.color(this.start),d.color(this.end),this.pos))}});d.seriesType("solidgauge","gauge",
|
||||
{colorByPoint:!0},{bindAxes:function(){var a;d.seriesTypes.gauge.prototype.bindAxes.call(this);a=this.yAxis;d.extend(a,m);a.options.dataClasses&&a.initDataClasses(a.options);a.initStops(a.options)},drawPoints:function(){var a=this,c=a.yAxis,e=c.center,d=a.options,r=a.chart.renderer,f=d.overshoot,g=u(f)?f/180*Math.PI:0;l(a.points,function(b){var h=b.graphic,f=c.startAngleRad+c.translate(b.y,null,null,null,!0),l=k(t(b.options.radius,d.radius,100))*e[2]/200,n=k(t(b.options.innerRadius,d.innerRadius,
|
||||
60))*e[2]/200,p=c.toColor(b.y,b),q=Math.min(c.startAngleRad,c.endAngleRad),m=Math.max(c.startAngleRad,c.endAngleRad);"none"===p&&(p=b.color||a.color||"none");"none"!==p&&(b.color=p);f=Math.max(q-g,Math.min(m+g,f));!1===d.wrap&&(f=Math.max(q,Math.min(m,f)));q=Math.min(f,c.startAngleRad);f=Math.max(f,c.startAngleRad);f-q>2*Math.PI&&(f=q+2*Math.PI);b.shapeArgs=n={x:e[0],y:e[1],r:l,innerR:n,start:q,end:f,fill:p};b.startR=l;h?(b=n.d,h.animate(n),b&&(n.d=b)):b.graphic=r.arc(n).addClass("highcharts-point").attr({fill:p,
|
||||
"sweep-flag":0}).add(a.group)})},animate:function(a){a||(this.startAngleRad=this.yAxis.startAngleRad,d.seriesTypes.pie.prototype.animate.call(this,a))}})})(k)});
|
||||
277
assets/plugin/chart/highcharts/code/js/modules/solid-gauge.src.js
Executable file
277
assets/plugin/chart/highcharts/code/js/modules/solid-gauge.src.js
Executable file
@ -0,0 +1,277 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* Solid angular gauge module
|
||||
*
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* Solid angular gauge module
|
||||
*
|
||||
* (c) 2010-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var pInt = H.pInt,
|
||||
pick = H.pick,
|
||||
each = H.each,
|
||||
isNumber = H.isNumber,
|
||||
colorAxisMethods;
|
||||
|
||||
// These methods are defined in the ColorAxis object, and copied here.
|
||||
// If we implement an AMD system we should make ColorAxis a dependency.
|
||||
colorAxisMethods = {
|
||||
|
||||
|
||||
initDataClasses: function(userOptions) {
|
||||
var axis = this,
|
||||
chart = this.chart,
|
||||
dataClasses,
|
||||
colorCounter = 0,
|
||||
options = this.options;
|
||||
this.dataClasses = dataClasses = [];
|
||||
|
||||
each(userOptions.dataClasses, function(dataClass, i) {
|
||||
var colors;
|
||||
|
||||
dataClass = H.merge(dataClass);
|
||||
dataClasses.push(dataClass);
|
||||
if (!dataClass.color) {
|
||||
if (options.dataClassColor === 'category') {
|
||||
colors = chart.options.colors;
|
||||
dataClass.color = colors[colorCounter++];
|
||||
// loop back to zero
|
||||
if (colorCounter === colors.length) {
|
||||
colorCounter = 0;
|
||||
}
|
||||
} else {
|
||||
dataClass.color = axis.tweenColors(H.color(options.minColor), H.color(options.maxColor), i / (userOptions.dataClasses.length - 1));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initStops: function(userOptions) {
|
||||
this.stops = userOptions.stops || [
|
||||
[0, this.options.minColor],
|
||||
[1, this.options.maxColor]
|
||||
];
|
||||
each(this.stops, function(stop) {
|
||||
stop.color = H.color(stop[1]);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Translate from a value to a color
|
||||
*/
|
||||
toColor: function(value, point) {
|
||||
var pos,
|
||||
stops = this.stops,
|
||||
from,
|
||||
to,
|
||||
color,
|
||||
dataClasses = this.dataClasses,
|
||||
dataClass,
|
||||
i;
|
||||
|
||||
if (dataClasses) {
|
||||
i = dataClasses.length;
|
||||
while (i--) {
|
||||
dataClass = dataClasses[i];
|
||||
from = dataClass.from;
|
||||
to = dataClass.to;
|
||||
if ((from === undefined || value >= from) && (to === undefined || value <= to)) {
|
||||
color = dataClass.color;
|
||||
if (point) {
|
||||
point.dataClass = i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (this.isLog) {
|
||||
value = this.val2lin(value);
|
||||
}
|
||||
pos = 1 - ((this.max - value) / (this.max - this.min));
|
||||
i = stops.length;
|
||||
while (i--) {
|
||||
if (pos > stops[i][0]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
from = stops[i] || stops[i + 1];
|
||||
to = stops[i + 1] || from;
|
||||
|
||||
// The position within the gradient
|
||||
pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
|
||||
|
||||
color = this.tweenColors(
|
||||
from.color,
|
||||
to.color,
|
||||
pos
|
||||
);
|
||||
}
|
||||
return color;
|
||||
},
|
||||
/*
|
||||
* Return an intermediate color between two colors, according to pos where 0
|
||||
* is the from color and 1 is the to color.
|
||||
*/
|
||||
tweenColors: function(from, to, pos) {
|
||||
// Check for has alpha, because rgba colors perform worse due to lack of
|
||||
// support in WebKit.
|
||||
var hasAlpha,
|
||||
ret;
|
||||
|
||||
// Unsupported color, return to-color (#3920)
|
||||
if (!to.rgba.length || !from.rgba.length) {
|
||||
ret = to.input || 'none';
|
||||
|
||||
// Interpolate
|
||||
} else {
|
||||
from = from.rgba;
|
||||
to = to.rgba;
|
||||
hasAlpha = (to[3] !== 1 || from[3] !== 1);
|
||||
ret = (hasAlpha ? 'rgba(' : 'rgb(') +
|
||||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
|
||||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
|
||||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
|
||||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle animation of the color attributes directly
|
||||
*/
|
||||
each(['fill', 'stroke'], function(prop) {
|
||||
H.Fx.prototype[prop + 'Setter'] = function() {
|
||||
this.elem.attr(prop, colorAxisMethods.tweenColors(H.color(this.start), H.color(this.end), this.pos));
|
||||
};
|
||||
});
|
||||
|
||||
// The solidgauge series type
|
||||
H.seriesType('solidgauge', 'gauge', {
|
||||
colorByPoint: true
|
||||
|
||||
}, {
|
||||
bindAxes: function() {
|
||||
var axis;
|
||||
H.seriesTypes.gauge.prototype.bindAxes.call(this);
|
||||
|
||||
axis = this.yAxis;
|
||||
H.extend(axis, colorAxisMethods);
|
||||
|
||||
// Prepare data classes
|
||||
if (axis.options.dataClasses) {
|
||||
axis.initDataClasses(axis.options);
|
||||
}
|
||||
axis.initStops(axis.options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Draw the points where each point is one needle
|
||||
*/
|
||||
drawPoints: function() {
|
||||
var series = this,
|
||||
yAxis = series.yAxis,
|
||||
center = yAxis.center,
|
||||
options = series.options,
|
||||
renderer = series.chart.renderer,
|
||||
overshoot = options.overshoot,
|
||||
overshootVal = isNumber(overshoot) ? overshoot / 180 * Math.PI : 0;
|
||||
|
||||
each(series.points, function(point) {
|
||||
var graphic = point.graphic,
|
||||
rotation = yAxis.startAngleRad + yAxis.translate(point.y, null, null, null, true),
|
||||
radius = (pInt(pick(point.options.radius, options.radius, 100)) * center[2]) / 200,
|
||||
innerRadius = (pInt(pick(point.options.innerRadius, options.innerRadius, 60)) * center[2]) / 200,
|
||||
shapeArgs,
|
||||
d,
|
||||
toColor = yAxis.toColor(point.y, point),
|
||||
axisMinAngle = Math.min(yAxis.startAngleRad, yAxis.endAngleRad),
|
||||
axisMaxAngle = Math.max(yAxis.startAngleRad, yAxis.endAngleRad),
|
||||
minAngle,
|
||||
maxAngle;
|
||||
|
||||
if (toColor === 'none') { // #3708
|
||||
toColor = point.color || series.color || 'none';
|
||||
}
|
||||
if (toColor !== 'none') {
|
||||
point.color = toColor;
|
||||
}
|
||||
|
||||
// Handle overshoot and clipping to axis max/min
|
||||
rotation = Math.max(axisMinAngle - overshootVal, Math.min(axisMaxAngle + overshootVal, rotation));
|
||||
|
||||
// Handle the wrap option
|
||||
if (options.wrap === false) {
|
||||
rotation = Math.max(axisMinAngle, Math.min(axisMaxAngle, rotation));
|
||||
}
|
||||
|
||||
minAngle = Math.min(rotation, yAxis.startAngleRad);
|
||||
maxAngle = Math.max(rotation, yAxis.startAngleRad);
|
||||
|
||||
if (maxAngle - minAngle > 2 * Math.PI) {
|
||||
maxAngle = minAngle + 2 * Math.PI;
|
||||
}
|
||||
|
||||
point.shapeArgs = shapeArgs = {
|
||||
x: center[0],
|
||||
y: center[1],
|
||||
r: radius,
|
||||
innerR: innerRadius,
|
||||
start: minAngle,
|
||||
end: maxAngle,
|
||||
fill: toColor
|
||||
};
|
||||
point.startR = radius; // For PieSeries.animate
|
||||
|
||||
if (graphic) {
|
||||
d = shapeArgs.d;
|
||||
graphic.animate(shapeArgs);
|
||||
if (d) {
|
||||
shapeArgs.d = d; // animate alters it
|
||||
}
|
||||
} else {
|
||||
point.graphic = renderer.arc(shapeArgs)
|
||||
.addClass('highcharts-point')
|
||||
.attr({
|
||||
fill: toColor,
|
||||
'sweep-flag': 0
|
||||
})
|
||||
.add(series.group);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Extend the pie slice animation by animating from start angle and up
|
||||
*/
|
||||
animate: function(init) {
|
||||
|
||||
if (!init) {
|
||||
this.startAngleRad = this.yAxis.startAngleRad;
|
||||
H.seriesTypes.pie.prototype.animate.call(this, init);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
29
assets/plugin/chart/highcharts/code/js/modules/treemap.js
Executable file
29
assets/plugin/chart/highcharts/code/js/modules/treemap.js
Executable file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
(c) 2014 Highsoft AS
|
||||
Authors: Jon Arild Nygard / Oystein Moseng
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(p){"object"===typeof module&&module.exports?module.exports=p:p(Highcharts)})(function(p){(function(g){var p=g.seriesType,t=g.seriesTypes,D=g.map,w=g.merge,z=g.extend,A=g.noop,m=g.each,y=g.grep,E=g.isNumber,k=g.pick,u=g.Series,F=g.stableSort,G=function(a,b,c){var e;c=c||this;for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)},B=function(a,b,c,e){e=e||this;a=a||[];m(a,function(d,f){c=b.call(e,c,d,f,a)});return c},x=function(a,b,c){c=c||this;a=b.call(c,a);!1!==a&&x(a,b,c)};p("treemap","scatter",
|
||||
{showInLegend:!1,marker:!1,dataLabels:{enabled:!0,defer:!1,verticalAlign:"middle",formatter:function(){return this.point.name||this.point.id},inside:!0},tooltip:{headerFormat:"",pointFormat:"\x3cb\x3e{point.name}\x3c/b\x3e: {point.value}\x3c/b\x3e\x3cbr/\x3e"},layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,drillUpButton:{position:{align:"right",x:-10,y:10}}},{pointArrayMap:["value"],axisTypes:t.heatmap?["xAxis","yAxis","colorAxis"]:
|
||||
["xAxis","yAxis"],optionalAxis:"colorAxis",getSymbol:A,parallelArrays:["x","y","value","colorValue"],colorKey:"colorValue",translateColors:t.heatmap&&t.heatmap.prototype.translateColors,trackerGroups:["group","dataLabelsGroup"],getListOfParents:function(a,b){a=B(a,function(a,b,d){b=k(b.parent,"");void 0===a[b]&&(a[b]=[]);a[b].push(d);return a},{});G(a,function(a,e,d){""!==e&&-1===g.inArray(e,b)&&(m(a,function(a){d[""].push(a)}),delete d[e])});return a},getTree:function(){var a,b=this;a=D(this.data,
|
||||
function(a){return a.id});a=b.getListOfParents(this.data,a);b.nodeMap=[];a=b.buildNode("",-1,0,a,null);x(this.nodeMap[this.rootNode],function(a){var c=!1,d=a.parent;a.visible=!0;if(d||""===d)c=b.nodeMap[d];return c});x(this.nodeMap[this.rootNode].children,function(a){var b=!1;m(a,function(a){a.visible=!0;a.children.length&&(b=(b||[]).concat(a.children))});return b});this.setTreeValues(a);return a},init:function(a,b){u.prototype.init.call(this,a,b);this.options.allowDrillToNode&&this.drillTo()},buildNode:function(a,
|
||||
b,c,e,d){var f=this,h=[],C=f.points[b],v;m(e[a]||[],function(b){v=f.buildNode(f.points[b].id,b,c+1,e,a);h.push(v)});b={id:a,i:b,children:h,level:c,parent:d,visible:!1};f.nodeMap[b.id]=b;C&&(C.node=b);return b},setTreeValues:function(a){var b=this,c=b.options,e=0,d=[],f,h=b.points[a.i];m(a.children,function(a){a=b.setTreeValues(a);d.push(a);a.ignore?x(a.children,function(a){var b=!1;m(a,function(a){z(a,{ignore:!0,isLeaf:!1,visible:!1});a.children.length&&(b=(b||[]).concat(a.children))});return b}):
|
||||
e+=a.val});F(d,function(a,b){return a.sortIndex-b.sortIndex});f=k(h&&h.options.value,e);h&&(h.value=f);z(a,{children:d,childrenTotal:e,ignore:!(k(h&&h.visible,!0)&&0<f),isLeaf:a.visible&&!e,levelDynamic:c.levelIsConstant?a.level:a.level-b.nodeMap[b.rootNode].level,name:k(h&&h.name,""),sortIndex:k(h&&h.sortIndex,-f),val:f});return a},calculateChildrenAreas:function(a,b){var c=this,e=c.options,d=this.levelMap[a.levelDynamic+1],f=k(c[d&&d.layoutAlgorithm]&&d.layoutAlgorithm,e.layoutAlgorithm),h=e.alternateStartingDirection,
|
||||
g=[];a=y(a.children,function(a){return!a.ignore});d&&d.layoutStartingDirection&&(b.direction="vertical"===d.layoutStartingDirection?0:1);g=c[f](b,a);m(a,function(a,d){d=g[d];a.values=w(d,{val:a.childrenTotal,direction:h?1-b.direction:b.direction});a.pointValues=w(d,{x:d.x/c.axisRatio,width:d.width/c.axisRatio});a.children.length&&c.calculateChildrenAreas(a,a.values)})},setPointValues:function(){var a=this.xAxis,b=this.yAxis;m(this.points,function(c){var e=c.node,d=e.pointValues,f,h;d&&e.visible?(e=
|
||||
Math.round(a.translate(d.x,0,0,0,1))-.5,f=Math.round(a.translate(d.x+d.width,0,0,0,1))-.5,h=Math.round(b.translate(d.y,0,0,0,1))-.5,d=Math.round(b.translate(d.y+d.height,0,0,0,1))-.5,c.shapeType="rect",c.shapeArgs={x:Math.min(e,f),y:Math.min(h,d),width:Math.abs(f-e),height:Math.abs(d-h)},c.plotX=c.shapeArgs.x+c.shapeArgs.width/2,c.plotY=c.shapeArgs.y+c.shapeArgs.height/2):(delete c.plotX,delete c.plotY)})},setColorRecursive:function(a,b,c){var e=this,d,f;a&&(d=e.points[a.i],f=e.levelMap[a.levelDynamic],
|
||||
b=k(d&&d.options.color,f&&f.color,b),c=k(d&&d.options.colorIndex,f&&f.colorIndex,c),d&&(d.color=b,d.colorIndex=c),a.children.length&&m(a.children,function(a){e.setColorRecursive(a,b,c)}))},algorithmGroup:function(a,b,c,e){this.height=a;this.width=b;this.plot=e;this.startDirection=this.direction=c;this.lH=this.nH=this.lW=this.nW=this.total=0;this.elArr=[];this.lP={total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(a,b){return Math.max(a/b,b/a)}};this.addElement=function(a){this.lP.total=this.elArr[this.elArr.length-
|
||||
1];this.total+=a;0===this.direction?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR=this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=this.nH,this.lP.lW=this.lP.total/this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW,this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH));this.elArr.push(a)};this.reset=function(){this.lW=
|
||||
this.nW=0;this.elArr=[];this.total=0}},algorithmCalcPoints:function(a,b,c,e){var d,f,h,g,v=c.lW,n=c.lH,l=c.plot,k,q=0,r=c.elArr.length-1;b?(v=c.nW,n=c.nH):k=c.elArr[c.elArr.length-1];m(c.elArr,function(a){if(b||q<r)0===c.direction?(d=l.x,f=l.y,h=v,g=a/h):(d=l.x,f=l.y,g=n,h=a/g),e.push({x:d,y:f,width:h,height:g}),0===c.direction?l.y+=g:l.x+=h;q+=1});c.reset();0===c.direction?c.width-=v:c.height-=n;l.y=l.parent.y+(l.parent.height-c.height);l.x=l.parent.x+(l.parent.width-c.width);a&&(c.direction=1-c.direction);
|
||||
b||c.addElement(k)},algorithmLowAspectRatio:function(a,b,c){var e=[],d=this,f,h={x:b.x,y:b.y,parent:b},g=0,k=c.length-1,n=new this.algorithmGroup(b.height,b.width,b.direction,h);m(c,function(c){f=c.val/b.val*b.height*b.width;n.addElement(f);n.lP.nR>n.lP.lR&&d.algorithmCalcPoints(a,!1,n,e,h);g===k&&d.algorithmCalcPoints(a,!0,n,e,h);g+=1});return e},algorithmFill:function(a,b,c){var e=[],d,f=b.direction,h=b.x,g=b.y,k=b.width,n=b.height,l,p,q,r;m(c,function(c){d=c.val/b.val*b.height*b.width;l=h;p=g;
|
||||
0===f?(r=n,q=d/r,k-=q,h+=q):(q=k,r=d/q,n-=r,g+=r);e.push({x:l,y:p,width:q,height:r});a&&(f=1-f)});return e},strip:function(a,b){return this.algorithmLowAspectRatio(!1,a,b)},squarified:function(a,b){return this.algorithmLowAspectRatio(!0,a,b)},sliceAndDice:function(a,b){return this.algorithmFill(!0,a,b)},stripes:function(a,b){return this.algorithmFill(!1,a,b)},translate:function(){var a,b;u.prototype.translate.call(this);this.rootNode=k(this.options.rootId,"");this.levelMap=B(this.options.levels,function(a,
|
||||
b){a[b.level]=b;return a},{});b=this.tree=this.getTree();this.axisRatio=this.xAxis.len/this.yAxis.len;this.nodeMap[""].pointValues=a={x:0,y:0,width:100,height:100};this.nodeMap[""].values=a=w(a,{width:a.width*this.axisRatio,direction:"vertical"===this.options.layoutStartingDirection?0:1,val:b.val});this.calculateChildrenAreas(b,a);this.colorAxis?this.translateColors():this.options.colorByPoint||this.setColorRecursive(this.tree);this.options.allowDrillToNode&&(b=this.nodeMap[this.rootNode].pointValues,
|
||||
this.xAxis.setExtremes(b.x,b.x+b.width,!1),this.yAxis.setExtremes(b.y,b.y+b.height,!1),this.xAxis.setScale(),this.yAxis.setScale());this.setPointValues()},drawDataLabels:function(){var a=this,b=y(a.points,function(a){return a.node.visible}),c,e;m(b,function(b){e=a.levelMap[b.node.levelDynamic];c={style:{}};b.node.isLeaf||(c.enabled=!1);e&&e.dataLabels&&(c=w(c,e.dataLabels),a._hasPointLabels=!0);b.shapeArgs&&(c.style.width=b.shapeArgs.width,b.dataLabel&&b.dataLabel.css({width:b.shapeArgs.width+"px"}));
|
||||
b.dlOptions=w(c,b.options.dataLabels)});u.prototype.drawDataLabels.call(this)},alignDataLabel:function(a){t.column.prototype.alignDataLabel.apply(this,arguments);a.dataLabel&&a.dataLabel.attr({zIndex:a.node.zIndex+1})},drawPoints:function(){var a=this,b=y(a.points,function(a){return a.node.visible});m(b,function(b){var c="levelGroup-"+b.node.levelDynamic;a[c]||(a[c]=a.chart.renderer.g(c).attr({zIndex:1E3-b.node.levelDynamic}).add(a.group));b.group=a[c]});t.column.prototype.drawPoints.call(this);a.options.allowDrillToNode&&
|
||||
m(b,function(b){b.graphic&&(b.drillId=a.options.interactByLeaf?a.drillToByLeaf(b):a.drillToByGroup(b))})},drillTo:function(){var a=this;g.addEvent(a,"click",function(b){b=b.point;var c=b.drillId,e;c&&(e=a.nodeMap[a.rootNode].name||a.rootNode,b.setState(""),a.drillToNode(c),a.showDrillUpButton(e))})},drillToByGroup:function(a){var b=!1;1!==a.node.level-this.nodeMap[this.rootNode].level||a.node.isLeaf||(b=a.id);return b},drillToByLeaf:function(a){var b=!1;if(a.node.parent!==this.rootNode&&a.node.isLeaf)for(a=
|
||||
a.node;!b;)a=this.nodeMap[a.parent],a.parent===this.rootNode&&(b=a.id);return b},drillUp:function(){var a=null;this.rootNode&&(a=this.nodeMap[this.rootNode],a=null!==a.parent?this.nodeMap[a.parent]:this.nodeMap[""]);null!==a&&(this.drillToNode(a.id),""===a.id?this.drillUpButton=this.drillUpButton.destroy():(a=this.nodeMap[a.parent],this.showDrillUpButton(a.name||a.id)))},drillToNode:function(a){this.options.rootId=a;this.isDirty=!0;this.chart.redraw()},showDrillUpButton:function(a){var b=this;a=a||
|
||||
"\x3c Back";var c=b.options.drillUpButton,e,d;c.text&&(a=c.text);this.drillUpButton?this.drillUpButton.attr({text:a}).align():(d=(e=c.theme)&&e.states,this.drillUpButton=this.chart.renderer.button(a,null,null,function(){b.drillUp()},e,d&&d.hover,d&&d.select).attr({align:c.position.align,zIndex:7}).add().align(c.position,!1,c.relativeTo||"plotBox"))},buildKDTree:A,drawLegendSymbol:g.LegendSymbolMixin.drawRectangle,getExtremes:function(){u.prototype.getExtremes.call(this,this.colorValueData);this.valueMin=
|
||||
this.dataMin;this.valueMax=this.dataMax;u.prototype.getExtremes.call(this)},getExtremesFromAll:!0,bindAxes:function(){var a={endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,dataMin:0,minPadding:0,max:100,dataMax:100,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]};u.prototype.bindAxes.call(this);g.extend(this.yAxis.options,a);g.extend(this.xAxis.options,a)}},{getClassName:function(){var a=g.Point.prototype.getClassName.call(this),b=this.series,c=b.options;this.node.level<=b.nodeMap[b.rootNode].level?
|
||||
a+=" highcharts-above-level":this.node.isLeaf||k(c.interactByLeaf,!c.allowDrillToNode)?this.node.isLeaf||(a+=" highcharts-internal-node"):a+=" highcharts-internal-node-interactive";return a},isValid:function(){return E(this.value)},setState:function(a){g.Point.prototype.setState.call(this,a);this.graphic.attr({zIndex:"hover"===a?1:0})},setVisible:t.pie.prototype.pointClass.prototype.setVisible})})(p)});
|
||||
881
assets/plugin/chart/highcharts/code/js/modules/treemap.src.js
Executable file
881
assets/plugin/chart/highcharts/code/js/modules/treemap.src.js
Executable file
@ -0,0 +1,881 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
*
|
||||
* (c) 2014 Highsoft AS
|
||||
* Authors: Jon Arild Nygard / Oystein Moseng
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2014 Highsoft AS
|
||||
* Authors: Jon Arild Nygard / Oystein Moseng
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var seriesType = H.seriesType,
|
||||
seriesTypes = H.seriesTypes,
|
||||
map = H.map,
|
||||
merge = H.merge,
|
||||
extend = H.extend,
|
||||
noop = H.noop,
|
||||
each = H.each,
|
||||
grep = H.grep,
|
||||
isNumber = H.isNumber,
|
||||
pick = H.pick,
|
||||
Series = H.Series,
|
||||
stableSort = H.stableSort,
|
||||
color = H.Color,
|
||||
eachObject = function(list, func, context) {
|
||||
var key;
|
||||
context = context || this;
|
||||
for (key in list) {
|
||||
if (list.hasOwnProperty(key)) {
|
||||
func.call(context, list[key], key, list);
|
||||
}
|
||||
}
|
||||
},
|
||||
reduce = function(arr, func, previous, context) {
|
||||
context = context || this;
|
||||
arr = arr || []; // @note should each be able to handle empty values automatically?
|
||||
each(arr, function(current, i) {
|
||||
previous = func.call(context, previous, current, i, arr);
|
||||
});
|
||||
return previous;
|
||||
},
|
||||
// @todo find correct name for this function.
|
||||
// @todo Similar to reduce, this function is likely redundant
|
||||
recursive = function(item, func, context) {
|
||||
var next;
|
||||
context = context || this;
|
||||
next = func.call(context, item);
|
||||
if (next !== false) {
|
||||
recursive(next, func, context);
|
||||
}
|
||||
};
|
||||
|
||||
// The Treemap series type
|
||||
seriesType('treemap', 'scatter', {
|
||||
showInLegend: false,
|
||||
marker: false,
|
||||
dataLabels: {
|
||||
enabled: true,
|
||||
defer: false,
|
||||
verticalAlign: 'middle',
|
||||
formatter: function() { // #2945
|
||||
return this.point.name || this.point.id;
|
||||
},
|
||||
inside: true
|
||||
},
|
||||
tooltip: {
|
||||
headerFormat: '',
|
||||
pointFormat: '<b>{point.name}</b>: {point.value}</b><br/>'
|
||||
},
|
||||
layoutAlgorithm: 'sliceAndDice',
|
||||
layoutStartingDirection: 'vertical',
|
||||
alternateStartingDirection: false,
|
||||
levelIsConstant: true,
|
||||
drillUpButton: {
|
||||
position: {
|
||||
align: 'right',
|
||||
x: -10,
|
||||
y: 10
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// Prototype members
|
||||
}, {
|
||||
pointArrayMap: ['value'],
|
||||
axisTypes: seriesTypes.heatmap ? ['xAxis', 'yAxis', 'colorAxis'] : ['xAxis', 'yAxis'],
|
||||
optionalAxis: 'colorAxis',
|
||||
getSymbol: noop,
|
||||
parallelArrays: ['x', 'y', 'value', 'colorValue'],
|
||||
colorKey: 'colorValue', // Point color option key
|
||||
translateColors: seriesTypes.heatmap && seriesTypes.heatmap.prototype.translateColors,
|
||||
trackerGroups: ['group', 'dataLabelsGroup'],
|
||||
/**
|
||||
* Creates an object map from parent id to childrens index.
|
||||
* @param {Array} data List of points set in options.
|
||||
* @param {string} data[].parent Parent id of point.
|
||||
* @param {Array} ids List of all point ids.
|
||||
* @return {Object} Map from parent id to children index in data.
|
||||
*/
|
||||
getListOfParents: function(data, ids) {
|
||||
var listOfParents = reduce(data, function(prev, curr, i) {
|
||||
var parent = pick(curr.parent, '');
|
||||
if (prev[parent] === undefined) {
|
||||
prev[parent] = [];
|
||||
}
|
||||
prev[parent].push(i);
|
||||
return prev;
|
||||
}, {});
|
||||
|
||||
// If parent does not exist, hoist parent to root of tree.
|
||||
eachObject(listOfParents, function(children, parent, list) {
|
||||
if ((parent !== '') && (H.inArray(parent, ids) === -1)) {
|
||||
each(children, function(child) {
|
||||
list[''].push(child);
|
||||
});
|
||||
delete list[parent];
|
||||
}
|
||||
});
|
||||
return listOfParents;
|
||||
},
|
||||
/**
|
||||
* Creates a tree structured object from the series points
|
||||
*/
|
||||
getTree: function() {
|
||||
var tree,
|
||||
series = this,
|
||||
allIds = map(this.data, function(d) {
|
||||
return d.id;
|
||||
}),
|
||||
parentList = series.getListOfParents(this.data, allIds);
|
||||
|
||||
series.nodeMap = [];
|
||||
tree = series.buildNode('', -1, 0, parentList, null);
|
||||
// Parents of the root node is by default visible
|
||||
recursive(this.nodeMap[this.rootNode], function(node) {
|
||||
var next = false,
|
||||
p = node.parent;
|
||||
node.visible = true;
|
||||
if (p || p === '') {
|
||||
next = series.nodeMap[p];
|
||||
}
|
||||
return next;
|
||||
});
|
||||
// Children of the root node is by default visible
|
||||
recursive(this.nodeMap[this.rootNode].children, function(children) {
|
||||
var next = false;
|
||||
each(children, function(child) {
|
||||
child.visible = true;
|
||||
if (child.children.length) {
|
||||
next = (next || []).concat(child.children);
|
||||
}
|
||||
});
|
||||
return next;
|
||||
});
|
||||
this.setTreeValues(tree);
|
||||
return tree;
|
||||
},
|
||||
init: function(chart, options) {
|
||||
var series = this;
|
||||
Series.prototype.init.call(series, chart, options);
|
||||
if (series.options.allowDrillToNode) {
|
||||
series.drillTo();
|
||||
}
|
||||
},
|
||||
buildNode: function(id, i, level, list, parent) {
|
||||
var series = this,
|
||||
children = [],
|
||||
point = series.points[i],
|
||||
node,
|
||||
child;
|
||||
|
||||
// Actions
|
||||
each((list[id] || []), function(i) {
|
||||
child = series.buildNode(series.points[i].id, i, (level + 1), list, id);
|
||||
children.push(child);
|
||||
});
|
||||
node = {
|
||||
id: id,
|
||||
i: i,
|
||||
children: children,
|
||||
level: level,
|
||||
parent: parent,
|
||||
visible: false // @todo move this to better location
|
||||
};
|
||||
series.nodeMap[node.id] = node;
|
||||
if (point) {
|
||||
point.node = node;
|
||||
}
|
||||
return node;
|
||||
},
|
||||
setTreeValues: function(tree) {
|
||||
var series = this,
|
||||
options = series.options,
|
||||
childrenTotal = 0,
|
||||
children = [],
|
||||
val,
|
||||
point = series.points[tree.i];
|
||||
|
||||
// First give the children some values
|
||||
each(tree.children, function(child) {
|
||||
child = series.setTreeValues(child);
|
||||
children.push(child);
|
||||
|
||||
if (!child.ignore) {
|
||||
childrenTotal += child.val;
|
||||
} else {
|
||||
// @todo Add predicate to avoid looping already ignored children
|
||||
recursive(child.children, function(children) {
|
||||
var next = false;
|
||||
each(children, function(node) {
|
||||
extend(node, {
|
||||
ignore: true,
|
||||
isLeaf: false,
|
||||
visible: false
|
||||
});
|
||||
if (node.children.length) {
|
||||
next = (next || []).concat(node.children);
|
||||
}
|
||||
});
|
||||
return next;
|
||||
});
|
||||
}
|
||||
});
|
||||
// Sort the children
|
||||
stableSort(children, function(a, b) {
|
||||
return a.sortIndex - b.sortIndex;
|
||||
});
|
||||
// Set the values
|
||||
val = pick(point && point.options.value, childrenTotal);
|
||||
if (point) {
|
||||
point.value = val;
|
||||
}
|
||||
extend(tree, {
|
||||
children: children,
|
||||
childrenTotal: childrenTotal,
|
||||
// Ignore this node if point is not visible
|
||||
ignore: !(pick(point && point.visible, true) && (val > 0)),
|
||||
isLeaf: tree.visible && !childrenTotal,
|
||||
levelDynamic: (options.levelIsConstant ? tree.level : (tree.level - series.nodeMap[series.rootNode].level)),
|
||||
name: pick(point && point.name, ''),
|
||||
sortIndex: pick(point && point.sortIndex, -val),
|
||||
val: val
|
||||
});
|
||||
return tree;
|
||||
},
|
||||
/**
|
||||
* Recursive function which calculates the area for all children of a node.
|
||||
* @param {Object} node The node which is parent to the children.
|
||||
* @param {Object} area The rectangular area of the parent.
|
||||
*/
|
||||
calculateChildrenAreas: function(parent, area) {
|
||||
var series = this,
|
||||
options = series.options,
|
||||
level = this.levelMap[parent.levelDynamic + 1],
|
||||
algorithm = pick((series[level && level.layoutAlgorithm] && level.layoutAlgorithm), options.layoutAlgorithm),
|
||||
alternate = options.alternateStartingDirection,
|
||||
childrenValues = [],
|
||||
children;
|
||||
|
||||
// Collect all children which should be included
|
||||
children = grep(parent.children, function(n) {
|
||||
return !n.ignore;
|
||||
});
|
||||
|
||||
if (level && level.layoutStartingDirection) {
|
||||
area.direction = level.layoutStartingDirection === 'vertical' ? 0 : 1;
|
||||
}
|
||||
childrenValues = series[algorithm](area, children);
|
||||
each(children, function(child, index) {
|
||||
var values = childrenValues[index];
|
||||
child.values = merge(values, {
|
||||
val: child.childrenTotal,
|
||||
direction: (alternate ? 1 - area.direction : area.direction)
|
||||
});
|
||||
child.pointValues = merge(values, {
|
||||
x: (values.x / series.axisRatio),
|
||||
width: (values.width / series.axisRatio)
|
||||
});
|
||||
// If node has children, then call method recursively
|
||||
if (child.children.length) {
|
||||
series.calculateChildrenAreas(child, child.values);
|
||||
}
|
||||
});
|
||||
},
|
||||
setPointValues: function() {
|
||||
var series = this,
|
||||
xAxis = series.xAxis,
|
||||
yAxis = series.yAxis;
|
||||
each(series.points, function(point) {
|
||||
var node = point.node,
|
||||
values = node.pointValues,
|
||||
x1,
|
||||
x2,
|
||||
y1,
|
||||
y2,
|
||||
crispCorr = 0.5; // Assume 1px borderWidth for simplicity
|
||||
|
||||
// Points which is ignored, have no values.
|
||||
if (values && node.visible) {
|
||||
x1 = Math.round(xAxis.translate(values.x, 0, 0, 0, 1)) - crispCorr;
|
||||
x2 = Math.round(xAxis.translate(values.x + values.width, 0, 0, 0, 1)) - crispCorr;
|
||||
y1 = Math.round(yAxis.translate(values.y, 0, 0, 0, 1)) - crispCorr;
|
||||
y2 = Math.round(yAxis.translate(values.y + values.height, 0, 0, 0, 1)) - crispCorr;
|
||||
// Set point values
|
||||
point.shapeType = 'rect';
|
||||
point.shapeArgs = {
|
||||
x: Math.min(x1, x2),
|
||||
y: Math.min(y1, y2),
|
||||
width: Math.abs(x2 - x1),
|
||||
height: Math.abs(y2 - y1)
|
||||
};
|
||||
point.plotX = point.shapeArgs.x + (point.shapeArgs.width / 2);
|
||||
point.plotY = point.shapeArgs.y + (point.shapeArgs.height / 2);
|
||||
} else {
|
||||
// Reset visibility
|
||||
delete point.plotX;
|
||||
delete point.plotY;
|
||||
}
|
||||
});
|
||||
},
|
||||
setColorRecursive: function(node, color, colorIndex) {
|
||||
var series = this,
|
||||
point,
|
||||
level;
|
||||
if (node) {
|
||||
point = series.points[node.i];
|
||||
level = series.levelMap[node.levelDynamic];
|
||||
// Select either point color, level color or inherited color.
|
||||
color = pick(point && point.options.color, level && level.color, color);
|
||||
colorIndex = pick(point && point.options.colorIndex, level && level.colorIndex, colorIndex);
|
||||
if (point) {
|
||||
point.color = color;
|
||||
point.colorIndex = colorIndex;
|
||||
}
|
||||
|
||||
// Do it all again with the children
|
||||
if (node.children.length) {
|
||||
each(node.children, function(child) {
|
||||
series.setColorRecursive(child, color, colorIndex);
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
algorithmGroup: function(h, w, d, p) {
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
this.plot = p;
|
||||
this.direction = d;
|
||||
this.startDirection = d;
|
||||
this.total = 0;
|
||||
this.nW = 0;
|
||||
this.lW = 0;
|
||||
this.nH = 0;
|
||||
this.lH = 0;
|
||||
this.elArr = [];
|
||||
this.lP = {
|
||||
total: 0,
|
||||
lH: 0,
|
||||
nH: 0,
|
||||
lW: 0,
|
||||
nW: 0,
|
||||
nR: 0,
|
||||
lR: 0,
|
||||
aspectRatio: function(w, h) {
|
||||
return Math.max((w / h), (h / w));
|
||||
}
|
||||
};
|
||||
this.addElement = function(el) {
|
||||
this.lP.total = this.elArr[this.elArr.length - 1];
|
||||
this.total = this.total + el;
|
||||
if (this.direction === 0) {
|
||||
// Calculate last point old aspect ratio
|
||||
this.lW = this.nW;
|
||||
this.lP.lH = this.lP.total / this.lW;
|
||||
this.lP.lR = this.lP.aspectRatio(this.lW, this.lP.lH);
|
||||
// Calculate last point new aspect ratio
|
||||
this.nW = this.total / this.height;
|
||||
this.lP.nH = this.lP.total / this.nW;
|
||||
this.lP.nR = this.lP.aspectRatio(this.nW, this.lP.nH);
|
||||
} else {
|
||||
// Calculate last point old aspect ratio
|
||||
this.lH = this.nH;
|
||||
this.lP.lW = this.lP.total / this.lH;
|
||||
this.lP.lR = this.lP.aspectRatio(this.lP.lW, this.lH);
|
||||
// Calculate last point new aspect ratio
|
||||
this.nH = this.total / this.width;
|
||||
this.lP.nW = this.lP.total / this.nH;
|
||||
this.lP.nR = this.lP.aspectRatio(this.lP.nW, this.nH);
|
||||
}
|
||||
this.elArr.push(el);
|
||||
};
|
||||
this.reset = function() {
|
||||
this.nW = 0;
|
||||
this.lW = 0;
|
||||
this.elArr = [];
|
||||
this.total = 0;
|
||||
};
|
||||
},
|
||||
algorithmCalcPoints: function(directionChange, last, group, childrenArea) {
|
||||
var pX,
|
||||
pY,
|
||||
pW,
|
||||
pH,
|
||||
gW = group.lW,
|
||||
gH = group.lH,
|
||||
plot = group.plot,
|
||||
keep,
|
||||
i = 0,
|
||||
end = group.elArr.length - 1;
|
||||
if (last) {
|
||||
gW = group.nW;
|
||||
gH = group.nH;
|
||||
} else {
|
||||
keep = group.elArr[group.elArr.length - 1];
|
||||
}
|
||||
each(group.elArr, function(p) {
|
||||
if (last || (i < end)) {
|
||||
if (group.direction === 0) {
|
||||
pX = plot.x;
|
||||
pY = plot.y;
|
||||
pW = gW;
|
||||
pH = p / pW;
|
||||
} else {
|
||||
pX = plot.x;
|
||||
pY = plot.y;
|
||||
pH = gH;
|
||||
pW = p / pH;
|
||||
}
|
||||
childrenArea.push({
|
||||
x: pX,
|
||||
y: pY,
|
||||
width: pW,
|
||||
height: pH
|
||||
});
|
||||
if (group.direction === 0) {
|
||||
plot.y = plot.y + pH;
|
||||
} else {
|
||||
plot.x = plot.x + pW;
|
||||
}
|
||||
}
|
||||
i = i + 1;
|
||||
});
|
||||
// Reset variables
|
||||
group.reset();
|
||||
if (group.direction === 0) {
|
||||
group.width = group.width - gW;
|
||||
} else {
|
||||
group.height = group.height - gH;
|
||||
}
|
||||
plot.y = plot.parent.y + (plot.parent.height - group.height);
|
||||
plot.x = plot.parent.x + (plot.parent.width - group.width);
|
||||
if (directionChange) {
|
||||
group.direction = 1 - group.direction;
|
||||
}
|
||||
// If not last, then add uncalculated element
|
||||
if (!last) {
|
||||
group.addElement(keep);
|
||||
}
|
||||
},
|
||||
algorithmLowAspectRatio: function(directionChange, parent, children) {
|
||||
var childrenArea = [],
|
||||
series = this,
|
||||
pTot,
|
||||
plot = {
|
||||
x: parent.x,
|
||||
y: parent.y,
|
||||
parent: parent
|
||||
},
|
||||
direction = parent.direction,
|
||||
i = 0,
|
||||
end = children.length - 1,
|
||||
group = new this.algorithmGroup(parent.height, parent.width, direction, plot); // eslint-disable-line new-cap
|
||||
// Loop through and calculate all areas
|
||||
each(children, function(child) {
|
||||
pTot = (parent.width * parent.height) * (child.val / parent.val);
|
||||
group.addElement(pTot);
|
||||
if (group.lP.nR > group.lP.lR) {
|
||||
series.algorithmCalcPoints(directionChange, false, group, childrenArea, plot);
|
||||
}
|
||||
// If last child, then calculate all remaining areas
|
||||
if (i === end) {
|
||||
series.algorithmCalcPoints(directionChange, true, group, childrenArea, plot);
|
||||
}
|
||||
i = i + 1;
|
||||
});
|
||||
return childrenArea;
|
||||
},
|
||||
algorithmFill: function(directionChange, parent, children) {
|
||||
var childrenArea = [],
|
||||
pTot,
|
||||
direction = parent.direction,
|
||||
x = parent.x,
|
||||
y = parent.y,
|
||||
width = parent.width,
|
||||
height = parent.height,
|
||||
pX,
|
||||
pY,
|
||||
pW,
|
||||
pH;
|
||||
each(children, function(child) {
|
||||
pTot = (parent.width * parent.height) * (child.val / parent.val);
|
||||
pX = x;
|
||||
pY = y;
|
||||
if (direction === 0) {
|
||||
pH = height;
|
||||
pW = pTot / pH;
|
||||
width = width - pW;
|
||||
x = x + pW;
|
||||
} else {
|
||||
pW = width;
|
||||
pH = pTot / pW;
|
||||
height = height - pH;
|
||||
y = y + pH;
|
||||
}
|
||||
childrenArea.push({
|
||||
x: pX,
|
||||
y: pY,
|
||||
width: pW,
|
||||
height: pH
|
||||
});
|
||||
if (directionChange) {
|
||||
direction = 1 - direction;
|
||||
}
|
||||
});
|
||||
return childrenArea;
|
||||
},
|
||||
strip: function(parent, children) {
|
||||
return this.algorithmLowAspectRatio(false, parent, children);
|
||||
},
|
||||
squarified: function(parent, children) {
|
||||
return this.algorithmLowAspectRatio(true, parent, children);
|
||||
},
|
||||
sliceAndDice: function(parent, children) {
|
||||
return this.algorithmFill(true, parent, children);
|
||||
},
|
||||
stripes: function(parent, children) {
|
||||
return this.algorithmFill(false, parent, children);
|
||||
},
|
||||
translate: function() {
|
||||
var pointValues,
|
||||
seriesArea,
|
||||
tree,
|
||||
val;
|
||||
|
||||
// Call prototype function
|
||||
Series.prototype.translate.call(this);
|
||||
|
||||
// Assign variables
|
||||
this.rootNode = pick(this.options.rootId, '');
|
||||
// Create a object map from level to options
|
||||
this.levelMap = reduce(this.options.levels, function(arr, item) {
|
||||
arr[item.level] = item;
|
||||
return arr;
|
||||
}, {});
|
||||
tree = this.tree = this.getTree(); // @todo Only if series.isDirtyData is true
|
||||
|
||||
// Calculate plotting values.
|
||||
this.axisRatio = (this.xAxis.len / this.yAxis.len);
|
||||
this.nodeMap[''].pointValues = pointValues = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 100,
|
||||
height: 100
|
||||
};
|
||||
this.nodeMap[''].values = seriesArea = merge(pointValues, {
|
||||
width: (pointValues.width * this.axisRatio),
|
||||
direction: (this.options.layoutStartingDirection === 'vertical' ? 0 : 1),
|
||||
val: tree.val
|
||||
});
|
||||
this.calculateChildrenAreas(tree, seriesArea);
|
||||
|
||||
// Logic for point colors
|
||||
if (this.colorAxis) {
|
||||
this.translateColors();
|
||||
} else if (!this.options.colorByPoint) {
|
||||
this.setColorRecursive(this.tree);
|
||||
}
|
||||
|
||||
// Update axis extremes according to the root node.
|
||||
if (this.options.allowDrillToNode) {
|
||||
val = this.nodeMap[this.rootNode].pointValues;
|
||||
this.xAxis.setExtremes(val.x, val.x + val.width, false);
|
||||
this.yAxis.setExtremes(val.y, val.y + val.height, false);
|
||||
this.xAxis.setScale();
|
||||
this.yAxis.setScale();
|
||||
}
|
||||
|
||||
// Assign values to points.
|
||||
this.setPointValues();
|
||||
},
|
||||
/**
|
||||
* Extend drawDataLabels with logic to handle custom options related to the treemap series:
|
||||
* - Points which is not a leaf node, has dataLabels disabled by default.
|
||||
* - Options set on series.levels is merged in.
|
||||
* - Width of the dataLabel is set to match the width of the point shape.
|
||||
*/
|
||||
drawDataLabels: function() {
|
||||
var series = this,
|
||||
points = grep(series.points, function(n) {
|
||||
return n.node.visible;
|
||||
}),
|
||||
options,
|
||||
level;
|
||||
each(points, function(point) {
|
||||
level = series.levelMap[point.node.levelDynamic];
|
||||
// Set options to new object to avoid problems with scope
|
||||
options = {
|
||||
style: {}
|
||||
};
|
||||
|
||||
// If not a leaf, then label should be disabled as default
|
||||
if (!point.node.isLeaf) {
|
||||
options.enabled = false;
|
||||
}
|
||||
|
||||
// If options for level exists, include them as well
|
||||
if (level && level.dataLabels) {
|
||||
options = merge(options, level.dataLabels);
|
||||
series._hasPointLabels = true;
|
||||
}
|
||||
|
||||
// Set dataLabel width to the width of the point shape.
|
||||
if (point.shapeArgs) {
|
||||
options.style.width = point.shapeArgs.width;
|
||||
if (point.dataLabel) {
|
||||
point.dataLabel.css({
|
||||
width: point.shapeArgs.width + 'px'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Merge custom options with point options
|
||||
point.dlOptions = merge(options, point.options.dataLabels);
|
||||
});
|
||||
Series.prototype.drawDataLabels.call(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Over the alignment method by setting z index
|
||||
*/
|
||||
alignDataLabel: function(point) {
|
||||
seriesTypes.column.prototype.alignDataLabel.apply(this, arguments);
|
||||
if (point.dataLabel) {
|
||||
point.dataLabel.attr({
|
||||
zIndex: point.node.zIndex + 1
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Extending ColumnSeries drawPoints
|
||||
*/
|
||||
drawPoints: function() {
|
||||
var series = this,
|
||||
points = grep(series.points, function(n) {
|
||||
return n.node.visible;
|
||||
});
|
||||
|
||||
each(points, function(point) {
|
||||
var groupKey = 'levelGroup-' + point.node.levelDynamic;
|
||||
if (!series[groupKey]) {
|
||||
series[groupKey] = series.chart.renderer.g(groupKey)
|
||||
.attr({
|
||||
zIndex: 1000 - point.node.levelDynamic // @todo Set the zIndex based upon the number of levels, instead of using 1000
|
||||
})
|
||||
.add(series.group);
|
||||
}
|
||||
point.group = series[groupKey];
|
||||
|
||||
});
|
||||
// Call standard drawPoints
|
||||
seriesTypes.column.prototype.drawPoints.call(this);
|
||||
|
||||
// If drillToNode is allowed, set a point cursor on clickables & add drillId to point
|
||||
if (series.options.allowDrillToNode) {
|
||||
each(points, function(point) {
|
||||
if (point.graphic) {
|
||||
point.drillId = series.options.interactByLeaf ? series.drillToByLeaf(point) : series.drillToByGroup(point);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Add drilling on the suitable points
|
||||
*/
|
||||
drillTo: function() {
|
||||
var series = this;
|
||||
H.addEvent(series, 'click', function(event) {
|
||||
var point = event.point,
|
||||
drillId = point.drillId,
|
||||
drillName;
|
||||
// If a drill id is returned, add click event and cursor.
|
||||
if (drillId) {
|
||||
drillName = series.nodeMap[series.rootNode].name || series.rootNode;
|
||||
point.setState(''); // Remove hover
|
||||
series.drillToNode(drillId);
|
||||
series.showDrillUpButton(drillName);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Finds the drill id for a parent node.
|
||||
* Returns false if point should not have a click event
|
||||
* @param {Object} point
|
||||
* @return {string || boolean} Drill to id or false when point should not have a click event
|
||||
*/
|
||||
drillToByGroup: function(point) {
|
||||
var series = this,
|
||||
drillId = false;
|
||||
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.node.isLeaf) {
|
||||
drillId = point.id;
|
||||
}
|
||||
return drillId;
|
||||
},
|
||||
/**
|
||||
* Finds the drill id for a leaf node.
|
||||
* Returns false if point should not have a click event
|
||||
* @param {Object} point
|
||||
* @return {string || boolean} Drill to id or false when point should not have a click event
|
||||
*/
|
||||
drillToByLeaf: function(point) {
|
||||
var series = this,
|
||||
drillId = false,
|
||||
nodeParent;
|
||||
if ((point.node.parent !== series.rootNode) && (point.node.isLeaf)) {
|
||||
nodeParent = point.node;
|
||||
while (!drillId) {
|
||||
nodeParent = series.nodeMap[nodeParent.parent];
|
||||
if (nodeParent.parent === series.rootNode) {
|
||||
drillId = nodeParent.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return drillId;
|
||||
},
|
||||
drillUp: function() {
|
||||
var drillPoint = null,
|
||||
node,
|
||||
parent;
|
||||
if (this.rootNode) {
|
||||
node = this.nodeMap[this.rootNode];
|
||||
if (node.parent !== null) {
|
||||
drillPoint = this.nodeMap[node.parent];
|
||||
} else {
|
||||
drillPoint = this.nodeMap[''];
|
||||
}
|
||||
}
|
||||
|
||||
if (drillPoint !== null) {
|
||||
this.drillToNode(drillPoint.id);
|
||||
if (drillPoint.id === '') {
|
||||
this.drillUpButton = this.drillUpButton.destroy();
|
||||
} else {
|
||||
parent = this.nodeMap[drillPoint.parent];
|
||||
this.showDrillUpButton((parent.name || parent.id));
|
||||
}
|
||||
}
|
||||
},
|
||||
drillToNode: function(id) {
|
||||
this.options.rootId = id;
|
||||
this.isDirty = true; // Force redraw
|
||||
this.chart.redraw();
|
||||
},
|
||||
showDrillUpButton: function(name) {
|
||||
var series = this,
|
||||
backText = (name || '< Back'),
|
||||
buttonOptions = series.options.drillUpButton,
|
||||
attr,
|
||||
states;
|
||||
|
||||
if (buttonOptions.text) {
|
||||
backText = buttonOptions.text;
|
||||
}
|
||||
if (!this.drillUpButton) {
|
||||
attr = buttonOptions.theme;
|
||||
states = attr && attr.states;
|
||||
|
||||
this.drillUpButton = this.chart.renderer.button(
|
||||
backText,
|
||||
null,
|
||||
null,
|
||||
function() {
|
||||
series.drillUp();
|
||||
},
|
||||
attr,
|
||||
states && states.hover,
|
||||
states && states.select
|
||||
)
|
||||
.attr({
|
||||
align: buttonOptions.position.align,
|
||||
zIndex: 7
|
||||
})
|
||||
.add()
|
||||
.align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox');
|
||||
} else {
|
||||
this.drillUpButton.attr({
|
||||
text: backText
|
||||
})
|
||||
.align();
|
||||
}
|
||||
},
|
||||
buildKDTree: noop,
|
||||
drawLegendSymbol: H.LegendSymbolMixin.drawRectangle,
|
||||
getExtremes: function() {
|
||||
// Get the extremes from the value data
|
||||
Series.prototype.getExtremes.call(this, this.colorValueData);
|
||||
this.valueMin = this.dataMin;
|
||||
this.valueMax = this.dataMax;
|
||||
|
||||
// Get the extremes from the y data
|
||||
Series.prototype.getExtremes.call(this);
|
||||
},
|
||||
getExtremesFromAll: true,
|
||||
bindAxes: function() {
|
||||
var treeAxis = {
|
||||
endOnTick: false,
|
||||
gridLineWidth: 0,
|
||||
lineWidth: 0,
|
||||
min: 0,
|
||||
dataMin: 0,
|
||||
minPadding: 0,
|
||||
max: 100,
|
||||
dataMax: 100,
|
||||
maxPadding: 0,
|
||||
startOnTick: false,
|
||||
title: null,
|
||||
tickPositions: []
|
||||
};
|
||||
Series.prototype.bindAxes.call(this);
|
||||
H.extend(this.yAxis.options, treeAxis);
|
||||
H.extend(this.xAxis.options, treeAxis);
|
||||
}
|
||||
|
||||
// Point class
|
||||
}, {
|
||||
getClassName: function() {
|
||||
var className = H.Point.prototype.getClassName.call(this),
|
||||
series = this.series,
|
||||
options = series.options;
|
||||
|
||||
// Above the current level
|
||||
if (this.node.level <= series.nodeMap[series.rootNode].level) {
|
||||
className += ' highcharts-above-level';
|
||||
|
||||
} else if (!this.node.isLeaf && !pick(options.interactByLeaf, !options.allowDrillToNode)) {
|
||||
className += ' highcharts-internal-node-interactive';
|
||||
|
||||
} else if (!this.node.isLeaf) {
|
||||
className += ' highcharts-internal-node';
|
||||
}
|
||||
return className;
|
||||
},
|
||||
isValid: function() {
|
||||
return isNumber(this.value);
|
||||
},
|
||||
setState: function(state) {
|
||||
H.Point.prototype.setState.call(this, state);
|
||||
this.graphic.attr({
|
||||
zIndex: state === 'hover' ? 1 : 0
|
||||
});
|
||||
},
|
||||
setVisible: seriesTypes.pie.prototype.pointClass.prototype.setVisible
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
15
assets/plugin/chart/highcharts/code/js/modules/xrange-series.js
Executable file
15
assets/plugin/chart/highcharts/code/js/modules/xrange-series.js
Executable file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
X-range series
|
||||
|
||||
(c) 2010-2016 Torstein Honsi, Lars A. V. Cabrera
|
||||
|
||||
--- WORK IN PROGRESS ---
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(h){"object"===typeof module&&module.exports?module.exports=h:h(Highcharts)})(function(h){(function(c){var h=c.getOptions().plotOptions,m=c.seriesTypes.column,k=c.each,p=c.extendClass,q=c.isNumber,v=c.isObject,n=c.merge,r=c.pick,t=c.seriesTypes,w=c.stop,x=c.wrap,y=c.Axis,u=c.Point,z=c.Series;h.xrange=n(h.column,{tooltip:{pointFormat:'\x3cspan style\x3d"color:{point.color}"\x3e\u25cf\x3c/span\x3e {series.name}: \x3cb\x3e{point.yCategory}\x3c/b\x3e\x3cbr/\x3e'}});t.xrange=p(m,{pointClass:p(u,
|
||||
{getLabelConfig:function(){var g=u.prototype.getLabelConfig.call(this);g.x2=this.x2;g.yCategory=this.yCategory=this.series.yAxis.categories&&this.series.yAxis.categories[this.y];return g}}),type:"xrange",forceDL:!0,parallelArrays:["x","x2","y"],requireSorting:!1,animate:t.line.prototype.animate,getColumnMetrics:function(){function g(){k(f.series,function(b){var a=b.xAxis;b.xAxis=b.yAxis;b.yAxis=a})}var e,f=this.chart;g();this.yAxis.closestPointRange=1;e=m.prototype.getColumnMetrics.call(this);g();
|
||||
return e},cropData:function(g,e,f,b){e=z.prototype.cropData.call(this,this.x2Data,e,f,b);e.xData=g.slice(e.start,e.end);return e},translate:function(){m.prototype.translate.apply(this,arguments);var g=this.xAxis,e=this.columnMetrics,f=this.options.minPointLength||0;k(this.points,function(b){var a=b.plotX,d=r(b.x2,b.x+(b.len||0)),d=g.toPixels(d,!0),c=d-a,l;f&&(l=f-c,0>l&&(l=0),a-=l/2,d+=l/2);a=Math.max(a,-10);d=Math.min(Math.max(d,-10),g.len+10);b.shapeArgs={x:a,y:b.plotY+e.offset,width:d-a,height:e.width};
|
||||
b.tooltipPos[0]+=c/2;b.tooltipPos[1]-=e.width/2;if(d=b.partialFill)v(d)&&(d=d.amount),q(d)||(d=0),a=b.shapeArgs,b.partShapeArgs={x:a.x,y:a.y+1,width:a.width*d,height:a.height-2}})},drawPoints:function(){var c=this,e=this.chart,f=e.renderer,b=e.pointCount<(c.options.animationLimit||250)?"animate":"attr";k(c.points,function(a){var d=a.graphic,e=a.shapeType,g=a.shapeArgs,h=a.partShapeArgs;if(q(a.plotY)&&null!==a.y)if(d){if(w(d),a.graphicOriginal[b](n(g)),h)a.graphicOverlay[b](n(h))}else a.graphic=d=
|
||||
f.g("point").attr({"class":a.getClassName()}).add(a.group||c.group),a.graphicOriginal=f[e](g).addClass("highcharts-partfill-original").add(d),h&&(a.graphicOverlay=f[e](h).addClass("highcharts-partfill-overlay").add(d));else d&&(a.graphic=d.destroy())})}});x(y.prototype,"getSeriesExtremes",function(c){var e=this.series,f,b;c.call(this);this.isXAxis&&"xrange"===e.type&&(f=r(this.dataMax,Number.MIN_VALUE),k(this.series,function(a){k(a.x2Data||[],function(a){a>f&&(f=a,b=!0)})}),b&&(this.dataMax=f))})})(h)});
|
||||
256
assets/plugin/chart/highcharts/code/js/modules/xrange-series.src.js
Executable file
256
assets/plugin/chart/highcharts/code/js/modules/xrange-series.src.js
Executable file
@ -0,0 +1,256 @@
|
||||
/**
|
||||
* @license Highcharts JS v5.0.2 (2016-10-26)
|
||||
* X-range series
|
||||
*
|
||||
* (c) 2010-2016 Torstein Honsi, Lars A. V. Cabrera
|
||||
*
|
||||
* --- WORK IN PROGRESS ---
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
factory(Highcharts);
|
||||
}
|
||||
}(function(Highcharts) {
|
||||
(function(H) {
|
||||
/**
|
||||
* (c) 2014-2016 Highsoft AS
|
||||
* Authors: Torstein Honsi, Lars A. V. Cabrera
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var defaultPlotOptions = H.getOptions().plotOptions,
|
||||
color = H.Color,
|
||||
columnType = H.seriesTypes.column,
|
||||
each = H.each,
|
||||
extendClass = H.extendClass,
|
||||
isNumber = H.isNumber,
|
||||
isObject = H.isObject,
|
||||
merge = H.merge,
|
||||
pick = H.pick,
|
||||
seriesTypes = H.seriesTypes,
|
||||
stop = H.stop,
|
||||
wrap = H.wrap,
|
||||
Axis = H.Axis,
|
||||
Point = H.Point,
|
||||
Series = H.Series,
|
||||
pointFormat = '<span style="color:{point.color}">' +
|
||||
'\u25CF' +
|
||||
'</span> {series.name}: <b>{point.yCategory}</b><br/>',
|
||||
xrange = 'xrange';
|
||||
|
||||
defaultPlotOptions.xrange = merge(defaultPlotOptions.column, {
|
||||
tooltip: {
|
||||
pointFormat: pointFormat
|
||||
}
|
||||
});
|
||||
seriesTypes.xrange = extendClass(columnType, {
|
||||
pointClass: extendClass(Point, {
|
||||
// Add x2 and yCategory to the available properties for tooltip formats
|
||||
getLabelConfig: function() {
|
||||
var cfg = Point.prototype.getLabelConfig.call(this);
|
||||
|
||||
cfg.x2 = this.x2;
|
||||
cfg.yCategory = this.yCategory = this.series.yAxis.categories && this.series.yAxis.categories[this.y];
|
||||
return cfg;
|
||||
}
|
||||
}),
|
||||
type: xrange,
|
||||
forceDL: true,
|
||||
parallelArrays: ['x', 'x2', 'y'],
|
||||
requireSorting: false,
|
||||
animate: seriesTypes.line.prototype.animate,
|
||||
|
||||
/**
|
||||
* Borrow the column series metrics, but with swapped axes. This gives free access
|
||||
* to features like groupPadding, grouping, pointWidth etc.
|
||||
*/
|
||||
getColumnMetrics: function() {
|
||||
var metrics,
|
||||
chart = this.chart;
|
||||
|
||||
function swapAxes() {
|
||||
each(chart.series, function(s) {
|
||||
var xAxis = s.xAxis;
|
||||
s.xAxis = s.yAxis;
|
||||
s.yAxis = xAxis;
|
||||
});
|
||||
}
|
||||
|
||||
swapAxes();
|
||||
|
||||
this.yAxis.closestPointRange = 1;
|
||||
metrics = columnType.prototype.getColumnMetrics.call(this);
|
||||
|
||||
swapAxes();
|
||||
|
||||
return metrics;
|
||||
},
|
||||
|
||||
/**
|
||||
* Override cropData to show a point where x is outside visible range
|
||||
* but x2 is outside.
|
||||
*/
|
||||
cropData: function(xData, yData, min, max) {
|
||||
|
||||
// Replace xData with x2Data to find the appropriate cropStart
|
||||
var cropData = Series.prototype.cropData,
|
||||
crop = cropData.call(this, this.x2Data, yData, min, max);
|
||||
|
||||
// Re-insert the cropped xData
|
||||
crop.xData = xData.slice(crop.start, crop.end);
|
||||
|
||||
return crop;
|
||||
},
|
||||
|
||||
translate: function() {
|
||||
columnType.prototype.translate.apply(this, arguments);
|
||||
var series = this,
|
||||
xAxis = series.xAxis,
|
||||
metrics = series.columnMetrics,
|
||||
minPointLength = series.options.minPointLength || 0;
|
||||
|
||||
each(series.points, function(point) {
|
||||
var plotX = point.plotX,
|
||||
posX = pick(point.x2, point.x + (point.len || 0)),
|
||||
plotX2 = xAxis.toPixels(posX, true),
|
||||
width = plotX2 - plotX,
|
||||
widthDifference,
|
||||
shapeArgs,
|
||||
partialFill;
|
||||
|
||||
if (minPointLength) {
|
||||
widthDifference = minPointLength - width;
|
||||
if (widthDifference < 0) {
|
||||
widthDifference = 0;
|
||||
}
|
||||
plotX -= widthDifference / 2;
|
||||
plotX2 += widthDifference / 2;
|
||||
}
|
||||
|
||||
plotX = Math.max(plotX, -10);
|
||||
plotX2 = Math.min(Math.max(plotX2, -10), xAxis.len + 10);
|
||||
|
||||
point.shapeArgs = {
|
||||
x: plotX,
|
||||
y: point.plotY + metrics.offset,
|
||||
width: plotX2 - plotX,
|
||||
height: metrics.width
|
||||
};
|
||||
point.tooltipPos[0] += width / 2;
|
||||
point.tooltipPos[1] -= metrics.width / 2;
|
||||
|
||||
// Add a partShapeArgs to the point, based on the shapeArgs property
|
||||
partialFill = point.partialFill;
|
||||
if (partialFill) {
|
||||
// Get the partial fill amount
|
||||
if (isObject(partialFill)) {
|
||||
partialFill = partialFill.amount;
|
||||
}
|
||||
// If it was not a number, assume 0
|
||||
if (!isNumber(partialFill)) {
|
||||
partialFill = 0;
|
||||
}
|
||||
shapeArgs = point.shapeArgs;
|
||||
point.partShapeArgs = {
|
||||
x: shapeArgs.x,
|
||||
y: shapeArgs.y + 1,
|
||||
width: shapeArgs.width * partialFill,
|
||||
height: shapeArgs.height - 2
|
||||
};
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
drawPoints: function() {
|
||||
var series = this,
|
||||
chart = this.chart,
|
||||
options = series.options,
|
||||
renderer = chart.renderer,
|
||||
animationLimit = options.animationLimit || 250,
|
||||
verb = chart.pointCount < animationLimit ? 'animate' : 'attr';
|
||||
|
||||
// draw the columns
|
||||
each(series.points, function(point) {
|
||||
var plotY = point.plotY,
|
||||
graphic = point.graphic,
|
||||
type = point.shapeType,
|
||||
shapeArgs = point.shapeArgs,
|
||||
partShapeArgs = point.partShapeArgs,
|
||||
seriesOpts = series.options,
|
||||
pfOptions = point.partialFill,
|
||||
fill,
|
||||
state = point.selected && 'select',
|
||||
cutOff = options.stacking && !options.borderRadius;
|
||||
|
||||
if (isNumber(plotY) && point.y !== null) {
|
||||
if (graphic) { // update
|
||||
stop(graphic);
|
||||
point.graphicOriginal[verb](
|
||||
merge(shapeArgs)
|
||||
);
|
||||
if (partShapeArgs) {
|
||||
point.graphicOverlay[verb](
|
||||
merge(partShapeArgs)
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
point.graphic = graphic = renderer.g('point')
|
||||
.attr({
|
||||
'class': point.getClassName()
|
||||
})
|
||||
.add(point.group || series.group);
|
||||
|
||||
point.graphicOriginal = renderer[type](shapeArgs)
|
||||
.addClass('highcharts-partfill-original')
|
||||
.add(graphic);
|
||||
if (partShapeArgs) {
|
||||
point.graphicOverlay = renderer[type](partShapeArgs)
|
||||
.addClass('highcharts-partfill-overlay')
|
||||
.add(graphic);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else if (graphic) {
|
||||
point.graphic = graphic.destroy(); // #1269
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Max x2 should be considered in xAxis extremes
|
||||
*/
|
||||
wrap(Axis.prototype, 'getSeriesExtremes', function(proceed) {
|
||||
var axis = this,
|
||||
series = axis.series,
|
||||
dataMax,
|
||||
modMax;
|
||||
|
||||
proceed.call(this);
|
||||
if (axis.isXAxis && series.type === xrange) {
|
||||
dataMax = pick(axis.dataMax, Number.MIN_VALUE);
|
||||
each(this.series, function(series) {
|
||||
each(series.x2Data || [], function(val) {
|
||||
if (val > dataMax) {
|
||||
dataMax = val;
|
||||
modMax = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
if (modMax) {
|
||||
axis.dataMax = dataMax;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}(Highcharts));
|
||||
}));
|
||||
BIN
assets/plugin/chart/highcharts/css/._highcharts.css
Executable file
BIN
assets/plugin/chart/highcharts/css/._highcharts.css
Executable file
Binary file not shown.
751
assets/plugin/chart/highcharts/css/highcharts.css
Executable file
751
assets/plugin/chart/highcharts/css/highcharts.css
Executable file
@ -0,0 +1,751 @@
|
||||
/**
|
||||
* @license Highcharts
|
||||
*
|
||||
* (c) 2009-2016 Torstein Honsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
.highcharts-container {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: left;
|
||||
line-height: normal;
|
||||
z-index: 0;
|
||||
/* #1072 */
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.highcharts-root text {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-background {
|
||||
fill: #ffffff;
|
||||
}
|
||||
|
||||
.highcharts-plot-border, .highcharts-plot-background {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.highcharts-label-box {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.highcharts-button-box {
|
||||
fill: inherit;
|
||||
}
|
||||
|
||||
/* Titles */
|
||||
.highcharts-title {
|
||||
fill: #333333;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.highcharts-subtitle {
|
||||
fill: #666666;
|
||||
}
|
||||
|
||||
/* Axes */
|
||||
.highcharts-axis-line {
|
||||
fill: none;
|
||||
stroke: #ccd6eb;
|
||||
}
|
||||
|
||||
.highcharts-yaxis .highcharts-axis-line {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-axis-title {
|
||||
fill: #666666;
|
||||
}
|
||||
|
||||
.highcharts-axis-labels {
|
||||
fill: #666666;
|
||||
cursor: default;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.highcharts-grid-line {
|
||||
fill: none;
|
||||
stroke: #e6e6e6;
|
||||
}
|
||||
|
||||
.highcharts-xaxis-grid .highcharts-grid-line {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-tick {
|
||||
stroke: #ccd6eb;
|
||||
}
|
||||
|
||||
.highcharts-yaxis .highcharts-tick {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-minor-grid-line {
|
||||
stroke: #f2f2f2;
|
||||
}
|
||||
|
||||
.highcharts-crosshair-thin {
|
||||
stroke-width: 1px;
|
||||
stroke: #cccccc;
|
||||
}
|
||||
|
||||
.highcharts-crosshair-category {
|
||||
stroke: #ccd6eb;
|
||||
stroke-opacity: 0.25;
|
||||
}
|
||||
|
||||
/* Credits */
|
||||
.highcharts-credits {
|
||||
cursor: pointer;
|
||||
fill: #999999;
|
||||
font-size: 0.7em;
|
||||
transition: fill 250ms, font-size 250ms;
|
||||
}
|
||||
|
||||
.highcharts-credits:hover {
|
||||
fill: black;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/* Tooltip */
|
||||
.highcharts-tooltip {
|
||||
cursor: default;
|
||||
pointer-events: none;
|
||||
white-space: nowrap;
|
||||
transition: stroke 150ms;
|
||||
}
|
||||
|
||||
.highcharts-tooltip text {
|
||||
fill: #333333;
|
||||
}
|
||||
|
||||
.highcharts-tooltip .highcharts-header {
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
.highcharts-tooltip-box {
|
||||
stroke-width: 1px;
|
||||
fill: #f7f7f7;
|
||||
fill-opacity: 0.85;
|
||||
}
|
||||
|
||||
.highcharts-selection-marker {
|
||||
fill: #335cad;
|
||||
fill-opacity: 0.25;
|
||||
}
|
||||
|
||||
.highcharts-graph {
|
||||
fill: none;
|
||||
stroke-width: 2px;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
|
||||
.highcharts-state-hover .highcharts-graph {
|
||||
stroke-width: 3;
|
||||
}
|
||||
|
||||
.highcharts-state-hover path {
|
||||
transition: stroke-width 50;
|
||||
/* quick in */
|
||||
}
|
||||
|
||||
.highcharts-state-normal path {
|
||||
transition: stroke-width 250ms;
|
||||
/* slow out */
|
||||
}
|
||||
|
||||
/* Legend hover affects points and series */
|
||||
g.highcharts-series, .highcharts-point {
|
||||
transition: opacity 250ms;
|
||||
}
|
||||
|
||||
.highcharts-legend-series-active g.highcharts-series:not(.highcharts-series-hover),
|
||||
.highcharts-legend-point-active .highcharts-point:not(.highcharts-point-hover) {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
/* Series options */
|
||||
/* Default colors */
|
||||
.highcharts-color-0 {
|
||||
fill: #7cb5ec;
|
||||
stroke: #7cb5ec;
|
||||
}
|
||||
|
||||
.highcharts-color-1 {
|
||||
fill: #434348;
|
||||
stroke: #434348;
|
||||
}
|
||||
|
||||
.highcharts-color-2 {
|
||||
fill: #90ed7d;
|
||||
stroke: #90ed7d;
|
||||
}
|
||||
|
||||
.highcharts-color-3 {
|
||||
fill: #f7a35c;
|
||||
stroke: #f7a35c;
|
||||
}
|
||||
|
||||
.highcharts-color-4 {
|
||||
fill: #8085e9;
|
||||
stroke: #8085e9;
|
||||
}
|
||||
|
||||
.highcharts-color-5 {
|
||||
fill: #f15c80;
|
||||
stroke: #f15c80;
|
||||
}
|
||||
|
||||
.highcharts-color-6 {
|
||||
fill: #e4d354;
|
||||
stroke: #e4d354;
|
||||
}
|
||||
|
||||
.highcharts-color-7 {
|
||||
fill: #2b908f;
|
||||
stroke: #2b908f;
|
||||
}
|
||||
|
||||
.highcharts-color-8 {
|
||||
fill: #f45b5b;
|
||||
stroke: #f45b5b;
|
||||
}
|
||||
|
||||
.highcharts-color-9 {
|
||||
fill: #91e8e1;
|
||||
stroke: #91e8e1;
|
||||
}
|
||||
|
||||
.highcharts-area {
|
||||
fill-opacity: 0.75;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-markers {
|
||||
stroke-width: 1px;
|
||||
stroke: #ffffff;
|
||||
}
|
||||
|
||||
.highcharts-point {
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.highcharts-dense-data .highcharts-point {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-data-label {
|
||||
font-size: 0.9em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.highcharts-data-label-box {
|
||||
fill: none;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-data-label text {
|
||||
fill: #333333;
|
||||
}
|
||||
|
||||
.highcharts-data-label-connector {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.highcharts-halo {
|
||||
fill-opacity: 0.25;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-point-select {
|
||||
fill: #cccccc;
|
||||
stroke: #000000;
|
||||
}
|
||||
|
||||
.highcharts-column-series .highcharts-point {
|
||||
stroke: #ffffff;
|
||||
transition: fill-opacity 250ms;
|
||||
}
|
||||
|
||||
.highcharts-column-series .highcharts-point-hover {
|
||||
fill-opacity: 0.75;
|
||||
transition: fill-opacity 50ms;
|
||||
}
|
||||
|
||||
.highcharts-pie-series .highcharts-point {
|
||||
stroke-linejoin: round;
|
||||
stroke: #ffffff;
|
||||
}
|
||||
|
||||
.highcharts-pie-series .highcharts-point-hover {
|
||||
fill-opacity: 0.75;
|
||||
transition: fill-opacity 50ms;
|
||||
}
|
||||
|
||||
.highcharts-pie-series .highcharts-point-select {
|
||||
fill: inherit;
|
||||
stroke: inherit;
|
||||
}
|
||||
|
||||
.highcharts-funnel-series .highcharts-point {
|
||||
stroke-linejoin: round;
|
||||
stroke: #ffffff;
|
||||
}
|
||||
|
||||
.highcharts-funnel-series .highcharts-point-hover {
|
||||
fill-opacity: 0.75;
|
||||
transition: fill-opacity 50ms;
|
||||
}
|
||||
|
||||
.highcharts-funnel-series .highcharts-point-select {
|
||||
fill: inherit;
|
||||
stroke: inherit;
|
||||
}
|
||||
|
||||
.highcharts-pyramid-series .highcharts-point {
|
||||
stroke-linejoin: round;
|
||||
stroke: #ffffff;
|
||||
}
|
||||
|
||||
.highcharts-pyramid-series .highcharts-point-hover {
|
||||
fill-opacity: 0.75;
|
||||
transition: fill-opacity 50ms;
|
||||
}
|
||||
|
||||
.highcharts-pyramid-series .highcharts-point-select {
|
||||
fill: inherit;
|
||||
stroke: inherit;
|
||||
}
|
||||
|
||||
.highcharts-solidgauge-series .highcharts-point {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-treemap-series .highcharts-point {
|
||||
stroke-width: 1px;
|
||||
stroke: #e6e6e6;
|
||||
transition: stroke 250ms, fill 250ms, fill-opacity 250ms;
|
||||
}
|
||||
|
||||
.highcharts-treemap-series .highcharts-point-hover {
|
||||
stroke: #999999;
|
||||
transition: stroke 25ms, fill 25ms, fill-opacity 25ms;
|
||||
}
|
||||
|
||||
.highcharts-treemap-series .highcharts-above-level {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.highcharts-treemap-series .highcharts-internal-node {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.highcharts-treemap-series .highcharts-internal-node-interactive {
|
||||
fill-opacity: 0.15;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.highcharts-treemap-series .highcharts-internal-node-interactive:hover {
|
||||
fill-opacity: 0.75;
|
||||
}
|
||||
|
||||
/* Legend */
|
||||
.highcharts-legend-box {
|
||||
fill: none;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-legend-item text {
|
||||
fill: #333333;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-legend-item:hover text {
|
||||
fill: #000000;
|
||||
}
|
||||
|
||||
.highcharts-legend-item-hidden * {
|
||||
fill: #cccccc !important;
|
||||
stroke: #cccccc !important;
|
||||
transition: fill 250ms;
|
||||
}
|
||||
|
||||
.highcharts-legend-nav-active {
|
||||
fill: #003399;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.highcharts-legend-nav-inactive {
|
||||
fill: #cccccc;
|
||||
}
|
||||
|
||||
.highcharts-legend-title-box {
|
||||
fill: none;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
/* Loading */
|
||||
.highcharts-loading {
|
||||
position: absolute;
|
||||
background-color: #ffffff;
|
||||
opacity: 0.5;
|
||||
text-align: center;
|
||||
z-index: 10;
|
||||
transition: opacity 250ms;
|
||||
}
|
||||
|
||||
.highcharts-loading-hidden {
|
||||
height: 0 !important;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
transition: opacity 250ms, height 250ms step-end;
|
||||
}
|
||||
|
||||
.highcharts-loading-inner {
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
top: 45%;
|
||||
}
|
||||
|
||||
/* Plot bands and polar pane backgrounds */
|
||||
.highcharts-plot-band {
|
||||
fill: #000000;
|
||||
fill-opacity: 0.05;
|
||||
}
|
||||
|
||||
.highcharts-plot-line {
|
||||
fill: none;
|
||||
stroke: #999999;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
/* Highcharts More */
|
||||
.highcharts-boxplot-box {
|
||||
fill: #ffffff;
|
||||
}
|
||||
|
||||
.highcharts-boxplot-median {
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.highcharts-bubble-series .highcharts-point {
|
||||
fill-opacity: 0.5;
|
||||
}
|
||||
|
||||
.highcharts-errorbar-series .highcharts-point {
|
||||
stroke: #000000;
|
||||
}
|
||||
|
||||
.highcharts-gauge-series .highcharts-data-label-box {
|
||||
stroke: #cccccc;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.highcharts-gauge-series .highcharts-dial {
|
||||
fill: #000000;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-polygon-series .highcharts-graph {
|
||||
fill: inherit;
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-waterfall-series .highcharts-graph {
|
||||
stroke: #333333;
|
||||
stroke-dasharray: 1, 3;
|
||||
}
|
||||
|
||||
/* Highstock */
|
||||
.highcharts-navigator-mask {
|
||||
fill: #6685c2;
|
||||
/* navigator.maskFill option */
|
||||
fill-opacity: 0.25;
|
||||
}
|
||||
|
||||
.highcharts-navigator-mask-inside {
|
||||
fill: #6685c2;
|
||||
/* navigator.maskFill option */
|
||||
fill-opacity: 0.25;
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
.highcharts-navigator-outline {
|
||||
stroke: #cccccc;
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.highcharts-navigator-handle {
|
||||
stroke: #cccccc;
|
||||
fill: #f2f2f2;
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
.highcharts-navigator-series {
|
||||
fill: #335cad;
|
||||
stroke: #335cad;
|
||||
}
|
||||
|
||||
.highcharts-navigator-series .highcharts-graph {
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.highcharts-navigator-series .highcharts-area {
|
||||
fill-opacity: 0.05;
|
||||
}
|
||||
|
||||
.highcharts-navigator-xaxis .highcharts-axis-line {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-navigator-xaxis .highcharts-grid-line {
|
||||
stroke-width: 1px;
|
||||
stroke: #e6e6e6;
|
||||
}
|
||||
|
||||
.highcharts-navigator-xaxis.highcharts-axis-labels {
|
||||
fill: #999999;
|
||||
}
|
||||
|
||||
.highcharts-navigator-yaxis .highcharts-grid-line {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-scrollbar-thumb {
|
||||
fill: #cccccc;
|
||||
stroke: #cccccc;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.highcharts-scrollbar-button {
|
||||
fill: #e6e6e6;
|
||||
stroke: #cccccc;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.highcharts-scrollbar-arrow {
|
||||
fill: #666666;
|
||||
}
|
||||
|
||||
.highcharts-scrollbar-rifles {
|
||||
stroke: #666666;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.highcharts-scrollbar-track {
|
||||
fill: #f2f2f2;
|
||||
stroke: #f2f2f2;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.highcharts-button {
|
||||
fill: #f7f7f7;
|
||||
stroke: #cccccc;
|
||||
cursor: default;
|
||||
stroke-width: 1px;
|
||||
transition: fill 250ms;
|
||||
}
|
||||
|
||||
.highcharts-button text {
|
||||
fill: #333333;
|
||||
}
|
||||
|
||||
.highcharts-button-hover {
|
||||
transition: fill 0ms;
|
||||
fill: #e6e6e6;
|
||||
stroke: #333333;
|
||||
}
|
||||
|
||||
.highcharts-button-pressed {
|
||||
font-weight: bold;
|
||||
fill: #e6ebf5;
|
||||
stroke: #335cad;
|
||||
}
|
||||
|
||||
.highcharts-button-disabled text {
|
||||
fill: #cccccc;
|
||||
}
|
||||
|
||||
.highcharts-range-selector-buttons .highcharts-button {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-range-label rect {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.highcharts-range-label text {
|
||||
fill: #666666;
|
||||
}
|
||||
|
||||
.highcharts-range-input rect {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.highcharts-range-input text {
|
||||
fill: #333333;
|
||||
}
|
||||
|
||||
input.highcharts-range-selector {
|
||||
position: absolute;
|
||||
border: 0;
|
||||
width: 1px;
|
||||
/* Chrome needs a pixel to see it */
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
left: -9em;
|
||||
/* #4798 */
|
||||
}
|
||||
|
||||
.highcharts-crosshair-label text {
|
||||
fill: #ffffff;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.highcharts-crosshair-label .highcharts-label-box {
|
||||
fill: inherit;
|
||||
}
|
||||
|
||||
.highcharts-candlestick-series .highcharts-point {
|
||||
stroke: #000000;
|
||||
stroke-width: 1px;
|
||||
}
|
||||
|
||||
.highcharts-candlestick-series .highcharts-point-up {
|
||||
fill: #ffffff;
|
||||
}
|
||||
|
||||
.highcharts-ohlc-series .highcharts-point-hover {
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.highcharts-flags-series .highcharts-point {
|
||||
stroke: #999999;
|
||||
fill: #ffffff;
|
||||
}
|
||||
|
||||
.highcharts-flags-series .highcharts-point-hover {
|
||||
stroke: #000000;
|
||||
fill: #ccd6eb;
|
||||
}
|
||||
|
||||
.highcharts-flags-series .highcharts-point text {
|
||||
fill: #000000;
|
||||
font-size: 0.9em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Highmaps */
|
||||
.highcharts-map-series .highcharts-point {
|
||||
transition: fill 500ms, fill-opacity 500ms, stroke-width 250ms;
|
||||
stroke: #cccccc;
|
||||
}
|
||||
|
||||
.highcharts-map-series .highcharts-point-hover {
|
||||
transition: fill 0ms, fill-opacity 0ms;
|
||||
fill-opacity: 0.5;
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
.highcharts-mapline-series .highcharts-point {
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.highcharts-heatmap-series .highcharts-point {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-map-navigation {
|
||||
font-size: 1.3em;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.highcharts-coloraxis {
|
||||
stroke-width: 0;
|
||||
}
|
||||
|
||||
.highcharts-coloraxis-marker {
|
||||
fill: #999999;
|
||||
}
|
||||
|
||||
.highcharts-null-point {
|
||||
fill: #f7f7f7;
|
||||
}
|
||||
|
||||
/* 3d charts */
|
||||
.highcharts-3d-frame {
|
||||
fill: transparent;
|
||||
}
|
||||
|
||||
.highcharts-column-series .highcharts-point {
|
||||
stroke: inherit;
|
||||
/* use point color */
|
||||
}
|
||||
|
||||
/* Exporting module */
|
||||
.highcharts-contextbutton {
|
||||
fill: #ffffff;
|
||||
/* needed to capture hover */
|
||||
stroke: none;
|
||||
stroke-linecap: round;
|
||||
}
|
||||
|
||||
.highcharts-contextbutton:hover {
|
||||
fill: #e6e6e6;
|
||||
stroke: #e6e6e6;
|
||||
}
|
||||
|
||||
.highcharts-button-symbol {
|
||||
stroke: #666666;
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.highcharts-menu {
|
||||
border: 1px solid #999999;
|
||||
background: #ffffff;
|
||||
padding: 5px 0;
|
||||
box-shadow: 3px 3px 10px #888;
|
||||
}
|
||||
|
||||
.highcharts-menu-item {
|
||||
padding: 0.5em 1em;
|
||||
background: none;
|
||||
color: #333333;
|
||||
cursor: pointer;
|
||||
transition: background 250ms, color 250ms;
|
||||
}
|
||||
|
||||
.highcharts-menu-item:hover {
|
||||
background: #335cad;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Drilldown module */
|
||||
.highcharts-drilldown-point {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.highcharts-drilldown-data-label text, .highcharts-drilldown-axis-label {
|
||||
cursor: pointer;
|
||||
fill: #003399;
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* No-data module */
|
||||
.highcharts-no-data text {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
fill: #666666;
|
||||
}
|
||||
49
assets/plugin/chart/highcharts/highcharts-3d.js
Executable file
49
assets/plugin/chart/highcharts/highcharts-3d.js
Executable file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
3D features for Highcharts JS
|
||||
|
||||
@license: www.highcharts.com/license
|
||||
*/
|
||||
(function(E){"object"===typeof module&&module.exports?module.exports=E:E(Highcharts)})(function(E){(function(a){var r=a.deg2rad,g=a.pick;a.perspective=function(t,n,v){var k=n.options.chart.options3d,p=v?n.inverted:!1,h=n.plotWidth/2,m=n.plotHeight/2,f=k.depth/2,d=g(k.depth,1)*g(k.viewDistance,0),e=n.scale3d||1,b=r*k.beta*(p?-1:1),k=r*k.alpha*(p?-1:1),c=Math.cos(k),q=Math.cos(-b),x=Math.sin(k),y=Math.sin(-b);v||(h+=n.plotLeft,m+=n.plotTop);return a.map(t,function(b){var a,k;k=(p?b.y:b.x)-h;var g=(p?
|
||||
b.x:b.y)-m,n=(b.z||0)-f;a=q*k-y*n;b=-x*y*k+c*g-q*x*n;k=c*y*k+x*g+c*q*n;g=0<d&&d<Number.POSITIVE_INFINITY?d/(k+f+d):1;a=a*g*e+h;b=b*g*e+m;return{x:p?b:a,y:p?a:b,z:k*e+f}})}})(E);(function(a){function r(b){var c=0,l,a;for(l=0;l<b.length;l++)a=(l+1)%b.length,c+=b[l].x*b[a].y-b[a].x*b[l].y;return c/2}function g(b){var a=0,l;for(l=0;l<b.length;l++)a+=b[l].z;return b.length?a/b.length:0}function t(b,a,l,c,e,d,D,f){var G=[],C=d-e;return d>e&&d-e>Math.PI/2+.0001?(G=G.concat(t(b,a,l,c,e,e+Math.PI/2,D,f)),
|
||||
G=G.concat(t(b,a,l,c,e+Math.PI/2,d,D,f))):d<e&&e-d>Math.PI/2+.0001?(G=G.concat(t(b,a,l,c,e,e-Math.PI/2,D,f)),G=G.concat(t(b,a,l,c,e-Math.PI/2,d,D,f))):["C",b+l*Math.cos(e)-l*B*C*Math.sin(e)+D,a+c*Math.sin(e)+c*B*C*Math.cos(e)+f,b+l*Math.cos(d)+l*B*C*Math.sin(d)+D,a+c*Math.sin(d)-c*B*C*Math.cos(d)+f,b+l*Math.cos(d)+D,a+c*Math.sin(d)+f]}var n=Math.cos,v=Math.PI,k=Math.sin,p=a.animObject,h=a.charts,m=a.color,f=a.defined,d=a.deg2rad,e=a.each,b=a.extend,c=a.inArray,q=a.map,x=a.merge,y=a.perspective,F=
|
||||
a.pick,z=a.SVGElement,A=a.SVGRenderer,w=a.wrap,B=4*(Math.sqrt(2)-1)/3/(v/2);A.prototype.toLinePath=function(b,a){var l=[];e(b,function(b){l.push("L",b.x,b.y)});b.length&&(l[0]="M",a&&l.push("Z"));return l};A.prototype.cuboid=function(b){var c=this.g();b=this.cuboidPath(b);c.attr({"stroke-linejoin":"round"});c.front=this.path(b[0]).attr({"class":"highcharts-3d-front",zIndex:b[3]}).add(c);c.top=this.path(b[1]).attr({"class":"highcharts-3d-top",zIndex:b[4]}).add(c);c.side=this.path(b[2]).attr({"class":"highcharts-3d-side",
|
||||
zIndex:b[5]}).add(c);c.fillSetter=function(b){this.front.attr({fill:b});this.top.attr({fill:m(b).brighten(.1).get()});this.side.attr({fill:m(b).brighten(-.1).get()});this.color=b;return this};c.opacitySetter=function(b){this.front.attr({opacity:b});this.top.attr({opacity:b});this.side.attr({opacity:b});return this};c.attr=function(b){if(b.shapeArgs||f(b.x))b=this.renderer.cuboidPath(b.shapeArgs||b),this.front.attr({d:b[0],zIndex:b[3]}),this.top.attr({d:b[1],zIndex:b[4]}),this.side.attr({d:b[2],zIndex:b[5]});
|
||||
else return a.SVGElement.prototype.attr.call(this,b);return this};c.animate=function(b,c,a){f(b.x)&&f(b.y)?(b=this.renderer.cuboidPath(b),this.front.attr({zIndex:b[3]}).animate({d:b[0]},c,a),this.top.attr({zIndex:b[4]}).animate({d:b[1]},c,a),this.side.attr({zIndex:b[5]}).animate({d:b[2]},c,a),this.attr({zIndex:-b[6]})):b.opacity?(this.front.animate(b,c,a),this.top.animate(b,c,a),this.side.animate(b,c,a)):z.prototype.animate.call(this,b,c,a);return this};c.destroy=function(){this.front.destroy();this.top.destroy();
|
||||
this.side.destroy();return null};c.attr({zIndex:-b[6]});return c};A.prototype.cuboidPath=function(b){function c(b){return k[b]}var a=b.x,e=b.y,d=b.z,f=b.height,D=b.width,m=b.depth,k=[{x:a,y:e,z:d},{x:a+D,y:e,z:d},{x:a+D,y:e+f,z:d},{x:a,y:e+f,z:d},{x:a,y:e+f,z:d+m},{x:a+D,y:e+f,z:d+m},{x:a+D,y:e,z:d+m},{x:a,y:e,z:d+m}],k=y(k,h[this.chartIndex],b.insidePlotArea),d=function(b,a){var e=[];b=q(b,c);a=q(a,c);0>r(b)?e=b:0>r(a)&&(e=a);return e};b=d([3,2,1,0],[7,6,5,4]);a=[4,5,2,3];e=d([1,6,7,0],a);d=d([1,
|
||||
2,5,6],[0,7,4,3]);return[this.toLinePath(b,!0),this.toLinePath(e,!0),this.toLinePath(d,!0),g(b),g(e),g(d),9E9*g(q(a,c))]};a.SVGRenderer.prototype.arc3d=function(a){function f(b){var a=!1,e={},d;for(d in b)-1!==c(d,h)&&(e[d]=b[d],delete b[d],a=!0);return a?e:!1}var l=this.g(),k=l.renderer,h="x y r innerR start end".split(" ");a=x(a);a.alpha*=d;a.beta*=d;l.top=k.path();l.side1=k.path();l.side2=k.path();l.inn=k.path();l.out=k.path();l.onAdd=function(){var b=l.parentGroup,a=l.attr("class");l.top.add(l);
|
||||
e(["out","inn","side1","side2"],function(c){l[c].addClass(a+" highcharts-3d-side").add(b)})};l.setPaths=function(b){var a=l.renderer.arc3dPath(b),c=100*a.zTop;l.attribs=b;l.top.attr({d:a.top,zIndex:a.zTop});l.inn.attr({d:a.inn,zIndex:a.zInn});l.out.attr({d:a.out,zIndex:a.zOut});l.side1.attr({d:a.side1,zIndex:a.zSide1});l.side2.attr({d:a.side2,zIndex:a.zSide2});l.zIndex=c;l.attr({zIndex:c});b.center&&(l.top.setRadialReference(b.center),delete b.center)};l.setPaths(a);l.fillSetter=function(b){var a=
|
||||
m(b).brighten(-.1).get();this.fill=b;this.side1.attr({fill:a});this.side2.attr({fill:a});this.inn.attr({fill:a});this.out.attr({fill:a});this.top.attr({fill:b});return this};e(["opacity","translateX","translateY","visibility"],function(b){l[b+"Setter"]=function(b,a){l[a]=b;e(["out","inn","side1","side2","top"],function(c){l[c].attr(a,b)})}});w(l,"attr",function(a,c,e){var d;"object"===typeof c&&(d=f(c))&&(b(l.attribs,d),l.setPaths(l.attribs));return a.call(this,c,e)});w(l,"animate",function(b,a,c,
|
||||
e){var d,l=this.attribs,k;delete a.center;delete a.z;delete a.depth;delete a.alpha;delete a.beta;k=p(F(c,this.renderer.globalAnimation));k.duration&&(a=x(a),d=f(a),a.dummy=1,d&&(k.step=function(b,a){function c(b){return l[b]+(F(d[b],l[b])-l[b])*a.pos}"dummy"===a.prop&&a.elem.setPaths(x(l,{x:c("x"),y:c("y"),r:c("r"),innerR:c("innerR"),start:c("start"),end:c("end")}))}),c=k);return b.call(this,a,c,e)});l.destroy=function(){this.top.destroy();this.out.destroy();this.inn.destroy();this.side1.destroy();
|
||||
this.side2.destroy();z.prototype.destroy.call(this)};l.hide=function(){this.top.hide();this.out.hide();this.inn.hide();this.side1.hide();this.side2.hide()};l.show=function(){this.top.show();this.out.show();this.inn.show();this.side1.show();this.side2.show()};return l};A.prototype.arc3dPath=function(b){function a(b){b%=2*Math.PI;b>Math.PI&&(b=2*Math.PI-b);return b}var c=b.x,e=b.y,d=b.start,f=b.end-.00001,m=b.r,h=b.innerR,p=b.depth,q=b.alpha,g=b.beta,x=Math.cos(d),r=Math.sin(d);b=Math.cos(f);var y=
|
||||
Math.sin(f),u=m*Math.cos(g),m=m*Math.cos(q),B=h*Math.cos(g),C=h*Math.cos(q),h=p*Math.sin(g),w=p*Math.sin(q),p=["M",c+u*x,e+m*r],p=p.concat(t(c,e,u,m,d,f,0,0)),p=p.concat(["L",c+B*b,e+C*y]),p=p.concat(t(c,e,B,C,f,d,0,0)),p=p.concat(["Z"]),F=0<g?Math.PI/2:0,g=0<q?0:Math.PI/2,F=d>-F?d:f>-F?-F:d,z=f<v-g?f:d<v-g?v-g:f,A=2*v-g,q=["M",c+u*n(F),e+m*k(F)],q=q.concat(t(c,e,u,m,F,z,0,0));f>A&&d<A?(q=q.concat(["L",c+u*n(z)+h,e+m*k(z)+w]),q=q.concat(t(c,e,u,m,z,A,h,w)),q=q.concat(["L",c+u*n(A),e+m*k(A)]),q=q.concat(t(c,
|
||||
e,u,m,A,f,0,0)),q=q.concat(["L",c+u*n(f)+h,e+m*k(f)+w]),q=q.concat(t(c,e,u,m,f,A,h,w)),q=q.concat(["L",c+u*n(A),e+m*k(A)]),q=q.concat(t(c,e,u,m,A,z,0,0))):f>v-g&&d<v-g&&(q=q.concat(["L",c+u*Math.cos(z)+h,e+m*Math.sin(z)+w]),q=q.concat(t(c,e,u,m,z,f,h,w)),q=q.concat(["L",c+u*Math.cos(f),e+m*Math.sin(f)]),q=q.concat(t(c,e,u,m,f,z,0,0)));q=q.concat(["L",c+u*Math.cos(z)+h,e+m*Math.sin(z)+w]);q=q.concat(t(c,e,u,m,z,F,h,w));q=q.concat(["Z"]);g=["M",c+B*x,e+C*r];g=g.concat(t(c,e,B,C,d,f,0,0));g=g.concat(["L",
|
||||
c+B*Math.cos(f)+h,e+C*Math.sin(f)+w]);g=g.concat(t(c,e,B,C,f,d,h,w));g=g.concat(["Z"]);x=["M",c+u*x,e+m*r,"L",c+u*x+h,e+m*r+w,"L",c+B*x+h,e+C*r+w,"L",c+B*x,e+C*r,"Z"];c=["M",c+u*b,e+m*y,"L",c+u*b+h,e+m*y+w,"L",c+B*b+h,e+C*y+w,"L",c+B*b,e+C*y,"Z"];y=Math.atan2(w,-h);e=Math.abs(f+y);b=Math.abs(d+y);d=Math.abs((d+f)/2+y);e=a(e);b=a(b);d=a(d);d*=1E5;f=1E5*b;e*=1E5;return{top:p,zTop:1E5*Math.PI+1,out:q,zOut:Math.max(d,f,e),inn:g,zInn:Math.max(d,f,e),side1:x,zSide1:.99*e,side2:c,zSide2:.99*f}}})(E);(function(a){function r(a,
|
||||
f){var d=a.plotLeft,e=a.plotWidth+d,b=a.plotTop,c=a.plotHeight+b,q=d+a.plotWidth/2,m=b+a.plotHeight/2,h=Number.MAX_VALUE,k=-Number.MAX_VALUE,g=Number.MAX_VALUE,p=-Number.MAX_VALUE,n,r=1;n=[{x:d,y:b,z:0},{x:d,y:b,z:f}];t([0,1],function(b){n.push({x:e,y:n[b].y,z:n[b].z})});t([0,1,2,3],function(b){n.push({x:n[b].x,y:c,z:n[b].z})});n=v(n,a,!1);t(n,function(b){h=Math.min(h,b.x);k=Math.max(k,b.x);g=Math.min(g,b.y);p=Math.max(p,b.y)});d>h&&(r=Math.min(r,1-Math.abs((d+q)/(h+q))%1));e<k&&(r=Math.min(r,(e-
|
||||
q)/(k-q)));b>g&&(r=0>g?Math.min(r,(b+m)/(-g+b+m)):Math.min(r,1-(b+m)/(g+m)%1));c<p&&(r=Math.min(r,Math.abs((c-m)/(p-m))));return r}var g=a.Chart,t=a.each,n=a.merge,v=a.perspective,k=a.pick,p=a.wrap;g.prototype.is3d=function(){return this.options.chart.options3d&&this.options.chart.options3d.enabled};g.prototype.propsRequireDirtyBox.push("chart.options3d");g.prototype.propsRequireUpdateSeries.push("chart.options3d");a.wrap(a.Chart.prototype,"isInsidePlot",function(a){return this.is3d()||a.apply(this,
|
||||
[].slice.call(arguments,1))});var h=a.getOptions();n(!0,h,{chart:{options3d:{enabled:!1,alpha:0,beta:0,depth:100,fitToPlot:!0,viewDistance:25,frame:{bottom:{size:1},side:{size:1},back:{size:1}}}}});p(g.prototype,"setClassName",function(a){a.apply(this,[].slice.call(arguments,1));this.is3d()&&(this.container.className+=" highcharts-3d-chart")});a.wrap(a.Chart.prototype,"setChartSize",function(a){var f=this.options.chart.options3d;a.apply(this,[].slice.call(arguments,1));if(this.is3d()){var d=this.inverted,
|
||||
e=this.clipBox,b=this.margin;e[d?"y":"x"]=-(b[3]||0);e[d?"x":"y"]=-(b[0]||0);e[d?"height":"width"]=this.chartWidth+(b[3]||0)+(b[1]||0);e[d?"width":"height"]=this.chartHeight+(b[0]||0)+(b[2]||0);this.scale3d=1;!0===f.fitToPlot&&(this.scale3d=r(this,f.depth))}});p(g.prototype,"redraw",function(a){this.is3d()&&(this.isDirtyBox=!0);a.apply(this,[].slice.call(arguments,1))});p(g.prototype,"renderSeries",function(a){var f=this.series.length;if(this.is3d())for(;f--;)a=this.series[f],a.translate(),a.render();
|
||||
else a.call(this)});g.prototype.retrieveStacks=function(a){var f=this.series,d={},e,b=1;t(this.series,function(c){e=k(c.options.stack,a?0:f.length-1-c.index);d[e]?d[e].series.push(c):(d[e]={series:[c],position:b},b++)});d.totalStacks=b+1;return d}})(E);(function(a){var r,g=a.Axis,t=a.Chart,n=a.each,v=a.extend,k=a.merge,p=a.perspective,h=a.pick,m=a.splat,f=a.Tick,d=a.wrap;d(g.prototype,"setOptions",function(a,b){a.call(this,b);this.chart.is3d()&&(a=this.options,a.tickWidth=h(a.tickWidth,0),a.gridLineWidth=
|
||||
h(a.gridLineWidth,1))});d(g.prototype,"render",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var b=this.chart,c=b.renderer,e=b.options.chart.options3d,d=e.frame,f=d.bottom,h=d.back,d=d.side,k=e.depth,g=this.height,m=this.width,p=this.left,n=this.top;this.isZAxis||(this.horiz?(h={x:p,y:n+(b.xAxis[0].opposite?-f.size:g),z:0,width:m,height:f.size,depth:k,insidePlotArea:!1},this.bottomFrame?this.bottomFrame.animate(h):(this.bottomFrame=c.cuboid(h).attr({"class":"highcharts-3d-frame highcharts-3d-frame-bottom",
|
||||
zIndex:b.yAxis[0].reversed&&0<e.alpha?4:-1}).add(),this.bottomFrame.attr({fill:f.color||"none",stroke:f.color||"none"}))):(e={x:p+(b.yAxis[0].opposite?0:-d.size),y:n+(b.xAxis[0].opposite?-f.size:0),z:k,width:m+d.size,height:g+f.size,depth:h.size,insidePlotArea:!1},this.backFrame?this.backFrame.animate(e):(this.backFrame=c.cuboid(e).attr({"class":"highcharts-3d-frame highcharts-3d-frame-back",zIndex:-3}).add(),this.backFrame.attr({fill:h.color||"none",stroke:h.color||"none"})),b={x:p+(b.yAxis[0].opposite?
|
||||
m:-d.size),y:n+(b.xAxis[0].opposite?-f.size:0),z:0,width:d.size,height:g+f.size,depth:k,insidePlotArea:!1},this.sideFrame?this.sideFrame.animate(b):(this.sideFrame=c.cuboid(b).attr({"class":"highcharts-3d-frame highcharts-3d-frame-side",zIndex:-2}).add(),this.sideFrame.attr({fill:d.color||"none",stroke:d.color||"none"}))))}});d(g.prototype,"getPlotLinePath",function(a){var b=a.apply(this,[].slice.call(arguments,1));if(!this.chart.is3d()||null===b)return b;var c=this.chart,e=c.options.chart.options3d,
|
||||
c=this.isZAxis?c.plotWidth:e.depth,e=this.opposite;this.horiz&&(e=!e);b=[this.swapZ({x:b[1],y:b[2],z:e?c:0}),this.swapZ({x:b[1],y:b[2],z:c}),this.swapZ({x:b[4],y:b[5],z:c}),this.swapZ({x:b[4],y:b[5],z:e?0:c})];b=p(b,this.chart,!1);return b=this.chart.renderer.toLinePath(b,!1)});d(g.prototype,"getLinePath",function(a){return this.chart.is3d()?[]:a.apply(this,[].slice.call(arguments,1))});d(g.prototype,"getPlotBandPath",function(a){if(!this.chart.is3d())return a.apply(this,[].slice.call(arguments,1));
|
||||
var b=arguments,c=b[1],b=this.getPlotLinePath(b[2]);(c=this.getPlotLinePath(c))&&b?c.push("L",b[10],b[11],"L",b[7],b[8],"L",b[4],b[5],"L",b[1],b[2]):c=null;return c});d(f.prototype,"getMarkPath",function(a){var b=a.apply(this,[].slice.call(arguments,1));if(!this.axis.chart.is3d())return b;b=[this.axis.swapZ({x:b[1],y:b[2],z:0}),this.axis.swapZ({x:b[4],y:b[5],z:0})];b=p(b,this.axis.chart,!1);return b=["M",b[0].x,b[0].y,"L",b[1].x,b[1].y]});d(f.prototype,"getLabelPosition",function(a){var b=a.apply(this,
|
||||
[].slice.call(arguments,1));this.axis.chart.is3d()&&(b=p([this.axis.swapZ({x:b.x,y:b.y,z:0})],this.axis.chart,!1)[0]);return b});a.wrap(g.prototype,"getTitlePosition",function(a){var b=this.chart.is3d(),c,e;b&&(e=this.axisTitleMargin,this.axisTitleMargin=0);c=a.apply(this,[].slice.call(arguments,1));b&&(c=p([this.swapZ({x:c.x,y:c.y,z:0})],this.chart,!1)[0],c[this.horiz?"y":"x"]+=(this.horiz?1:-1)*(this.opposite?-1:1)*e,this.axisTitleMargin=e);return c});d(g.prototype,"drawCrosshair",function(a){var b=
|
||||
arguments;this.chart.is3d()&&b[2]&&(b[2]={plotX:b[2].plotXold||b[2].plotX,plotY:b[2].plotYold||b[2].plotY});a.apply(this,[].slice.call(b,1))});g.prototype.swapZ=function(a,b){if(this.isZAxis){b=b?0:this.chart.plotLeft;var c=this.chart;return{x:b+(c.yAxis[0].opposite?a.z:c.xAxis[0].width-a.z),y:a.y,z:a.x-b}}return a};r=a.ZAxis=function(){this.isZAxis=!0;this.init.apply(this,arguments)};v(r.prototype,g.prototype);v(r.prototype,{setOptions:function(a){a=k({offset:0,lineWidth:0},a);g.prototype.setOptions.call(this,
|
||||
a);this.coll="zAxis"},setAxisSize:function(){g.prototype.setAxisSize.call(this);this.width=this.len=this.chart.options.chart.options3d.depth;this.right=this.chart.chartWidth-this.width-this.left},getSeriesExtremes:function(){var a=this,b=a.chart;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=a.ignoreMinPadding=a.ignoreMaxPadding=null;a.buildStacks&&a.buildStacks();n(a.series,function(c){if(c.visible||!b.options.chart.ignoreHiddenSeries)a.hasVisibleSeries=!0,c=c.zData,c.length&&(a.dataMin=Math.min(h(a.dataMin,
|
||||
c[0]),Math.min.apply(null,c)),a.dataMax=Math.max(h(a.dataMax,c[0]),Math.max.apply(null,c)))})}});d(t.prototype,"getAxes",function(a){var b=this,c=this.options,c=c.zAxis=m(c.zAxis||{});a.call(this);b.is3d()&&(this.zAxis=[],n(c,function(a,c){a.index=c;a.isX=!0;(new r(b,a)).setScale()}))})})(E);(function(a){function r(a){var f=a.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&(f.stroke=this.options.edgeColor||f.fill,f["stroke-width"]=v(this.options.edgeWidth,1));return f}function g(a){if(this.chart.is3d()){var f=
|
||||
this.chart.options.plotOptions.column.grouping;void 0===f||f||void 0===this.group.zIndex||this.zIndexSet||(this.group.attr({zIndex:10*this.group.zIndex}),this.zIndexSet=!0)}a.apply(this,[].slice.call(arguments,1))}var t=a.each,n=a.perspective,v=a.pick,k=a.Series,p=a.seriesTypes,h=a.svg;a=a.wrap;a(p.column.prototype,"translate",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var f=this.chart,d=this.options,e=d.depth||25,b=(d.stacking?d.stack||0:this._i)*(e+(d.groupZPadding||
|
||||
1));!1!==d.grouping&&(b=0);b+=d.groupZPadding||1;t(this.data,function(a){if(null!==a.y){var c=a.shapeArgs,d=a.tooltipPos;a.shapeType="cuboid";c.z=b;c.depth=e;c.insidePlotArea=!0;d=n([{x:d[0],y:d[1],z:b}],f,!0)[0];a.tooltipPos=[d.x,d.y]}});this.z=b}});a(p.column.prototype,"animate",function(a){if(this.chart.is3d()){var f=arguments[1],d=this.yAxis,e=this,b=this.yAxis.reversed;h&&(f?t(e.data,function(a){null!==a.y&&(a.height=a.shapeArgs.height,a.shapey=a.shapeArgs.y,a.shapeArgs.height=1,b||(a.shapeArgs.y=
|
||||
a.stackY?a.plotY+d.translate(a.stackY):a.plotY+(a.negative?-a.height:a.height)))}):(t(e.data,function(a){null!==a.y&&(a.shapeArgs.height=a.height,a.shapeArgs.y=a.shapey,a.graphic&&a.graphic.animate(a.shapeArgs,e.options.animation))}),this.drawDataLabels(),e.animate=null))}else a.apply(this,[].slice.call(arguments,1))});a(p.column.prototype,"init",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var f=this.options,d=f.grouping,e=f.stacking,b=v(this.yAxis.options.reversedStacks,
|
||||
!0),c=0;if(void 0===d||d){d=this.chart.retrieveStacks(e);c=f.stack||0;for(e=0;e<d[c].series.length&&d[c].series[e]!==this;e++);c=10*(d.totalStacks-d[c].position)+(b?e:-e);this.xAxis.reversed||(c=10*d.totalStacks-c)}f.zIndex=c}});a(p.column.prototype,"pointAttribs",r);p.columnrange&&a(p.columnrange.prototype,"pointAttribs",r);a(k.prototype,"alignDataLabel",function(a){if(this.chart.is3d()&&("column"===this.type||"columnrange"===this.type)){var f=arguments[4],d={x:f.x,y:f.y,z:this.z},d=n([d],this.chart,
|
||||
!0)[0];f.x=d.x;f.y=d.y}a.apply(this,[].slice.call(arguments,1))});p.columnrange&&a(p.columnrange.prototype,"drawPoints",g);a(p.column.prototype,"drawPoints",g)})(E);(function(a){var r=a.deg2rad,g=a.each,t=a.pick,n=a.seriesTypes,v=a.svg;a=a.wrap;a(n.pie.prototype,"translate",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var k=this,h=k.options,m=h.depth||0,f=k.chart.options.chart.options3d,d=f.alpha,e=f.beta,b=h.stacking?(h.stack||0)*m:k._i*m,b=b+m/2;!1!==h.grouping&&(b=
|
||||
0);g(k.data,function(a){var c=a.shapeArgs;a.shapeType="arc3d";c.z=b;c.depth=.75*m;c.alpha=d;c.beta=e;c.center=k.center;c=(c.end+c.start)/2;a.slicedTranslation={translateX:Math.round(Math.cos(c)*h.slicedOffset*Math.cos(d*r)),translateY:Math.round(Math.sin(c)*h.slicedOffset*Math.cos(d*r))}})}});a(n.pie.prototype.pointClass.prototype,"haloPath",function(a){var k=arguments;return this.series.chart.is3d()?[]:a.call(this,k[1])});a(n.pie.prototype,"pointAttribs",function(a,g,h){a=a.call(this,g,h);h=this.options;
|
||||
this.chart.is3d()&&(a.stroke=h.edgeColor||g.color||this.color,a["stroke-width"]=t(h.edgeWidth,1));return a});a(n.pie.prototype,"drawPoints",function(a){a.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&g(this.points,function(a){var h=a.graphic;if(h)h[a.y&&a.visible?"show":"hide"]()})});a(n.pie.prototype,"drawDataLabels",function(a){if(this.chart.is3d()){var k=this.chart.options.chart.options3d;g(this.data,function(a){var h=a.shapeArgs,f=h.r,d=(h.start+h.end)/2,e=a.labelPos,b=-f*(1-Math.cos((h.alpha||
|
||||
k.alpha)*r))*Math.sin(d),c=f*(Math.cos((h.beta||k.beta)*r)-1)*Math.cos(d);g([0,2,4],function(a){e[a]+=c;e[a+1]+=b})})}a.apply(this,[].slice.call(arguments,1))});a(n.pie.prototype,"addPoint",function(a){a.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&this.update(this.userOptions,!0)});a(n.pie.prototype,"animate",function(a){if(this.chart.is3d()){var g=arguments[1],h=this.options.animation,k=this.center,f=this.group,d=this.markerGroup;v&&(!0===h&&(h={}),g?(f.oldtranslateX=f.translateX,f.oldtranslateY=
|
||||
f.translateY,g={translateX:k[0],translateY:k[1],scaleX:.001,scaleY:.001},f.attr(g),d&&(d.attrSetters=f.attrSetters,d.attr(g))):(g={translateX:f.oldtranslateX,translateY:f.oldtranslateY,scaleX:1,scaleY:1},f.animate(g,h),d&&d.animate(g,h),this.animate=null))}else a.apply(this,[].slice.call(arguments,1))})})(E);(function(a){var r=a.perspective,g=a.pick,t=a.seriesTypes;a=a.wrap;a(t.scatter.prototype,"translate",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var n=this.chart,
|
||||
k=g(this.zAxis,n.options.zAxis[0]),p=[],h,m,f;for(f=0;f<this.data.length;f++)h=this.data[f],m=k.isLog&&k.val2lin?k.val2lin(h.z):h.z,h.plotZ=k.translate(m),h.isInside=h.isInside?m>=k.min&&m<=k.max:!1,p.push({x:h.plotX,y:h.plotY,z:h.plotZ});n=r(p,n,!0);for(f=0;f<this.data.length;f++)h=this.data[f],k=n[f],h.plotXold=h.plotX,h.plotYold=h.plotY,h.plotZold=h.plotZ,h.plotX=k.x,h.plotY=k.y,h.plotZ=k.z}});a(t.scatter.prototype,"init",function(a,g,k){g.is3d()&&(this.axisTypes=["xAxis","yAxis","zAxis"],this.pointArrayMap=
|
||||
["x","y","z"],this.parallelArrays=["x","y","z"],this.directTouch=!0);a=a.apply(this,[g,k]);this.chart.is3d()&&(this.tooltipOptions.pointFormat=this.userOptions.tooltip?this.userOptions.tooltip.pointFormat||"x: \x3cb\x3e{point.x}\x3c/b\x3e\x3cbr/\x3ey: \x3cb\x3e{point.y}\x3c/b\x3e\x3cbr/\x3ez: \x3cb\x3e{point.z}\x3c/b\x3e\x3cbr/\x3e":"x: \x3cb\x3e{point.x}\x3c/b\x3e\x3cbr/\x3ey: \x3cb\x3e{point.y}\x3c/b\x3e\x3cbr/\x3ez: \x3cb\x3e{point.z}\x3c/b\x3e\x3cbr/\x3e");return a})})(E);(function(a){var r=a.Axis,
|
||||
g=a.SVGRenderer,t=a.VMLRenderer;t&&(a.setOptions({animate:!1}),t.prototype.cuboid=g.prototype.cuboid,t.prototype.cuboidPath=g.prototype.cuboidPath,t.prototype.toLinePath=g.prototype.toLinePath,t.prototype.createElement3D=g.prototype.createElement3D,t.prototype.arc3d=function(a){a=g.prototype.arc3d.call(this,a);a.css({zIndex:a.zIndex});return a},a.VMLRenderer.prototype.arc3dPath=a.SVGRenderer.prototype.arc3dPath,a.wrap(r.prototype,"render",function(a){a.apply(this,[].slice.call(arguments,1));this.sideFrame&&
|
||||
(this.sideFrame.css({zIndex:0}),this.sideFrame.front.attr({fill:this.sideFrame.color}));this.bottomFrame&&(this.bottomFrame.css({zIndex:1}),this.bottomFrame.front.attr({fill:this.bottomFrame.color}));this.backFrame&&(this.backFrame.css({zIndex:0}),this.backFrame.front.attr({fill:this.backFrame.color}))}))})(E)});
|
||||
2097
assets/plugin/chart/highcharts/highcharts-3d.src.js
Executable file
2097
assets/plugin/chart/highcharts/highcharts-3d.src.js
Executable file
File diff suppressed because it is too large
Load Diff
60
assets/plugin/chart/highcharts/highcharts-more.js
Executable file
60
assets/plugin/chart/highcharts/highcharts-more.js
Executable file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
(c) 2009-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(x){"object"===typeof module&&module.exports?module.exports=x:x(Highcharts)})(function(x){(function(a){function t(a,b,d){this.init(a,b,d)}var u=a.each,w=a.extend,q=a.merge,r=a.splat;w(t.prototype,{init:function(a,b,d){var h=this,k=h.defaultOptions;h.chart=b;h.options=a=q(k,b.angular?{background:{}}:void 0,a);(a=a.background)&&u([].concat(r(a)).reverse(),function(b){var c,k=d.userOptions;c=q(h.defaultBackgroundOptions,b);b.backgroundColor&&(c.backgroundColor=b.backgroundColor);c.color=c.backgroundColor;
|
||||
d.options.plotBands.unshift(c);k.plotBands=k.plotBands||[];k.plotBands!==d.options.plotBands&&k.plotBands.unshift(c)})},defaultOptions:{center:["50%","50%"],size:"85%",startAngle:0},defaultBackgroundOptions:{className:"highcharts-pane",shape:"circle",borderWidth:1,borderColor:"#cccccc",backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"#ffffff"],[1,"#e6e6e6"]]},from:-Number.MAX_VALUE,innerRadius:0,to:Number.MAX_VALUE,outerRadius:"105%"}});a.Pane=t})(x);(function(a){var t=a.CenteredSeriesMixin,
|
||||
u=a.each,w=a.extend,q=a.map,r=a.merge,e=a.noop,b=a.Pane,d=a.pick,h=a.pInt,k=a.splat,n=a.wrap,c,g,l=a.Axis.prototype;a=a.Tick.prototype;c={getOffset:e,redraw:function(){this.isDirty=!1},render:function(){this.isDirty=!1},setScale:e,setCategories:e,setTitle:e};g={defaultRadialGaugeOptions:{labels:{align:"center",x:0,y:null},minorGridLineWidth:0,minorTickInterval:"auto",minorTickLength:10,minorTickPosition:"inside",minorTickWidth:1,tickLength:10,tickPosition:"inside",tickWidth:2,title:{rotation:0},zIndex:2},
|
||||
defaultRadialXOptions:{gridLineWidth:1,labels:{align:null,distance:15,x:0,y:null},maxPadding:0,minPadding:0,showLastLabel:!1,tickLength:0},defaultRadialYOptions:{gridLineInterpolation:"circle",labels:{align:"right",x:-3,y:-2},showLastLabel:!1,title:{x:4,text:null,rotation:90}},setOptions:function(b){b=this.options=r(this.defaultOptions,this.defaultRadialOptions,b);b.plotBands||(b.plotBands=[])},getOffset:function(){l.getOffset.call(this);this.chart.axisOffset[this.side]=0;this.center=this.pane.center=
|
||||
t.getCenter.call(this.pane)},getLinePath:function(b,f){b=this.center;var c=this.chart,h=d(f,b[2]/2-this.offset);this.isCircular||void 0!==f?f=this.chart.renderer.symbols.arc(this.left+b[0],this.top+b[1],h,h,{start:this.startAngleRad,end:this.endAngleRad,open:!0,innerR:0}):(f=this.postTranslate(this.angleRad,h),f=["M",b[0]+c.plotLeft,b[1]+c.plotTop,"L",f.x,f.y]);return f},setAxisTranslation:function(){l.setAxisTranslation.call(this);this.center&&(this.transA=this.isCircular?(this.endAngleRad-this.startAngleRad)/
|
||||
(this.max-this.min||1):this.center[2]/2/(this.max-this.min||1),this.minPixelPadding=this.isXAxis?this.transA*this.minPointOffset:0)},beforeSetTickPositions:function(){if(this.autoConnect=this.isCircular&&void 0===d(this.userMax,this.options.max)&&this.endAngleRad-this.startAngleRad===2*Math.PI)this.max+=this.categories&&1||this.pointRange||this.closestPointRange||0},setAxisSize:function(){l.setAxisSize.call(this);this.isRadial&&(this.center=this.pane.center=t.getCenter.call(this.pane),this.isCircular&&
|
||||
(this.sector=this.endAngleRad-this.startAngleRad),this.len=this.width=this.height=this.center[2]*d(this.sector,1)/2)},getPosition:function(b,f){return this.postTranslate(this.isCircular?this.translate(b):this.angleRad,d(this.isCircular?f:this.translate(b),this.center[2]/2)-this.offset)},postTranslate:function(b,f){var d=this.chart,c=this.center;b=this.startAngleRad+b;return{x:d.plotLeft+c[0]+Math.cos(b)*f,y:d.plotTop+c[1]+Math.sin(b)*f}},getPlotBandPath:function(b,f,c){var k=this.center,p=this.startAngleRad,
|
||||
l=k[2]/2,m=[d(c.outerRadius,"100%"),c.innerRadius,d(c.thickness,10)],a=Math.min(this.offset,0),g=/%$/,n,e=this.isCircular;"polygon"===this.options.gridLineInterpolation?k=this.getPlotLinePath(b).concat(this.getPlotLinePath(f,!0)):(b=Math.max(b,this.min),f=Math.min(f,this.max),e||(m[0]=this.translate(b),m[1]=this.translate(f)),m=q(m,function(b){g.test(b)&&(b=h(b,10)*l/100);return b}),"circle"!==c.shape&&e?(b=p+this.translate(b),f=p+this.translate(f)):(b=-Math.PI/2,f=1.5*Math.PI,n=!0),m[0]-=a,m[2]-=
|
||||
a,k=this.chart.renderer.symbols.arc(this.left+k[0],this.top+k[1],m[0],m[0],{start:Math.min(b,f),end:Math.max(b,f),innerR:d(m[1],m[0]-m[2]),open:n}));return k},getPlotLinePath:function(b,f){var d=this,c=d.center,h=d.chart,k=d.getPosition(b),a,l,p;d.isCircular?p=["M",c[0]+h.plotLeft,c[1]+h.plotTop,"L",k.x,k.y]:"circle"===d.options.gridLineInterpolation?(b=d.translate(b))&&(p=d.getLinePath(0,b)):(u(h.xAxis,function(b){b.pane===d.pane&&(a=b)}),p=[],b=d.translate(b),c=a.tickPositions,a.autoConnect&&(c=
|
||||
c.concat([c[0]])),f&&(c=[].concat(c).reverse()),u(c,function(f,d){l=a.getPosition(f,b);p.push(d?"L":"M",l.x,l.y)}));return p},getTitlePosition:function(){var b=this.center,f=this.chart,d=this.options.title;return{x:f.plotLeft+b[0]+(d.x||0),y:f.plotTop+b[1]-{high:.5,middle:.25,low:0}[d.align]*b[2]+(d.y||0)}}};n(l,"init",function(h,f,a){var l=f.angular,p=f.polar,m=a.isX,n=l&&m,e,A=f.options,q=a.pane||0;if(l){if(w(this,n?c:g),e=!m)this.defaultRadialOptions=this.defaultRadialGaugeOptions}else p&&(w(this,
|
||||
g),this.defaultRadialOptions=(e=m)?this.defaultRadialXOptions:r(this.defaultYAxisOptions,this.defaultRadialYOptions));l||p?(this.isRadial=!0,f.inverted=!1,A.chart.zoomType=null):this.isRadial=!1;h.call(this,f,a);n||!l&&!p||(h=this.options,f.panes||(f.panes=[]),this.pane=f=f.panes[q]=f.panes[q]||new b(k(A.pane)[q],f,this),f=f.options,this.angleRad=(h.angle||0)*Math.PI/180,this.startAngleRad=(f.startAngle-90)*Math.PI/180,this.endAngleRad=(d(f.endAngle,f.startAngle+360)-90)*Math.PI/180,this.offset=h.offset||
|
||||
0,this.isCircular=e)});n(l,"autoLabelAlign",function(b){if(!this.isRadial)return b.apply(this,[].slice.call(arguments,1))});n(a,"getPosition",function(b,d,c,h,k){var f=this.axis;return f.getPosition?f.getPosition(c):b.call(this,d,c,h,k)});n(a,"getLabelPosition",function(b,f,c,h,k,a,l,g,n){var m=this.axis,p=a.y,e=20,y=a.align,v=(m.translate(this.pos)+m.startAngleRad+Math.PI/2)/Math.PI*180%360;m.isRadial?(b=m.getPosition(this.pos,m.center[2]/2+d(a.distance,-25)),"auto"===a.rotation?h.attr({rotation:v}):
|
||||
null===p&&(p=m.chart.renderer.fontMetrics(h.styles.fontSize).b-h.getBBox().height/2),null===y&&(m.isCircular?(this.label.getBBox().width>m.len*m.tickInterval/(m.max-m.min)&&(e=0),y=v>e&&v<180-e?"left":v>180+e&&v<360-e?"right":"center"):y="center",h.attr({align:y})),b.x+=a.x,b.y+=p):b=b.call(this,f,c,h,k,a,l,g,n);return b});n(a,"getMarkPath",function(b,d,c,h,k,a,l){var f=this.axis;f.isRadial?(b=f.getPosition(this.pos,f.center[2]/2+h),d=["M",d,c,"L",b.x,b.y]):d=b.call(this,d,c,h,k,a,l);return d})})(x);
|
||||
(function(a){var t=a.each,u=a.noop,w=a.pick,q=a.Series,r=a.seriesType,e=a.seriesTypes;r("arearange","area",{lineWidth:1,marker:null,threshold:null,tooltip:{pointFormat:'\x3cspan style\x3d"color:{series.color}"\x3e\u25cf\x3c/span\x3e {series.name}: \x3cb\x3e{point.low}\x3c/b\x3e - \x3cb\x3e{point.high}\x3c/b\x3e\x3cbr/\x3e'},trackByArea:!0,dataLabels:{align:null,verticalAlign:null,xLow:0,xHigh:0,yLow:0,yHigh:0},states:{hover:{halo:!1}}},{pointArrayMap:["low","high"],dataLabelCollections:["dataLabel",
|
||||
"dataLabelUpper"],toYData:function(b){return[b.low,b.high]},pointValKey:"low",deferTranslatePolar:!0,highToXY:function(b){var d=this.chart,h=this.xAxis.postTranslate(b.rectPlotX,this.yAxis.len-b.plotHigh);b.plotHighX=h.x-d.plotLeft;b.plotHigh=h.y-d.plotTop},translate:function(){var b=this,d=b.yAxis,h=!!b.modifyValue;e.area.prototype.translate.apply(b);t(b.points,function(k){var a=k.low,c=k.high,g=k.plotY;null===c||null===a?k.isNull=!0:(k.plotLow=g,k.plotHigh=d.translate(h?b.modifyValue(c,k):c,0,1,
|
||||
0,1),h&&(k.yBottom=k.plotHigh))});this.chart.polar&&t(this.points,function(d){b.highToXY(d)})},getGraphPath:function(b){var d=[],h=[],a,n=e.area.prototype.getGraphPath,c,g,l;l=this.options;var p=l.step;b=b||this.points;for(a=b.length;a--;)c=b[a],c.isNull||l.connectEnds||b[a+1]&&!b[a+1].isNull||h.push({plotX:c.plotX,plotY:c.plotY,doCurve:!1}),g={polarPlotY:c.polarPlotY,rectPlotX:c.rectPlotX,yBottom:c.yBottom,plotX:w(c.plotHighX,c.plotX),plotY:c.plotHigh,isNull:c.isNull},h.push(g),d.push(g),c.isNull||
|
||||
l.connectEnds||b[a-1]&&!b[a-1].isNull||h.push({plotX:c.plotX,plotY:c.plotY,doCurve:!1});b=n.call(this,b);p&&(!0===p&&(p="left"),l.step={left:"right",center:"center",right:"left"}[p]);d=n.call(this,d);h=n.call(this,h);l.step=p;l=[].concat(b,d);this.chart.polar||"M"!==h[0]||(h[0]="L");this.graphPath=l;this.areaPath=this.areaPath.concat(b,h);l.isArea=!0;l.xMap=b.xMap;this.areaPath.xMap=b.xMap;return l},drawDataLabels:function(){var b=this.data,d=b.length,h,a=[],n=q.prototype,c=this.options.dataLabels,
|
||||
g=c.align,l=c.verticalAlign,p=c.inside,f,m,e=this.chart.inverted;if(c.enabled||this._hasPointLabels){for(h=d;h--;)if(f=b[h])m=p?f.plotHigh<f.plotLow:f.plotHigh>f.plotLow,f.y=f.high,f._plotY=f.plotY,f.plotY=f.plotHigh,a[h]=f.dataLabel,f.dataLabel=f.dataLabelUpper,f.below=m,e?g||(c.align=m?"right":"left"):l||(c.verticalAlign=m?"top":"bottom"),c.x=c.xHigh,c.y=c.yHigh;n.drawDataLabels&&n.drawDataLabels.apply(this,arguments);for(h=d;h--;)if(f=b[h])m=p?f.plotHigh<f.plotLow:f.plotHigh>f.plotLow,f.dataLabelUpper=
|
||||
f.dataLabel,f.dataLabel=a[h],f.y=f.low,f.plotY=f._plotY,f.below=!m,e?g||(c.align=m?"left":"right"):l||(c.verticalAlign=m?"bottom":"top"),c.x=c.xLow,c.y=c.yLow;n.drawDataLabels&&n.drawDataLabels.apply(this,arguments)}c.align=g;c.verticalAlign=l},alignDataLabel:function(){e.column.prototype.alignDataLabel.apply(this,arguments)},setStackedPoints:u,getSymbol:u,drawPoints:u})})(x);(function(a){var t=a.seriesType;t("areasplinerange","arearange",null,{getPointSpline:a.seriesTypes.spline.prototype.getPointSpline})})(x);
|
||||
(function(a){var t=a.defaultPlotOptions,u=a.each,w=a.merge,q=a.noop,r=a.pick,e=a.seriesType,b=a.seriesTypes.column.prototype;e("columnrange","arearange",w(t.column,t.arearange,{lineWidth:1,pointRange:null}),{translate:function(){var d=this,h=d.yAxis,a=d.xAxis,n=a.startAngleRad,c,g=d.chart,l=d.xAxis.isRadial,p;b.translate.apply(d);u(d.points,function(b){var f=b.shapeArgs,k=d.options.minPointLength,e,v;b.plotHigh=p=h.translate(b.high,0,1,0,1);b.plotLow=b.plotY;v=p;e=r(b.rectPlotY,b.plotY)-p;Math.abs(e)<
|
||||
k?(k-=e,e+=k,v-=k/2):0>e&&(e*=-1,v-=e);l?(c=b.barX+n,b.shapeType="path",b.shapeArgs={d:d.polarArc(v+e,v,c,c+b.pointWidth)}):(f.height=e,f.y=v,b.tooltipPos=g.inverted?[h.len+h.pos-g.plotLeft-v-e/2,a.len+a.pos-g.plotTop-f.x-f.width/2,e]:[a.left-g.plotLeft+f.x+f.width/2,h.pos-g.plotTop+v+e/2,e])})},directTouch:!0,trackerGroups:["group","dataLabelsGroup"],drawGraph:q,crispCol:b.crispCol,drawPoints:b.drawPoints,drawTracker:b.drawTracker,getColumnMetrics:b.getColumnMetrics,animate:function(){return b.animate.apply(this,
|
||||
arguments)},polarArc:function(){return b.polarArc.apply(this,arguments)},pointAttribs:b.pointAttribs})})(x);(function(a){var t=a.each,u=a.isNumber,w=a.merge,q=a.pick,r=a.pInt,e=a.Series,b=a.seriesType,d=a.TrackerMixin;b("gauge","line",{dataLabels:{enabled:!0,defer:!1,y:15,borderRadius:3,crop:!1,verticalAlign:"top",zIndex:2,borderWidth:1,borderColor:"#cccccc"},dial:{},pivot:{},tooltip:{headerFormat:""},showInLegend:!1},{angular:!0,directTouch:!0,drawGraph:a.noop,fixedBox:!0,forceDL:!0,noSharedTooltip:!0,
|
||||
trackerGroups:["group","dataLabelsGroup"],translate:function(){var b=this.yAxis,d=this.options,a=b.center;this.generatePoints();t(this.points,function(c){var h=w(d.dial,c.dial),l=r(q(h.radius,80))*a[2]/200,k=r(q(h.baseLength,70))*l/100,f=r(q(h.rearLength,10))*l/100,m=h.baseWidth||3,n=h.topWidth||1,e=d.overshoot,v=b.startAngleRad+b.translate(c.y,null,null,null,!0);u(e)?(e=e/180*Math.PI,v=Math.max(b.startAngleRad-e,Math.min(b.endAngleRad+e,v))):!1===d.wrap&&(v=Math.max(b.startAngleRad,Math.min(b.endAngleRad,
|
||||
v)));v=180*v/Math.PI;c.shapeType="path";c.shapeArgs={d:h.path||["M",-f,-m/2,"L",k,-m/2,l,-n/2,l,n/2,k,m/2,-f,m/2,"z"],translateX:a[0],translateY:a[1],rotation:v};c.plotX=a[0];c.plotY=a[1]})},drawPoints:function(){var b=this,d=b.yAxis.center,a=b.pivot,c=b.options,g=c.pivot,l=b.chart.renderer;t(b.points,function(d){var a=d.graphic,h=d.shapeArgs,k=h.d,g=w(c.dial,d.dial);a?(a.animate(h),h.d=k):(d.graphic=l[d.shapeType](h).attr({rotation:h.rotation,zIndex:1}).addClass("highcharts-dial").add(b.group),d.graphic.attr({stroke:g.borderColor||
|
||||
"none","stroke-width":g.borderWidth||0,fill:g.backgroundColor||"#000000"}))});a?a.animate({translateX:d[0],translateY:d[1]}):(b.pivot=l.circle(0,0,q(g.radius,5)).attr({zIndex:2}).addClass("highcharts-pivot").translate(d[0],d[1]).add(b.group),b.pivot.attr({"stroke-width":g.borderWidth||0,stroke:g.borderColor||"#cccccc",fill:g.backgroundColor||"#000000"}))},animate:function(b){var d=this;b||(t(d.points,function(b){var c=b.graphic;c&&(c.attr({rotation:180*d.yAxis.startAngleRad/Math.PI}),c.animate({rotation:b.shapeArgs.rotation},
|
||||
d.options.animation))}),d.animate=null)},render:function(){this.group=this.plotGroup("group","series",this.visible?"visible":"hidden",this.options.zIndex,this.chart.seriesGroup);e.prototype.render.call(this);this.group.clip(this.chart.clipRect)},setData:function(b,d){e.prototype.setData.call(this,b,!1);this.processData();this.generatePoints();q(d,!0)&&this.chart.redraw()},drawTracker:d&&d.drawTrackerPoint},{setState:function(b){this.state=b}})})(x);(function(a){var t=a.each,u=a.noop,w=a.pick,q=a.seriesType,
|
||||
r=a.seriesTypes;q("boxplot","column",{threshold:null,tooltip:{pointFormat:'\x3cspan style\x3d"color:{point.color}"\x3e\u25cf\x3c/span\x3e \x3cb\x3e {series.name}\x3c/b\x3e\x3cbr/\x3eMaximum: {point.high}\x3cbr/\x3eUpper quartile: {point.q3}\x3cbr/\x3eMedian: {point.median}\x3cbr/\x3eLower quartile: {point.q1}\x3cbr/\x3eMinimum: {point.low}\x3cbr/\x3e'},whiskerLength:"50%",fillColor:"#ffffff",lineWidth:1,medianWidth:2,states:{hover:{brightness:-.3}},whiskerWidth:2},{pointArrayMap:["low","q1","median",
|
||||
"q3","high"],toYData:function(a){return[a.low,a.q1,a.median,a.q3,a.high]},pointValKey:"high",pointAttribs:function(a){var b=this.options,d=a&&a.color||this.color;return{fill:a.fillColor||b.fillColor||d,stroke:b.lineColor||d,"stroke-width":b.lineWidth||0}},drawDataLabels:u,translate:function(){var a=this.yAxis,b=this.pointArrayMap;r.column.prototype.translate.apply(this);t(this.points,function(d){t(b,function(b){null!==d[b]&&(d[b+"Plot"]=a.translate(d[b],0,1,0,1))})})},drawPoints:function(){var a=
|
||||
this,b=a.options,d=a.chart.renderer,h,k,n,c,g,l,p=0,f,m,q,r,v=!1!==a.doQuartiles,u,x=a.options.whiskerLength;t(a.points,function(e){var t=e.graphic,y=t?"animate":"attr",I=e.shapeArgs,z={},B={},G={},H=e.color||a.color;void 0!==e.plotY&&(f=I.width,m=Math.floor(I.x),q=m+f,r=Math.round(f/2),h=Math.floor(v?e.q1Plot:e.lowPlot),k=Math.floor(v?e.q3Plot:e.lowPlot),n=Math.floor(e.highPlot),c=Math.floor(e.lowPlot),t||(e.graphic=t=d.g("point").add(a.group),e.stem=d.path().addClass("highcharts-boxplot-stem").add(t),
|
||||
x&&(e.whiskers=d.path().addClass("highcharts-boxplot-whisker").add(t)),v&&(e.box=d.path(void 0).addClass("highcharts-boxplot-box").add(t)),e.medianShape=d.path(void 0).addClass("highcharts-boxplot-median").add(t),z.stroke=e.stemColor||b.stemColor||H,z["stroke-width"]=w(e.stemWidth,b.stemWidth,b.lineWidth),z.dashstyle=e.stemDashStyle||b.stemDashStyle,e.stem.attr(z),x&&(B.stroke=e.whiskerColor||b.whiskerColor||H,B["stroke-width"]=w(e.whiskerWidth,b.whiskerWidth,b.lineWidth),e.whiskers.attr(B)),v&&(t=
|
||||
a.pointAttribs(e),e.box.attr(t)),G.stroke=e.medianColor||b.medianColor||H,G["stroke-width"]=w(e.medianWidth,b.medianWidth,b.lineWidth),e.medianShape.attr(G)),l=e.stem.strokeWidth()%2/2,p=m+r+l,e.stem[y]({d:["M",p,k,"L",p,n,"M",p,h,"L",p,c]}),v&&(l=e.box.strokeWidth()%2/2,h=Math.floor(h)+l,k=Math.floor(k)+l,m+=l,q+=l,e.box[y]({d:["M",m,k,"L",m,h,"L",q,h,"L",q,k,"L",m,k,"z"]})),x&&(l=e.whiskers.strokeWidth()%2/2,n+=l,c+=l,u=/%$/.test(x)?r*parseFloat(x)/100:x/2,e.whiskers[y]({d:["M",p-u,n,"L",p+u,n,
|
||||
"M",p-u,c,"L",p+u,c]})),g=Math.round(e.medianPlot),l=e.medianShape.strokeWidth()%2/2,g+=l,e.medianShape[y]({d:["M",m,g,"L",q,g]}))})},setStackedPoints:u})})(x);(function(a){var t=a.each,u=a.noop,w=a.seriesType,q=a.seriesTypes;w("errorbar","boxplot",{color:"#000000",grouping:!1,linkedTo:":previous",tooltip:{pointFormat:'\x3cspan style\x3d"color:{point.color}"\x3e\u25cf\x3c/span\x3e {series.name}: \x3cb\x3e{point.low}\x3c/b\x3e - \x3cb\x3e{point.high}\x3c/b\x3e\x3cbr/\x3e'},whiskerWidth:null},{type:"errorbar",
|
||||
pointArrayMap:["low","high"],toYData:function(a){return[a.low,a.high]},pointValKey:"high",doQuartiles:!1,drawDataLabels:q.arearange?function(){var a=this.pointValKey;q.arearange.prototype.drawDataLabels.call(this);t(this.data,function(e){e.y=e[a]})}:u,getColumnMetrics:function(){return this.linkedParent&&this.linkedParent.columnMetrics||q.column.prototype.getColumnMetrics.call(this)}})})(x);(function(a){var t=a.correctFloat,u=a.isNumber,w=a.pick,q=a.Point,r=a.Series,e=a.seriesType,b=a.seriesTypes;
|
||||
e("waterfall","column",{dataLabels:{inside:!0},lineWidth:1,lineColor:"#333333",dashStyle:"dot",borderColor:"#333333",states:{hover:{lineWidthPlus:0}}},{pointValKey:"y",translate:function(){var d=this.options,a=this.yAxis,k,e,c,g,l,p,f,m,q,r=w(d.minPointLength,5),v=d.threshold,u=d.stacking;b.column.prototype.translate.apply(this);this.minPointLengthOffset=0;f=m=v;e=this.points;k=0;for(d=e.length;k<d;k++)c=e[k],p=this.processedYData[k],g=c.shapeArgs,q=(l=u&&a.stacks[(this.negStacks&&p<v?"-":"")+this.stackKey])?
|
||||
l[c.x].points[this.index+","+k]:[0,p],c.isSum?c.y=t(p):c.isIntermediateSum&&(c.y=t(p-m)),l=Math.max(f,f+c.y)+q[0],g.y=a.toPixels(l,!0),c.isSum?(g.y=a.toPixels(q[1],!0),g.height=Math.min(a.toPixels(q[0],!0),a.len)-g.y+this.minPointLengthOffset):c.isIntermediateSum?(g.y=a.toPixels(q[1],!0),g.height=Math.min(a.toPixels(m,!0),a.len)-g.y+this.minPointLengthOffset,m=q[1]):(g.height=0<p?a.toPixels(f,!0)-g.y:a.toPixels(f,!0)-a.toPixels(f-p,!0),f+=p),0>g.height&&(g.y+=g.height,g.height*=-1),c.plotY=g.y=Math.round(g.y)-
|
||||
this.borderWidth%2/2,g.height=Math.max(Math.round(g.height),.001),c.yBottom=g.y+g.height,g.height<=r&&(g.height=r,this.minPointLengthOffset+=r),g.y-=this.minPointLengthOffset,g=c.plotY+(c.negative?g.height:0)-this.minPointLengthOffset,this.chart.inverted?c.tooltipPos[0]=a.len-g:c.tooltipPos[1]=g},processData:function(b){var a=this.yData,d=this.options.data,e,c=a.length,g,l,p,f,m,q;l=g=p=f=this.options.threshold||0;for(q=0;q<c;q++)m=a[q],e=d&&d[q]?d[q]:{},"sum"===m||e.isSum?a[q]=t(l):"intermediateSum"===
|
||||
m||e.isIntermediateSum?a[q]=t(g):(l+=m,g+=m),p=Math.min(l,p),f=Math.max(l,f);r.prototype.processData.call(this,b);this.dataMin=p;this.dataMax=f},toYData:function(b){return b.isSum?0===b.x?null:"sum":b.isIntermediateSum?0===b.x?null:"intermediateSum":b.y},pointAttribs:function(a,h){var d=this.options.upColor;d&&!a.options.color&&(a.color=0<a.y?d:null);a=b.column.prototype.pointAttribs.call(this,a,h);delete a.dashstyle;return a},getGraphPath:function(){return["M",0,0]},getCrispPath:function(){var b=
|
||||
this.data,a=b.length,e=this.graph.strokeWidth()+this.borderWidth,e=Math.round(e)%2/2,n=[],c,g,l;for(l=1;l<a;l++)g=b[l].shapeArgs,c=b[l-1].shapeArgs,g=["M",c.x+c.width,c.y+e,"L",g.x,c.y+e],0>b[l-1].y&&(g[2]+=c.height,g[5]+=c.height),n=n.concat(g);return n},drawGraph:function(){r.prototype.drawGraph.call(this);this.graph.attr({d:this.getCrispPath()})},getExtremes:a.noop},{getClassName:function(){var b=q.prototype.getClassName.call(this);this.isSum?b+=" highcharts-sum":this.isIntermediateSum&&(b+=" highcharts-intermediate-sum");
|
||||
return b},isValid:function(){return u(this.y,!0)||this.isSum||this.isIntermediateSum}})})(x);(function(a){var t=a.Series,u=a.seriesType,w=a.seriesTypes;u("polygon","scatter",{marker:{enabled:!1,states:{hover:{enabled:!1}}},stickyTracking:!1,tooltip:{followPointer:!0,pointFormat:""},trackByArea:!0},{type:"polygon",getGraphPath:function(){for(var a=t.prototype.getGraphPath.call(this),r=a.length+1;r--;)(r===a.length||"M"===a[r])&&0<r&&a.splice(r,0,"z");return this.areaPath=a},drawGraph:function(){this.options.fillColor=
|
||||
this.color;w.area.prototype.drawGraph.call(this)},drawLegendSymbol:a.LegendSymbolMixin.drawRectangle,drawTracker:t.prototype.drawTracker,setStackedPoints:a.noop})})(x);(function(a){var t=a.arrayMax,u=a.arrayMin,w=a.Axis,q=a.color,r=a.each,e=a.isNumber,b=a.noop,d=a.pick,h=a.pInt,k=a.Point,n=a.Series,c=a.seriesType,g=a.seriesTypes;c("bubble","scatter",{dataLabels:{formatter:function(){return this.point.z},inside:!0,verticalAlign:"middle"},marker:{lineColor:null,lineWidth:1,radius:null,states:{hover:{radiusPlus:0}}},
|
||||
minSize:8,maxSize:"20%",softThreshold:!1,states:{hover:{halo:{size:5}}},tooltip:{pointFormat:"({point.x}, {point.y}), Size: {point.z}"},turboThreshold:0,zThreshold:0,zoneAxis:"z"},{pointArrayMap:["y","z"],parallelArrays:["x","y","z"],trackerGroups:["group","dataLabelsGroup"],bubblePadding:!0,zoneAxis:"z",markerAttribs:null,pointAttribs:function(b,a){var c=d(this.options.marker.fillOpacity,.5);b=n.prototype.pointAttribs.call(this,b,a);1!==c&&(b.fill=q(b.fill).setOpacity(c).get("rgba"));return b},getRadii:function(b,
|
||||
a,d,c){var f,h,e,l=this.zData,g=[],m=this.options,k="width"!==m.sizeBy,n=m.zThreshold,p=a-b;h=0;for(f=l.length;h<f;h++)e=l[h],m.sizeByAbsoluteValue&&null!==e&&(e=Math.abs(e-n),a=Math.max(a-n,Math.abs(b-n)),b=0),null===e?e=null:e<b?e=d/2-1:(e=0<p?(e-b)/p:.5,k&&0<=e&&(e=Math.sqrt(e)),e=Math.ceil(d+e*(c-d))/2),g.push(e);this.radii=g},animate:function(b){var a=this.options.animation;b||(r(this.points,function(b){var d=b.graphic;b=b.shapeArgs;d&&b&&(d.attr("r",1),d.animate({r:b.r},a))}),this.animate=null)},
|
||||
translate:function(){var b,a=this.data,d,c,h=this.radii;g.scatter.prototype.translate.call(this);for(b=a.length;b--;)d=a[b],c=h?h[b]:0,e(c)&&c>=this.minPxSize/2?(d.shapeType="circle",d.shapeArgs={x:d.plotX,y:d.plotY,r:c},d.dlBox={x:d.plotX-c,y:d.plotY-c,width:2*c,height:2*c}):d.shapeArgs=d.plotY=d.dlBox=void 0},drawLegendSymbol:function(b,a){var d=this.chart.renderer,c=d.fontMetrics(b.itemStyle.fontSize).f/2;a.legendSymbol=d.circle(c,b.baseline-c,c).attr({zIndex:3}).add(a.legendGroup);a.legendSymbol.isMarker=
|
||||
!0},drawPoints:g.column.prototype.drawPoints,alignDataLabel:g.column.prototype.alignDataLabel,buildKDTree:b,applyZones:b},{haloPath:function(){return k.prototype.haloPath.call(this,this.shapeArgs.r+this.series.options.states.hover.halo.size)},ttBelow:!1});w.prototype.beforePadding=function(){var b=this,a=this.len,c=this.chart,g=0,k=a,n=this.isXAxis,q=n?"xData":"yData",w=this.min,x={},A=Math.min(c.plotWidth,c.plotHeight),C=Number.MAX_VALUE,D=-Number.MAX_VALUE,E=this.max-w,z=a/E,F=[];r(this.series,
|
||||
function(a){var e=a.options;!a.bubblePadding||!a.visible&&c.options.chart.ignoreHiddenSeries||(b.allowZoomOutside=!0,F.push(a),n&&(r(["minSize","maxSize"],function(b){var a=e[b],d=/%$/.test(a),a=h(a);x[b]=d?A*a/100:a}),a.minPxSize=x.minSize,a.maxPxSize=x.maxSize,a=a.zData,a.length&&(C=d(e.zMin,Math.min(C,Math.max(u(a),!1===e.displayNegative?e.zThreshold:-Number.MAX_VALUE))),D=d(e.zMax,Math.max(D,t(a))))))});r(F,function(a){var d=a[q],c=d.length,h;n&&a.getRadii(C,D,a.minPxSize,a.maxPxSize);if(0<E)for(;c--;)e(d[c])&&
|
||||
b.dataMin<=d[c]&&d[c]<=b.dataMax&&(h=a.radii[c],g=Math.min((d[c]-w)*z-h,g),k=Math.max((d[c]-w)*z+h,k))});F.length&&0<E&&!this.isLog&&(k-=a,z*=(a+g-k)/a,r([["min","userMin",g],["max","userMax",k]],function(a){void 0===d(b.options[a[0]],b[a[1]])&&(b[a[0]]+=a[2]/z)}))}})(x);(function(a){function t(b,a){var d=this.chart,e=this.options.animation,n=this.group,c=this.markerGroup,g=this.xAxis.center,l=d.plotLeft,p=d.plotTop;d.polar?d.renderer.isSVG&&(!0===e&&(e={}),a?(b={translateX:g[0]+l,translateY:g[1]+
|
||||
p,scaleX:.001,scaleY:.001},n.attr(b),c&&c.attr(b)):(b={translateX:l,translateY:p,scaleX:1,scaleY:1},n.animate(b,e),c&&c.animate(b,e),this.animate=null)):b.call(this,a)}var u=a.each,w=a.pick,q=a.seriesTypes,r=a.wrap,e=a.Series.prototype;a=a.Pointer.prototype;e.searchPointByAngle=function(b){var a=this.chart,e=this.xAxis.pane.center;return this.searchKDTree({clientX:180+-180/Math.PI*Math.atan2(b.chartX-e[0]-a.plotLeft,b.chartY-e[1]-a.plotTop)})};r(e,"buildKDTree",function(b){this.chart.polar&&(this.kdByAngle?
|
||||
this.searchPoint=this.searchPointByAngle:this.kdDimensions=2);b.apply(this)});e.toXY=function(b){var a,e=this.chart,k=b.plotX;a=b.plotY;b.rectPlotX=k;b.rectPlotY=a;a=this.xAxis.postTranslate(b.plotX,this.yAxis.len-a);b.plotX=b.polarPlotX=a.x-e.plotLeft;b.plotY=b.polarPlotY=a.y-e.plotTop;this.kdByAngle?(e=(k/Math.PI*180+this.xAxis.pane.options.startAngle)%360,0>e&&(e+=360),b.clientX=e):b.clientX=b.plotX};q.spline&&r(q.spline.prototype,"getPointSpline",function(b,a,e,k){var d,c,g,h,p,f,m;this.chart.polar?
|
||||
(d=e.plotX,c=e.plotY,b=a[k-1],g=a[k+1],this.connectEnds&&(b||(b=a[a.length-2]),g||(g=a[1])),b&&g&&(h=b.plotX,p=b.plotY,a=g.plotX,f=g.plotY,h=(1.5*d+h)/2.5,p=(1.5*c+p)/2.5,g=(1.5*d+a)/2.5,m=(1.5*c+f)/2.5,a=Math.sqrt(Math.pow(h-d,2)+Math.pow(p-c,2)),f=Math.sqrt(Math.pow(g-d,2)+Math.pow(m-c,2)),h=Math.atan2(p-c,h-d),p=Math.atan2(m-c,g-d),m=Math.PI/2+(h+p)/2,Math.abs(h-m)>Math.PI/2&&(m-=Math.PI),h=d+Math.cos(m)*a,p=c+Math.sin(m)*a,g=d+Math.cos(Math.PI+m)*f,m=c+Math.sin(Math.PI+m)*f,e.rightContX=g,e.rightContY=
|
||||
m),k?(e=["C",b.rightContX||b.plotX,b.rightContY||b.plotY,h||d,p||c,d,c],b.rightContX=b.rightContY=null):e=["M",d,c]):e=b.call(this,a,e,k);return e});r(e,"translate",function(b){var a=this.chart;b.call(this);if(a.polar&&(this.kdByAngle=a.tooltip&&a.tooltip.shared,!this.preventPostTranslate))for(b=this.points,a=b.length;a--;)this.toXY(b[a])});r(e,"getGraphPath",function(b,a){var d=this,e,n;if(this.chart.polar){a=a||this.points;for(e=0;e<a.length;e++)if(!a[e].isNull){n=e;break}!1!==this.options.connectEnds&&
|
||||
void 0!==n&&(this.connectEnds=!0,a.splice(a.length,0,a[n]));u(a,function(b){void 0===b.polarPlotY&&d.toXY(b)})}return b.apply(this,[].slice.call(arguments,1))});r(e,"animate",t);q.column&&(q=q.column.prototype,q.polarArc=function(b,a,e,k){var d=this.xAxis.center,c=this.yAxis.len;return this.chart.renderer.symbols.arc(d[0],d[1],c-a,null,{start:e,end:k,innerR:c-w(b,c)})},r(q,"animate",t),r(q,"translate",function(b){var a=this.xAxis,e=a.startAngleRad,k,n,c;this.preventPostTranslate=!0;b.call(this);if(a.isRadial)for(k=
|
||||
this.points,c=k.length;c--;)n=k[c],b=n.barX+e,n.shapeType="path",n.shapeArgs={d:this.polarArc(n.yBottom,n.plotY,b,b+n.pointWidth)},this.toXY(n),n.tooltipPos=[n.plotX,n.plotY],n.ttBelow=n.plotY>a.center[1]}),r(q,"alignDataLabel",function(a,d,h,k,n,c){this.chart.polar?(a=d.rectPlotX/Math.PI*180,null===k.align&&(k.align=20<a&&160>a?"left":200<a&&340>a?"right":"center"),null===k.verticalAlign&&(k.verticalAlign=45>a||315<a?"bottom":135<a&&225>a?"top":"middle"),e.alignDataLabel.call(this,d,h,k,n,c)):a.call(this,
|
||||
d,h,k,n,c)}));r(a,"getCoordinates",function(a,d){var b=this.chart,e={xAxis:[],yAxis:[]};b.polar?u(b.axes,function(a){var c=a.isXAxis,g=a.center,h=d.chartX-g[0]-b.plotLeft,g=d.chartY-g[1]-b.plotTop;e[c?"xAxis":"yAxis"].push({axis:a,value:a.translate(c?Math.PI-Math.atan2(h,g):Math.sqrt(Math.pow(h,2)+Math.pow(g,2)),!0)})}):e=a.call(this,d);return e})})(x)});
|
||||
2957
assets/plugin/chart/highcharts/highcharts-more.src.js
Executable file
2957
assets/plugin/chart/highcharts/highcharts-more.src.js
Executable file
File diff suppressed because it is too large
Load Diff
382
assets/plugin/chart/highcharts/highcharts.js
Executable file
382
assets/plugin/chart/highcharts/highcharts.js
Executable file
@ -0,0 +1,382 @@
|
||||
/*
|
||||
Highcharts JS v5.0.2 (2016-10-26)
|
||||
|
||||
(c) 2009-2016 Torstein Honsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(M,a){"object"===typeof module&&module.exports?module.exports=M.document?a(M):a:M.Highcharts=a(M)})("undefined"!==typeof window?window:this,function(M){M=function(){var a=window,D=a.document,z=a.navigator&&a.navigator.userAgent||"",F=D&&D.createElementNS&&!!D.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,J=/(edge|msie|trident)/i.test(z)&&!window.opera,m=!F,f=/Firefox/.test(z),h=f&&4>parseInt(z.split("Firefox/")[1],10);return a.Highcharts?a.Highcharts.error(16,!0):{product:"Highcharts",
|
||||
version:"5.0.2",deg2rad:2*Math.PI/360,doc:D,hasBidiBug:h,hasTouch:D&&void 0!==D.documentElement.ontouchstart,isMS:J,isWebKit:/AppleWebKit/.test(z),isFirefox:f,isTouchDevice:/(Mobile|Android|Windows Phone)/.test(z),SVG_NS:"http://www.w3.org/2000/svg",idCounter:0,chartCount:0,seriesTypes:{},symbolSizes:{},svg:F,vml:m,win:a,charts:[],marginNames:["plotTop","marginRight","marginBottom","plotLeft"],noop:function(){}}}();(function(a){var D=[],z=a.charts,F=a.doc,J=a.win;a.error=function(a,f){a="Highcharts error #"+
|
||||
a+": www.highcharts.com/errors/"+a;if(f)throw Error(a);J.console&&console.log(a)};a.Fx=function(a,f,h){this.options=f;this.elem=a;this.prop=h};a.Fx.prototype={dSetter:function(){var a=this.paths[0],f=this.paths[1],h=[],q=this.now,n=a.length,k;if(1===q)h=this.toD;else if(n===f.length&&1>q)for(;n--;)k=parseFloat(a[n]),h[n]=isNaN(k)?a[n]:q*parseFloat(f[n]-k)+k;else h=f;this.elem.attr("d",h)},update:function(){var a=this.elem,f=this.prop,h=this.now,q=this.options.step;if(this[f+"Setter"])this[f+"Setter"]();
|
||||
else a.attr?a.element&&a.attr(f,h):a.style[f]=h+this.unit;q&&q.call(a,h,this)},run:function(a,f,h){var m=this,n=function(a){return n.stopped?!1:m.step(a)},k;this.startTime=+new Date;this.start=a;this.end=f;this.unit=h;this.now=this.start;this.pos=0;n.elem=this.elem;n()&&1===D.push(n)&&(n.timerId=setInterval(function(){for(k=0;k<D.length;k++)D[k]()||D.splice(k--,1);D.length||clearInterval(n.timerId)},13))},step:function(a){var f=+new Date,h,m=this.options;h=this.elem;var n=m.complete,k=m.duration,
|
||||
v=m.curAnim,d;if(h.attr&&!h.element)h=!1;else if(a||f>=k+this.startTime){this.now=this.end;this.pos=1;this.update();a=v[this.prop]=!0;for(d in v)!0!==v[d]&&(a=!1);a&&n&&n.call(h);h=!1}else this.pos=m.easing((f-this.startTime)/k),this.now=this.start+(this.end-this.start)*this.pos,this.update(),h=!0;return h},initPath:function(m,f,h){function q(a){for(l=a.length;l--;)"M"!==a[l]&&"L"!==a[l]||a.splice(l+1,0,a[l+1],a[l+2],a[l+1],a[l+2])}function n(a,b){for(;a.length<c;){a[0]=b[c-a.length];var e=a.slice(0,
|
||||
B);[].splice.apply(a,[0,0].concat(e));u&&(e=a.slice(a.length-B),[].splice.apply(a,[a.length,0].concat(e)),l--)}a[0]="M"}function k(a,b){for(var t=(c-a.length)/B;0<t&&t--;)e=a.slice().splice(a.length/L-B,B*L),e[0]=b[c-B-t*B],w&&(e[B-6]=e[B-2],e[B-5]=e[B-1]),[].splice.apply(a,[a.length/L,0].concat(e)),u&&t--}f=f||"";var v,d=m.startX,g=m.endX,w=-1<f.indexOf("C"),B=w?7:3,c,e,l;f=f.split(" ");h=h.slice();var u=m.isArea,L=u?2:1,b;w&&(q(f),q(h));if(d&&g){for(l=0;l<d.length;l++)if(d[l]===g[0]){v=l;break}else if(d[0]===
|
||||
g[g.length-d.length+l]){v=l;b=!0;break}void 0===v&&(f=[])}f.length&&a.isNumber(v)&&(c=h.length+v*L*B,b?(n(f,h),k(h,f)):(n(h,f),k(f,h)));return[f,h]}};a.extend=function(a,f){var h;a||(a={});for(h in f)a[h]=f[h];return a};a.merge=function(){var m,f=arguments,h,q={},n=function(k,f){var d,g;"object"!==typeof k&&(k={});for(g in f)f.hasOwnProperty(g)&&(d=f[g],a.isObject(d,!0)&&"renderTo"!==g&&"number"!==typeof d.nodeType?k[g]=n(k[g]||{},d):k[g]=f[g]);return k};!0===f[0]&&(q=f[1],f=Array.prototype.slice.call(f,
|
||||
2));h=f.length;for(m=0;m<h;m++)q=n(q,f[m]);return q};a.pInt=function(a,f){return parseInt(a,f||10)};a.isString=function(a){return"string"===typeof a};a.isArray=function(a){a=Object.prototype.toString.call(a);return"[object Array]"===a||"[object Array Iterator]"===a};a.isObject=function(m,f){return m&&"object"===typeof m&&(!f||!a.isArray(m))};a.isNumber=function(a){return"number"===typeof a&&!isNaN(a)};a.erase=function(a,f){for(var h=a.length;h--;)if(a[h]===f){a.splice(h,1);break}};a.defined=function(a){return void 0!==
|
||||
a&&null!==a};a.attr=function(m,f,h){var q,n;if(a.isString(f))a.defined(h)?m.setAttribute(f,h):m&&m.getAttribute&&(n=m.getAttribute(f));else if(a.defined(f)&&a.isObject(f))for(q in f)m.setAttribute(q,f[q]);return n};a.splat=function(m){return a.isArray(m)?m:[m]};a.syncTimeout=function(a,f,h){if(f)return setTimeout(a,f,h);a.call(0,h)};a.pick=function(){var a=arguments,f,h,q=a.length;for(f=0;f<q;f++)if(h=a[f],void 0!==h&&null!==h)return h};a.css=function(m,f){a.isMS&&!a.svg&&f&&void 0!==f.opacity&&(f.filter=
|
||||
"alpha(opacity\x3d"+100*f.opacity+")");a.extend(m.style,f)};a.createElement=function(m,f,h,q,n){m=F.createElement(m);var k=a.css;f&&a.extend(m,f);n&&k(m,{padding:0,border:"none",margin:0});h&&k(m,h);q&&q.appendChild(m);return m};a.extendClass=function(m,f){var h=function(){};h.prototype=new m;a.extend(h.prototype,f);return h};a.pad=function(a,f,h){return Array((f||2)+1-String(a).length).join(h||0)+a};a.relativeLength=function(a,f){return/%$/.test(a)?f*parseFloat(a)/100:parseFloat(a)};a.wrap=function(a,
|
||||
f,h){var m=a[f];a[f]=function(){var a=Array.prototype.slice.call(arguments);a.unshift(m);return h.apply(this,a)}};a.getTZOffset=function(m){var f=a.Date;return 6E4*(f.hcGetTimezoneOffset&&f.hcGetTimezoneOffset(m)||f.hcTimezoneOffset||0)};a.dateFormat=function(m,f,h){if(!a.defined(f)||isNaN(f))return a.defaultOptions.lang.invalidDate||"";m=a.pick(m,"%Y-%m-%d %H:%M:%S");var q=a.Date,n=new q(f-a.getTZOffset(f)),k,v=n[q.hcGetHours](),d=n[q.hcGetDay](),g=n[q.hcGetDate](),w=n[q.hcGetMonth](),B=n[q.hcGetFullYear](),
|
||||
c=a.defaultOptions.lang,e=c.weekdays,l=c.shortWeekdays,u=a.pad,q=a.extend({a:l?l[d]:e[d].substr(0,3),A:e[d],d:u(g),e:u(g,2," "),w:d,b:c.shortMonths[w],B:c.months[w],m:u(w+1),y:B.toString().substr(2,2),Y:B,H:u(v),k:v,I:u(v%12||12),l:v%12||12,M:u(n[q.hcGetMinutes]()),p:12>v?"AM":"PM",P:12>v?"am":"pm",S:u(n.getSeconds()),L:u(Math.round(f%1E3),3)},a.dateFormats);for(k in q)for(;-1!==m.indexOf("%"+k);)m=m.replace("%"+k,"function"===typeof q[k]?q[k](f):q[k]);return h?m.substr(0,1).toUpperCase()+m.substr(1):
|
||||
m};a.formatSingle=function(m,f){var h=/\.([0-9])/,q=a.defaultOptions.lang;/f$/.test(m)?(h=(h=m.match(h))?h[1]:-1,null!==f&&(f=a.numberFormat(f,h,q.decimalPoint,-1<m.indexOf(",")?q.thousandsSep:""))):f=a.dateFormat(m,f);return f};a.format=function(m,f){for(var h="{",q=!1,n,k,v,d,g=[],w;m;){h=m.indexOf(h);if(-1===h)break;n=m.slice(0,h);if(q){n=n.split(":");k=n.shift().split(".");d=k.length;w=f;for(v=0;v<d;v++)w=w[k[v]];n.length&&(w=a.formatSingle(n.join(":"),w));g.push(w)}else g.push(n);m=m.slice(h+
|
||||
1);h=(q=!q)?"}":"{"}g.push(m);return g.join("")};a.getMagnitude=function(a){return Math.pow(10,Math.floor(Math.log(a)/Math.LN10))};a.normalizeTickInterval=function(m,f,h,q,n){var k,v=m;h=a.pick(h,1);k=m/h;f||(f=[1,2,2.5,5,10],!1===q&&(1===h?f=[1,2,5,10]:.1>=h&&(f=[1/h])));for(q=0;q<f.length&&!(v=f[q],n&&v*h>=m||!n&&k<=(f[q]+(f[q+1]||f[q]))/2);q++);return v*h};a.stableSort=function(a,f){var h=a.length,m,n;for(n=0;n<h;n++)a[n].safeI=n;a.sort(function(a,n){m=f(a,n);return 0===m?a.safeI-n.safeI:m});for(n=
|
||||
0;n<h;n++)delete a[n].safeI};a.arrayMin=function(a){for(var f=a.length,h=a[0];f--;)a[f]<h&&(h=a[f]);return h};a.arrayMax=function(a){for(var f=a.length,h=a[0];f--;)a[f]>h&&(h=a[f]);return h};a.destroyObjectProperties=function(a,f){for(var h in a)a[h]&&a[h]!==f&&a[h].destroy&&a[h].destroy(),delete a[h]};a.discardElement=function(m){var f=a.garbageBin;f||(f=a.createElement("div"));m&&f.appendChild(m);f.innerHTML=""};a.correctFloat=function(a,f){return parseFloat(a.toPrecision(f||14))};a.setAnimation=
|
||||
function(m,f){f.renderer.globalAnimation=a.pick(m,f.options.chart.animation,!0)};a.animObject=function(m){return a.isObject(m)?a.merge(m):{duration:m?500:0}};a.timeUnits={millisecond:1,second:1E3,minute:6E4,hour:36E5,day:864E5,week:6048E5,month:24192E5,year:314496E5};a.numberFormat=function(m,f,h,q){m=+m||0;f=+f;var n=a.defaultOptions.lang,k=(m.toString().split(".")[1]||"").length,v,d,g=Math.abs(m);-1===f?f=Math.min(k,20):a.isNumber(f)||(f=2);v=String(a.pInt(g.toFixed(f)));d=3<v.length?v.length%3:
|
||||
0;h=a.pick(h,n.decimalPoint);q=a.pick(q,n.thousandsSep);m=(0>m?"-":"")+(d?v.substr(0,d)+q:"");m+=v.substr(d).replace(/(\d{3})(?=\d)/g,"$1"+q);f&&(q=Math.abs(g-v+Math.pow(10,-Math.max(f,k)-1)),m+=h+q.toFixed(f).slice(2));return m};Math.easeInOutSine=function(a){return-.5*(Math.cos(Math.PI*a)-1)};a.getStyle=function(m,f){return"width"===f?Math.min(m.offsetWidth,m.scrollWidth)-a.getStyle(m,"padding-left")-a.getStyle(m,"padding-right"):"height"===f?Math.min(m.offsetHeight,m.scrollHeight)-a.getStyle(m,
|
||||
"padding-top")-a.getStyle(m,"padding-bottom"):(m=J.getComputedStyle(m,void 0))&&a.pInt(m.getPropertyValue(f))};a.inArray=function(a,f){return f.indexOf?f.indexOf(a):[].indexOf.call(f,a)};a.grep=function(a,f){return[].filter.call(a,f)};a.map=function(a,f){for(var h=[],q=0,n=a.length;q<n;q++)h[q]=f.call(a[q],a[q],q,a);return h};a.offset=function(a){var f=F.documentElement;a=a.getBoundingClientRect();return{top:a.top+(J.pageYOffset||f.scrollTop)-(f.clientTop||0),left:a.left+(J.pageXOffset||f.scrollLeft)-
|
||||
(f.clientLeft||0)}};a.stop=function(a){for(var f=D.length;f--;)D[f].elem===a&&(D[f].stopped=!0)};a.each=function(a,f,h){return Array.prototype.forEach.call(a,f,h)};a.addEvent=function(a,f,h){function q(k){k.target=k.srcElement||J;h.call(a,k)}var n=a.hcEvents=a.hcEvents||{};a.addEventListener?a.addEventListener(f,h,!1):a.attachEvent&&(a.hcEventsIE||(a.hcEventsIE={}),a.hcEventsIE[h.toString()]=q,a.attachEvent("on"+f,q));n[f]||(n[f]=[]);n[f].push(h)};a.removeEvent=function(m,f,h){function q(a,d){m.removeEventListener?
|
||||
m.removeEventListener(a,d,!1):m.attachEvent&&(d=m.hcEventsIE[d.toString()],m.detachEvent("on"+a,d))}function n(){var a,d;if(m.nodeName)for(d in f?(a={},a[f]=!0):a=v,a)if(v[d])for(a=v[d].length;a--;)q(d,v[d][a])}var k,v=m.hcEvents,d;v&&(f?(k=v[f]||[],h?(d=a.inArray(h,k),-1<d&&(k.splice(d,1),v[f]=k),q(f,h)):(n(),v[f]=[])):(n(),m.hcEvents={}))};a.fireEvent=function(m,f,h,q){var n;n=m.hcEvents;var k,v;h=h||{};if(F.createEvent&&(m.dispatchEvent||m.fireEvent))n=F.createEvent("Events"),n.initEvent(f,!0,
|
||||
!0),a.extend(n,h),m.dispatchEvent?m.dispatchEvent(n):m.fireEvent(f,n);else if(n)for(n=n[f]||[],k=n.length,h.target||a.extend(h,{preventDefault:function(){h.defaultPrevented=!0},target:m,type:f}),f=0;f<k;f++)(v=n[f])&&!1===v.call(m,h)&&h.preventDefault();q&&!h.defaultPrevented&&q(h)};a.animate=function(m,f,h){var q,n="",k,v,d;a.isObject(h)||(q=arguments,h={duration:q[2],easing:q[3],complete:q[4]});a.isNumber(h.duration)||(h.duration=400);h.easing="function"===typeof h.easing?h.easing:Math[h.easing]||
|
||||
Math.easeInOutSine;h.curAnim=a.merge(f);for(d in f)v=new a.Fx(m,h,d),k=null,"d"===d?(v.paths=v.initPath(m,m.d,f.d),v.toD=f.d,q=0,k=1):m.attr?q=m.attr(d):(q=parseFloat(a.getStyle(m,d))||0,"opacity"!==d&&(n="px")),k||(k=f[d]),k.match&&k.match("px")&&(k=k.replace(/px/g,"")),v.run(q,k,n)};a.seriesType=function(m,f,h,q,n){var k=a.getOptions(),v=a.seriesTypes;k.plotOptions[m]=a.merge(k.plotOptions[f],h);v[m]=a.extendClass(v[f]||function(){},q);v[m].prototype.type=m;n&&(v[m].prototype.pointClass=a.extendClass(a.Point,
|
||||
n));return v[m]};J.jQuery&&(J.jQuery.fn.highcharts=function(){var m=[].slice.call(arguments);if(this[0])return m[0]?(new (a[a.isString(m[0])?m.shift():"Chart"])(this[0],m[0],m[1]),this):z[a.attr(this[0],"data-highcharts-chart")]});F&&!F.defaultView&&(a.getStyle=function(m,f){var h={width:"clientWidth",height:"clientHeight"}[f];if(m.style[f])return a.pInt(m.style[f]);"opacity"===f&&(f="filter");if(h)return m.style.zoom=1,Math.max(m[h]-2*a.getStyle(m,"padding"),0);m=m.currentStyle[f.replace(/\-(\w)/g,
|
||||
function(a,n){return n.toUpperCase()})];"filter"===f&&(m=m.replace(/alpha\(opacity=([0-9]+)\)/,function(a,n){return n/100}));return""===m?1:a.pInt(m)});Array.prototype.forEach||(a.each=function(a,f,h){for(var q=0,n=a.length;q<n;q++)if(!1===f.call(h,a[q],q,a))return q});Array.prototype.indexOf||(a.inArray=function(a,f){var h,q=0;if(f)for(h=f.length;q<h;q++)if(f[q]===a)return q;return-1});Array.prototype.filter||(a.grep=function(a,f){for(var h=[],q=0,n=a.length;q<n;q++)f(a[q],q)&&h.push(a[q]);return h})})(M);
|
||||
(function(a){var D=a.each,z=a.isNumber,F=a.map,J=a.merge,m=a.pInt;a.Color=function(f){if(!(this instanceof a.Color))return new a.Color(f);this.init(f)};a.Color.prototype={parsers:[{regex:/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/,parse:function(a){return[m(a[1]),m(a[2]),m(a[3]),parseFloat(a[4],10)]}},{regex:/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,parse:function(a){return[m(a[1],16),m(a[2],16),m(a[3],16),1]}},{regex:/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/,
|
||||
parse:function(a){return[m(a[1]),m(a[2]),m(a[3]),1]}}],names:{white:"#ffffff",black:"#000000"},init:function(f){var h,q,n,k;if((this.input=f=this.names[f]||f)&&f.stops)this.stops=F(f.stops,function(k){return new a.Color(k[1])});else for(n=this.parsers.length;n--&&!q;)k=this.parsers[n],(h=k.regex.exec(f))&&(q=k.parse(h));this.rgba=q||[]},get:function(a){var h=this.input,f=this.rgba,n;this.stops?(n=J(h),n.stops=[].concat(n.stops),D(this.stops,function(k,f){n.stops[f]=[n.stops[f][0],k.get(a)]})):n=f&&
|
||||
z(f[0])?"rgb"===a||!a&&1===f[3]?"rgb("+f[0]+","+f[1]+","+f[2]+")":"a"===a?f[3]:"rgba("+f.join(",")+")":h;return n},brighten:function(a){var h,f=this.rgba;if(this.stops)D(this.stops,function(n){n.brighten(a)});else if(z(a)&&0!==a)for(h=0;3>h;h++)f[h]+=m(255*a),0>f[h]&&(f[h]=0),255<f[h]&&(f[h]=255);return this},setOpacity:function(a){this.rgba[3]=a;return this}};a.color=function(f){return new a.Color(f)}})(M);(function(a){var D,z,F=a.addEvent,J=a.animate,m=a.attr,f=a.charts,h=a.color,q=a.css,n=a.createElement,
|
||||
k=a.defined,v=a.deg2rad,d=a.destroyObjectProperties,g=a.doc,w=a.each,B=a.extend,c=a.erase,e=a.grep,l=a.hasTouch,u=a.isArray,L=a.isFirefox,b=a.isMS,t=a.isObject,y=a.isString,K=a.isWebKit,x=a.merge,I=a.noop,r=a.pick,G=a.pInt,H=a.removeEvent,N=a.stop,p=a.svg,A=a.SVG_NS,P=a.symbolSizes,O=a.win;D=a.SVGElement=function(){return this};D.prototype={opacity:1,SVG_NS:A,textProps:"direction fontSize fontWeight fontFamily fontStyle color lineHeight width textDecoration textOverflow textShadow".split(" "),init:function(a,
|
||||
b){this.element="span"===b?n(b):g.createElementNS(this.SVG_NS,b);this.renderer=a},animate:function(a,b,p){b=r(b,this.renderer.globalAnimation,!0);N(this);b?(p&&(b.complete=p),J(this,a,b)):this.attr(a,null,p);return this},colorGradient:function(b,E,p){var C=this.renderer,e,A,c,d,t,S,l,g,y,r,n,H=[],G;b.linearGradient?A="linearGradient":b.radialGradient&&(A="radialGradient");if(A){c=b[A];t=C.gradients;l=b.stops;r=p.radialReference;u(c)&&(b[A]=c={x1:c[0],y1:c[1],x2:c[2],y2:c[3],gradientUnits:"userSpaceOnUse"});
|
||||
"radialGradient"===A&&r&&!k(c.gradientUnits)&&(d=c,c=x(c,C.getRadialAttr(r,d),{gradientUnits:"userSpaceOnUse"}));for(n in c)"id"!==n&&H.push(n,c[n]);for(n in l)H.push(l[n]);H=H.join(",");t[H]?r=t[H].attr("id"):(c.id=r="highcharts-"+a.idCounter++,t[H]=S=C.createElement(A).attr(c).add(C.defs),S.radAttr=d,S.stops=[],w(l,function(b){0===b[1].indexOf("rgba")?(e=a.color(b[1]),g=e.get("rgb"),y=e.get("a")):(g=b[1],y=1);b=C.createElement("stop").attr({offset:b[0],"stop-color":g,"stop-opacity":y}).add(S);S.stops.push(b)}));
|
||||
G="url("+C.url+"#"+r+")";p.setAttribute(E,G);p.gradient=H;b.toString=function(){return G}}},applyTextShadow:function(a){var C=this.element,p,e=-1!==a.indexOf("contrast"),c={},A=this.renderer.forExport,d=this.renderer.forExport||void 0!==C.style.textShadow&&!b;e&&(c.textShadow=a=a.replace(/contrast/g,this.renderer.getContrast(C.style.fill)));if(K||A)c.textRendering="geometricPrecision";d?this.css(c):(this.fakeTS=!0,this.ySetter=this.xSetter,p=[].slice.call(C.getElementsByTagName("tspan")),w(a.split(/\s?,\s?/g),
|
||||
function(a){var b=C.firstChild,E,e;a=a.split(" ");E=a[a.length-1];(e=a[a.length-2])&&w(p,function(a,p){0===p&&(a.setAttribute("x",C.getAttribute("x")),p=C.getAttribute("y"),a.setAttribute("y",p||0),null===p&&C.setAttribute("y",0));a=a.cloneNode(1);m(a,{"class":"highcharts-text-shadow",fill:E,stroke:E,"stroke-opacity":1/Math.max(G(e),3),"stroke-width":e,"stroke-linejoin":"round"});C.insertBefore(a,b)})}))},attr:function(a,b,p){var C,E=this.element,e,c=this,A;"string"===typeof a&&void 0!==b&&(C=a,a=
|
||||
{},a[C]=b);if("string"===typeof a)c=(this[a+"Getter"]||this._defaultGetter).call(this,a,E);else{for(C in a)b=a[C],A=!1,this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(C)&&(e||(this.symbolAttr(a),e=!0),A=!0),!this.rotation||"x"!==C&&"y"!==C||(this.doTransform=!0),A||(A=this[C+"Setter"]||this._defaultSetter,A.call(this,b,C,E),this.shadows&&/^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(C)&&this.updateShadows(C,b,A));this.doTransform&&(this.updateTransform(),
|
||||
this.doTransform=!1)}p&&p();return c},updateShadows:function(a,b,p){for(var C=this.shadows,E=C.length;E--;)p.call(C[E],"height"===a?Math.max(b-(C[E].cutHeight||0),0):"d"===a?this.d:b,a,C[E])},addClass:function(a,b){var C=this.attr("class")||"";-1===C.indexOf(a)&&(b||(a=(C+(C?" ":"")+a).replace(" "," ")),this.attr("class",a));return this},hasClass:function(a){return-1!==m(this.element,"class").indexOf(a)},removeClass:function(a){m(this.element,"class",(m(this.element,"class")||"").replace(a,""));
|
||||
return this},symbolAttr:function(a){var b=this;w("x y r start end width height innerR anchorX anchorY".split(" "),function(C){b[C]=r(a[C],b[C])});b.attr({d:b.renderer.symbols[b.symbolName](b.x,b.y,b.width,b.height,b)})},clip:function(a){return this.attr("clip-path",a?"url("+this.renderer.url+"#"+a.id+")":"none")},crisp:function(a,b){var C,p={},E;b=b||a.strokeWidth||0;E=Math.round(b)%2/2;a.x=Math.floor(a.x||this.x||0)+E;a.y=Math.floor(a.y||this.y||0)+E;a.width=Math.floor((a.width||this.width||0)-2*
|
||||
E);a.height=Math.floor((a.height||this.height||0)-2*E);k(a.strokeWidth)&&(a.strokeWidth=b);for(C in a)this[C]!==a[C]&&(this[C]=p[C]=a[C]);return p},css:function(a){var C=this.styles,e={},A=this.element,c,d,t="";c=!C;a&&a.color&&(a.fill=a.color);if(C)for(d in a)a[d]!==C[d]&&(e[d]=a[d],c=!0);if(c){c=this.textWidth=a&&a.width&&"text"===A.nodeName.toLowerCase()&&G(a.width)||this.textWidth;C&&(a=B(C,e));this.styles=a;c&&!p&&this.renderer.forExport&&delete a.width;if(b&&!p)q(this.element,a);else{C=function(a,
|
||||
b){return"-"+b.toLowerCase()};for(d in a)t+=d.replace(/([A-Z])/g,C)+":"+a[d]+";";m(A,"style",t)}this.added&&c&&this.renderer.buildText(this)}return this},strokeWidth:function(){return this["stroke-width"]||0},on:function(a,b){var C=this,p=C.element;l&&"click"===a?(p.ontouchstart=function(a){C.touchEventFired=Date.now();a.preventDefault();b.call(p,a)},p.onclick=function(a){(-1===O.navigator.userAgent.indexOf("Android")||1100<Date.now()-(C.touchEventFired||0))&&b.call(p,a)}):p["on"+a]=b;return this},
|
||||
setRadialReference:function(a){var b=this.renderer.gradients[this.element.gradient];this.element.radialReference=a;b&&b.radAttr&&b.animate(this.renderer.getRadialAttr(a,b.radAttr));return this},translate:function(a,b){return this.attr({translateX:a,translateY:b})},invert:function(a){this.inverted=a;this.updateTransform();return this},updateTransform:function(){var a=this.translateX||0,b=this.translateY||0,p=this.scaleX,e=this.scaleY,c=this.inverted,A=this.rotation,d=this.element;c&&(a+=this.attr("width"),
|
||||
b+=this.attr("height"));a=["translate("+a+","+b+")"];c?a.push("rotate(90) scale(-1,1)"):A&&a.push("rotate("+A+" "+(d.getAttribute("x")||0)+" "+(d.getAttribute("y")||0)+")");(k(p)||k(e))&&a.push("scale("+r(p,1)+" "+r(e,1)+")");a.length&&d.setAttribute("transform",a.join(" "))},toFront:function(){var a=this.element;a.parentNode.appendChild(a);return this},align:function(a,b,p){var C,E,e,A,d={};E=this.renderer;e=E.alignedObjects;var t,l;if(a){if(this.alignOptions=a,this.alignByTranslate=b,!p||y(p))this.alignTo=
|
||||
C=p||"renderer",c(e,this),e.push(this),p=null}else a=this.alignOptions,b=this.alignByTranslate,C=this.alignTo;p=r(p,E[C],E);C=a.align;E=a.verticalAlign;e=(p.x||0)+(a.x||0);A=(p.y||0)+(a.y||0);"right"===C?t=1:"center"===C&&(t=2);t&&(e+=(p.width-(a.width||0))/t);d[b?"translateX":"x"]=Math.round(e);"bottom"===E?l=1:"middle"===E&&(l=2);l&&(A+=(p.height-(a.height||0))/l);d[b?"translateY":"y"]=Math.round(A);this[this.placed?"animate":"attr"](d);this.placed=!0;this.alignAttr=d;return this},getBBox:function(a,
|
||||
p){var C,E=this.renderer,e,A=this.element,c=this.styles,d,t=this.textStr,l,g=A.style,y,u=E.cache,x=E.cacheKeys,k;p=r(p,this.rotation);e=p*v;d=c&&c.fontSize;void 0!==t&&(k=t.toString().replace(/[0-9]/g,"0")+["",p||0,d,A.style.width].join());k&&!a&&(C=u[k]);if(!C){if(A.namespaceURI===this.SVG_NS||E.forExport){try{y=this.fakeTS&&function(a){w(A.querySelectorAll(".highcharts-text-shadow"),function(b){b.style.display=a})},L&&g.textShadow?(l=g.textShadow,g.textShadow=""):y&&y("none"),C=A.getBBox?B({},A.getBBox()):
|
||||
{width:A.offsetWidth,height:A.offsetHeight},l?g.textShadow=l:y&&y("")}catch(V){}if(!C||0>C.width)C={width:0,height:0}}else C=this.htmlGetBBox();E.isSVG&&(a=C.width,E=C.height,b&&c&&"11px"===c.fontSize&&"16.9"===E.toPrecision(3)&&(C.height=E=14),p&&(C.width=Math.abs(E*Math.sin(e))+Math.abs(a*Math.cos(e)),C.height=Math.abs(E*Math.cos(e))+Math.abs(a*Math.sin(e))));if(k&&0<C.height){for(;250<x.length;)delete u[x.shift()];u[k]||x.push(k);u[k]=C}}return C},show:function(a){return this.attr({visibility:a?
|
||||
"inherit":"visible"})},hide:function(){return this.attr({visibility:"hidden"})},fadeOut:function(a){var b=this;b.animate({opacity:0},{duration:a||150,complete:function(){b.attr({y:-9999})}})},add:function(a){var b=this.renderer,p=this.element,C;a&&(this.parentGroup=a);this.parentInverted=a&&a.inverted;void 0!==this.textStr&&b.buildText(this);this.added=!0;if(!a||a.handleZ||this.zIndex)C=this.zIndexSetter();C||(a?a.element:b.box).appendChild(p);if(this.onAdd)this.onAdd();return this},safeRemoveChild:function(a){var b=
|
||||
a.parentNode;b&&b.removeChild(a)},destroy:function(){var a=this.element||{},b=this.renderer.isSVG&&"SPAN"===a.nodeName&&this.parentGroup,p,e;a.onclick=a.onmouseout=a.onmouseover=a.onmousemove=a.point=null;N(this);this.clipPath&&(this.clipPath=this.clipPath.destroy());if(this.stops){for(e=0;e<this.stops.length;e++)this.stops[e]=this.stops[e].destroy();this.stops=null}this.safeRemoveChild(a);for(this.destroyShadows();b&&b.div&&0===b.div.childNodes.length;)a=b.parentGroup,this.safeRemoveChild(b.div),
|
||||
delete b.div,b=a;this.alignTo&&c(this.renderer.alignedObjects,this);for(p in this)delete this[p];return null},shadow:function(a,b,p){var C=[],e,E,A=this.element,c,d,t,l;if(!a)this.destroyShadows();else if(!this.shadows){d=r(a.width,3);t=(a.opacity||.15)/d;l=this.parentInverted?"(-1,-1)":"("+r(a.offsetX,1)+", "+r(a.offsetY,1)+")";for(e=1;e<=d;e++)E=A.cloneNode(0),c=2*d+1-2*e,m(E,{isShadow:"true",stroke:a.color||"#000000","stroke-opacity":t*e,"stroke-width":c,transform:"translate"+l,fill:"none"}),p&&
|
||||
(m(E,"height",Math.max(m(E,"height")-c,0)),E.cutHeight=c),b?b.element.appendChild(E):A.parentNode.insertBefore(E,A),C.push(E);this.shadows=C}return this},destroyShadows:function(){w(this.shadows||[],function(a){this.safeRemoveChild(a)},this);this.shadows=void 0},xGetter:function(a){"circle"===this.element.nodeName&&("x"===a?a="cx":"y"===a&&(a="cy"));return this._defaultGetter(a)},_defaultGetter:function(a){a=r(this[a],this.element?this.element.getAttribute(a):null,0);/^[\-0-9\.]+$/.test(a)&&(a=parseFloat(a));
|
||||
return a},dSetter:function(a,b,p){a&&a.join&&(a=a.join(" "));/(NaN| {2}|^$)/.test(a)&&(a="M 0 0");p.setAttribute(b,a);this[b]=a},dashstyleSetter:function(a){var b,p=this["stroke-width"];"inherit"===p&&(p=1);if(a=a&&a.toLowerCase()){a=a.replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").split(",");for(b=a.length;b--;)a[b]=G(a[b])*
|
||||
p;a=a.join(",").replace(/NaN/g,"none");this.element.setAttribute("stroke-dasharray",a)}},alignSetter:function(a){this.element.setAttribute("text-anchor",{left:"start",center:"middle",right:"end"}[a])},opacitySetter:function(a,b,p){this[b]=a;p.setAttribute(b,a)},titleSetter:function(a){var b=this.element.getElementsByTagName("title")[0];b||(b=g.createElementNS(this.SVG_NS,"title"),this.element.appendChild(b));b.firstChild&&b.removeChild(b.firstChild);b.appendChild(g.createTextNode(String(r(a),"").replace(/<[^>]*>/g,
|
||||
"")))},textSetter:function(a){a!==this.textStr&&(delete this.bBox,this.textStr=a,this.added&&this.renderer.buildText(this))},fillSetter:function(a,b,p){"string"===typeof a?p.setAttribute(b,a):a&&this.colorGradient(a,b,p)},visibilitySetter:function(a,b,p){"inherit"===a?p.removeAttribute(b):p.setAttribute(b,a)},zIndexSetter:function(a,b){var p=this.renderer,e=this.parentGroup,C=(e||p).element||p.box,E,A=this.element,c;E=this.added;var d;k(a)&&(A.zIndex=a,a=+a,this[b]===a&&(E=!1),this[b]=a);if(E){(a=
|
||||
this.zIndex)&&e&&(e.handleZ=!0);b=C.childNodes;for(d=0;d<b.length&&!c;d++)e=b[d],E=e.zIndex,e!==A&&(G(E)>a||!k(a)&&k(E)||0>a&&!k(E)&&C!==p.box)&&(C.insertBefore(A,e),c=!0);c||C.appendChild(A)}return c},_defaultSetter:function(a,b,p){p.setAttribute(b,a)}};D.prototype.yGetter=D.prototype.xGetter;D.prototype.translateXSetter=D.prototype.translateYSetter=D.prototype.rotationSetter=D.prototype.verticalAlignSetter=D.prototype.scaleXSetter=D.prototype.scaleYSetter=function(a,b){this[b]=a;this.doTransform=
|
||||
!0};D.prototype["stroke-widthSetter"]=D.prototype.strokeSetter=function(a,b,p){this[b]=a;this.stroke&&this["stroke-width"]?(D.prototype.fillSetter.call(this,this.stroke,"stroke",p),p.setAttribute("stroke-width",this["stroke-width"]),this.hasStroke=!0):"stroke-width"===b&&0===a&&this.hasStroke&&(p.removeAttribute("stroke"),this.hasStroke=!1)};z=a.SVGRenderer=function(){this.init.apply(this,arguments)};z.prototype={Element:D,SVG_NS:A,init:function(a,b,p,e,A,c){var E;e=this.createElement("svg").attr({version:"1.1",
|
||||
"class":"highcharts-root"}).css(this.getStyle(e));E=e.element;a.appendChild(E);-1===a.innerHTML.indexOf("xmlns")&&m(E,"xmlns",this.SVG_NS);this.isSVG=!0;this.box=E;this.boxWrapper=e;this.alignedObjects=[];this.url=(L||K)&&g.getElementsByTagName("base").length?O.location.href.replace(/#.*?$/,"").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20"):"";this.createElement("desc").add().element.appendChild(g.createTextNode("Created with Highcharts 5.0.2"));this.defs=this.createElement("defs").add();this.allowHTML=
|
||||
c;this.forExport=A;this.gradients={};this.cache={};this.cacheKeys=[];this.imgCount=0;this.setSize(b,p,!1);var C;L&&a.getBoundingClientRect&&(this.subPixelFix=b=function(){q(a,{left:0,top:0});C=a.getBoundingClientRect();q(a,{left:Math.ceil(C.left)-C.left+"px",top:Math.ceil(C.top)-C.top+"px"})},b(),F(O,"resize",b))},getStyle:function(a){return this.style=B({fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif',fontSize:"12px"},a)},setStyle:function(a){this.boxWrapper.css(this.getStyle(a))},
|
||||
isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var a=this.defs;this.box=null;this.boxWrapper=this.boxWrapper.destroy();d(this.gradients||{});this.gradients=null;a&&(this.defs=a.destroy());this.subPixelFix&&H(O,"resize",this.subPixelFix);return this.alignedObjects=null},createElement:function(a){var b=new this.Element;b.init(this,a);return b},draw:I,getRadialAttr:function(a,b){return{cx:a[0]-a[2]/2+b.cx*a[2],cy:a[1]-a[2]/2+b.cy*a[2],r:b.r*a[2]}},buildText:function(a){for(var b=
|
||||
a.element,c=this,d=c.forExport,C=r(a.textStr,"").toString(),t=-1!==C.indexOf("\x3c"),l=b.childNodes,y,u,x,k,n=m(b,"x"),H=a.styles,f=a.textWidth,K=H&&H.lineHeight,h=H&&H.textShadow,v=H&&"ellipsis"===H.textOverflow,O=l.length,B=f&&!a.added&&this.box,P=function(a){var b;b=/(px|em)$/.test(a&&a.style.fontSize)?a.style.fontSize:H&&H.fontSize||c.style.fontSize||12;return K?G(K):c.fontMetrics(b,a).h};O--;)b.removeChild(l[O]);t||h||v||f||-1!==C.indexOf(" ")?(y=/<.*class="([^"]+)".*>/,u=/<.*style="([^"]+)".*>/,
|
||||
x=/<.*href="(http[^"]+)".*>/,B&&B.appendChild(b),C=t?C.replace(/<(b|strong)>/g,'\x3cspan style\x3d"font-weight:bold"\x3e').replace(/<(i|em)>/g,'\x3cspan style\x3d"font-style:italic"\x3e').replace(/<a/g,"\x3cspan").replace(/<\/(b|strong|i|em|a)>/g,"\x3c/span\x3e").split(/<br.*?>/g):[C],C=e(C,function(a){return""!==a}),w(C,function(e,E){var C,t=0;e=e.replace(/^\s+|\s+$/g,"").replace(/<span/g,"|||\x3cspan").replace(/<\/span>/g,"\x3c/span\x3e|||");C=e.split("|||");w(C,function(e){if(""!==e||1===C.length){var l=
|
||||
{},r=g.createElementNS(c.SVG_NS,"tspan"),w,S;y.test(e)&&(w=e.match(y)[1],m(r,"class",w));u.test(e)&&(S=e.match(u)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),m(r,"style",S));x.test(e)&&!d&&(m(r,"onclick",'location.href\x3d"'+e.match(x)[1]+'"'),q(r,{cursor:"pointer"}));e=(e.replace(/<(.|\n)*?>/g,"")||" ").replace(/</g,"\x3c").replace(/>/g,"\x3e");if(" "!==e){r.appendChild(g.createTextNode(e));t?l.dx=0:E&&null!==n&&(l.x=n);m(r,l);b.appendChild(r);!t&&E&&(!p&&d&&q(r,{display:"block"}),m(r,"dy",
|
||||
P(r)));if(f){l=e.replace(/([^\^])-/g,"$1- ").split(" ");w="nowrap"===H.whiteSpace;for(var G=1<C.length||E||1<l.length&&!w,K,h,O=[],B=P(r),R=a.rotation,I=e,Q=I.length;(G||v)&&(l.length||O.length);)a.rotation=0,K=a.getBBox(!0),h=K.width,!p&&c.forExport&&(h=c.measureSpanWidth(r.firstChild.data,a.styles)),K=h>f,void 0===k&&(k=K),v&&k?(Q/=2,""===I||!K&&.5>Q?l=[]:(I=e.substring(0,I.length+(K?-1:1)*Math.ceil(Q)),l=[I+(3<f?"\u2026":"")],r.removeChild(r.firstChild))):K&&1!==l.length?(r.removeChild(r.firstChild),
|
||||
O.unshift(l.pop())):(l=O,O=[],l.length&&!w&&(r=g.createElementNS(A,"tspan"),m(r,{dy:B,x:n}),S&&m(r,"style",S),b.appendChild(r)),h>f&&(f=h)),l.length&&r.appendChild(g.createTextNode(l.join(" ").replace(/- /g,"-")));a.rotation=R}t++}}})}),k&&a.attr("title",a.textStr),B&&B.removeChild(b),h&&a.applyTextShadow&&a.applyTextShadow(h)):b.appendChild(g.createTextNode(C.replace(/</g,"\x3c").replace(/>/g,"\x3e")))},getContrast:function(a){a=h(a).rgba;return 510<a[0]+a[1]+a[2]?"#000000":"#FFFFFF"},button:function(a,
|
||||
p,e,c,A,d,t,l,g){var E=this.label(a,p,e,g,null,null,null,null,"button"),C=0;E.attr(x({padding:8,r:2},A));var r,y,u,k;A=x({fill:"#f7f7f7",stroke:"#cccccc","stroke-width":1,style:{color:"#333333",cursor:"pointer",fontWeight:"normal"}},A);r=A.style;delete A.style;d=x(A,{fill:"#e6e6e6"},d);y=d.style;delete d.style;t=x(A,{fill:"#e6ebf5",style:{color:"#000000",fontWeight:"bold"}},t);u=t.style;delete t.style;l=x(A,{style:{color:"#cccccc"}},l);k=l.style;delete l.style;F(E.element,b?"mouseover":"mouseenter",
|
||||
function(){3!==C&&E.setState(1)});F(E.element,b?"mouseout":"mouseleave",function(){3!==C&&E.setState(C)});E.setState=function(a){1!==a&&(E.state=C=a);E.removeClass(/highcharts-button-(normal|hover|pressed|disabled)/).addClass("highcharts-button-"+["normal","hover","pressed","disabled"][a||0]);E.attr([A,d,t,l][a||0]).css([r,y,u,k][a||0])};E.attr(A).css(B({cursor:"default"},r));return E.on("click",function(a){3!==C&&c.call(E,a)})},crispLine:function(a,b){a[1]===a[4]&&(a[1]=a[4]=Math.round(a[1])-b%2/
|
||||
2);a[2]===a[5]&&(a[2]=a[5]=Math.round(a[2])+b%2/2);return a},path:function(a){var b={fill:"none"};u(a)?b.d=a:t(a)&&B(b,a);return this.createElement("path").attr(b)},circle:function(a,b,p){a=t(a)?a:{x:a,y:b,r:p};b=this.createElement("circle");b.xSetter=b.ySetter=function(a,b,p){p.setAttribute("c"+b,a)};return b.attr(a)},arc:function(a,b,p,e,A,c){t(a)&&(b=a.y,p=a.r,e=a.innerR,A=a.start,c=a.end,a=a.x);a=this.symbol("arc",a||0,b||0,p||0,p||0,{innerR:e||0,start:A||0,end:c||0});a.r=p;return a},rect:function(a,
|
||||
b,p,e,A,c){A=t(a)?a.r:A;var d=this.createElement("rect");a=t(a)?a:void 0===a?{}:{x:a,y:b,width:Math.max(p,0),height:Math.max(e,0)};void 0!==c&&(a.strokeWidth=c,a=d.crisp(a));a.fill="none";A&&(a.r=A);d.rSetter=function(a,b,p){m(p,{rx:a,ry:a})};return d.attr(a)},setSize:function(a,b,p){var e=this.alignedObjects,A=e.length;this.width=a;this.height=b;for(this.boxWrapper.animate({width:a,height:b},{step:function(){this.attr({viewBox:"0 0 "+this.attr("width")+" "+this.attr("height")})},duration:r(p,!0)?
|
||||
void 0:0});A--;)e[A].align()},g:function(a){var b=this.createElement("g");return a?b.attr({"class":"highcharts-"+a}):b},image:function(a,b,p,e,A){var c={preserveAspectRatio:"none"};1<arguments.length&&B(c,{x:b,y:p,width:e,height:A});c=this.createElement("image").attr(c);c.element.setAttributeNS?c.element.setAttributeNS("http://www.w3.org/1999/xlink","href",a):c.element.setAttribute("hc-svg-href",a);return c},symbol:function(a,b,p,e,A,c){var d=this,E,t=this.symbols[a],l=k(b)&&t&&t(Math.round(b),Math.round(p),
|
||||
e,A,c),C=/^url\((.*?)\)$/,y,u;t?(E=this.path(l),E.attr("fill","none"),B(E,{symbolName:a,x:b,y:p,width:e,height:A}),c&&B(E,c)):C.test(a)&&(y=a.match(C)[1],E=this.image(y),E.imgwidth=r(P[y]&&P[y].width,c&&c.width),E.imgheight=r(P[y]&&P[y].height,c&&c.height),u=function(){E.attr({width:E.width,height:E.height})},w(["width","height"],function(a){E[a+"Setter"]=function(a,b){var p={},e=this["img"+b],c="width"===b?"translateX":"translateY";this[b]=a;k(e)&&(this.element&&this.element.setAttribute(b,e),this.alignByTranslate||
|
||||
(p[c]=((this[b]||0)-e)/2,this.attr(p)))}}),k(b)&&E.attr({x:b,y:p}),E.isImg=!0,k(E.imgwidth)&&k(E.imgheight)?u():(E.attr({width:0,height:0}),n("img",{onload:function(){var a=f[d.chartIndex];0===this.width&&(q(this,{position:"absolute",top:"-999em"}),g.body.appendChild(this));P[y]={width:this.width,height:this.height};E.imgwidth=this.width;E.imgheight=this.height;E.element&&u();this.parentNode&&this.parentNode.removeChild(this);d.imgCount--;if(!d.imgCount&&a&&a.onload)a.onload()},src:y}),this.imgCount++));
|
||||
return E},symbols:{circle:function(a,b,p,e){var c=.166*p;return["M",a+p/2,b,"C",a+p+c,b,a+p+c,b+e,a+p/2,b+e,"C",a-c,b+e,a-c,b,a+p/2,b,"Z"]},square:function(a,b,p,e){return["M",a,b,"L",a+p,b,a+p,b+e,a,b+e,"Z"]},triangle:function(a,b,p,e){return["M",a+p/2,b,"L",a+p,b+e,a,b+e,"Z"]},"triangle-down":function(a,b,p,e){return["M",a,b,"L",a+p,b,a+p/2,b+e,"Z"]},diamond:function(a,b,p,e){return["M",a+p/2,b,"L",a+p,b+e/2,a+p/2,b+e,a,b+e/2,"Z"]},arc:function(a,b,p,e,c){var A=c.start;p=c.r||p||e;var d=c.end-.001;
|
||||
e=c.innerR;var t=c.open,E=Math.cos(A),l=Math.sin(A),y=Math.cos(d),d=Math.sin(d);c=c.end-A<Math.PI?0:1;return["M",a+p*E,b+p*l,"A",p,p,0,c,1,a+p*y,b+p*d,t?"M":"L",a+e*y,b+e*d,"A",e,e,0,c,0,a+e*E,b+e*l,t?"":"Z"]},callout:function(a,b,p,e,c){var A=Math.min(c&&c.r||0,p,e),d=A+6,t=c&&c.anchorX;c=c&&c.anchorY;var l;l=["M",a+A,b,"L",a+p-A,b,"C",a+p,b,a+p,b,a+p,b+A,"L",a+p,b+e-A,"C",a+p,b+e,a+p,b+e,a+p-A,b+e,"L",a+A,b+e,"C",a,b+e,a,b+e,a,b+e-A,"L",a,b+A,"C",a,b,a,b,a+A,b];t&&t>p&&c>b+d&&c<b+e-d?l.splice(13,
|
||||
3,"L",a+p,c-6,a+p+6,c,a+p,c+6,a+p,b+e-A):t&&0>t&&c>b+d&&c<b+e-d?l.splice(33,3,"L",a,c+6,a-6,c,a,c-6,a,b+A):c&&c>e&&t>a+d&&t<a+p-d?l.splice(23,3,"L",t+6,b+e,t,b+e+6,t-6,b+e,a+A,b+e):c&&0>c&&t>a+d&&t<a+p-d&&l.splice(3,3,"L",t-6,b,t,b-6,t+6,b,p-A,b);return l}},clipRect:function(b,p,e,c){var A="highcharts-"+a.idCounter++,d=this.createElement("clipPath").attr({id:A}).add(this.defs);b=this.rect(b,p,e,c,0).add(d);b.id=A;b.clipPath=d;b.count=0;return b},text:function(a,b,e,c){var A=!p&&this.forExport,d={};
|
||||
if(c&&(this.allowHTML||!this.forExport))return this.html(a,b,e);d.x=Math.round(b||0);e&&(d.y=Math.round(e));if(a||0===a)d.text=a;a=this.createElement("text").attr(d);A&&a.css({position:"absolute"});c||(a.xSetter=function(a,b,p){var e=p.getElementsByTagName("tspan"),c,A=p.getAttribute(b),d;for(d=0;d<e.length;d++)c=e[d],c.getAttribute(b)===A&&c.setAttribute(b,a);p.setAttribute(b,a)});return a},fontMetrics:function(a,b){a=a||this.style&&this.style.fontSize;a=/px/.test(a)?G(a):/em/.test(a)?12*parseFloat(a):
|
||||
12;b=24>a?a+3:Math.round(1.2*a);return{h:b,b:Math.round(.8*b),f:a}},rotCorr:function(a,b,p){var e=a;b&&p&&(e=Math.max(e*Math.cos(b*v),4));return{x:-a/3*Math.sin(b*v),y:e}},label:function(a,b,p,e,c,A,d,t,l){var y=this,r=y.g("button"!==l&&"label"),g=r.text=y.text("",0,0,d).attr({zIndex:1}),E,u,n=0,K=3,G=0,C,f,h,O,v,I={},P,S,q=/^url\((.*?)\)$/.test(e),N=q,L,m,R,Q;l&&r.addClass("highcharts-"+l);N=q;L=function(){return(P||0)%2/2};m=function(){var a=g.element.style,b={};u=(void 0===C||void 0===f||v)&&k(g.textStr)&&
|
||||
g.getBBox();r.width=(C||u.width||0)+2*K+G;r.height=(f||u.height||0)+2*K;S=K+y.fontMetrics(a&&a.fontSize,g).b;N&&(E||(r.box=E=y.symbols[e]||q?y.symbol(e):y.rect(),E.addClass(("button"===l?"":"highcharts-label-box")+(l?" highcharts-"+l+"-box":"")),E.add(r),a=L(),b.x=a,b.y=(t?-S:0)+a),b.width=Math.round(r.width),b.height=Math.round(r.height),E.attr(B(b,I)),I={})};R=function(){var a=G+K,b;b=t?0:S;k(C)&&u&&("center"===v||"right"===v)&&(a+={center:.5,right:1}[v]*(C-u.width));if(a!==g.x||b!==g.y)g.attr("x",
|
||||
a),void 0!==b&&g.attr("y",b);g.x=a;g.y=b};Q=function(a,b){E?E.attr(a,b):I[a]=b};r.onAdd=function(){g.add(r);r.attr({text:a||0===a?a:"",x:b,y:p});E&&k(c)&&r.attr({anchorX:c,anchorY:A})};r.widthSetter=function(a){C=a};r.heightSetter=function(a){f=a};r["text-alignSetter"]=function(a){v=a};r.paddingSetter=function(a){k(a)&&a!==K&&(K=r.padding=a,R())};r.paddingLeftSetter=function(a){k(a)&&a!==G&&(G=a,R())};r.alignSetter=function(a){a={left:0,center:.5,right:1}[a];a!==n&&(n=a,u&&r.attr({x:h}))};r.textSetter=
|
||||
function(a){void 0!==a&&g.textSetter(a);m();R()};r["stroke-widthSetter"]=function(a,b){a&&(N=!0);P=this["stroke-width"]=a;Q(b,a)};r.strokeSetter=r.fillSetter=r.rSetter=function(a,b){"fill"===b&&a&&(N=!0);Q(b,a)};r.anchorXSetter=function(a,b){c=a;Q(b,Math.round(a)-L()-h)};r.anchorYSetter=function(a,b){A=a;Q(b,a-O)};r.xSetter=function(a){r.x=a;n&&(a-=n*((C||u.width)+2*K));h=Math.round(a);r.attr("translateX",h)};r.ySetter=function(a){O=r.y=Math.round(a);r.attr("translateY",O)};var T=r.css;return B(r,
|
||||
{css:function(a){if(a){var b={};a=x(a);w(r.textProps,function(p){void 0!==a[p]&&(b[p]=a[p],delete a[p])});g.css(b)}return T.call(r,a)},getBBox:function(){return{width:u.width+2*K,height:u.height+2*K,x:u.x-K,y:u.y-K}},shadow:function(a){a&&(m(),E&&E.shadow(a));return r},destroy:function(){H(r.element,"mouseenter");H(r.element,"mouseleave");g&&(g=g.destroy());E&&(E=E.destroy());D.prototype.destroy.call(r);r=y=m=R=Q=null}})}};a.Renderer=z})(M);(function(a){var D=a.attr,z=a.createElement,F=a.css,J=a.defined,
|
||||
m=a.each,f=a.extend,h=a.isFirefox,q=a.isMS,n=a.isWebKit,k=a.pInt,v=a.SVGRenderer,d=a.win,g=a.wrap;f(a.SVGElement.prototype,{htmlCss:function(a){var d=this.element;if(d=a&&"SPAN"===d.tagName&&a.width)delete a.width,this.textWidth=d,this.updateTransform();a&&"ellipsis"===a.textOverflow&&(a.whiteSpace="nowrap",a.overflow="hidden");this.styles=f(this.styles,a);F(this.element,a);return this},htmlGetBBox:function(){var a=this.element;"text"===a.nodeName&&(a.style.position="absolute");return{x:a.offsetLeft,
|
||||
y:a.offsetTop,width:a.offsetWidth,height:a.offsetHeight}},htmlUpdateTransform:function(){if(this.added){var a=this.renderer,d=this.element,c=this.translateX||0,e=this.translateY||0,l=this.x||0,g=this.y||0,f=this.textAlign||"left",b={left:0,center:.5,right:1}[f],t=this.styles;F(d,{marginLeft:c,marginTop:e});this.shadows&&m(this.shadows,function(a){F(a,{marginLeft:c+1,marginTop:e+1})});this.inverted&&m(d.childNodes,function(b){a.invertChild(b,d)});if("SPAN"===d.tagName){var y=this.rotation,K=k(this.textWidth),
|
||||
x=t&&t.whiteSpace,h=[y,f,d.innerHTML,this.textWidth,this.textAlign].join();h!==this.cTT&&(t=a.fontMetrics(d.style.fontSize).b,J(y)&&this.setSpanRotation(y,b,t),F(d,{width:"",whiteSpace:x||"nowrap"}),d.offsetWidth>K&&/[ \-]/.test(d.textContent||d.innerText)&&F(d,{width:K+"px",display:"block",whiteSpace:x||"normal"}),this.getSpanCorrection(d.offsetWidth,t,b,y,f));F(d,{left:l+(this.xCorr||0)+"px",top:g+(this.yCorr||0)+"px"});n&&(t=d.offsetHeight);this.cTT=h}}else this.alignOnAdd=!0},setSpanRotation:function(a,
|
||||
g,c){var e={},l=q?"-ms-transform":n?"-webkit-transform":h?"MozTransform":d.opera?"-o-transform":"";e[l]=e.transform="rotate("+a+"deg)";e[l+(h?"Origin":"-origin")]=e.transformOrigin=100*g+"% "+c+"px";F(this.element,e)},getSpanCorrection:function(a,d,c){this.xCorr=-a*c;this.yCorr=-d}});f(v.prototype,{html:function(a,d,c){var e=this.createElement("span"),l=e.element,u=e.renderer,k=u.isSVG,b=function(a,b){m(["opacity","visibility"],function(e){g(a,e+"Setter",function(a,e,c,d){a.call(this,e,c,d);b[c]=
|
||||
e})})};e.textSetter=function(a){a!==l.innerHTML&&delete this.bBox;l.innerHTML=this.textStr=a;e.htmlUpdateTransform()};k&&b(e,e.element.style);e.xSetter=e.ySetter=e.alignSetter=e.rotationSetter=function(a,b){"align"===b&&(b="textAlign");e[b]=a;e.htmlUpdateTransform()};e.attr({text:a,x:Math.round(d),y:Math.round(c)}).css({fontFamily:this.style.fontFamily,fontSize:this.style.fontSize,position:"absolute"});l.style.whiteSpace="nowrap";e.css=e.htmlCss;k&&(e.add=function(a){var c,d=u.box.parentNode,t=[];
|
||||
if(this.parentGroup=a){if(c=a.div,!c){for(;a;)t.push(a),a=a.parentGroup;m(t.reverse(),function(a){var e,t=D(a.element,"class");t&&(t={className:t});c=a.div=a.div||z("div",t,{position:"absolute",left:(a.translateX||0)+"px",top:(a.translateY||0)+"px",display:a.display,opacity:a.opacity,pointerEvents:a.styles&&a.styles.pointerEvents},c||d);e=c.style;f(a,{translateXSetter:function(b,c){e.left=b+"px";a[c]=b;a.doTransform=!0},translateYSetter:function(b,c){e.top=b+"px";a[c]=b;a.doTransform=!0}});b(a,e)})}}else c=
|
||||
d;c.appendChild(l);e.added=!0;e.alignOnAdd&&e.htmlUpdateTransform();return e});return e}})})(M);(function(a){var D,z,F=a.createElement,J=a.css,m=a.defined,f=a.deg2rad,h=a.discardElement,q=a.doc,n=a.each,k=a.erase,v=a.extend;D=a.extendClass;var d=a.isArray,g=a.isNumber,w=a.isObject,B=a.merge;z=a.noop;var c=a.pick,e=a.pInt,l=a.SVGElement,u=a.SVGRenderer,L=a.win;a.svg||(z={docMode8:q&&8===q.documentMode,init:function(a,e){var b=["\x3c",e,' filled\x3d"f" stroked\x3d"f"'],c=["position: ","absolute",";"],
|
||||
d="div"===e;("shape"===e||d)&&c.push("left:0;top:0;width:1px;height:1px;");c.push("visibility: ",d?"hidden":"visible");b.push(' style\x3d"',c.join(""),'"/\x3e');e&&(b=d||"span"===e||"img"===e?b.join(""):a.prepVML(b),this.element=F(b));this.renderer=a},add:function(a){var b=this.renderer,e=this.element,c=b.box,d=a&&a.inverted,c=a?a.element||a:c;a&&(this.parentGroup=a);d&&b.invertChild(e,c);c.appendChild(e);this.added=!0;this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform();if(this.onAdd)this.onAdd();
|
||||
this.className&&this.attr("class",this.className);return this},updateTransform:l.prototype.htmlUpdateTransform,setSpanRotation:function(){var a=this.rotation,e=Math.cos(a*f),c=Math.sin(a*f);J(this.element,{filter:a?["progid:DXImageTransform.Microsoft.Matrix(M11\x3d",e,", M12\x3d",-c,", M21\x3d",c,", M22\x3d",e,", sizingMethod\x3d'auto expand')"].join(""):"none"})},getSpanCorrection:function(a,e,d,l,g){var b=l?Math.cos(l*f):1,t=l?Math.sin(l*f):0,y=c(this.elemHeight,this.element.offsetHeight),u;this.xCorr=
|
||||
0>b&&-a;this.yCorr=0>t&&-y;u=0>b*t;this.xCorr+=t*e*(u?1-d:d);this.yCorr-=b*e*(l?u?d:1-d:1);g&&"left"!==g&&(this.xCorr-=a*d*(0>b?-1:1),l&&(this.yCorr-=y*d*(0>t?-1:1)),J(this.element,{textAlign:g}))},pathToVML:function(a){for(var b=a.length,e=[];b--;)g(a[b])?e[b]=Math.round(10*a[b])-5:"Z"===a[b]?e[b]="x":(e[b]=a[b],!a.isArc||"wa"!==a[b]&&"at"!==a[b]||(e[b+5]===e[b+7]&&(e[b+7]+=a[b+7]>a[b+5]?1:-1),e[b+6]===e[b+8]&&(e[b+8]+=a[b+8]>a[b+6]?1:-1)));return e.join(" ")||"x"},clip:function(a){var b=this,e;
|
||||
a?(e=a.members,k(e,b),e.push(b),b.destroyClip=function(){k(e,b)},a=a.getCSS(b)):(b.destroyClip&&b.destroyClip(),a={clip:b.docMode8?"inherit":"rect(auto)"});return b.css(a)},css:l.prototype.htmlCss,safeRemoveChild:function(a){a.parentNode&&h(a)},destroy:function(){this.destroyClip&&this.destroyClip();return l.prototype.destroy.apply(this)},on:function(a,e){this.element["on"+a]=function(){var a=L.event;a.target=a.srcElement;e(a)};return this},cutOffPath:function(a,c){var b;a=a.split(/[ ,]/);b=a.length;
|
||||
if(9===b||11===b)a[b-4]=a[b-2]=e(a[b-2])-10*c;return a.join(" ")},shadow:function(a,d,l){var b=[],g,t=this.element,r=this.renderer,u,y=t.style,k,p=t.path,A,n,f,C;p&&"string"!==typeof p.value&&(p="x");n=p;if(a){f=c(a.width,3);C=(a.opacity||.15)/f;for(g=1;3>=g;g++)A=2*f+1-2*g,l&&(n=this.cutOffPath(p.value,A+.5)),k=['\x3cshape isShadow\x3d"true" strokeweight\x3d"',A,'" filled\x3d"false" path\x3d"',n,'" coordsize\x3d"10 10" style\x3d"',t.style.cssText,'" /\x3e'],u=F(r.prepVML(k),null,{left:e(y.left)+
|
||||
c(a.offsetX,1),top:e(y.top)+c(a.offsetY,1)}),l&&(u.cutOff=A+1),k=['\x3cstroke color\x3d"',a.color||"#000000",'" opacity\x3d"',C*g,'"/\x3e'],F(r.prepVML(k),null,null,u),d?d.element.appendChild(u):t.parentNode.insertBefore(u,t),b.push(u);this.shadows=b}return this},updateShadows:z,setAttr:function(a,e){this.docMode8?this.element[a]=e:this.element.setAttribute(a,e)},classSetter:function(a){(this.added?this.element:this).className=a},dashstyleSetter:function(a,e,c){(c.getElementsByTagName("stroke")[0]||
|
||||
F(this.renderer.prepVML(["\x3cstroke/\x3e"]),null,null,c))[e]=a||"solid";this[e]=a},dSetter:function(a,e,c){var b=this.shadows;a=a||[];this.d=a.join&&a.join(" ");c.path=a=this.pathToVML(a);if(b)for(c=b.length;c--;)b[c].path=b[c].cutOff?this.cutOffPath(a,b[c].cutOff):a;this.setAttr(e,a)},fillSetter:function(a,e,c){var b=c.nodeName;"SPAN"===b?c.style.color=a:"IMG"!==b&&(c.filled="none"!==a,this.setAttr("fillcolor",this.renderer.color(a,c,e,this)))},"fill-opacitySetter":function(a,e,c){F(this.renderer.prepVML(["\x3c",
|
||||
e.split("-")[0],' opacity\x3d"',a,'"/\x3e']),null,null,c)},opacitySetter:z,rotationSetter:function(a,e,c){c=c.style;this[e]=c[e]=a;c.left=-Math.round(Math.sin(a*f)+1)+"px";c.top=Math.round(Math.cos(a*f))+"px"},strokeSetter:function(a,e,c){this.setAttr("strokecolor",this.renderer.color(a,c,e,this))},"stroke-widthSetter":function(a,e,c){c.stroked=!!a;this[e]=a;g(a)&&(a+="px");this.setAttr("strokeweight",a)},titleSetter:function(a,e){this.setAttr(e,a)},visibilitySetter:function(a,e,c){"inherit"===a&&
|
||||
(a="visible");this.shadows&&n(this.shadows,function(b){b.style[e]=a});"DIV"===c.nodeName&&(a="hidden"===a?"-999em":0,this.docMode8||(c.style[e]=a?"visible":"hidden"),e="top");c.style[e]=a},xSetter:function(a,e,c){this[e]=a;"x"===e?e="left":"y"===e&&(e="top");this.updateClipping?(this[e]=a,this.updateClipping()):c.style[e]=a},zIndexSetter:function(a,e,c){c.style[e]=a}},z["stroke-opacitySetter"]=z["fill-opacitySetter"],a.VMLElement=z=D(l,z),z.prototype.ySetter=z.prototype.widthSetter=z.prototype.heightSetter=
|
||||
z.prototype.xSetter,z={Element:z,isIE8:-1<L.navigator.userAgent.indexOf("MSIE 8.0"),init:function(a,e,c){var b,d;this.alignedObjects=[];b=this.createElement("div").css({position:"relative"});d=b.element;a.appendChild(b.element);this.isVML=!0;this.box=d;this.boxWrapper=b;this.gradients={};this.cache={};this.cacheKeys=[];this.imgCount=0;this.setSize(e,c,!1);if(!q.namespaces.hcv){q.namespaces.add("hcv","urn:schemas-microsoft-com:vml");try{q.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}catch(I){q.styleSheets[0].cssText+=
|
||||
"hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } "}}},isHidden:function(){return!this.box.offsetWidth},clipRect:function(a,e,c,d){var b=this.createElement(),l=w(a);return v(b,{members:[],count:0,left:(l?a.x:a)+1,top:(l?a.y:e)+1,width:(l?a.width:c)-1,height:(l?a.height:d)-1,getCSS:function(a){var b=a.element,e=b.nodeName,c=a.inverted,p=this.top-("shape"===e?b.offsetTop:0),d=this.left,b=d+this.width,l=p+this.height,p={clip:"rect("+Math.round(c?
|
||||
d:p)+"px,"+Math.round(c?l:b)+"px,"+Math.round(c?b:l)+"px,"+Math.round(c?p:d)+"px)"};!c&&a.docMode8&&"DIV"===e&&v(p,{width:b+"px",height:l+"px"});return p},updateClipping:function(){n(b.members,function(a){a.element&&a.css(b.getCSS(a))})}})},color:function(b,e,c,d){var l=this,g,r=/^rgba/,u,t,k="none";b&&b.linearGradient?t="gradient":b&&b.radialGradient&&(t="pattern");if(t){var p,A,f=b.linearGradient||b.radialGradient,h,C,E,y,w,v="";b=b.stops;var K,B=[],q=function(){u=['\x3cfill colors\x3d"'+B.join(",")+
|
||||
'" opacity\x3d"',E,'" o:opacity2\x3d"',C,'" type\x3d"',t,'" ',v,'focus\x3d"100%" method\x3d"any" /\x3e'];F(l.prepVML(u),null,null,e)};h=b[0];K=b[b.length-1];0<h[0]&&b.unshift([0,h[1]]);1>K[0]&&b.push([1,K[1]]);n(b,function(b,e){r.test(b[1])?(g=a.color(b[1]),p=g.get("rgb"),A=g.get("a")):(p=b[1],A=1);B.push(100*b[0]+"% "+p);e?(E=A,y=p):(C=A,w=p)});if("fill"===c)if("gradient"===t)c=f.x1||f[0]||0,b=f.y1||f[1]||0,h=f.x2||f[2]||0,f=f.y2||f[3]||0,v='angle\x3d"'+(90-180*Math.atan((f-b)/(h-c))/Math.PI)+'"',
|
||||
q();else{var k=f.r,L=2*k,m=2*k,z=f.cx,D=f.cy,J=e.radialReference,U,k=function(){J&&(U=d.getBBox(),z+=(J[0]-U.x)/U.width-.5,D+=(J[1]-U.y)/U.height-.5,L*=J[2]/U.width,m*=J[2]/U.height);v='src\x3d"'+a.getOptions().global.VMLRadialGradientURL+'" size\x3d"'+L+","+m+'" origin\x3d"0.5,0.5" position\x3d"'+z+","+D+'" color2\x3d"'+w+'" ';q()};d.added?k():d.onAdd=k;k=y}else k=p}else r.test(b)&&"IMG"!==e.tagName?(g=a.color(b),d[c+"-opacitySetter"](g.get("a"),c,e),k=g.get("rgb")):(k=e.getElementsByTagName(c),
|
||||
k.length&&(k[0].opacity=1,k[0].type="solid"),k=b);return k},prepVML:function(a){var b=this.isIE8;a=a.join("");b?(a=a.replace("/\x3e",' xmlns\x3d"urn:schemas-microsoft-com:vml" /\x3e'),a=-1===a.indexOf('style\x3d"')?a.replace("/\x3e",' style\x3d"display:inline-block;behavior:url(#default#VML);" /\x3e'):a.replace('style\x3d"','style\x3d"display:inline-block;behavior:url(#default#VML);')):a=a.replace("\x3c","\x3chcv:");return a},text:u.prototype.html,path:function(a){var b={coordsize:"10 10"};d(a)?b.d=
|
||||
a:w(a)&&v(b,a);return this.createElement("shape").attr(b)},circle:function(a,e,c){var b=this.symbol("circle");w(a)&&(c=a.r,e=a.y,a=a.x);b.isCircle=!0;b.r=c;return b.attr({x:a,y:e})},g:function(a){var b;a&&(b={className:"highcharts-"+a,"class":"highcharts-"+a});return this.createElement("div").attr(b)},image:function(a,e,c,d,l){var b=this.createElement("img").attr({src:a});1<arguments.length&&b.attr({x:e,y:c,width:d,height:l});return b},createElement:function(a){return"rect"===a?this.symbol(a):u.prototype.createElement.call(this,
|
||||
a)},invertChild:function(a,c){var b=this;c=c.style;var d="IMG"===a.tagName&&a.style;J(a,{flip:"x",left:e(c.width)-(d?e(d.top):1),top:e(c.height)-(d?e(d.left):1),rotation:-90});n(a.childNodes,function(e){b.invertChild(e,a)})},symbols:{arc:function(a,e,c,d,l){var b=l.start,g=l.end,u=l.r||c||d;c=l.innerR;d=Math.cos(b);var k=Math.sin(b),t=Math.cos(g),p=Math.sin(g);if(0===g-b)return["x"];b=["wa",a-u,e-u,a+u,e+u,a+u*d,e+u*k,a+u*t,e+u*p];l.open&&!c&&b.push("e","M",a,e);b.push("at",a-c,e-c,a+c,e+c,a+c*t,
|
||||
e+c*p,a+c*d,e+c*k,"x","e");b.isArc=!0;return b},circle:function(a,e,c,d,l){l&&m(l.r)&&(c=d=2*l.r);l&&l.isCircle&&(a-=c/2,e-=d/2);return["wa",a,e,a+c,e+d,a+c,e+d/2,a+c,e+d/2,"e"]},rect:function(a,e,c,d,l){return u.prototype.symbols[m(l)&&l.r?"callout":"square"].call(0,a,e,c,d,l)}}},a.VMLRenderer=D=function(){this.init.apply(this,arguments)},D.prototype=B(u.prototype,z),a.Renderer=D);u.prototype.measureSpanWidth=function(a,e){var b=q.createElement("span");a=q.createTextNode(a);b.appendChild(a);J(b,
|
||||
e);this.box.appendChild(b);e=b.offsetWidth;h(b);return e}})(M);(function(a){function D(){var q=a.defaultOptions.global,n,k=q.useUTC,v=k?"getUTC":"get",d=k?"setUTC":"set";a.Date=n=q.Date||h.Date;n.hcTimezoneOffset=k&&q.timezoneOffset;n.hcGetTimezoneOffset=k&&q.getTimezoneOffset;n.hcMakeTime=function(a,d,h,c,e,l){var g;k?(g=n.UTC.apply(0,arguments),g+=J(g)):g=(new n(a,d,f(h,1),f(c,0),f(e,0),f(l,0))).getTime();return g};F("Minutes Hours Day Date Month FullYear".split(" "),function(a){n["hcGet"+a]=v+
|
||||
a});F("Milliseconds Seconds Minutes Hours Date Month FullYear".split(" "),function(a){n["hcSet"+a]=d+a})}var z=a.color,F=a.each,J=a.getTZOffset,m=a.merge,f=a.pick,h=a.win;a.defaultOptions={colors:"#7cb5ec #434348 #90ed7d #f7a35c #8085e9 #f15c80 #e4d354 #2b908f #f45b5b #91e8e1".split(" "),symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:"January February March April May June July August September October November December".split(" "),shortMonths:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),
|
||||
weekdays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),decimalPoint:".",numericSymbols:"kMGTPE".split(""),resetZoom:"Reset zoom",resetZoomTitle:"Reset zoom level 1:1",thousandsSep:" "},global:{useUTC:!0,VMLRadialGradientURL:"http://code.highcharts.com/5.0.2/gfx/vml-radial-gradient.png"},chart:{borderRadius:0,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacing:[10,10,15,10],resetZoomButton:{theme:{zIndex:20},position:{align:"right",x:-10,y:10}},width:null,height:null,borderColor:"#335cad",
|
||||
backgroundColor:"#ffffff",plotBorderColor:"#cccccc"},title:{text:"Chart title",align:"center",margin:15,style:{color:"#333333",fontSize:"18px"},widthAdjust:-44},subtitle:{text:"",align:"center",style:{color:"#666666"},widthAdjust:-44},plotOptions:{},labels:{style:{position:"absolute",color:"#333333"}},legend:{enabled:!0,align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderColor:"#999999",borderRadius:0,navigation:{activeColor:"#003399",inactiveColor:"#cccccc"},itemStyle:{color:"#333333",
|
||||
fontSize:"12px",fontWeight:"bold"},itemHoverStyle:{color:"#000000"},itemHiddenStyle:{color:"#cccccc"},shadow:!1,itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},squareSymbol:!0,symbolPadding:5,verticalAlign:"bottom",x:0,y:0,title:{style:{fontWeight:"bold"}}},loading:{labelStyle:{fontWeight:"bold",position:"relative",top:"45%"},style:{position:"absolute",backgroundColor:"#ffffff",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,animation:a.svg,borderRadius:3,dateTimeLabelFormats:{millisecond:"%A, %b %e, %H:%M:%S.%L",
|
||||
second:"%A, %b %e, %H:%M:%S",minute:"%A, %b %e, %H:%M",hour:"%A, %b %e, %H:%M",day:"%A, %b %e, %Y",week:"Week from %A, %b %e, %Y",month:"%B %Y",year:"%Y"},footerFormat:"",padding:8,snap:a.isTouchDevice?25:10,backgroundColor:z("#f7f7f7").setOpacity(.85).get(),borderWidth:1,headerFormat:'\x3cspan style\x3d"font-size: 10px"\x3e{point.key}\x3c/span\x3e\x3cbr/\x3e',pointFormat:'\x3cspan style\x3d"color:{point.color}"\x3e\u25cf\x3c/span\x3e {series.name}: \x3cb\x3e{point.y}\x3c/b\x3e\x3cbr/\x3e',shadow:!0,
|
||||
style:{color:"#333333",cursor:"default",fontSize:"12px",pointerEvents:"none",whiteSpace:"nowrap"}},credits:{enabled:!0,href:"http://www.highcharts.com",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#999999",fontSize:"9px"},text:"Highcharts.com"}};a.setOptions=function(f){a.defaultOptions=m(!0,a.defaultOptions,f);D();return a.defaultOptions};a.getOptions=function(){return a.defaultOptions};a.defaultPlotOptions=a.defaultOptions.plotOptions;D()})(M);(function(a){var D=
|
||||
a.arrayMax,z=a.arrayMin,F=a.defined,J=a.destroyObjectProperties,m=a.each,f=a.erase,h=a.merge,q=a.pick;a.PlotLineOrBand=function(a,k){this.axis=a;k&&(this.options=k,this.id=k.id)};a.PlotLineOrBand.prototype={render:function(){var a=this,k=a.axis,f=k.horiz,d=a.options,g=d.label,w=a.label,B=d.to,c=d.from,e=d.value,l=F(c)&&F(B),u=F(e),L=a.svgElem,b=!L,t=[],y,K=d.color,x=q(d.zIndex,0),m=d.events,t={"class":"highcharts-plot-"+(l?"band ":"line ")+(d.className||"")},r={},G=k.chart.renderer,H=l?"bands":"lines",
|
||||
N=k.log2lin;k.isLog&&(c=N(c),B=N(B),e=N(e));u?(t={stroke:K,"stroke-width":d.width},d.dashStyle&&(t.dashstyle=d.dashStyle)):l&&(K&&(t.fill=K),d.borderWidth&&(t.stroke=d.borderColor,t["stroke-width"]=d.borderWidth));r.zIndex=x;H+="-"+x;(K=k[H])||(k[H]=K=G.g("plot-"+H).attr(r).add());b&&(a.svgElem=L=G.path().attr(t).add(K));if(u)t=k.getPlotLinePath(e,L.strokeWidth());else if(l)t=k.getPlotBandPath(c,B,d);else return;if(b&&t&&t.length){if(L.attr({d:t}),m)for(y in d=function(b){L.on(b,function(e){m[b].apply(a,
|
||||
[e])})},m)d(y)}else L&&(t?(L.show(),L.animate({d:t})):(L.hide(),w&&(a.label=w=w.destroy())));g&&F(g.text)&&t&&t.length&&0<k.width&&0<k.height&&!t.flat?(g=h({align:f&&l&&"center",x:f?!l&&4:10,verticalAlign:!f&&l&&"middle",y:f?l?16:10:l?6:-4,rotation:f&&!l&&90},g),this.renderLabel(g,t,l,x)):w&&w.hide();return a},renderLabel:function(a,k,f,d){var g=this.label,h=this.axis.chart.renderer;g||(g={align:a.textAlign||a.align,rotation:a.rotation,"class":"highcharts-plot-"+(f?"band":"line")+"-label "+(a.className||
|
||||
"")},g.zIndex=d,this.label=g=h.text(a.text,0,0,a.useHTML).attr(g).add(),g.css(a.style));d=[k[1],k[4],f?k[6]:k[1]];k=[k[2],k[5],f?k[7]:k[2]];f=z(d);h=z(k);g.align(a,!1,{x:f,y:h,width:D(d)-f,height:D(k)-h});g.show()},destroy:function(){f(this.axis.plotLinesAndBands,this);delete this.axis;J(this)}};a.AxisPlotLineOrBandExtension={getPlotBandPath:function(a,k){k=this.getPlotLinePath(k,null,null,!0);(a=this.getPlotLinePath(a,null,null,!0))&&k?(a.flat=a.toString()===k.toString(),a.push(k[4],k[5],k[1],k[2])):
|
||||
a=null;return a},addPlotBand:function(a){return this.addPlotBandOrLine(a,"plotBands")},addPlotLine:function(a){return this.addPlotBandOrLine(a,"plotLines")},addPlotBandOrLine:function(f,k){var h=(new a.PlotLineOrBand(this,f)).render(),d=this.userOptions;h&&(k&&(d[k]=d[k]||[],d[k].push(f)),this.plotLinesAndBands.push(h));return h},removePlotBandOrLine:function(a){for(var k=this.plotLinesAndBands,h=this.options,d=this.userOptions,g=k.length;g--;)k[g].id===a&&k[g].destroy();m([h.plotLines||[],d.plotLines||
|
||||
[],h.plotBands||[],d.plotBands||[]],function(d){for(g=d.length;g--;)d[g].id===a&&f(d,d[g])})}}})(M);(function(a){var D=a.correctFloat,z=a.defined,F=a.destroyObjectProperties,J=a.isNumber,m=a.merge,f=a.pick,h=a.stop,q=a.deg2rad;a.Tick=function(a,k,f,d){this.axis=a;this.pos=k;this.type=f||"";this.isNew=!0;f||d||this.addLabel()};a.Tick.prototype={addLabel:function(){var a=this.axis,k=a.options,h=a.chart,d=a.categories,g=a.names,w=this.pos,B=k.labels,c=a.tickPositions,e=w===c[0],l=w===c[c.length-1],g=
|
||||
d?f(d[w],g[w],w):w,d=this.label,c=c.info,u;a.isDatetimeAxis&&c&&(u=k.dateTimeLabelFormats[c.higherRanks[w]||c.unitName]);this.isFirst=e;this.isLast=l;k=a.labelFormatter.call({axis:a,chart:h,isFirst:e,isLast:l,dateTimeLabelFormat:u,value:a.isLog?D(a.lin2log(g)):g});z(d)?d&&d.attr({text:k}):(this.labelLength=(this.label=d=z(k)&&B.enabled?h.renderer.text(k,0,0,B.useHTML).css(m(B.style)).add(a.labelGroup):null)&&d.getBBox().width,this.rotation=0)},getLabelSize:function(){return this.label?this.label.getBBox()[this.axis.horiz?
|
||||
"height":"width"]:0},handleOverflow:function(a){var k=this.axis,h=a.x,d=k.chart.chartWidth,g=k.chart.spacing,w=f(k.labelLeft,Math.min(k.pos,g[3])),g=f(k.labelRight,Math.max(k.pos+k.len,d-g[1])),n=this.label,c=this.rotation,e={left:0,center:.5,right:1}[k.labelAlign],l=n.getBBox().width,u=k.getSlotWidth(),m=u,b=1,t,y={};if(c)0>c&&h-e*l<w?t=Math.round(h/Math.cos(c*q)-w):0<c&&h+e*l>g&&(t=Math.round((d-h)/Math.cos(c*q)));else if(d=h+(1-e)*l,h-e*l<w?m=a.x+m*(1-e)-w:d>g&&(m=g-a.x+m*e,b=-1),m=Math.min(u,
|
||||
m),m<u&&"center"===k.labelAlign&&(a.x+=b*(u-m-e*(u-Math.min(l,m)))),l>m||k.autoRotation&&(n.styles||{}).width)t=m;t&&(y.width=t,(k.options.labels.style||{}).textOverflow||(y.textOverflow="ellipsis"),n.css(y))},getPosition:function(a,k,f,d){var g=this.axis,h=g.chart,n=d&&h.oldChartHeight||h.chartHeight;return{x:a?g.translate(k+f,null,null,d)+g.transB:g.left+g.offset+(g.opposite?(d&&h.oldChartWidth||h.chartWidth)-g.right-g.left:0),y:a?n-g.bottom+g.offset-(g.opposite?g.height:0):n-g.translate(k+f,null,
|
||||
null,d)-g.transB}},getLabelPosition:function(a,k,f,d,g,h,B,c){var e=this.axis,l=e.transA,u=e.reversed,w=e.staggerLines,b=e.tickRotCorr||{x:0,y:0},t=g.y;z(t)||(t=0===e.side?f.rotation?-8:-f.getBBox().height:2===e.side?b.y+8:Math.cos(f.rotation*q)*(b.y-f.getBBox(!1,0).height/2));a=a+g.x+b.x-(h&&d?h*l*(u?-1:1):0);k=k+t-(h&&!d?h*l*(u?1:-1):0);w&&(f=B/(c||1)%w,e.opposite&&(f=w-f-1),k+=e.labelOffset/w*f);return{x:a,y:Math.round(k)}},getMarkPath:function(a,f,h,d,g,w){return w.crispLine(["M",a,f,"L",a+(g?
|
||||
0:-h),f+(g?h:0)],d)},render:function(a,k,v){var d=this.axis,g=d.options,w=d.chart.renderer,n=d.horiz,c=this.type,e=this.label,l=this.pos,u=g.labels,q=this.gridLine,b=c?c+"Tick":"tick",t=d.tickSize(b),y=this.mark,K=!y,x=u.step,m={},r=!0,G=d.tickmarkOffset,H=this.getPosition(n,l,G,k),N=H.x,H=H.y,p=n&&N===d.pos+d.len||!n&&H===d.pos?-1:1,A=c?c+"Grid":"grid",P=g[A+"LineWidth"],O=g[A+"LineColor"],C=g[A+"LineDashStyle"],A=f(g[b+"Width"],!c&&d.isXAxis?1:0),b=g[b+"Color"];v=f(v,1);this.isActive=!0;q||(m.stroke=
|
||||
O,m["stroke-width"]=P,C&&(m.dashstyle=C),c||(m.zIndex=1),k&&(m.opacity=0),this.gridLine=q=w.path().attr(m).addClass("highcharts-"+(c?c+"-":"")+"grid-line").add(d.gridGroup));if(!k&&q&&(l=d.getPlotLinePath(l+G,q.strokeWidth()*p,k,!0)))q[this.isNew?"attr":"animate"]({d:l,opacity:v});t&&(d.opposite&&(t[0]=-t[0]),K&&(this.mark=y=w.path().addClass("highcharts-"+(c?c+"-":"")+"tick").add(d.axisGroup),y.attr({stroke:b,"stroke-width":A})),y[K?"attr":"animate"]({d:this.getMarkPath(N,H,t[0],y.strokeWidth()*
|
||||
p,n,w),opacity:v}));e&&J(N)&&(e.xy=H=this.getLabelPosition(N,H,e,n,u,G,a,x),this.isFirst&&!this.isLast&&!f(g.showFirstLabel,1)||this.isLast&&!this.isFirst&&!f(g.showLastLabel,1)?r=!1:!n||d.isRadial||u.step||u.rotation||k||0===v||this.handleOverflow(H),x&&a%x&&(r=!1),r&&J(H.y)?(H.opacity=v,e[this.isNew?"attr":"animate"](H)):(h(e),e.attr("y",-9999)),this.isNew=!1)},destroy:function(){F(this,this.axis)}}})(M);(function(a){var D=a.addEvent,z=a.animObject,F=a.arrayMax,J=a.arrayMin,m=a.AxisPlotLineOrBandExtension,
|
||||
f=a.color,h=a.correctFloat,q=a.defaultOptions,n=a.defined,k=a.deg2rad,v=a.destroyObjectProperties,d=a.each,g=a.error,w=a.extend,B=a.fireEvent,c=a.format,e=a.getMagnitude,l=a.grep,u=a.inArray,L=a.isArray,b=a.isNumber,t=a.isString,y=a.merge,K=a.normalizeTickInterval,x=a.pick,I=a.PlotLineOrBand,r=a.removeEvent,G=a.splat,H=a.syncTimeout,N=a.Tick;a.Axis=function(){this.init.apply(this,arguments)};a.Axis.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:"%H:%M:%S.%L",second:"%H:%M:%S",minute:"%H:%M",
|
||||
hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,labels:{enabled:!0,style:{color:"#666666",cursor:"default",fontSize:"11px"},x:0},minPadding:.01,maxPadding:.01,minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickLength:10,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",title:{align:"middle",style:{color:"#666666"}},type:"linear",minorGridLineColor:"#f2f2f2",minorGridLineWidth:1,minorTickColor:"#999999",lineColor:"#ccd6eb",
|
||||
lineWidth:1,gridLineColor:"#e6e6e6",tickColor:"#ccd6eb"},defaultYAxisOptions:{endOnTick:!0,tickPixelInterval:72,showLastLabel:!0,labels:{x:-8},maxPadding:.05,minPadding:.05,startOnTick:!0,title:{rotation:270,text:"Values"},stackLabels:{enabled:!1,formatter:function(){return a.numberFormat(this.total,-1)},style:{fontSize:"11px",fontWeight:"bold",color:"#000000",textShadow:"1px 1px contrast, -1px -1px contrast, -1px 1px contrast, 1px -1px contrast"}},gridLineWidth:1,lineWidth:0},defaultLeftAxisOptions:{labels:{x:-15},
|
||||
title:{rotation:270}},defaultRightAxisOptions:{labels:{x:15},title:{rotation:90}},defaultBottomAxisOptions:{labels:{autoRotation:[-45],x:0},title:{rotation:0}},defaultTopAxisOptions:{labels:{autoRotation:[-45],x:0},title:{rotation:0}},init:function(a,b){var e=b.isX;this.chart=a;this.horiz=a.inverted?!e:e;this.isXAxis=e;this.coll=this.coll||(e?"xAxis":"yAxis");this.opposite=b.opposite;this.side=b.side||(this.horiz?this.opposite?0:2:this.opposite?1:3);this.setOptions(b);var c=this.options,p=c.type;
|
||||
this.labelFormatter=c.labels.formatter||this.defaultLabelFormatter;this.userOptions=b;this.minPixelPadding=0;this.reversed=c.reversed;this.visible=!1!==c.visible;this.zoomEnabled=!1!==c.zoomEnabled;this.hasNames="category"===p||!0===c.categories;this.categories=c.categories||this.hasNames;this.names=this.names||[];this.isLog="logarithmic"===p;this.isDatetimeAxis="datetime"===p;this.isLinked=n(c.linkedTo);this.ticks={};this.labelEdge=[];this.minorTicks={};this.plotLinesAndBands=[];this.alternateBands=
|
||||
{};this.len=0;this.minRange=this.userMinRange=c.minRange||c.maxZoom;this.range=c.range;this.offset=c.offset||0;this.stacks={};this.oldStacks={};this.stacksTouched=0;this.min=this.max=null;this.crosshair=x(c.crosshair,G(a.options.tooltip.crosshairs)[e?0:1],!1);var d;b=this.options.events;-1===u(this,a.axes)&&(e?a.axes.splice(a.xAxis.length,0,this):a.axes.push(this),a[this.coll].push(this));this.series=this.series||[];a.inverted&&e&&void 0===this.reversed&&(this.reversed=!0);this.removePlotLine=this.removePlotBand=
|
||||
this.removePlotBandOrLine;for(d in b)D(this,d,b[d]);this.isLog&&(this.val2lin=this.log2lin,this.lin2val=this.lin2log)},setOptions:function(a){this.options=y(this.defaultOptions,"yAxis"===this.coll&&this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],y(q[this.coll],a))},defaultLabelFormatter:function(){var b=this.axis,e=this.value,d=b.categories,l=this.dateTimeLabelFormat,g=q.lang.numericSymbols,r=g&&
|
||||
g.length,u,f=b.options.labels.format,b=b.isLog?e:b.tickInterval;if(f)u=c(f,this);else if(d)u=e;else if(l)u=a.dateFormat(l,e);else if(r&&1E3<=b)for(;r--&&void 0===u;)d=Math.pow(1E3,r+1),b>=d&&0===10*e%d&&null!==g[r]&&0!==e&&(u=a.numberFormat(e/d,-1)+g[r]);void 0===u&&(u=1E4<=Math.abs(e)?a.numberFormat(e,-1):a.numberFormat(e,-1,void 0,""));return u},getSeriesExtremes:function(){var a=this,e=a.chart;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=a.threshold=null;a.softThreshold=!a.isXAxis;a.buildStacks&&
|
||||
a.buildStacks();d(a.series,function(c){if(c.visible||!e.options.chart.ignoreHiddenSeries){var p=c.options,d=p.threshold,A;a.hasVisibleSeries=!0;a.isLog&&0>=d&&(d=null);if(a.isXAxis)p=c.xData,p.length&&(c=J(p),b(c)||c instanceof Date||(p=l(p,function(a){return b(a)}),c=J(p)),a.dataMin=Math.min(x(a.dataMin,p[0]),c),a.dataMax=Math.max(x(a.dataMax,p[0]),F(p)));else if(c.getExtremes(),A=c.dataMax,c=c.dataMin,n(c)&&n(A)&&(a.dataMin=Math.min(x(a.dataMin,c),c),a.dataMax=Math.max(x(a.dataMax,A),A)),n(d)&&
|
||||
(a.threshold=d),!p.softThreshold||a.isLog)a.softThreshold=!1}})},translate:function(a,e,c,d,l,g){var p=this.linkedParent||this,A=1,r=0,u=d?p.oldTransA:p.transA;d=d?p.oldMin:p.min;var E=p.minPixelPadding;l=(p.isOrdinal||p.isBroken||p.isLog&&l)&&p.lin2val;u||(u=p.transA);c&&(A*=-1,r=p.len);p.reversed&&(A*=-1,r-=A*(p.sector||p.len));e?(a=(a*A+r-E)/u+d,l&&(a=p.lin2val(a))):(l&&(a=p.val2lin(a)),"between"===g&&(g=.5),a=A*(a-d)*u+r+A*E+(b(g)?u*g*p.pointRange:0));return a},toPixels:function(a,b){return this.translate(a,
|
||||
!1,!this.horiz,null,!0)+(b?0:this.pos)},toValue:function(a,b){return this.translate(a-(b?0:this.pos),!0,!this.horiz,null,!0)},getPlotLinePath:function(a,e,c,d,l){var p=this.chart,A=this.left,g=this.top,r,u,f=c&&p.oldChartHeight||p.chartHeight,k=c&&p.oldChartWidth||p.chartWidth,h;r=this.transB;var t=function(a,b,e){if(a<b||a>e)d?a=Math.min(Math.max(b,a),e):h=!0;return a};l=x(l,this.translate(a,null,null,c));a=c=Math.round(l+r);r=u=Math.round(f-l-r);b(l)?this.horiz?(r=g,u=f-this.bottom,a=c=t(a,A,A+
|
||||
this.width)):(a=A,c=k-this.right,r=u=t(r,g,g+this.height)):h=!0;return h&&!d?null:p.renderer.crispLine(["M",a,r,"L",c,u],e||1)},getLinearTickPositions:function(a,e,c){var p,d=h(Math.floor(e/a)*a),A=h(Math.ceil(c/a)*a),l=[];if(e===c&&b(e))return[e];for(e=d;e<=A;){l.push(e);e=h(e+a);if(e===p)break;p=e}return l},getMinorTickPositions:function(){var a=this.options,b=this.tickPositions,e=this.minorTickInterval,c=[],d,l=this.pointRangePadding||0;d=this.min-l;var l=this.max+l,g=l-d;if(g&&g/e<this.len/3)if(this.isLog)for(l=
|
||||
b.length,d=1;d<l;d++)c=c.concat(this.getLogTickPositions(e,b[d-1],b[d],!0));else if(this.isDatetimeAxis&&"auto"===a.minorTickInterval)c=c.concat(this.getTimeTicks(this.normalizeTimeTickInterval(e),d,l,a.startOfWeek));else for(b=d+(b[0]-d)%e;b<=l;b+=e)c.push(b);0!==c.length&&this.trimTicks(c,a.startOnTick,a.endOnTick);return c},adjustForMinRange:function(){var a=this.options,b=this.min,e=this.max,c,l=this.dataMax-this.dataMin>=this.minRange,g,r,u,f,k,h;this.isXAxis&&void 0===this.minRange&&!this.isLog&&
|
||||
(n(a.min)||n(a.max)?this.minRange=null:(d(this.series,function(a){f=a.xData;for(r=k=a.xIncrement?1:f.length-1;0<r;r--)if(u=f[r]-f[r-1],void 0===g||u<g)g=u}),this.minRange=Math.min(5*g,this.dataMax-this.dataMin)));e-b<this.minRange&&(h=this.minRange,c=(h-e+b)/2,c=[b-c,x(a.min,b-c)],l&&(c[2]=this.isLog?this.log2lin(this.dataMin):this.dataMin),b=F(c),e=[b+h,x(a.max,b+h)],l&&(e[2]=this.isLog?this.log2lin(this.dataMax):this.dataMax),e=J(e),e-b<h&&(c[0]=e-h,c[1]=x(a.min,e-h),b=F(c)));this.min=b;this.max=
|
||||
e},getClosest:function(){var a;this.categories?a=1:d(this.series,function(b){var e=b.closestPointRange;!b.noSharedTooltip&&n(e)&&(a=n(a)?Math.min(a,e):e)});return a},nameToX:function(a){var b=L(this.categories),e=b?this.categories:this.names,c=a.options.x,p;a.series.requireSorting=!1;n(c)||(c=!1===this.options.uniqueNames?a.series.autoIncrement():u(a.name,e));-1===c?b||(p=e.length):p=c;this.names[p]=a.name;return p},updateNames:function(){var a=this;0<this.names.length&&(this.names.length=0,this.minRange=
|
||||
void 0,d(this.series||[],function(b){if(!b.points||b.isDirtyData)b.processData(),b.generatePoints();d(b.points,function(e,c){var p;e.options&&void 0===e.options.x&&(p=a.nameToX(e),p!==e.x&&(e.x=p,b.xData[c]=p))})}))},setAxisTranslation:function(a){var b=this,e=b.max-b.min,c=b.axisPointRange||0,p,l=0,g=0,r=b.linkedParent,u=!!b.categories,f=b.transA,h=b.isXAxis;if(h||u||c)r?(l=r.minPointOffset,g=r.pointRangePadding):(p=b.getClosest(),d(b.series,function(a){var e=u?1:h?x(a.options.pointRange,p,0):b.axisPointRange||
|
||||
0;a=a.options.pointPlacement;c=Math.max(c,e);b.single||(l=Math.max(l,t(a)?0:e/2),g=Math.max(g,"on"===a?0:e))})),r=b.ordinalSlope&&p?b.ordinalSlope/p:1,b.minPointOffset=l*=r,b.pointRangePadding=g*=r,b.pointRange=Math.min(c,e),h&&(b.closestPointRange=p);a&&(b.oldTransA=f);b.translationSlope=b.transA=f=b.len/(e+g||1);b.transB=b.horiz?b.left:b.bottom;b.minPixelPadding=f*l},minFromRange:function(){return this.max-this.range},setTickInterval:function(a){var c=this,p=c.chart,l=c.options,r=c.isLog,u=c.log2lin,
|
||||
f=c.isDatetimeAxis,k=c.isXAxis,t=c.isLinked,H=l.maxPadding,w=l.minPadding,y=l.tickInterval,G=l.tickPixelInterval,v=c.categories,q=c.threshold,m=c.softThreshold,I,L,N,z;f||v||t||this.getTickAmount();N=x(c.userMin,l.min);z=x(c.userMax,l.max);t?(c.linkedParent=p[c.coll][l.linkedTo],p=c.linkedParent.getExtremes(),c.min=x(p.min,p.dataMin),c.max=x(p.max,p.dataMax),l.type!==c.linkedParent.options.type&&g(11,1)):(!m&&n(q)&&(c.dataMin>=q?(I=q,w=0):c.dataMax<=q&&(L=q,H=0)),c.min=x(N,I,c.dataMin),c.max=x(z,
|
||||
L,c.dataMax));r&&(!a&&0>=Math.min(c.min,x(c.dataMin,c.min))&&g(10,1),c.min=h(u(c.min),15),c.max=h(u(c.max),15));c.range&&n(c.max)&&(c.userMin=c.min=N=Math.max(c.min,c.minFromRange()),c.userMax=z=c.max,c.range=null);B(c,"foundExtremes");c.beforePadding&&c.beforePadding();c.adjustForMinRange();!(v||c.axisPointRange||c.usePercentage||t)&&n(c.min)&&n(c.max)&&(u=c.max-c.min)&&(!n(N)&&w&&(c.min-=u*w),!n(z)&&H&&(c.max+=u*H));b(l.floor)?c.min=Math.max(c.min,l.floor):b(l.softMin)&&(c.min=Math.min(c.min,l.softMin));
|
||||
b(l.ceiling)?c.max=Math.min(c.max,l.ceiling):b(l.softMax)&&(c.max=Math.max(c.max,l.softMax));m&&n(c.dataMin)&&(q=q||0,!n(N)&&c.min<q&&c.dataMin>=q?c.min=q:!n(z)&&c.max>q&&c.dataMax<=q&&(c.max=q));c.tickInterval=c.min===c.max||void 0===c.min||void 0===c.max?1:t&&!y&&G===c.linkedParent.options.tickPixelInterval?y=c.linkedParent.tickInterval:x(y,this.tickAmount?(c.max-c.min)/Math.max(this.tickAmount-1,1):void 0,v?1:(c.max-c.min)*G/Math.max(c.len,G));k&&!a&&d(c.series,function(a){a.processData(c.min!==
|
||||
c.oldMin||c.max!==c.oldMax)});c.setAxisTranslation(!0);c.beforeSetTickPositions&&c.beforeSetTickPositions();c.postProcessTickInterval&&(c.tickInterval=c.postProcessTickInterval(c.tickInterval));c.pointRange&&!y&&(c.tickInterval=Math.max(c.pointRange,c.tickInterval));a=x(l.minTickInterval,c.isDatetimeAxis&&c.closestPointRange);!y&&c.tickInterval<a&&(c.tickInterval=a);f||r||y||(c.tickInterval=K(c.tickInterval,null,e(c.tickInterval),x(l.allowDecimals,!(.5<c.tickInterval&&5>c.tickInterval&&1E3<c.max&&
|
||||
9999>c.max)),!!this.tickAmount));this.tickAmount||(c.tickInterval=c.unsquish());this.setTickPositions()},setTickPositions:function(){var a=this.options,b,c=a.tickPositions,e=a.tickPositioner,d=a.startOnTick,l=a.endOnTick,g;this.tickmarkOffset=this.categories&&"between"===a.tickmarkPlacement&&1===this.tickInterval?.5:0;this.minorTickInterval="auto"===a.minorTickInterval&&this.tickInterval?this.tickInterval/5:a.minorTickInterval;this.tickPositions=b=c&&c.slice();!b&&(b=this.isDatetimeAxis?this.getTimeTicks(this.normalizeTimeTickInterval(this.tickInterval,
|
||||
a.units),this.min,this.max,a.startOfWeek,this.ordinalPositions,this.closestPointRange,!0):this.isLog?this.getLogTickPositions(this.tickInterval,this.min,this.max):this.getLinearTickPositions(this.tickInterval,this.min,this.max),b.length>this.len&&(b=[b[0],b.pop()]),this.tickPositions=b,e&&(e=e.apply(this,[this.min,this.max])))&&(this.tickPositions=b=e);this.isLinked||(this.trimTicks(b,d,l),this.min===this.max&&n(this.min)&&!this.tickAmount&&(g=!0,this.min-=.5,this.max+=.5),this.single=g,c||e||this.adjustTickAmount())},
|
||||
trimTicks:function(a,b,c){var e=a[0],d=a[a.length-1],p=this.minPointOffset||0;if(b)this.min=e;else for(;this.min-p>a[0];)a.shift();if(c)this.max=d;else for(;this.max+p<a[a.length-1];)a.pop();0===a.length&&n(e)&&a.push((d+e)/2)},alignToOthers:function(){var a={},b,c=this.options;!1!==this.chart.options.chart.alignTicks&&!1!==c.alignTicks&&d(this.chart[this.coll],function(c){var e=c.options,e=[c.horiz?e.left:e.top,e.width,e.height,e.pane].join();c.series.length&&(a[e]?b=!0:a[e]=1)});return b},getTickAmount:function(){var a=
|
||||
this.options,b=a.tickAmount,c=a.tickPixelInterval;!n(a.tickInterval)&&this.len<c&&!this.isRadial&&!this.isLog&&a.startOnTick&&a.endOnTick&&(b=2);!b&&this.alignToOthers()&&(b=Math.ceil(this.len/c)+1);4>b&&(this.finalTickAmt=b,b=5);this.tickAmount=b},adjustTickAmount:function(){var a=this.tickInterval,b=this.tickPositions,c=this.tickAmount,e=this.finalTickAmt,d=b&&b.length;if(d<c){for(;b.length<c;)b.push(h(b[b.length-1]+a));this.transA*=(d-1)/(c-1);this.max=b[b.length-1]}else d>c&&(this.tickInterval*=
|
||||
2,this.setTickPositions());if(n(e)){for(a=c=b.length;a--;)(3===e&&1===a%2||2>=e&&0<a&&a<c-1)&&b.splice(a,1);this.finalTickAmt=void 0}},setScale:function(){var a,b;this.oldMin=this.min;this.oldMax=this.max;this.oldAxisLength=this.len;this.setAxisSize();b=this.len!==this.oldAxisLength;d(this.series,function(b){if(b.isDirtyData||b.isDirty||b.xAxis.isDirty)a=!0});b||a||this.isLinked||this.forceRedraw||this.userMin!==this.oldUserMin||this.userMax!==this.oldUserMax||this.alignToOthers()?(this.resetStacks&&
|
||||
this.resetStacks(),this.forceRedraw=!1,this.getSeriesExtremes(),this.setTickInterval(),this.oldUserMin=this.userMin,this.oldUserMax=this.userMax,this.isDirty||(this.isDirty=b||this.min!==this.oldMin||this.max!==this.oldMax)):this.cleanStacks&&this.cleanStacks()},setExtremes:function(a,b,c,e,l){var p=this,g=p.chart;c=x(c,!0);d(p.series,function(a){delete a.kdTree});l=w(l,{min:a,max:b});B(p,"setExtremes",l,function(){p.userMin=a;p.userMax=b;p.eventArgs=l;c&&g.redraw(e)})},zoom:function(a,b){var c=this.dataMin,
|
||||
e=this.dataMax,d=this.options,p=Math.min(c,x(d.min,c)),d=Math.max(e,x(d.max,e));if(a!==this.min||b!==this.max)this.allowZoomOutside||(n(c)&&a<=p&&(a=p),n(e)&&b>=d&&(b=d)),this.displayBtn=void 0!==a||void 0!==b,this.setExtremes(a,b,!1,void 0,{trigger:"zoom"});return!0},setAxisSize:function(){var a=this.chart,b=this.options,c=b.offsetLeft||0,e=this.horiz,d=x(b.width,a.plotWidth-c+(b.offsetRight||0)),l=x(b.height,a.plotHeight),g=x(b.top,a.plotTop),b=x(b.left,a.plotLeft+c),c=/%$/;c.test(l)&&(l=Math.round(parseFloat(l)/
|
||||
100*a.plotHeight));c.test(g)&&(g=Math.round(parseFloat(g)/100*a.plotHeight+a.plotTop));this.left=b;this.top=g;this.width=d;this.height=l;this.bottom=a.chartHeight-l-g;this.right=a.chartWidth-d-b;this.len=Math.max(e?d:l,0);this.pos=e?b:g},getExtremes:function(){var a=this.isLog,b=this.lin2log;return{min:a?h(b(this.min)):this.min,max:a?h(b(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(a){var b=this.isLog,c=this.lin2log,
|
||||
e=b?c(this.min):this.min,b=b?c(this.max):this.max;null===a?a=e:e>a?a=e:b<a&&(a=b);return this.translate(a,0,1,0,1)},autoLabelAlign:function(a){a=(x(a,0)-90*this.side+720)%360;return 15<a&&165>a?"right":195<a&&345>a?"left":"center"},tickSize:function(a){var b=this.options,c=b[a+"Length"],e=x(b[a+"Width"],"tick"===a&&this.isXAxis?1:0);if(e&&c)return"inside"===b[a+"Position"]&&(c=-c),[c,e]},labelMetrics:function(){return this.chart.renderer.fontMetrics(this.options.labels.style&&this.options.labels.style.fontSize,
|
||||
this.ticks[0]&&this.ticks[0].label)},unsquish:function(){var a=this.options.labels,b=this.horiz,c=this.tickInterval,e=c,l=this.len/(((this.categories?1:0)+this.max-this.min)/c),g,r=a.rotation,u=this.labelMetrics(),f,h=Number.MAX_VALUE,t,H=function(a){a/=l||1;a=1<a?Math.ceil(a):1;return a*c};b?(t=!a.staggerLines&&!a.step&&(n(r)?[r]:l<x(a.autoRotationLimit,80)&&a.autoRotation))&&d(t,function(a){var b;if(a===r||a&&-90<=a&&90>=a)f=H(Math.abs(u.h/Math.sin(k*a))),b=f+Math.abs(a/360),b<h&&(h=b,g=a,e=f)}):
|
||||
a.step||(e=H(u.h));this.autoRotation=t;this.labelRotation=x(g,r);return e},getSlotWidth:function(){var a=this.chart,b=this.horiz,c=this.options.labels,e=Math.max(this.tickPositions.length-(this.categories?0:1),1),d=a.margin[3];return b&&2>(c.step||0)&&!c.rotation&&(this.staggerLines||1)*a.plotWidth/e||!b&&(d&&d-a.spacing[3]||.33*a.chartWidth)},renderUnsquish:function(){var a=this.chart,b=a.renderer,c=this.tickPositions,e=this.ticks,l=this.options.labels,g=this.horiz,r=this.getSlotWidth(),u=Math.max(1,
|
||||
Math.round(r-2*(l.padding||5))),f={},h=this.labelMetrics(),k=l.style&&l.style.textOverflow,H,w=0,x,G;t(l.rotation)||(f.rotation=l.rotation||0);d(c,function(a){(a=e[a])&&a.labelLength>w&&(w=a.labelLength)});this.maxLabelLength=w;if(this.autoRotation)w>u&&w>h.h?f.rotation=this.labelRotation:this.labelRotation=0;else if(r&&(H={width:u+"px"},!k))for(H.textOverflow="clip",x=c.length;!g&&x--;)if(G=c[x],u=e[G].label)u.styles&&"ellipsis"===u.styles.textOverflow?u.css({textOverflow:"clip"}):e[G].labelLength>
|
||||
r&&u.css({width:r+"px"}),u.getBBox().height>this.len/c.length-(h.h-h.f)&&(u.specCss={textOverflow:"ellipsis"});f.rotation&&(H={width:(w>.5*a.chartHeight?.33*a.chartHeight:a.chartHeight)+"px"},k||(H.textOverflow="ellipsis"));if(this.labelAlign=l.align||this.autoLabelAlign(this.labelRotation))f.align=this.labelAlign;d(c,function(a){var b=(a=e[a])&&a.label;b&&(b.attr(f),H&&b.css(y(H,b.specCss)),delete b.specCss,a.rotation=f.rotation)});this.tickRotCorr=b.rotCorr(h.b,this.labelRotation||0,0!==this.side)},
|
||||
hasData:function(){return this.hasVisibleSeries||n(this.min)&&n(this.max)&&!!this.tickPositions},getOffset:function(){var a=this,b=a.chart,c=b.renderer,e=a.options,l=a.tickPositions,g=a.ticks,r=a.horiz,u=a.side,f=b.inverted?[1,0,3,2][u]:u,h,k,t=0,H,w=0,y=e.title,G=e.labels,K=0,v=a.opposite,q=b.axisOffset,b=b.clipOffset,m=[-1,1,1,-1][u],B,I=e.className,L=a.axisParent,z=this.tickSize("tick");h=a.hasData();a.showAxis=k=h||x(e.showEmpty,!0);a.staggerLines=a.horiz&&G.staggerLines;a.axisGroup||(a.gridGroup=
|
||||
c.g("grid").attr({zIndex:e.gridZIndex||1}).addClass("highcharts-"+this.coll.toLowerCase()+"-grid "+(I||"")).add(L),a.axisGroup=c.g("axis").attr({zIndex:e.zIndex||2}).addClass("highcharts-"+this.coll.toLowerCase()+" "+(I||"")).add(L),a.labelGroup=c.g("axis-labels").attr({zIndex:G.zIndex||7}).addClass("highcharts-"+a.coll.toLowerCase()+"-labels "+(I||"")).add(L));if(h||a.isLinked)d(l,function(b){g[b]?g[b].addLabel():g[b]=new N(a,b)}),a.renderUnsquish(),!1===G.reserveSpace||0!==u&&2!==u&&{1:"left",3:"right"}[u]!==
|
||||
a.labelAlign&&"center"!==a.labelAlign||d(l,function(a){K=Math.max(g[a].getLabelSize(),K)}),a.staggerLines&&(K*=a.staggerLines,a.labelOffset=K*(a.opposite?-1:1));else for(B in g)g[B].destroy(),delete g[B];y&&y.text&&!1!==y.enabled&&(a.axisTitle||((B=y.textAlign)||(B=(r?{low:"left",middle:"center",high:"right"}:{low:v?"right":"left",middle:"center",high:v?"left":"right"})[y.align]),a.axisTitle=c.text(y.text,0,0,y.useHTML).attr({zIndex:7,rotation:y.rotation||0,align:B}).addClass("highcharts-axis-title").css(y.style).add(a.axisGroup),
|
||||
a.axisTitle.isNew=!0),k&&(t=a.axisTitle.getBBox()[r?"height":"width"],H=y.offset,w=n(H)?0:x(y.margin,r?5:10)),a.axisTitle[k?"show":"hide"](!0));a.renderLine();a.offset=m*x(e.offset,q[u]);a.tickRotCorr=a.tickRotCorr||{x:0,y:0};c=0===u?-a.labelMetrics().h:2===u?a.tickRotCorr.y:0;w=Math.abs(K)+w;K&&(w=w-c+m*(r?x(G.y,a.tickRotCorr.y+8*m):G.x));a.axisTitleMargin=x(H,w);q[u]=Math.max(q[u],a.axisTitleMargin+t+m*a.offset,w,h&&l.length&&z?z[0]:0);e=e.offset?0:2*Math.floor(a.axisLine.strokeWidth()/2);b[f]=
|
||||
Math.max(b[f],e)},getLinePath:function(a){var b=this.chart,c=this.opposite,e=this.offset,d=this.horiz,l=this.left+(c?this.width:0)+e,e=b.chartHeight-this.bottom-(c?this.height:0)+e;c&&(a*=-1);return b.renderer.crispLine(["M",d?this.left:l,d?e:this.top,"L",d?b.chartWidth-this.right:l,d?e:b.chartHeight-this.bottom],a)},renderLine:function(){this.axisLine||(this.axisLine=this.chart.renderer.path().addClass("highcharts-axis-line").add(this.axisGroup),this.axisLine.attr({stroke:this.options.lineColor,
|
||||
"stroke-width":this.options.lineWidth,zIndex:7}))},getTitlePosition:function(){var a=this.horiz,b=this.left,c=this.top,e=this.len,d=this.options.title,l=a?b:c,g=this.opposite,r=this.offset,u=d.x||0,f=d.y||0,h=this.chart.renderer.fontMetrics(d.style&&d.style.fontSize,this.axisTitle).f,e={low:l+(a?0:e),middle:l+e/2,high:l+(a?e:0)}[d.align],b=(a?c+this.height:b)+(a?1:-1)*(g?-1:1)*this.axisTitleMargin+(2===this.side?h:0);return{x:a?e+u:b+(g?this.width:0)+r+u,y:a?b+f-(g?this.height:0)+r:e+f}},render:function(){var a=
|
||||
this,c=a.chart,e=c.renderer,l=a.options,g=a.isLog,r=a.lin2log,u=a.isLinked,f=a.tickPositions,h=a.axisTitle,k=a.ticks,t=a.minorTicks,w=a.alternateBands,y=l.stackLabels,x=l.alternateGridColor,G=a.tickmarkOffset,n=a.axisLine,K=c.hasRendered&&b(a.oldMin),v=a.showAxis,q=z(e.globalAnimation),m,B;a.labelEdge.length=0;a.overlap=!1;d([k,t,w],function(a){for(var b in a)a[b].isActive=!1});if(a.hasData()||u)a.minorTickInterval&&!a.categories&&d(a.getMinorTickPositions(),function(b){t[b]||(t[b]=new N(a,b,"minor"));
|
||||
K&&t[b].isNew&&t[b].render(null,!0);t[b].render(null,!1,1)}),f.length&&(d(f,function(b,c){if(!u||b>=a.min&&b<=a.max)k[b]||(k[b]=new N(a,b)),K&&k[b].isNew&&k[b].render(c,!0,.1),k[b].render(c)}),G&&(0===a.min||a.single)&&(k[-1]||(k[-1]=new N(a,-1,null,!0)),k[-1].render(-1))),x&&d(f,function(b,e){B=void 0!==f[e+1]?f[e+1]+G:a.max-G;0===e%2&&b<a.max&&B<=a.max+(c.polar?-G:G)&&(w[b]||(w[b]=new I(a)),m=b+G,w[b].options={from:g?r(m):m,to:g?r(B):B,color:x},w[b].render(),w[b].isActive=!0)}),a._addedPlotLB||
|
||||
(d((l.plotLines||[]).concat(l.plotBands||[]),function(b){a.addPlotBandOrLine(b)}),a._addedPlotLB=!0);d([k,t,w],function(a){var b,e,d=[],l=q.duration;for(b in a)a[b].isActive||(a[b].render(b,!1,0),a[b].isActive=!1,d.push(b));H(function(){for(e=d.length;e--;)a[d[e]]&&!a[d[e]].isActive&&(a[d[e]].destroy(),delete a[d[e]])},a!==w&&c.hasRendered&&l?l:0)});n&&(n[n.isPlaced?"animate":"attr"]({d:this.getLinePath(n.strokeWidth())}),n.isPlaced=!0,n[v?"show":"hide"](!0));h&&v&&(h[h.isNew?"attr":"animate"](a.getTitlePosition()),
|
||||
h.isNew=!1);y&&y.enabled&&a.renderStackTotals();a.isDirty=!1},redraw:function(){this.visible&&(this.render(),d(this.plotLinesAndBands,function(a){a.render()}));d(this.series,function(a){a.isDirty=!0})},destroy:function(a){var b=this,c=b.stacks,e,l=b.plotLinesAndBands,g;a||r(b);for(e in c)v(c[e]),c[e]=null;d([b.ticks,b.minorTicks,b.alternateBands],function(a){v(a)});if(l)for(a=l.length;a--;)l[a].destroy();d("stackTotalGroup axisLine axisTitle axisGroup gridGroup labelGroup cross".split(" "),function(a){b[a]&&
|
||||
(b[a]=b[a].destroy())});l="extKey hcEvents names series userMax userMin".split(" ");for(g in b)b.hasOwnProperty(g)&&-1===u(g,l)&&delete b[g]},drawCrosshair:function(a,b){var c,e=this.crosshair,d=x(e.snap,!0),l,g=this.cross;a||(a=this.cross&&this.cross.e);this.crosshair&&!1!==(n(b)||!d)?(d?n(b)&&(l=this.isXAxis?b.plotX:this.len-b.plotY):l=a&&(this.horiz?a.chartX-this.pos:this.len-a.chartY+this.pos),n(l)&&(c=this.getPlotLinePath(b&&(this.isXAxis?b.x:x(b.stackY,b.y)),null,null,null,l)||null),n(c)?(b=
|
||||
this.categories&&!this.isRadial,g||(this.cross=g=this.chart.renderer.path().addClass("highcharts-crosshair highcharts-crosshair-"+(b?"category ":"thin ")+e.className).attr({zIndex:x(e.zIndex,2)}).add(),g.attr({stroke:e.color||(b?f("#ccd6eb").setOpacity(.25).get():"#cccccc"),"stroke-width":x(e.width,1)}),e.dashStyle&&g.attr({dashstyle:e.dashStyle})),g.show().attr({d:c}),b&&!e.width&&g.attr({"stroke-width":this.transA}),this.cross.e=a):this.hideCrosshair()):this.hideCrosshair()},hideCrosshair:function(){this.cross&&
|
||||
this.cross.hide()}};w(a.Axis.prototype,m)})(M);(function(a){var D=a.Axis,z=a.Date,F=a.dateFormat,J=a.defaultOptions,m=a.defined,f=a.each,h=a.extend,q=a.getMagnitude,n=a.getTZOffset,k=a.normalizeTickInterval,v=a.pick,d=a.timeUnits;D.prototype.getTimeTicks=function(a,k,q,c){var e=[],l={},g=J.global.useUTC,w,b=new z(k-n(k)),t,y=z.hcMakeTime,K=a.unitRange,x=a.count,B;if(m(k)){b[z.hcSetMilliseconds](K>=d.second?0:x*Math.floor(b.getMilliseconds()/x));if(K>=d.second)b[z.hcSetSeconds](K>=d.minute?0:x*Math.floor(b.getSeconds()/
|
||||
x));if(K>=d.minute)b[z.hcSetMinutes](K>=d.hour?0:x*Math.floor(b[z.hcGetMinutes]()/x));K>=d.hour&&(b[z.hcSetHours](K>=d.day?0:x*Math.floor(b[z.hcGetHours]()/x)),t=b[z.hcGetHours]());if(K>=d.day)b[z.hcSetDate](K>=d.month?1:x*Math.floor(b[z.hcGetDate]()/x));K>=d.month&&(b[z.hcSetMonth](K>=d.year?0:x*Math.floor(b[z.hcGetMonth]()/x)),w=b[z.hcGetFullYear]());if(K>=d.year)b[z.hcSetFullYear](w-w%x);if(K===d.week)b[z.hcSetDate](b[z.hcGetDate]()-b[z.hcGetDay]()+v(c,1));c=1;if(z.hcTimezoneOffset||z.hcGetTimezoneOffset)B=
|
||||
(!g||!!z.hcGetTimezoneOffset)&&(q-k>4*d.month||n(k)!==n(q)),b=b.getTime(),b=new z(b+n(b));w=b[z.hcGetFullYear]();k=b.getTime();g=b[z.hcGetMonth]();for(b=b[z.hcGetDate]();k<q;)e.push(k),k=K===d.year?y(w+c*x,0):K===d.month?y(w,g+c*x):!B||K!==d.day&&K!==d.week?B&&K===d.hour?y(w,g,b,t+c*x):k+K*x:y(w,g,b+c*x*(K===d.day?1:7)),c++;e.push(k);K<=d.hour&&f(e,function(a){"000000000"===F("%H%M%S%L",a)&&(l[a]="day")})}e.info=h(a,{higherRanks:l,totalRange:K*x});return e};D.prototype.normalizeTimeTickInterval=function(a,
|
||||
f){var g=f||[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1,2]],["week",[1,2]],["month",[1,2,3,4,6]],["year",null]];f=g[g.length-1];var c=d[f[0]],e=f[1],l;for(l=0;l<g.length&&!(f=g[l],c=d[f[0]],e=f[1],g[l+1]&&a<=(c*e[e.length-1]+d[g[l+1][0]])/2);l++);c===d.year&&a<5*c&&(e=[1,2,5]);a=k(a/c,e,"year"===f[0]?Math.max(q(a/c),1):1);return{unitRange:c,count:a,unitName:f[0]}}})(M);(function(a){var D=a.Axis,z=a.getMagnitude,
|
||||
F=a.map,J=a.normalizeTickInterval,m=a.pick;D.prototype.getLogTickPositions=function(a,h,q,n){var f=this.options,v=this.len,d=this.lin2log,g=this.log2lin,w=[];n||(this._minorAutoInterval=null);if(.5<=a)a=Math.round(a),w=this.getLinearTickPositions(a,h,q);else if(.08<=a)for(var v=Math.floor(h),B,c,e,l,u,f=.3<a?[1,2,4]:.15<a?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];v<q+1&&!u;v++)for(c=f.length,B=0;B<c&&!u;B++)e=g(d(v)*f[B]),e>h&&(!n||l<=q)&&void 0!==l&&w.push(l),l>q&&(u=!0),l=e;else h=d(h),q=d(q),a=f[n?"minorTickInterval":
|
||||
"tickInterval"],a=m("auto"===a?null:a,this._minorAutoInterval,f.tickPixelInterval/(n?5:1)*(q-h)/((n?v/this.tickPositions.length:v)||1)),a=J(a,null,z(a)),w=F(this.getLinearTickPositions(a,h,q),g),n||(this._minorAutoInterval=a/5);n||(this.tickInterval=a);return w};D.prototype.log2lin=function(a){return Math.log(a)/Math.LN10};D.prototype.lin2log=function(a){return Math.pow(10,a)}})(M);(function(a){var D=a.dateFormat,z=a.each,F=a.extend,J=a.format,m=a.isNumber,f=a.map,h=a.merge,q=a.pick,n=a.splat,k=a.stop,
|
||||
v=a.syncTimeout,d=a.timeUnits;a.Tooltip=function(){this.init.apply(this,arguments)};a.Tooltip.prototype={init:function(a,d){this.chart=a;this.options=d;this.crosshairs=[];this.now={x:0,y:0};this.isHidden=!0;this.split=d.split&&!a.inverted;this.shared=d.shared||this.split},cleanSplit:function(a){z(this.chart.series,function(d){var g=d&&d.tt;g&&(!g.isActive||a?d.tt=g.destroy():g.isActive=!1)})},getLabel:function(){var a=this.chart.renderer,d=this.options;this.label||(this.split?this.label=a.g("tooltip"):
|
||||
(this.label=a.label("",0,0,d.shape||"callout",null,null,d.useHTML,null,"tooltip").attr({padding:d.padding,r:d.borderRadius}),this.label.attr({fill:d.backgroundColor,"stroke-width":d.borderWidth}).css(d.style).shadow(d.shadow)),this.label.attr({zIndex:8}).add());return this.label},update:function(a){this.destroy();this.init(this.chart,h(!0,this.options,a))},destroy:function(){this.label&&(this.label=this.label.destroy());this.split&&this.tt&&(this.cleanSplit(this.chart,!0),this.tt=this.tt.destroy());
|
||||
clearTimeout(this.hideTimer);clearTimeout(this.tooltipTimeout)},move:function(a,d,f,c){var e=this,l=e.now,g=!1!==e.options.animation&&!e.isHidden&&(1<Math.abs(a-l.x)||1<Math.abs(d-l.y)),h=e.followPointer||1<e.len;F(l,{x:g?(2*l.x+a)/3:a,y:g?(l.y+d)/2:d,anchorX:h?void 0:g?(2*l.anchorX+f)/3:f,anchorY:h?void 0:g?(l.anchorY+c)/2:c});e.getLabel().attr(l);g&&(clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){e&&e.move(a,d,f,c)},32))},hide:function(a){var d=this;clearTimeout(this.hideTimer);
|
||||
a=q(a,this.options.hideDelay,500);this.isHidden||(this.hideTimer=v(function(){d.getLabel()[a?"fadeOut":"hide"]();d.isHidden=!0},a))},getAnchor:function(a,d){var g,c=this.chart,e=c.inverted,l=c.plotTop,u=c.plotLeft,h=0,b=0,k,y;a=n(a);g=a[0].tooltipPos;this.followPointer&&d&&(void 0===d.chartX&&(d=c.pointer.normalize(d)),g=[d.chartX-c.plotLeft,d.chartY-l]);g||(z(a,function(a){k=a.series.yAxis;y=a.series.xAxis;h+=a.plotX+(!e&&y?y.left-u:0);b+=(a.plotLow?(a.plotLow+a.plotHigh)/2:a.plotY)+(!e&&k?k.top-
|
||||
l:0)}),h/=a.length,b/=a.length,g=[e?c.plotWidth-b:h,this.shared&&!e&&1<a.length&&d?d.chartY-l:e?c.plotHeight-h:b]);return f(g,Math.round)},getPosition:function(a,d,f){var c=this.chart,e=this.distance,l={},g=f.h||0,h,b=["y",c.chartHeight,d,f.plotY+c.plotTop,c.plotTop,c.plotTop+c.plotHeight],k=["x",c.chartWidth,a,f.plotX+c.plotLeft,c.plotLeft,c.plotLeft+c.plotWidth],y=!this.followPointer&&q(f.ttBelow,!c.inverted===!!f.negative),n=function(a,b,c,d,r,u){var p=c<d-e,f=d+e+c<b,h=d-e-c;d+=e;if(y&&f)l[a]=
|
||||
d;else if(!y&&p)l[a]=h;else if(p)l[a]=Math.min(u-c,0>h-g?h:h-g);else if(f)l[a]=Math.max(r,d+g+c>b?d:d+g);else return!1},x=function(a,b,c,d){var g;d<e||d>b-e?g=!1:l[a]=d<c/2?1:d>b-c/2?b-c-2:d-c/2;return g},w=function(a){var c=b;b=k;k=c;h=a},r=function(){!1!==n.apply(0,b)?!1!==x.apply(0,k)||h||(w(!0),r()):h?l.x=l.y=0:(w(!0),r())};(c.inverted||1<this.len)&&w();r();return l},defaultFormatter:function(a){var d=this.points||n(this),g;g=[a.tooltipFooterHeaderFormatter(d[0])];g=g.concat(a.bodyFormatter(d));
|
||||
g.push(a.tooltipFooterHeaderFormatter(d[0],!0));return g},refresh:function(a,d){var g=this.chart,c=this.getLabel(),e=this.options,l,u,f={},b,h=[];b=e.formatter||this.defaultFormatter;var f=g.hoverPoints,y=this.shared;clearTimeout(this.hideTimer);this.followPointer=n(a)[0].series.tooltipOptions.followPointer;u=this.getAnchor(a,d);d=u[0];l=u[1];!y||a.series&&a.series.noSharedTooltip?f=a.getLabelConfig():(g.hoverPoints=a,f&&z(f,function(a){a.setState()}),z(a,function(a){a.setState("hover");h.push(a.getLabelConfig())}),
|
||||
f={x:a[0].category,y:a[0].y},f.points=h,this.len=h.length,a=a[0]);b=b.call(f,this);f=a.series;this.distance=q(f.tooltipOptions.distance,16);!1===b?this.hide():(this.isHidden&&(k(c),c.attr({opacity:1}).show()),this.split?this.renderSplit(b,g.hoverPoints):(c.attr({text:b.join?b.join(""):b}),c.removeClass(/highcharts-color-[\d]+/g).addClass("highcharts-color-"+q(a.colorIndex,f.colorIndex)),c.attr({stroke:e.borderColor||a.color||f.color||"#666666"}),this.updatePosition({plotX:d,plotY:l,negative:a.negative,
|
||||
ttBelow:a.ttBelow,h:u[2]||0})),this.isHidden=!1)},renderSplit:function(d,f){var g=this,c=[],e=this.chart,l=e.renderer,u=!0,h=this.options,b,k=this.getLabel();z(d.slice(0,d.length-1),function(a,d){d=f[d-1]||{isHeader:!0,plotX:f[0].plotX};var t=d.series||g,y=t.tt,r=d.series||{},G="highcharts-color-"+q(d.colorIndex,r.colorIndex,"none");y||(t.tt=y=l.label(null,null,null,d.isHeader&&"callout").addClass("highcharts-tooltip-box "+G).attr({padding:h.padding,r:h.borderRadius,fill:h.backgroundColor,stroke:d.color||
|
||||
r.color||"#333333","stroke-width":h.borderWidth}).add(k),d.series&&(y.connector=l.path().addClass("highcharts-tooltip-connector "+G).attr({"stroke-width":r.options.lineWidth||2,stroke:d.color||r.color||"#666666"}).add(y)));y.isActive=!0;y.attr({text:a});a=y.getBBox();r=a.width+y.strokeWidth();d.isHeader?(b=a.height,r=Math.max(0,Math.min(d.plotX+e.plotLeft-r/2,e.chartWidth-r))):r=d.plotX+e.plotLeft-q(h.distance,16)-r;0>r&&(u=!1);a=(d.series&&d.series.yAxis&&d.series.yAxis.pos)+(d.plotY||0);a-=e.plotTop;
|
||||
c.push({target:d.isHeader?e.plotHeight+b:a,rank:d.isHeader?1:0,size:t.tt.getBBox().height+1,point:d,x:r,tt:y})});this.cleanSplit();a.distribute(c,e.plotHeight+b);z(c,function(a){var b=a.point,c=a.tt,d;d={visibility:void 0===a.pos?"hidden":"inherit",x:u||b.isHeader?a.x:b.plotX+e.plotLeft+q(h.distance,16),y:a.pos+e.plotTop};b.isHeader&&(d.anchorX=b.plotX+e.plotLeft,d.anchorY=d.y-100);c.attr(d);b.isHeader||c.connector.attr({d:["M",b.plotX+e.plotLeft-d.x,b.plotY+b.series.yAxis.pos-d.y,"L",(u?-1:1)*q(h.distance,
|
||||
16)+b.plotX+e.plotLeft-d.x,a.pos+e.plotTop+c.getBBox().height/2-d.y]})})},updatePosition:function(a){var d=this.chart,g=this.getLabel(),g=(this.options.positioner||this.getPosition).call(this,g.width,g.height,a);this.move(Math.round(g.x),Math.round(g.y||0),a.plotX+d.plotLeft,a.plotY+d.plotTop)},getXDateFormat:function(a,f,h){var c;f=f.dateTimeLabelFormats;var e=h&&h.closestPointRange,l,g={millisecond:15,second:12,minute:9,hour:6,day:3},k,b="millisecond";if(e){k=D("%m-%d %H:%M:%S.%L",a.x);for(l in d){if(e===
|
||||
d.week&&+D("%w",a.x)===h.options.startOfWeek&&"00:00:00.000"===k.substr(6)){l="week";break}if(d[l]>e){l=b;break}if(g[l]&&k.substr(g[l])!=="01-01 00:00:00.000".substr(g[l]))break;"week"!==l&&(b=l)}l&&(c=f[l])}else c=f.day;return c||f.year},tooltipFooterHeaderFormatter:function(a,d){var g=d?"footer":"header";d=a.series;var c=d.tooltipOptions,e=c.xDateFormat,l=d.xAxis,u=l&&"datetime"===l.options.type&&m(a.key),g=c[g+"Format"];u&&!e&&(e=this.getXDateFormat(a,c,l));u&&e&&(g=g.replace("{point.key}","{point.key:"+
|
||||
e+"}"));return J(g,{point:a,series:d})},bodyFormatter:function(a){return f(a,function(a){var d=a.series.tooltipOptions;return(d.pointFormatter||a.point.tooltipFormatter).call(a.point,d.pointFormat)})}}})(M);(function(a){var D=a.addEvent,z=a.attr,F=a.charts,J=a.color,m=a.css,f=a.defined,h=a.doc,q=a.each,n=a.extend,k=a.fireEvent,v=a.offset,d=a.pick,g=a.removeEvent,w=a.splat,B=a.Tooltip,c=a.win;a.Pointer=function(a,c){this.init(a,c)};a.Pointer.prototype={init:function(a,c){this.options=c;this.chart=
|
||||
a;this.runChartClick=c.chart.events&&!!c.chart.events.click;this.pinchDown=[];this.lastValidTouch={};B&&c.tooltip.enabled&&(a.tooltip=new B(a,c.tooltip),this.followTouchMove=d(c.tooltip.followTouchMove,!0));this.setDOMEvents()},zoomOption:function(){var a=this.chart,c=a.options.chart.zoomType,d=/x/.test(c),c=/y/.test(c),a=a.inverted;this.zoomX=d;this.zoomY=c;this.zoomHor=d&&!a||c&&a;this.zoomVert=c&&!a||d&&a;this.hasZoom=d||c},normalize:function(a,d){var e,l;a=a||c.event;a.target||(a.target=a.srcElement);
|
||||
l=a.touches?a.touches.length?a.touches.item(0):a.changedTouches[0]:a;d||(this.chartPosition=d=v(this.chart.container));void 0===l.pageX?(e=Math.max(a.x,a.clientX-d.left),d=a.y):(e=l.pageX-d.left,d=l.pageY-d.top);return n(a,{chartX:Math.round(e),chartY:Math.round(d)})},getCoordinates:function(a){var c={xAxis:[],yAxis:[]};q(this.chart.axes,function(e){c[e.isXAxis?"xAxis":"yAxis"].push({axis:e,value:e.toValue(a[e.horiz?"chartX":"chartY"])})});return c},runPointActions:function(c){var e=this.chart,g=
|
||||
e.series,f=e.tooltip,b=f?f.shared:!1,k=!0,y=e.hoverPoint,n=e.hoverSeries,x,v,r,G=[],H;if(!b&&!n)for(x=0;x<g.length;x++)if(g[x].directTouch||!g[x].options.stickyTracking)g=[];n&&(b?n.noSharedTooltip:n.directTouch)&&y?G=[y]:(b||!n||n.options.stickyTracking||(g=[n]),q(g,function(a){v=a.noSharedTooltip&&b;r=!b&&a.directTouch;a.visible&&!v&&!r&&d(a.options.enableMouseTracking,!0)&&(H=a.searchPoint(c,!v&&1===a.kdDimensions))&&H.series&&G.push(H)}),G.sort(function(a,c){var e=a.distX-c.distX,d=a.dist-c.dist;
|
||||
return 0!==e&&b?e:0!==d?d:a.series.group.zIndex>c.series.group.zIndex?-1:1}));if(b)for(x=G.length;x--;)(G[x].x!==G[0].x||G[x].series.noSharedTooltip)&&G.splice(x,1);if(G[0]&&(G[0]!==this.prevKDPoint||f&&f.isHidden)){if(b&&!G[0].series.noSharedTooltip){for(x=0;x<G.length;x++)G[x].onMouseOver(c,G[x]!==(n&&n.directTouch&&y||G[0]));G.length&&f&&f.refresh(G.sort(function(a,b){return a.series.index-b.series.index}),c)}else if(f&&f.refresh(G[0],c),!n||!n.directTouch)G[0].onMouseOver(c);this.prevKDPoint=
|
||||
G[0];k=!1}k&&(g=n&&n.tooltipOptions.followPointer,f&&g&&!f.isHidden&&(g=f.getAnchor([{}],c),f.updatePosition({plotX:g[0],plotY:g[1]})));this._onDocumentMouseMove||(this._onDocumentMouseMove=function(b){if(F[a.hoverChartIndex])F[a.hoverChartIndex].pointer.onDocumentMouseMove(b)},D(h,"mousemove",this._onDocumentMouseMove));q(b?G:[d(y,G[0])],function(a){q(e.axes,function(b){(!a||a.series&&a.series[b.coll]===b)&&b.drawCrosshair(c,a)})})},reset:function(a,c){var e=this.chart,d=e.hoverSeries,b=e.hoverPoint,
|
||||
l=e.hoverPoints,f=e.tooltip,k=f&&f.shared?l:b;a&&k&&q(w(k),function(b){b.series.isCartesian&&void 0===b.plotX&&(a=!1)});if(a)f&&k&&(f.refresh(k),b&&(b.setState(b.state,!0),q(e.axes,function(a){a.crosshair&&a.drawCrosshair(null,b)})));else{if(b)b.onMouseOut();l&&q(l,function(a){a.setState()});if(d)d.onMouseOut();f&&f.hide(c);this._onDocumentMouseMove&&(g(h,"mousemove",this._onDocumentMouseMove),this._onDocumentMouseMove=null);q(e.axes,function(a){a.hideCrosshair()});this.hoverX=this.prevKDPoint=e.hoverPoints=
|
||||
e.hoverPoint=null}},scaleGroups:function(a,c){var e=this.chart,d;q(e.series,function(b){d=a||b.getPlotBox();b.xAxis&&b.xAxis.zoomEnabled&&b.group&&(b.group.attr(d),b.markerGroup&&(b.markerGroup.attr(d),b.markerGroup.clip(c?e.clipRect:null)),b.dataLabelsGroup&&b.dataLabelsGroup.attr(d))});e.clipRect.attr(c||e.clipBox)},dragStart:function(a){var c=this.chart;c.mouseIsDown=a.type;c.cancelClick=!1;c.mouseDownX=this.mouseDownX=a.chartX;c.mouseDownY=this.mouseDownY=a.chartY},drag:function(a){var c=this.chart,
|
||||
e=c.options.chart,d=a.chartX,b=a.chartY,g=this.zoomHor,f=this.zoomVert,h=c.plotLeft,k=c.plotTop,n=c.plotWidth,r=c.plotHeight,G,H=this.selectionMarker,v=this.mouseDownX,p=this.mouseDownY,q=e.panKey&&a[e.panKey+"Key"];H&&H.touch||(d<h?d=h:d>h+n&&(d=h+n),b<k?b=k:b>k+r&&(b=k+r),this.hasDragged=Math.sqrt(Math.pow(v-d,2)+Math.pow(p-b,2)),10<this.hasDragged&&(G=c.isInsidePlot(v-h,p-k),c.hasCartesianSeries&&(this.zoomX||this.zoomY)&&G&&!q&&!H&&(this.selectionMarker=H=c.renderer.rect(h,k,g?1:n,f?1:r,0).attr({fill:e.selectionMarkerFill||
|
||||
J("#335cad").setOpacity(.25).get(),"class":"highcharts-selection-marker",zIndex:7}).add()),H&&g&&(d-=v,H.attr({width:Math.abs(d),x:(0<d?0:d)+v})),H&&f&&(d=b-p,H.attr({height:Math.abs(d),y:(0<d?0:d)+p})),G&&!H&&e.panning&&c.pan(a,e.panning)))},drop:function(a){var c=this,e=this.chart,d=this.hasPinched;if(this.selectionMarker){var b={originalEvent:a,xAxis:[],yAxis:[]},g=this.selectionMarker,h=g.attr?g.attr("x"):g.x,v=g.attr?g.attr("y"):g.y,x=g.attr?g.attr("width"):g.width,w=g.attr?g.attr("height"):
|
||||
g.height,r;if(this.hasDragged||d)q(e.axes,function(e){if(e.zoomEnabled&&f(e.min)&&(d||c[{xAxis:"zoomX",yAxis:"zoomY"}[e.coll]])){var l=e.horiz,g="touchend"===a.type?e.minPixelPadding:0,p=e.toValue((l?h:v)+g),l=e.toValue((l?h+x:v+w)-g);b[e.coll].push({axis:e,min:Math.min(p,l),max:Math.max(p,l)});r=!0}}),r&&k(e,"selection",b,function(a){e.zoom(n(a,d?{animation:!1}:null))});this.selectionMarker=this.selectionMarker.destroy();d&&this.scaleGroups()}e&&(m(e.container,{cursor:e._cursor}),e.cancelClick=10<
|
||||
this.hasDragged,e.mouseIsDown=this.hasDragged=this.hasPinched=!1,this.pinchDown=[])},onContainerMouseDown:function(a){a=this.normalize(a);this.zoomOption();a.preventDefault&&a.preventDefault();this.dragStart(a)},onDocumentMouseUp:function(c){F[a.hoverChartIndex]&&F[a.hoverChartIndex].pointer.drop(c)},onDocumentMouseMove:function(a){var c=this.chart,e=this.chartPosition;a=this.normalize(a,e);!e||this.inClass(a.target,"highcharts-tracker")||c.isInsidePlot(a.chartX-c.plotLeft,a.chartY-c.plotTop)||this.reset()},
|
||||
onContainerMouseLeave:function(c){var e=F[a.hoverChartIndex];e&&(c.relatedTarget||c.toElement)&&(e.pointer.reset(),e.pointer.chartPosition=null)},onContainerMouseMove:function(c){var e=this.chart;f(a.hoverChartIndex)&&F[a.hoverChartIndex]&&F[a.hoverChartIndex].mouseIsDown||(a.hoverChartIndex=e.index);c=this.normalize(c);c.returnValue=!1;"mousedown"===e.mouseIsDown&&this.drag(c);!this.inClass(c.target,"highcharts-tracker")&&!e.isInsidePlot(c.chartX-e.plotLeft,c.chartY-e.plotTop)||e.openMenu||this.runPointActions(c)},
|
||||
inClass:function(a,c){for(var e;a;){if(e=z(a,"class")){if(-1!==e.indexOf(c))return!0;if(-1!==e.indexOf("highcharts-container"))return!1}a=a.parentNode}},onTrackerMouseOut:function(a){var c=this.chart.hoverSeries;a=a.relatedTarget||a.toElement;if(!(!c||!a||c.options.stickyTracking||this.inClass(a,"highcharts-tooltip")||this.inClass(a,"highcharts-series-"+c.index)&&this.inClass(a,"highcharts-tracker")))c.onMouseOut()},onContainerClick:function(a){var c=this.chart,e=c.hoverPoint,d=c.plotLeft,b=c.plotTop;
|
||||
a=this.normalize(a);c.cancelClick||(e&&this.inClass(a.target,"highcharts-tracker")?(k(e.series,"click",n(a,{point:e})),c.hoverPoint&&e.firePointEvent("click",a)):(n(a,this.getCoordinates(a)),c.isInsidePlot(a.chartX-d,a.chartY-b)&&k(c,"click",a)))},setDOMEvents:function(){var c=this,d=c.chart.container;d.onmousedown=function(a){c.onContainerMouseDown(a)};d.onmousemove=function(a){c.onContainerMouseMove(a)};d.onclick=function(a){c.onContainerClick(a)};D(d,"mouseleave",c.onContainerMouseLeave);1===a.chartCount&&
|
||||
D(h,"mouseup",c.onDocumentMouseUp);a.hasTouch&&(d.ontouchstart=function(a){c.onContainerTouchStart(a)},d.ontouchmove=function(a){c.onContainerTouchMove(a)},1===a.chartCount&&D(h,"touchend",c.onDocumentTouchEnd))},destroy:function(){var c;g(this.chart.container,"mouseleave",this.onContainerMouseLeave);a.chartCount||(g(h,"mouseup",this.onDocumentMouseUp),g(h,"touchend",this.onDocumentTouchEnd));clearInterval(this.tooltipTimeout);for(c in this)this[c]=null}}})(M);(function(a){var D=a.charts,z=a.each,
|
||||
F=a.extend,J=a.map,m=a.noop,f=a.pick;F(a.Pointer.prototype,{pinchTranslate:function(a,f,n,k,v,d){(this.zoomHor||this.pinchHor)&&this.pinchTranslateDirection(!0,a,f,n,k,v,d);(this.zoomVert||this.pinchVert)&&this.pinchTranslateDirection(!1,a,f,n,k,v,d)},pinchTranslateDirection:function(a,f,n,k,v,d,g,w){var h=this.chart,c=a?"x":"y",e=a?"X":"Y",l="chart"+e,u=a?"width":"height",q=h["plot"+(a?"Left":"Top")],b,t,y=w||1,m=h.inverted,x=h.bounds[a?"h":"v"],I=1===f.length,r=f[0][l],G=n[0][l],H=!I&&f[1][l],N=
|
||||
!I&&n[1][l],p;n=function(){!I&&20<Math.abs(r-H)&&(y=w||Math.abs(G-N)/Math.abs(r-H));t=(q-G)/y+r;b=h["plot"+(a?"Width":"Height")]/y};n();f=t;f<x.min?(f=x.min,p=!0):f+b>x.max&&(f=x.max-b,p=!0);p?(G-=.8*(G-g[c][0]),I||(N-=.8*(N-g[c][1])),n()):g[c]=[G,N];m||(d[c]=t-q,d[u]=b);d=m?1/y:y;v[u]=b;v[c]=f;k[m?a?"scaleY":"scaleX":"scale"+e]=y;k["translate"+e]=d*q+(G-d*r)},pinch:function(a){var h=this,n=h.chart,k=h.pinchDown,v=a.touches,d=v.length,g=h.lastValidTouch,w=h.hasZoom,B=h.selectionMarker,c={},e=1===
|
||||
d&&(h.inClass(a.target,"highcharts-tracker")&&n.runTrackerClick||h.runChartClick),l={};1<d&&(h.initiated=!0);w&&h.initiated&&!e&&a.preventDefault();J(v,function(a){return h.normalize(a)});"touchstart"===a.type?(z(v,function(a,c){k[c]={chartX:a.chartX,chartY:a.chartY}}),g.x=[k[0].chartX,k[1]&&k[1].chartX],g.y=[k[0].chartY,k[1]&&k[1].chartY],z(n.axes,function(a){if(a.zoomEnabled){var c=n.bounds[a.horiz?"h":"v"],b=a.minPixelPadding,e=a.toPixels(f(a.options.min,a.dataMin)),d=a.toPixels(f(a.options.max,
|
||||
a.dataMax)),g=Math.max(e,d);c.min=Math.min(a.pos,Math.min(e,d)-b);c.max=Math.max(a.pos+a.len,g+b)}}),h.res=!0):k.length&&(B||(h.selectionMarker=B=F({destroy:m,touch:!0},n.plotBox)),h.pinchTranslate(k,v,c,B,l,g),h.hasPinched=w,h.scaleGroups(c,l),!w&&h.followTouchMove&&1===d?this.runPointActions(h.normalize(a)):h.res&&(h.res=!1,this.reset(!1,0)))},touch:function(h,m){var n=this.chart,k;a.hoverChartIndex=n.index;1===h.touches.length?(h=this.normalize(h),n.isInsidePlot(h.chartX-n.plotLeft,h.chartY-n.plotTop)&&
|
||||
!n.openMenu?(m&&this.runPointActions(h),"touchmove"===h.type&&(m=this.pinchDown,k=m[0]?4<=Math.sqrt(Math.pow(m[0].chartX-h.chartX,2)+Math.pow(m[0].chartY-h.chartY,2)):!1),f(k,!0)&&this.pinch(h)):m&&this.reset()):2===h.touches.length&&this.pinch(h)},onContainerTouchStart:function(a){this.zoomOption();this.touch(a,!0)},onContainerTouchMove:function(a){this.touch(a)},onDocumentTouchEnd:function(f){D[a.hoverChartIndex]&&D[a.hoverChartIndex].pointer.drop(f)}})})(M);(function(a){var D=a.addEvent,z=a.charts,
|
||||
F=a.css,J=a.doc,m=a.extend,f=a.noop,h=a.Pointer,q=a.removeEvent,n=a.win,k=a.wrap;if(n.PointerEvent||n.MSPointerEvent){var v={},d=!!n.PointerEvent,g=function(){var a,c=[];c.item=function(a){return this[a]};for(a in v)v.hasOwnProperty(a)&&c.push({pageX:v[a].pageX,pageY:v[a].pageY,target:v[a].target});return c},w=function(d,c,e,l){"touch"!==d.pointerType&&d.pointerType!==d.MSPOINTER_TYPE_TOUCH||!z[a.hoverChartIndex]||(l(d),l=z[a.hoverChartIndex].pointer,l[c]({type:e,target:d.currentTarget,preventDefault:f,
|
||||
touches:g()}))};m(h.prototype,{onContainerPointerDown:function(a){w(a,"onContainerTouchStart","touchstart",function(a){v[a.pointerId]={pageX:a.pageX,pageY:a.pageY,target:a.currentTarget}})},onContainerPointerMove:function(a){w(a,"onContainerTouchMove","touchmove",function(a){v[a.pointerId]={pageX:a.pageX,pageY:a.pageY};v[a.pointerId].target||(v[a.pointerId].target=a.currentTarget)})},onDocumentPointerUp:function(a){w(a,"onDocumentTouchEnd","touchend",function(a){delete v[a.pointerId]})},batchMSEvents:function(a){a(this.chart.container,
|
||||
d?"pointerdown":"MSPointerDown",this.onContainerPointerDown);a(this.chart.container,d?"pointermove":"MSPointerMove",this.onContainerPointerMove);a(J,d?"pointerup":"MSPointerUp",this.onDocumentPointerUp)}});k(h.prototype,"init",function(a,c,e){a.call(this,c,e);this.hasZoom&&F(c.container,{"-ms-touch-action":"none","touch-action":"none"})});k(h.prototype,"setDOMEvents",function(a){a.apply(this);(this.hasZoom||this.followTouchMove)&&this.batchMSEvents(D)});k(h.prototype,"destroy",function(a){this.batchMSEvents(q);
|
||||
a.call(this)})}})(M);(function(a){var D,z=a.addEvent,F=a.css,J=a.discardElement,m=a.defined,f=a.each,h=a.extend,q=a.isFirefox,n=a.marginNames,k=a.merge,v=a.pick,d=a.setAnimation,g=a.stableSort,w=a.win,B=a.wrap;D=a.Legend=function(a,e){this.init(a,e)};D.prototype={init:function(a,e){this.chart=a;this.setOptions(e);e.enabled&&(this.render(),z(this.chart,"endResize",function(){this.legend.positionCheckboxes()}))},setOptions:function(a){var c=v(a.padding,8);this.options=a;this.itemStyle=a.itemStyle;this.itemHiddenStyle=
|
||||
k(this.itemStyle,a.itemHiddenStyle);this.itemMarginTop=a.itemMarginTop||0;this.initialItemX=this.padding=c;this.initialItemY=c-5;this.itemHeight=this.maxItemWidth=0;this.symbolWidth=v(a.symbolWidth,16);this.pages=[]},update:function(a,e){var c=this.chart;this.setOptions(k(!0,this.options,a));this.destroy();c.isDirtyLegend=c.isDirtyBox=!0;v(e,!0)&&c.redraw()},colorizeItem:function(a,e){a.legendGroup[e?"removeClass":"addClass"]("highcharts-legend-item-hidden");var c=this.options,d=a.legendItem,g=a.legendLine,
|
||||
b=a.legendSymbol,f=this.itemHiddenStyle.color,c=e?c.itemStyle.color:f,h=e?a.color||f:f,k=a.options&&a.options.marker,n={fill:h},v;d&&d.css({fill:c,color:c});g&&g.attr({stroke:h});if(b){if(k&&b.isMarker&&(n=a.pointAttribs(),!e))for(v in n)n[v]=f;b.attr(n)}},positionItem:function(a){var c=this.options,d=c.symbolPadding,c=!c.rtl,g=a._legendItemPos,f=g[0],g=g[1],b=a.checkbox;(a=a.legendGroup)&&a.element&&a.translate(c?f:this.legendWidth-f-2*d-4,g);b&&(b.x=f,b.y=g)},destroyItem:function(a){var c=a.checkbox;
|
||||
f(["legendItem","legendLine","legendSymbol","legendGroup"],function(c){a[c]&&(a[c]=a[c].destroy())});c&&J(a.checkbox)},destroy:function(){var a=this.group,e=this.box;e&&(this.box=e.destroy());f(this.getAllItems(),function(a){f(["legendItem","legendGroup"],function(c){a[c]&&(a[c]=a[c].destroy())})});a&&(this.group=a.destroy())},positionCheckboxes:function(a){var c=this.group.alignAttr,d,g=this.clipHeight||this.legendHeight,h=this.titleHeight;c&&(d=c.translateY,f(this.allItems,function(b){var e=b.checkbox,
|
||||
l;e&&(l=d+h+e.y+(a||0)+3,F(e,{left:c.translateX+b.checkboxOffset+e.x-20+"px",top:l+"px",display:l>d-6&&l<d+g-6?"":"none"}))}))},renderTitle:function(){var a=this.padding,e=this.options.title,d=0;e.text&&(this.title||(this.title=this.chart.renderer.label(e.text,a-3,a-4,null,null,null,null,null,"legend-title").attr({zIndex:1}).css(e.style).add(this.group)),a=this.title.getBBox(),d=a.height,this.offsetWidth=a.width,this.contentGroup.attr({translateY:d}));this.titleHeight=d},setText:function(c){var e=
|
||||
this.options;c.legendItem.attr({text:e.labelFormat?a.format(e.labelFormat,c):e.labelFormatter.call(c)})},renderItem:function(a){var c=this.chart,d=c.renderer,g=this.options,f="horizontal"===g.layout,b=this.symbolWidth,h=g.symbolPadding,n=this.itemStyle,m=this.itemHiddenStyle,x=this.padding,w=f?v(g.itemDistance,20):0,r=!g.rtl,G=g.width,H=g.itemMarginBottom||0,q=this.itemMarginTop,p=this.initialItemX,A=a.legendItem,B=!a.series,O=!B&&a.series.drawLegendSymbol?a.series:a,C=O.options,C=this.createCheckboxForItem&&
|
||||
C&&C.showCheckbox,E=g.useHTML;A||(a.legendGroup=d.g("legend-item").addClass("highcharts-"+O.type+"-series highcharts-color-"+a.colorIndex+" "+(a.options.className||"")+(B?"highcharts-series-"+a.index:"")).attr({zIndex:1}).add(this.scrollGroup),a.legendItem=A=d.text("",r?b+h:-h,this.baseline||0,E).css(k(a.visible?n:m)).attr({align:r?"left":"right",zIndex:2}).add(a.legendGroup),this.baseline||(n=n.fontSize,this.fontMetrics=d.fontMetrics(n,A),this.baseline=this.fontMetrics.f+3+q,A.attr("y",this.baseline)),
|
||||
O.drawLegendSymbol(this,a),this.setItemEvents&&this.setItemEvents(a,A,E),C&&this.createCheckboxForItem(a));this.colorizeItem(a,a.visible);this.setText(a);d=A.getBBox();b=a.checkboxOffset=g.itemWidth||a.legendItemWidth||b+h+d.width+w+(C?20:0);this.itemHeight=h=Math.round(a.legendItemHeight||d.height);f&&this.itemX-p+b>(G||c.chartWidth-2*x-p-g.x)&&(this.itemX=p,this.itemY+=q+this.lastLineHeight+H,this.lastLineHeight=0);this.maxItemWidth=Math.max(this.maxItemWidth,b);this.lastItemY=q+this.itemY+H;this.lastLineHeight=
|
||||
Math.max(h,this.lastLineHeight);a._legendItemPos=[this.itemX,this.itemY];f?this.itemX+=b:(this.itemY+=q+h+H,this.lastLineHeight=h);this.offsetWidth=G||Math.max((f?this.itemX-p-w:b)+x,this.offsetWidth)},getAllItems:function(){var a=[];f(this.chart.series,function(c){var e=c&&c.options;c&&v(e.showInLegend,m(e.linkedTo)?!1:void 0,!0)&&(a=a.concat(c.legendItems||("point"===e.legendType?c.data:c)))});return a},adjustMargins:function(a,e){var c=this.chart,d=this.options,g=d.align.charAt(0)+d.verticalAlign.charAt(0)+
|
||||
d.layout.charAt(0);d.floating||f([/(lth|ct|rth)/,/(rtv|rm|rbv)/,/(rbh|cb|lbh)/,/(lbv|lm|ltv)/],function(b,f){b.test(g)&&!m(a[f])&&(c[n[f]]=Math.max(c[n[f]],c.legend[(f+1)%2?"legendHeight":"legendWidth"]+[1,-1,-1,1][f]*d[f%2?"x":"y"]+v(d.margin,12)+e[f]))})},render:function(){var a=this,e=a.chart,d=e.renderer,k=a.group,n,b,t,v,m=a.box,x=a.options,w=a.padding;a.itemX=a.initialItemX;a.itemY=a.initialItemY;a.offsetWidth=0;a.lastItemY=0;k||(a.group=k=d.g("legend").attr({zIndex:7}).add(),a.contentGroup=
|
||||
d.g().attr({zIndex:1}).add(k),a.scrollGroup=d.g().add(a.contentGroup));a.renderTitle();n=a.getAllItems();g(n,function(a,b){return(a.options&&a.options.legendIndex||0)-(b.options&&b.options.legendIndex||0)});x.reversed&&n.reverse();a.allItems=n;a.display=b=!!n.length;a.lastLineHeight=0;f(n,function(b){a.renderItem(b)});t=(x.width||a.offsetWidth)+w;v=a.lastItemY+a.lastLineHeight+a.titleHeight;v=a.handleOverflow(v);v+=w;m||(a.box=m=d.rect().addClass("highcharts-legend-box").attr({r:x.borderRadius}).add(k),
|
||||
m.isNew=!0);m.attr({stroke:x.borderColor,"stroke-width":x.borderWidth||0,fill:x.backgroundColor||"none"}).shadow(x.shadow);0<t&&0<v&&(m[m.isNew?"attr":"animate"](m.crisp({x:0,y:0,width:t,height:v},m.strokeWidth())),m.isNew=!1);m[b?"show":"hide"]();a.legendWidth=t;a.legendHeight=v;f(n,function(b){a.positionItem(b)});b&&k.align(h({width:t,height:v},x),!0,"spacingBox");e.isResizing||this.positionCheckboxes()},handleOverflow:function(a){var c=this,d=this.chart,g=d.renderer,h=this.options,b=h.y,b=d.spacingBox.height+
|
||||
("top"===h.verticalAlign?-b:b)-this.padding,k=h.maxHeight,n,m=this.clipRect,x=h.navigation,w=v(x.animation,!0),r=x.arrowSize||12,G=this.nav,H=this.pages,q=this.padding,p,A=this.allItems,B=function(a){m.attr({height:a});c.contentGroup.div&&(c.contentGroup.div.style.clip="rect("+q+"px,9999px,"+(q+a)+"px,0)")};"horizontal"===h.layout&&(b/=2);k&&(b=Math.min(b,k));H.length=0;a>b&&!1!==x.enabled?(this.clipHeight=n=Math.max(b-20-this.titleHeight-q,0),this.currentPage=v(this.currentPage,1),this.fullHeight=
|
||||
a,f(A,function(a,b){var c=a._legendItemPos[1];a=Math.round(a.legendItem.getBBox().height);var d=H.length;if(!d||c-H[d-1]>n&&(p||c)!==H[d-1])H.push(p||c),d++;b===A.length-1&&c+a-H[d-1]>n&&H.push(c);c!==p&&(p=c)}),m||(m=c.clipRect=g.clipRect(0,q,9999,0),c.contentGroup.clip(m)),B(n),G||(this.nav=G=g.g().attr({zIndex:1}).add(this.group),this.up=g.symbol("triangle",0,0,r,r).on("click",function(){c.scroll(-1,w)}).add(G),this.pager=g.text("",15,10).addClass("highcharts-legend-navigation").css(x.style).add(G),
|
||||
this.down=g.symbol("triangle-down",0,0,r,r).on("click",function(){c.scroll(1,w)}).add(G)),c.scroll(0),a=b):G&&(B(d.chartHeight),G.hide(),this.scrollGroup.attr({translateY:1}),this.clipHeight=0);return a},scroll:function(a,e){var c=this.pages,g=c.length;a=this.currentPage+a;var f=this.clipHeight,b=this.options.navigation,h=this.pager,k=this.padding;a>g&&(a=g);0<a&&(void 0!==e&&d(e,this.chart),this.nav.attr({translateX:k,translateY:f+this.padding+7+this.titleHeight,visibility:"visible"}),this.up.attr({"class":1===
|
||||
a?"highcharts-legend-nav-inactive":"highcharts-legend-nav-active"}),h.attr({text:a+"/"+g}),this.down.attr({x:18+this.pager.getBBox().width,"class":a===g?"highcharts-legend-nav-inactive":"highcharts-legend-nav-active"}),this.up.attr({fill:1===a?b.inactiveColor:b.activeColor}).css({cursor:1===a?"default":"pointer"}),this.down.attr({fill:a===g?b.inactiveColor:b.activeColor}).css({cursor:a===g?"default":"pointer"}),e=-c[a-1]+this.initialItemY,this.scrollGroup.animate({translateY:e}),this.currentPage=
|
||||
a,this.positionCheckboxes(e))}};a.LegendSymbolMixin={drawRectangle:function(a,d){var c=a.options,e=c.symbolHeight||a.fontMetrics.f,c=c.squareSymbol;d.legendSymbol=this.chart.renderer.rect(c?(a.symbolWidth-e)/2:0,a.baseline-e+1,c?e:a.symbolWidth,e,v(a.options.symbolRadius,e/2)).addClass("highcharts-point").attr({zIndex:3}).add(d.legendGroup)},drawLineMarker:function(a){var c=this.options,d=c.marker,g=a.symbolWidth,f=this.chart.renderer,b=this.legendGroup;a=a.baseline-Math.round(.3*a.fontMetrics.b);
|
||||
var h;h={"stroke-width":c.lineWidth||0};c.dashStyle&&(h.dashstyle=c.dashStyle);this.legendLine=f.path(["M",0,a,"L",g,a]).addClass("highcharts-graph").attr(h).add(b);d&&!1!==d.enabled&&(c=0===this.symbol.indexOf("url")?0:d.radius,this.legendSymbol=d=f.symbol(this.symbol,g/2-c,a-c,2*c,2*c,d).addClass("highcharts-point").add(b),d.isMarker=!0)}};(/Trident\/7\.0/.test(w.navigator.userAgent)||q)&&B(D.prototype,"positionItem",function(a,d){var c=this,e=function(){d._legendItemPos&&a.call(c,d)};e();setTimeout(e)})})(M);
|
||||
(function(a){var D=a.addEvent,z=a.animate,F=a.animObject,J=a.attr,m=a.doc,f=a.Axis,h=a.createElement,q=a.defaultOptions,n=a.discardElement,k=a.charts,v=a.css,d=a.defined,g=a.each,w=a.error,B=a.extend,c=a.fireEvent,e=a.getStyle,l=a.grep,u=a.isNumber,L=a.isObject,b=a.isString,t=a.Legend,y=a.marginNames,K=a.merge,x=a.Pointer,I=a.pick,r=a.pInt,G=a.removeEvent,H=a.seriesTypes,N=a.splat,p=a.svg,A=a.syncTimeout,P=a.win,O=a.Renderer,C=a.Chart=function(){this.getArgs.apply(this,arguments)};a.chart=function(a,
|
||||
b,c){return new C(a,b,c)};C.prototype={callbacks:[],getArgs:function(){var a=[].slice.call(arguments);if(b(a[0])||a[0].nodeName)this.renderTo=a.shift();this.init(a[0],a[1])},init:function(b,c){var d,e=b.series;b.series=null;d=K(q,b);d.series=b.series=e;this.userOptions=b;this.respRules=[];b=d.chart;e=b.events;this.margin=[];this.spacing=[];this.bounds={h:{},v:{}};this.callback=c;this.isResizing=0;this.options=d;this.axes=[];this.series=[];this.hasCartesianSeries=b.showAxes;var g;this.index=k.length;
|
||||
k.push(this);a.chartCount++;if(e)for(g in e)D(this,g,e[g]);this.xAxis=[];this.yAxis=[];this.pointCount=this.colorCounter=this.symbolCounter=0;this.firstRender()},initSeries:function(a){var b=this.options.chart;(b=H[a.type||b.type||b.defaultSeriesType])||w(17,!0);b=new b;b.init(this,a);return b},isInsidePlot:function(a,b,c){var d=c?b:a;a=c?a:b;return 0<=d&&d<=this.plotWidth&&0<=a&&a<=this.plotHeight},redraw:function(b){var d=this.axes,e=this.series,f=this.pointer,r=this.legend,h=this.isDirtyLegend,
|
||||
l,p,k=this.hasCartesianSeries,n=this.isDirtyBox,H=e.length,t=H,u=this.renderer,v=u.isHidden(),G=[];a.setAnimation(b,this);v&&this.cloneRenderTo();for(this.layOutTitles();t--;)if(b=e[t],b.options.stacking&&(l=!0,b.isDirty)){p=!0;break}if(p)for(t=H;t--;)b=e[t],b.options.stacking&&(b.isDirty=!0);g(e,function(a){a.isDirty&&"point"===a.options.legendType&&(a.updateTotals&&a.updateTotals(),h=!0);a.isDirtyData&&c(a,"updatedData")});h&&r.options.enabled&&(r.render(),this.isDirtyLegend=!1);l&&this.getStacks();
|
||||
k&&g(d,function(a){a.updateNames();a.setScale()});this.getMargins();k&&(g(d,function(a){a.isDirty&&(n=!0)}),g(d,function(a){var b=a.min+","+a.max;a.extKey!==b&&(a.extKey=b,G.push(function(){c(a,"afterSetExtremes",B(a.eventArgs,a.getExtremes()));delete a.eventArgs}));(n||l)&&a.redraw()}));n&&this.drawChartBox();g(e,function(a){(n||a.isDirty)&&a.visible&&a.redraw()});f&&f.reset(!0);u.draw();c(this,"redraw");v&&this.cloneRenderTo(!0);g(G,function(a){a.call()})},get:function(a){var b=this.axes,c=this.series,
|
||||
d,e;for(d=0;d<b.length;d++)if(b[d].options.id===a)return b[d];for(d=0;d<c.length;d++)if(c[d].options.id===a)return c[d];for(d=0;d<c.length;d++)for(e=c[d].points||[],b=0;b<e.length;b++)if(e[b].id===a)return e[b];return null},getAxes:function(){var a=this,b=this.options,c=b.xAxis=N(b.xAxis||{}),b=b.yAxis=N(b.yAxis||{});g(c,function(a,b){a.index=b;a.isX=!0});g(b,function(a,b){a.index=b});c=c.concat(b);g(c,function(b){new f(a,b)})},getSelectedPoints:function(){var a=[];g(this.series,function(b){a=a.concat(l(b.points||
|
||||
[],function(a){return a.selected}))});return a},getSelectedSeries:function(){return l(this.series,function(a){return a.selected})},setTitle:function(a,b,c){var d=this,e=d.options,f;f=e.title=K(e.title,a);e=e.subtitle=K(e.subtitle,b);g([["title",a,f],["subtitle",b,e]],function(a,b){var c=a[0],e=d[c],g=a[1];a=a[2];e&&g&&(d[c]=e=e.destroy());a&&a.text&&!e&&(d[c]=d.renderer.text(a.text,0,0,a.useHTML).attr({align:a.align,"class":"highcharts-"+c,zIndex:a.zIndex||4}).add(),d[c].update=function(a){d.setTitle(!b&&
|
||||
a,b&&a)},d[c].css(a.style))});d.layOutTitles(c)},layOutTitles:function(a){var b=0,c,d=this.renderer,e=this.spacingBox;g(["title","subtitle"],function(a){var c=this[a],g=this.options[a],f;c&&(f=g.style.fontSize,f=d.fontMetrics(f,c).b,c.css({width:(g.width||e.width+g.widthAdjust)+"px"}).align(B({y:b+f+("title"===a?-3:2)},g),!1,"spacingBox"),g.floating||g.verticalAlign||(b=Math.ceil(b+c.getBBox().height)))},this);c=this.titleOffset!==b;this.titleOffset=b;!this.isDirtyBox&&c&&(this.isDirtyBox=c,this.hasRendered&&
|
||||
I(a,!0)&&this.isDirtyBox&&this.redraw())},getChartSize:function(){var a=this.options.chart,b=a.width,a=a.height,c=this.renderToClone||this.renderTo;d(b)||(this.containerWidth=e(c,"width"));d(a)||(this.containerHeight=e(c,"height"));this.chartWidth=Math.max(0,b||this.containerWidth||600);this.chartHeight=Math.max(0,I(a,19<this.containerHeight?this.containerHeight:400))},cloneRenderTo:function(a){var b=this.renderToClone,c=this.container;if(a){if(b){for(;b.childNodes.length;)this.renderTo.appendChild(b.firstChild);
|
||||
n(b);delete this.renderToClone}}else c&&c.parentNode===this.renderTo&&this.renderTo.removeChild(c),this.renderToClone=b=this.renderTo.cloneNode(0),v(b,{position:"absolute",top:"-9999px",display:"block"}),b.style.setProperty&&b.style.setProperty("display","block","important"),m.body.appendChild(b),c&&b.appendChild(c)},setClassName:function(a){this.container.className="highcharts-container "+(a||"")},getContainer:function(){var c,d=this.options,e=d.chart,g,f;c=this.renderTo;var l="highcharts-"+a.idCounter++,
|
||||
p;c||(this.renderTo=c=e.renderTo);b(c)&&(this.renderTo=c=m.getElementById(c));c||w(13,!0);g=r(J(c,"data-highcharts-chart"));u(g)&&k[g]&&k[g].hasRendered&&k[g].destroy();J(c,"data-highcharts-chart",this.index);c.innerHTML="";e.skipClone||c.offsetWidth||this.cloneRenderTo();this.getChartSize();g=this.chartWidth;f=this.chartHeight;p=B({position:"relative",overflow:"hidden",width:g+"px",height:f+"px",textAlign:"left",lineHeight:"normal",zIndex:0,"-webkit-tap-highlight-color":"rgba(0,0,0,0)"},e.style);
|
||||
this.container=c=h("div",{id:l},p,this.renderToClone||c);this._cursor=c.style.cursor;this.renderer=new (a[e.renderer]||O)(c,g,f,null,e.forExport,d.exporting&&d.exporting.allowHTML);this.setClassName(e.className);this.renderer.setStyle(e.style);this.renderer.chartIndex=this.index},getMargins:function(a){var b=this.spacing,c=this.margin,e=this.titleOffset;this.resetMargins();e&&!d(c[0])&&(this.plotTop=Math.max(this.plotTop,e+this.options.title.margin+b[0]));this.legend.display&&this.legend.adjustMargins(c,
|
||||
b);this.extraBottomMargin&&(this.marginBottom+=this.extraBottomMargin);this.extraTopMargin&&(this.plotTop+=this.extraTopMargin);a||this.getAxisMargins()},getAxisMargins:function(){var a=this,b=a.axisOffset=[0,0,0,0],c=a.margin;a.hasCartesianSeries&&g(a.axes,function(a){a.visible&&a.getOffset()});g(y,function(e,g){d(c[g])||(a[e]+=b[g])});a.setChartSize()},reflow:function(a){var b=this,c=b.options.chart,g=b.renderTo,f=d(c.width),r=c.width||e(g,"width"),c=c.height||e(g,"height"),g=a?a.target:P;if(!f&&
|
||||
!b.isPrinting&&r&&c&&(g===P||g===m)){if(r!==b.containerWidth||c!==b.containerHeight)clearTimeout(b.reflowTimeout),b.reflowTimeout=A(function(){b.container&&b.setSize(void 0,void 0,!1)},a?100:0);b.containerWidth=r;b.containerHeight=c}},initReflow:function(){var a=this,b=function(b){a.reflow(b)};D(P,"resize",b);D(a,"destroy",function(){G(P,"resize",b)})},setSize:function(b,d,e){var f=this,r=f.renderer;f.isResizing+=1;a.setAnimation(e,f);f.oldChartHeight=f.chartHeight;f.oldChartWidth=f.chartWidth;void 0!==
|
||||
b&&(f.options.chart.width=b);void 0!==d&&(f.options.chart.height=d);f.getChartSize();b=r.globalAnimation;(b?z:v)(f.container,{width:f.chartWidth+"px",height:f.chartHeight+"px"},b);f.setChartSize(!0);r.setSize(f.chartWidth,f.chartHeight,e);g(f.axes,function(a){a.isDirty=!0;a.setScale()});f.isDirtyLegend=!0;f.isDirtyBox=!0;f.layOutTitles();f.getMargins();f.setResponsive&&f.setResponsive(!1);f.redraw(e);f.oldChartHeight=null;c(f,"resize");A(function(){f&&c(f,"endResize",null,function(){--f.isResizing})},
|
||||
F(b).duration)},setChartSize:function(a){var b=this.inverted,c=this.renderer,d=this.chartWidth,e=this.chartHeight,f=this.options.chart,r=this.spacing,h=this.clipOffset,l,p,k,n;this.plotLeft=l=Math.round(this.plotLeft);this.plotTop=p=Math.round(this.plotTop);this.plotWidth=k=Math.max(0,Math.round(d-l-this.marginRight));this.plotHeight=n=Math.max(0,Math.round(e-p-this.marginBottom));this.plotSizeX=b?n:k;this.plotSizeY=b?k:n;this.plotBorderWidth=f.plotBorderWidth||0;this.spacingBox=c.spacingBox={x:r[3],
|
||||
y:r[0],width:d-r[3]-r[1],height:e-r[0]-r[2]};this.plotBox=c.plotBox={x:l,y:p,width:k,height:n};d=2*Math.floor(this.plotBorderWidth/2);b=Math.ceil(Math.max(d,h[3])/2);c=Math.ceil(Math.max(d,h[0])/2);this.clipBox={x:b,y:c,width:Math.floor(this.plotSizeX-Math.max(d,h[1])/2-b),height:Math.max(0,Math.floor(this.plotSizeY-Math.max(d,h[2])/2-c))};a||g(this.axes,function(a){a.setAxisSize();a.setAxisTranslation()})},resetMargins:function(){var a=this,b=a.options.chart;g(["margin","spacing"],function(c){var d=
|
||||
b[c],e=L(d)?d:[d,d,d,d];g(["Top","Right","Bottom","Left"],function(d,g){a[c][g]=I(b[c+d],e[g])})});g(y,function(b,c){a[b]=I(a.margin[c],a.spacing[c])});a.axisOffset=[0,0,0,0];a.clipOffset=[0,0,0,0]},drawChartBox:function(){var a=this.options.chart,b=this.renderer,c=this.chartWidth,d=this.chartHeight,e=this.chartBackground,g=this.plotBackground,f=this.plotBorder,r,h=this.plotBGImage,l=a.backgroundColor,p=a.plotBackgroundColor,k=a.plotBackgroundImage,n,t=this.plotLeft,H=this.plotTop,u=this.plotWidth,
|
||||
v=this.plotHeight,G=this.plotBox,m=this.clipRect,x=this.clipBox,y="animate";e||(this.chartBackground=e=b.rect().addClass("highcharts-background").add(),y="attr");r=a.borderWidth||0;n=r+(a.shadow?8:0);l={fill:l||"none"};if(r||e["stroke-width"])l.stroke=a.borderColor,l["stroke-width"]=r;e.attr(l).shadow(a.shadow);e[y]({x:n/2,y:n/2,width:c-n-r%2,height:d-n-r%2,r:a.borderRadius});y="animate";g||(y="attr",this.plotBackground=g=b.rect().addClass("highcharts-plot-background").add());g[y](G);g.attr({fill:p||
|
||||
"none"}).shadow(a.plotShadow);k&&(h?h.animate(G):this.plotBGImage=b.image(k,t,H,u,v).add());m?m.animate({width:x.width,height:x.height}):this.clipRect=b.clipRect(x);y="animate";f||(y="attr",this.plotBorder=f=b.rect().addClass("highcharts-plot-border").attr({zIndex:1}).add());f.attr({stroke:a.plotBorderColor,"stroke-width":a.plotBorderWidth||0,fill:"none"});f[y](f.crisp({x:t,y:H,width:u,height:v},-f.strokeWidth()));this.isDirtyBox=!1},propFromSeries:function(){var a=this,b=a.options.chart,c,d=a.options.series,
|
||||
e,f;g(["inverted","angular","polar"],function(g){c=H[b.type||b.defaultSeriesType];f=b[g]||c&&c.prototype[g];for(e=d&&d.length;!f&&e--;)(c=H[d[e].type])&&c.prototype[g]&&(f=!0);a[g]=f})},linkSeries:function(){var a=this,c=a.series;g(c,function(a){a.linkedSeries.length=0});g(c,function(c){var d=c.options.linkedTo;b(d)&&(d=":previous"===d?a.series[c.index-1]:a.get(d))&&d.linkedParent!==c&&(d.linkedSeries.push(c),c.linkedParent=d,c.visible=I(c.options.visible,d.options.visible,c.visible))})},renderSeries:function(){g(this.series,
|
||||
function(a){a.translate();a.render()})},renderLabels:function(){var a=this,b=a.options.labels;b.items&&g(b.items,function(c){var d=B(b.style,c.style),e=r(d.left)+a.plotLeft,g=r(d.top)+a.plotTop+12;delete d.left;delete d.top;a.renderer.text(c.html,e,g).attr({zIndex:2}).css(d).add()})},render:function(){var a=this.axes,b=this.renderer,c=this.options,d,e,f;this.setTitle();this.legend=new t(this,c.legend);this.getStacks&&this.getStacks();this.getMargins(!0);this.setChartSize();c=this.plotWidth;d=this.plotHeight-=
|
||||
21;g(a,function(a){a.setScale()});this.getAxisMargins();e=1.1<c/this.plotWidth;f=1.05<d/this.plotHeight;if(e||f)g(a,function(a){(a.horiz&&e||!a.horiz&&f)&&a.setTickInterval(!0)}),this.getMargins();this.drawChartBox();this.hasCartesianSeries&&g(a,function(a){a.visible&&a.render()});this.seriesGroup||(this.seriesGroup=b.g("series-group").attr({zIndex:3}).add());this.renderSeries();this.renderLabels();this.addCredits();this.setResponsive&&this.setResponsive();this.hasRendered=!0},addCredits:function(a){var b=
|
||||
this;a=K(!0,this.options.credits,a);a.enabled&&!this.credits&&(this.credits=this.renderer.text(a.text+(this.mapCredits||""),0,0).addClass("highcharts-credits").on("click",function(){a.href&&(P.location.href=a.href)}).attr({align:a.position.align,zIndex:8}).css(a.style).add().align(a.position),this.credits.update=function(a){b.credits=b.credits.destroy();b.addCredits(a)})},destroy:function(){var b=this,d=b.axes,e=b.series,f=b.container,r,h=f&&f.parentNode;c(b,"destroy");k[b.index]=void 0;a.chartCount--;
|
||||
b.renderTo.removeAttribute("data-highcharts-chart");G(b);for(r=d.length;r--;)d[r]=d[r].destroy();this.scroller&&this.scroller.destroy&&this.scroller.destroy();for(r=e.length;r--;)e[r]=e[r].destroy();g("title subtitle chartBackground plotBackground plotBGImage plotBorder seriesGroup clipRect credits pointer rangeSelector legend resetZoomButton tooltip renderer".split(" "),function(a){var c=b[a];c&&c.destroy&&(b[a]=c.destroy())});f&&(f.innerHTML="",G(f),h&&n(f));for(r in b)delete b[r]},isReadyToRender:function(){var a=
|
||||
this;return p||P!=P.top||"complete"===m.readyState?!0:(m.attachEvent("onreadystatechange",function(){m.detachEvent("onreadystatechange",a.firstRender);"complete"===m.readyState&&a.firstRender()}),!1)},firstRender:function(){var a=this,b=a.options;if(a.isReadyToRender()){a.getContainer();c(a,"init");a.resetMargins();a.setChartSize();a.propFromSeries();a.getAxes();g(b.series||[],function(b){a.initSeries(b)});a.linkSeries();c(a,"beforeRender");x&&(a.pointer=new x(a,b));a.render();a.renderer.draw();if(!a.renderer.imgCount&&
|
||||
a.onload)a.onload();a.cloneRenderTo(!0)}},onload:function(){g([this.callback].concat(this.callbacks),function(a){a&&void 0!==this.index&&a.apply(this,[this])},this);c(this,"load");!1!==this.options.chart.reflow&&this.initReflow();this.onload=null}}})(M);(function(a){var D,z=a.each,F=a.extend,J=a.erase,m=a.fireEvent,f=a.format,h=a.isArray,q=a.isNumber,n=a.pick,k=a.removeEvent;D=a.Point=function(){};D.prototype={init:function(a,d,g){this.series=a;this.color=a.color;this.applyOptions(d,g);a.options.colorByPoint?
|
||||
(d=a.options.colors||a.chart.options.colors,this.color=this.color||d[a.colorCounter],d=d.length,g=a.colorCounter,a.colorCounter++,a.colorCounter===d&&(a.colorCounter=0)):g=a.colorIndex;this.colorIndex=n(this.colorIndex,g);a.chart.pointCount++;return this},applyOptions:function(a,d){var g=this.series,f=g.options.pointValKey||g.pointValKey;a=D.prototype.optionsToObject.call(this,a);F(this,a);this.options=this.options?F(this.options,a):a;a.group&&delete this.group;f&&(this.y=this[f]);this.isNull=n(this.isValid&&
|
||||
!this.isValid(),null===this.x||!q(this.y,!0));this.selected&&(this.state="select");"name"in this&&void 0===d&&g.xAxis&&g.xAxis.hasNames&&(this.x=g.xAxis.nameToX(this));void 0===this.x&&g&&(this.x=void 0===d?g.autoIncrement(this):d);return this},optionsToObject:function(a){var d={},g=this.series,f=g.options.keys,k=f||g.pointArrayMap||["y"],c=k.length,e=0,l=0;if(q(a)||null===a)d[k[0]]=a;else if(h(a))for(!f&&a.length>c&&(g=typeof a[0],"string"===g?d.name=a[0]:"number"===g&&(d.x=a[0]),e++);l<c;)f&&void 0===
|
||||
a[e]||(d[k[l]]=a[e]),e++,l++;else"object"===typeof a&&(d=a,a.dataLabels&&(g._hasPointLabels=!0),a.marker&&(g._hasPointMarkers=!0));return d},getClassName:function(){return"highcharts-point"+(this.selected?" highcharts-point-select":"")+(this.negative?" highcharts-negative":"")+(this.isNull?" highcharts-null-point":"")+(void 0!==this.colorIndex?" highcharts-color-"+this.colorIndex:"")+(this.options.className?" "+this.options.className:"")},getZone:function(){var a=this.series,d=a.zones,a=a.zoneAxis||
|
||||
"y",g=0,f;for(f=d[g];this[a]>=f.value;)f=d[++g];f&&f.color&&!this.options.color&&(this.color=f.color);return f},destroy:function(){var a=this.series.chart,d=a.hoverPoints,g;a.pointCount--;d&&(this.setState(),J(d,this),d.length||(a.hoverPoints=null));if(this===a.hoverPoint)this.onMouseOut();if(this.graphic||this.dataLabel)k(this),this.destroyElements();this.legendItem&&a.legend.destroyItem(this);for(g in this)this[g]=null},destroyElements:function(){for(var a=["graphic","dataLabel","dataLabelUpper",
|
||||
"connector","shadowGroup"],d,g=6;g--;)d=a[g],this[d]&&(this[d]=this[d].destroy())},getLabelConfig:function(){return{x:this.category,y:this.y,color:this.color,key:this.name||this.category,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},tooltipFormatter:function(a){var d=this.series,g=d.tooltipOptions,h=n(g.valueDecimals,""),k=g.valuePrefix||"",c=g.valueSuffix||"";z(d.pointArrayMap||["y"],function(d){d="{point."+d;if(k||c)a=a.replace(d+"}",k+d+"}"+c);a=a.replace(d+
|
||||
"}",d+":,."+h+"f}")});return f(a,{point:this,series:this.series})},firePointEvent:function(a,d,g){var f=this,h=this.series.options;(h.point.events[a]||f.options&&f.options.events&&f.options.events[a])&&this.importEvents();"click"===a&&h.allowPointSelect&&(g=function(a){f.select&&f.select(null,a.ctrlKey||a.metaKey||a.shiftKey)});m(this,a,d,g)},visible:!0}})(M);(function(a){var D=a.addEvent,z=a.animObject,F=a.arrayMax,J=a.arrayMin,m=a.correctFloat,f=a.Date,h=a.defaultOptions,q=a.defaultPlotOptions,
|
||||
n=a.defined,k=a.each,v=a.erase,d=a.error,g=a.extend,w=a.fireEvent,B=a.grep,c=a.isArray,e=a.isNumber,l=a.isString,u=a.merge,L=a.pick,b=a.removeEvent,t=a.splat,y=a.stableSort,K=a.SVGElement,x=a.syncTimeout,I=a.win;a.Series=a.seriesType("line",null,{lineWidth:2,allowPointSelect:!1,showCheckbox:!1,animation:{duration:1E3},events:{},marker:{lineWidth:0,lineColor:"#ffffff",radius:4,states:{hover:{animation:{duration:50},enabled:!0,radiusPlus:2,lineWidthPlus:1},select:{fillColor:"#cccccc",lineColor:"#000000",
|
||||
lineWidth:2}}},point:{events:{}},dataLabels:{align:"center",formatter:function(){return null===this.y?"":a.numberFormat(this.y,-1)},style:{fontSize:"11px",fontWeight:"bold",color:"contrast",textShadow:"1px 1px contrast, -1px -1px contrast, -1px 1px contrast, 1px -1px contrast"},verticalAlign:"bottom",x:0,y:0,padding:5},cropThreshold:300,pointRange:0,softThreshold:!0,states:{hover:{lineWidthPlus:1,marker:{},halo:{size:10,opacity:.25}},select:{marker:{}}},stickyTracking:!0,turboThreshold:1E3},{isCartesian:!0,
|
||||
pointClass:a.Point,sorted:!0,requireSorting:!0,directTouch:!1,axisTypes:["xAxis","yAxis"],colorCounter:0,parallelArrays:["x","y"],coll:"series",init:function(a,b){var c=this,d,e,f=a.series,r=function(a,b){return L(a.options.index,a._i)-L(b.options.index,b._i)};c.chart=a;c.options=b=c.setOptions(b);c.linkedSeries=[];c.bindAxes();g(c,{name:b.name,state:"",visible:!1!==b.visible,selected:!0===b.selected});e=b.events;for(d in e)D(c,d,e[d]);if(e&&e.click||b.point&&b.point.events&&b.point.events.click||
|
||||
b.allowPointSelect)a.runTrackerClick=!0;c.getColor();c.getSymbol();k(c.parallelArrays,function(a){c[a+"Data"]=[]});c.setData(b.data,!1);c.isCartesian&&(a.hasCartesianSeries=!0);f.push(c);c._i=f.length-1;y(f,r);this.yAxis&&y(this.yAxis.series,r);k(f,function(a,b){a.index=b;a.name=a.name||"Series "+(b+1)})},bindAxes:function(){var a=this,b=a.options,c=a.chart,e;k(a.axisTypes||[],function(g){k(c[g],function(c){e=c.options;if(b[g]===e.index||void 0!==b[g]&&b[g]===e.id||void 0===b[g]&&0===e.index)c.series.push(a),
|
||||
a[g]=c,c.isDirty=!0});a[g]||a.optionalAxis===g||d(18,!0)})},updateParallelArrays:function(a,b){var c=a.series,d=arguments,g=e(b)?function(d){var e="y"===d&&c.toYData?c.toYData(a):a[d];c[d+"Data"][b]=e}:function(a){Array.prototype[b].apply(c[a+"Data"],Array.prototype.slice.call(d,2))};k(c.parallelArrays,g)},autoIncrement:function(){var a=this.options,b=this.xIncrement,c,d=a.pointIntervalUnit,b=L(b,a.pointStart,0);this.pointInterval=c=L(this.pointInterval,a.pointInterval,1);d&&(a=new f(b),"day"===d?
|
||||
a=+a[f.hcSetDate](a[f.hcGetDate]()+c):"month"===d?a=+a[f.hcSetMonth](a[f.hcGetMonth]()+c):"year"===d&&(a=+a[f.hcSetFullYear](a[f.hcGetFullYear]()+c)),c=a-b);this.xIncrement=b+c;return b},setOptions:function(a){var b=this.chart,c=b.options.plotOptions,b=b.userOptions||{},d=b.plotOptions||{},e=c[this.type];this.userOptions=a;c=u(e,c.series,a);this.tooltipOptions=u(h.tooltip,h.plotOptions[this.type].tooltip,b.tooltip,d.series&&d.series.tooltip,d[this.type]&&d[this.type].tooltip,a.tooltip);null===e.marker&&
|
||||
delete c.marker;this.zoneAxis=c.zoneAxis;a=this.zones=(c.zones||[]).slice();!c.negativeColor&&!c.negativeFillColor||c.zones||a.push({value:c[this.zoneAxis+"Threshold"]||c.threshold||0,className:"highcharts-negative",color:c.negativeColor,fillColor:c.negativeFillColor});a.length&&n(a[a.length-1].value)&&a.push({color:this.color,fillColor:this.fillColor});return c},getCyclic:function(a,b,c){var d,e=this.userOptions,g=a+"Index",f=a+"Counter",h=c?c.length:L(this.chart.options.chart[a+"Count"],this.chart[a+
|
||||
"Count"]);b||(d=L(e[g],e["_"+g]),n(d)||(e["_"+g]=d=this.chart[f]%h,this.chart[f]+=1),c&&(b=c[d]));void 0!==d&&(this[g]=d);this[a]=b},getColor:function(){this.options.colorByPoint?this.options.color=null:this.getCyclic("color",this.options.color||q[this.type].color,this.chart.options.colors)},getSymbol:function(){this.getCyclic("symbol",this.options.marker.symbol,this.chart.options.symbols)},drawLegendSymbol:a.LegendSymbolMixin.drawLineMarker,setData:function(a,b,g,f){var h=this,r=h.points,n=r&&r.length||
|
||||
0,t,u=h.options,x=h.chart,m=null,y=h.xAxis,G=u.turboThreshold,q=this.xData,w=this.yData,v=(t=h.pointArrayMap)&&t.length;a=a||[];t=a.length;b=L(b,!0);if(!1!==f&&t&&n===t&&!h.cropped&&!h.hasGroupedData&&h.visible)k(a,function(a,b){r[b].update&&a!==u.data[b]&&r[b].update(a,!1,null,!1)});else{h.xIncrement=null;h.colorCounter=0;k(this.parallelArrays,function(a){h[a+"Data"].length=0});if(G&&t>G){for(g=0;null===m&&g<t;)m=a[g],g++;if(e(m))for(g=0;g<t;g++)q[g]=this.autoIncrement(),w[g]=a[g];else if(c(m))if(v)for(g=
|
||||
0;g<t;g++)m=a[g],q[g]=m[0],w[g]=m.slice(1,v+1);else for(g=0;g<t;g++)m=a[g],q[g]=m[0],w[g]=m[1];else d(12)}else for(g=0;g<t;g++)void 0!==a[g]&&(m={series:h},h.pointClass.prototype.applyOptions.apply(m,[a[g]]),h.updateParallelArrays(m,g));l(w[0])&&d(14,!0);h.data=[];h.options.data=h.userOptions.data=a;for(g=n;g--;)r[g]&&r[g].destroy&&r[g].destroy();y&&(y.minRange=y.userMinRange);h.isDirty=x.isDirtyBox=!0;h.isDirtyData=!!r;g=!1}"point"===u.legendType&&(this.processData(),this.generatePoints());b&&x.redraw(g)},
|
||||
processData:function(a){var b=this.xData,c=this.yData,e=b.length,g;g=0;var f,h,l=this.xAxis,k,r=this.options;k=r.cropThreshold;var n=this.getExtremesFromAll||r.getExtremesFromAll,t=this.isCartesian,r=l&&l.val2lin,u=l&&l.isLog,m,x;if(t&&!this.isDirty&&!l.isDirty&&!this.yAxis.isDirty&&!a)return!1;l&&(a=l.getExtremes(),m=a.min,x=a.max);if(t&&this.sorted&&!n&&(!k||e>k||this.forceCrop))if(b[e-1]<m||b[0]>x)b=[],c=[];else if(b[0]<m||b[e-1]>x)g=this.cropData(this.xData,this.yData,m,x),b=g.xData,c=g.yData,
|
||||
g=g.start,f=!0;for(k=b.length||1;--k;)e=u?r(b[k])-r(b[k-1]):b[k]-b[k-1],0<e&&(void 0===h||e<h)?h=e:0>e&&this.requireSorting&&d(15);this.cropped=f;this.cropStart=g;this.processedXData=b;this.processedYData=c;this.closestPointRange=h},cropData:function(a,b,c,d){var e=a.length,g=0,f=e,h=L(this.cropShoulder,1),l;for(l=0;l<e;l++)if(a[l]>=c){g=Math.max(0,l-h);break}for(c=l;c<e;c++)if(a[c]>d){f=c+h;break}return{xData:a.slice(g,f),yData:b.slice(g,f),start:g,end:f}},generatePoints:function(){var a=this.options.data,
|
||||
b=this.data,c,d=this.processedXData,e=this.processedYData,g=this.pointClass,f=d.length,h=this.cropStart||0,l,k=this.hasGroupedData,n,u=[],m;b||k||(b=[],b.length=a.length,b=this.data=b);for(m=0;m<f;m++)l=h+m,k?(u[m]=(new g).init(this,[d[m]].concat(t(e[m]))),u[m].dataGroup=this.groupMap[m]):(b[l]?n=b[l]:void 0!==a[l]&&(b[l]=n=(new g).init(this,a[l],d[m])),u[m]=n),u[m].index=l;if(b&&(f!==(c=b.length)||k))for(m=0;m<c;m++)m!==h||k||(m+=f),b[m]&&(b[m].destroyElements(),b[m].plotX=void 0);this.data=b;this.points=
|
||||
u},getExtremes:function(a){var b=this.yAxis,d=this.processedXData,g,f=[],h=0;g=this.xAxis.getExtremes();var l=g.min,k=g.max,r,n,t,m;a=a||this.stackedYData||this.processedYData||[];g=a.length;for(m=0;m<g;m++)if(n=d[m],t=a[m],r=(e(t,!0)||c(t))&&(!b.isLog||t.length||0<t),n=this.getExtremesFromAll||this.options.getExtremesFromAll||this.cropped||(d[m+1]||n)>=l&&(d[m-1]||n)<=k,r&&n)if(r=t.length)for(;r--;)null!==t[r]&&(f[h++]=t[r]);else f[h++]=t;this.dataMin=J(f);this.dataMax=F(f)},translate:function(){this.processedXData||
|
||||
this.processData();this.generatePoints();for(var a=this.options,b=a.stacking,c=this.xAxis,d=c.categories,g=this.yAxis,f=this.points,h=f.length,l=!!this.modifyValue,k=a.pointPlacement,t="between"===k||e(k),u=a.threshold,x=a.startFromThreshold?u:0,y,q,w,v,K=Number.MAX_VALUE,a=0;a<h;a++){var I=f[a],B=I.x,z=I.y;q=I.low;var D=b&&g.stacks[(this.negStacks&&z<(x?0:u)?"-":"")+this.stackKey],F;g.isLog&&null!==z&&0>=z&&(I.isNull=!0);I.plotX=y=m(Math.min(Math.max(-1E5,c.translate(B,0,0,0,1,k,"flags"===this.type)),
|
||||
1E5));b&&this.visible&&!I.isNull&&D&&D[B]&&(v=this.getStackIndicator(v,B,this.index),F=D[B],z=F.points[v.key],q=z[0],z=z[1],q===x&&v.key===D[B].base&&(q=L(u,g.min)),g.isLog&&0>=q&&(q=null),I.total=I.stackTotal=F.total,I.percentage=F.total&&I.y/F.total*100,I.stackY=z,F.setOffset(this.pointXOffset||0,this.barW||0));I.yBottom=n(q)?g.translate(q,0,1,0,1):null;l&&(z=this.modifyValue(z,I));I.plotY=q="number"===typeof z&&Infinity!==z?Math.min(Math.max(-1E5,g.translate(z,0,1,0,1)),1E5):void 0;I.isInside=
|
||||
void 0!==q&&0<=q&&q<=g.len&&0<=y&&y<=c.len;I.clientX=t?m(c.translate(B,0,0,0,1,k)):y;I.negative=I.y<(u||0);I.category=d&&void 0!==d[I.x]?d[I.x]:I.x;I.isNull||(void 0!==w&&(K=Math.min(K,Math.abs(y-w))),w=y)}this.closestPointRangePx=K},getValidPoints:function(a,b){var c=this.chart;return B(a||this.points||[],function(a){return b&&!c.isInsidePlot(a.plotX,a.plotY,c.inverted)?!1:!a.isNull})},setClip:function(a){var b=this.chart,c=this.options,d=b.renderer,e=b.inverted,g=this.clipBox,f=g||b.clipBox,h=this.sharedClipKey||
|
||||
["_sharedClip",a&&a.duration,a&&a.easing,f.height,c.xAxis,c.yAxis].join(),l=b[h],k=b[h+"m"];l||(a&&(f.width=0,b[h+"m"]=k=d.clipRect(-99,e?-b.plotLeft:-b.plotTop,99,e?b.chartWidth:b.chartHeight)),b[h]=l=d.clipRect(f),l.count={length:0});a&&!l.count[this.index]&&(l.count[this.index]=!0,l.count.length+=1);!1!==c.clip&&(this.group.clip(a||g?l:b.clipRect),this.markerGroup.clip(k),this.sharedClipKey=h);a||(l.count[this.index]&&(delete l.count[this.index],--l.count.length),0===l.count.length&&h&&b[h]&&(g||
|
||||
(b[h]=b[h].destroy()),b[h+"m"]&&(b[h+"m"]=b[h+"m"].destroy())))},animate:function(a){var b=this.chart,c=z(this.options.animation),d;a?this.setClip(c):(d=this.sharedClipKey,(a=b[d])&&a.animate({width:b.plotSizeX},c),b[d+"m"]&&b[d+"m"].animate({width:b.plotSizeX+99},c),this.animate=null)},afterAnimate:function(){this.setClip();w(this,"afterAnimate")},drawPoints:function(){var a=this.points,b=this.chart,c,d,g,f,h=this.options.marker,l,k,n,t,m=this.markerGroup,u=L(h.enabled,this.xAxis.isRadial?!0:null,
|
||||
this.closestPointRangePx>2*h.radius);if(!1!==h.enabled||this._hasPointMarkers)for(d=a.length;d--;)g=a[d],c=g.plotY,f=g.graphic,l=g.marker||{},k=!!g.marker,n=u&&void 0===l.enabled||l.enabled,t=g.isInside,n&&e(c)&&null!==g.y?(c=L(l.symbol,this.symbol),g.hasImage=0===c.indexOf("url"),n=this.markerAttribs(g,g.selected&&"select"),f?f[t?"show":"hide"](!0).animate(n):t&&(0<n.width||g.hasImage)&&(g.graphic=f=b.renderer.symbol(c,n.x,n.y,n.width,n.height,k?l:h).add(m)),f&&f.attr(this.pointAttribs(g,g.selected&&
|
||||
"select")),f&&f.addClass(g.getClassName(),!0)):f&&(g.graphic=f.destroy())},markerAttribs:function(a,b){var c=this.options.marker,d=a&&a.options,e=d&&d.marker||{},d=L(e.radius,c.radius);b&&(c=c.states[b],b=e.states&&e.states[b],d=L(b&&b.radius,c&&c.radius,d+(c&&c.radiusPlus||0)));a.hasImage&&(d=0);a={x:Math.floor(a.plotX)-d,y:a.plotY-d};d&&(a.width=a.height=2*d);return a},pointAttribs:function(a,b){var c=this.options.marker,d=a&&a.options,e=d&&d.marker||{},g=c.lineWidth,f=this.color,d=d&&d.color,h=
|
||||
a&&a.color,l;a&&this.zones.length&&(a=a.getZone())&&a.color&&(l=a.color);f=d||l||h||f;l=e.fillColor||c.fillColor||f;f=e.lineColor||c.lineColor||f;b&&(c=c.states[b],b=e.states&&e.states[b]||{},g=c.lineWidth||g+c.lineWidthPlus,l=b.fillColor||c.fillColor||l,f=b.lineColor||c.lineColor||f);return{stroke:f,"stroke-width":g,fill:l}},destroy:function(){var a=this,c=a.chart,d=/AppleWebKit\/533/.test(I.navigator.userAgent),e,g=a.data||[],f,h,l;w(a,"destroy");b(a);k(a.axisTypes||[],function(b){(l=a[b])&&l.series&&
|
||||
(v(l.series,a),l.isDirty=l.forceRedraw=!0)});a.legendItem&&a.chart.legend.destroyItem(a);for(e=g.length;e--;)(f=g[e])&&f.destroy&&f.destroy();a.points=null;clearTimeout(a.animationTimeout);for(h in a)a[h]instanceof K&&!a[h].survive&&(e=d&&"group"===h?"hide":"destroy",a[h][e]());c.hoverSeries===a&&(c.hoverSeries=null);v(c.series,a);for(h in a)delete a[h]},getGraphPath:function(a,b,c){var d=this,e=d.options,g=e.step,f,h=[],l=[],r;a=a||d.points;(f=a.reversed)&&a.reverse();(g={right:1,center:2}[g]||g&&
|
||||
3)&&f&&(g=4-g);!e.connectNulls||b||c||(a=this.getValidPoints(a));k(a,function(f,k){var t=f.plotX,p=f.plotY,m=a[k-1];(f.leftCliff||m&&m.rightCliff)&&!c&&(r=!0);f.isNull&&!n(b)&&0<k?r=!e.connectNulls:f.isNull&&!b?r=!0:(0===k||r?k=["M",f.plotX,f.plotY]:d.getPointSpline?k=d.getPointSpline(a,f,k):g?(k=1===g?["L",m.plotX,p]:2===g?["L",(m.plotX+t)/2,m.plotY,"L",(m.plotX+t)/2,p]:["L",t,m.plotY],k.push("L",t,p)):k=["L",t,p],l.push(f.x),g&&l.push(f.x),h.push.apply(h,k),r=!1)});h.xMap=l;return d.graphPath=h},
|
||||
drawGraph:function(){var a=this,b=this.options,c=(this.gappedPath||this.getGraphPath).call(this),d=[["graph","highcharts-graph",b.lineColor||this.color,b.dashStyle]];k(this.zones,function(c,e){d.push(["zone-graph-"+e,"highcharts-graph highcharts-zone-graph-"+e+" "+(c.className||""),c.color||a.color,c.dashStyle||b.dashStyle])});k(d,function(d,e){var g=d[0],f=a[g];f?(f.endX=c.xMap,f.animate({d:c})):c.length&&(a[g]=a.chart.renderer.path(c).addClass(d[1]).attr({zIndex:1}).add(a.group),f={stroke:d[2],
|
||||
"stroke-width":b.lineWidth,fill:a.fillGraph&&a.color||"none"},d[3]?f.dashstyle=d[3]:"square"!==b.linecap&&(f["stroke-linecap"]=f["stroke-linejoin"]="round"),f=a[g].attr(f).shadow(2>e&&b.shadow));f&&(f.startX=c.xMap,f.isArea=c.isArea)})},applyZones:function(){var a=this,b=this.chart,c=b.renderer,d=this.zones,e,g,f=this.clips||[],h,l=this.graph,n=this.area,t=Math.max(b.chartWidth,b.chartHeight),m=this[(this.zoneAxis||"y")+"Axis"],u,x,y=b.inverted,q,w,v,K,I=!1;d.length&&(l||n)&&m&&void 0!==m.min&&(x=
|
||||
m.reversed,q=m.horiz,l&&l.hide(),n&&n.hide(),u=m.getExtremes(),k(d,function(d,k){e=x?q?b.plotWidth:0:q?0:m.toPixels(u.min);e=Math.min(Math.max(L(g,e),0),t);g=Math.min(Math.max(Math.round(m.toPixels(L(d.value,u.max),!0)),0),t);I&&(e=g=m.toPixels(u.max));w=Math.abs(e-g);v=Math.min(e,g);K=Math.max(e,g);m.isXAxis?(h={x:y?K:v,y:0,width:w,height:t},q||(h.x=b.plotHeight-h.x)):(h={x:0,y:y?K:v,width:t,height:w},q&&(h.y=b.plotWidth-h.y));y&&c.isVML&&(h=m.isXAxis?{x:0,y:x?v:K,height:h.width,width:b.chartWidth}:
|
||||
{x:h.y-b.plotLeft-b.spacingBox.x,y:0,width:h.height,height:b.chartHeight});f[k]?f[k].animate(h):(f[k]=c.clipRect(h),l&&a["zone-graph-"+k].clip(f[k]),n&&a["zone-area-"+k].clip(f[k]));I=d.value>u.max}),this.clips=f)},invertGroups:function(a){function c(){var b={width:d.yAxis.len,height:d.xAxis.len};k(["group","markerGroup"],function(c){d[c]&&d[c].attr(b).invert(a)})}var d=this,e=d.chart;d.xAxis&&(D(e,"resize",c),D(d,"destroy",function(){b(e,"resize",c)}),c(a),d.invertGroups=c)},plotGroup:function(a,
|
||||
b,c,d,e){var g=this[a],f=!g;f&&(this[a]=g=this.chart.renderer.g(b).attr({zIndex:d||.1}).add(e),g.addClass("highcharts-series-"+this.index+" highcharts-"+this.type+"-series highcharts-color-"+this.colorIndex+" "+(this.options.className||"")));g.attr({visibility:c})[f?"attr":"animate"](this.getPlotBox());return g},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;a.inverted&&(b=c,c=this.xAxis);return{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var a=
|
||||
this,b=a.chart,c,d=a.options,e=!!a.animate&&b.renderer.isSVG&&z(d.animation).duration,g=a.visible?"inherit":"hidden",f=d.zIndex,h=a.hasRendered,l=b.seriesGroup,k=b.inverted;c=a.plotGroup("group","series",g,f,l);a.markerGroup=a.plotGroup("markerGroup","markers",g,f,l);e&&a.animate(!0);c.inverted=a.isCartesian?k:!1;a.drawGraph&&(a.drawGraph(),a.applyZones());a.drawDataLabels&&a.drawDataLabels();a.visible&&a.drawPoints();a.drawTracker&&!1!==a.options.enableMouseTracking&&a.drawTracker();a.invertGroups(k);
|
||||
!1===d.clip||a.sharedClipKey||h||c.clip(b.clipRect);e&&a.animate();h||(a.animationTimeout=x(function(){a.afterAnimate()},e));a.isDirty=a.isDirtyData=!1;a.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirty||this.isDirtyData,c=this.group,d=this.xAxis,e=this.yAxis;c&&(a.inverted&&c.attr({width:a.plotWidth,height:a.plotHeight}),c.animate({translateX:L(d&&d.left,a.plotLeft),translateY:L(e&&e.top,a.plotTop)}));this.translate();this.render();b&&delete this.kdTree},kdDimensions:1,kdAxisArray:["clientX",
|
||||
"plotY"],searchPoint:function(a,b){var c=this.xAxis,d=this.yAxis,e=this.chart.inverted;return this.searchKDTree({clientX:e?c.len-a.chartY+c.pos:a.chartX-c.pos,plotY:e?d.len-a.chartX+d.pos:a.chartY-d.pos},b)},buildKDTree:function(){function a(c,d,e){var g,f;if(f=c&&c.length)return g=b.kdAxisArray[d%e],c.sort(function(a,b){return a[g]-b[g]}),f=Math.floor(f/2),{point:c[f],left:a(c.slice(0,f),d+1,e),right:a(c.slice(f+1),d+1,e)}}var b=this,c=b.kdDimensions;delete b.kdTree;x(function(){b.kdTree=a(b.getValidPoints(null,
|
||||
!b.directTouch),c,c)},b.options.kdNow?0:1)},searchKDTree:function(a,b){function c(a,b,h,l){var k=b.point,t=d.kdAxisArray[h%l],m,u,r=k;u=n(a[e])&&n(k[e])?Math.pow(a[e]-k[e],2):null;m=n(a[g])&&n(k[g])?Math.pow(a[g]-k[g],2):null;m=(u||0)+(m||0);k.dist=n(m)?Math.sqrt(m):Number.MAX_VALUE;k.distX=n(u)?Math.sqrt(u):Number.MAX_VALUE;t=a[t]-k[t];m=0>t?"left":"right";u=0>t?"right":"left";b[m]&&(m=c(a,b[m],h+1,l),r=m[f]<r[f]?m:k);b[u]&&Math.sqrt(t*t)<r[f]&&(a=c(a,b[u],h+1,l),r=a[f]<r[f]?a:r);return r}var d=
|
||||
this,e=this.kdAxisArray[0],g=this.kdAxisArray[1],f=b?"distX":"dist";this.kdTree||this.buildKDTree();if(this.kdTree)return c(a,this.kdTree,this.kdDimensions,this.kdDimensions)}})})(M);(function(a){function D(a,f,d,g,h){var k=a.chart.inverted;this.axis=a;this.isNegative=d;this.options=f;this.x=g;this.total=null;this.points={};this.stack=h;this.rightCliff=this.leftCliff=0;this.alignOptions={align:f.align||(k?d?"left":"right":"center"),verticalAlign:f.verticalAlign||(k?"middle":d?"bottom":"top"),y:n(f.y,
|
||||
k?4:d?14:-6),x:n(f.x,k?d?-6:6:0)};this.textAlign=f.textAlign||(k?d?"right":"left":"center")}var z=a.Axis,F=a.Chart,J=a.correctFloat,m=a.defined,f=a.destroyObjectProperties,h=a.each,q=a.format,n=a.pick;a=a.Series;D.prototype={destroy:function(){f(this,this.axis)},render:function(a){var f=this.options,d=f.format,d=d?q(d,this):f.formatter.call(this);this.label?this.label.attr({text:d,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(d,null,null,f.useHTML).css(f.style).attr({align:this.textAlign,
|
||||
rotation:f.rotation,visibility:"hidden"}).add(a)},setOffset:function(a,f){var d=this.axis,g=d.chart,h=g.inverted,k=d.reversed,k=this.isNegative&&!k||!this.isNegative&&k,c=d.translate(d.usePercentage?100:this.total,0,0,0,1),d=d.translate(0),d=Math.abs(c-d);a=g.xAxis[0].translate(this.x)+a;var e=g.plotHeight,h={x:h?k?c:c-d:a,y:h?e-a-f:k?e-c-d:e-c,width:h?d:f,height:h?f:d};if(f=this.label)f.align(this.alignOptions,null,h),h=f.alignAttr,f[!1===this.options.crop||g.isInsidePlot(h.x,h.y)?"show":"hide"](!0)}};
|
||||
F.prototype.getStacks=function(){var a=this;h(a.yAxis,function(a){a.stacks&&a.hasVisibleSeries&&(a.oldStacks=a.stacks)});h(a.series,function(f){!f.options.stacking||!0!==f.visible&&!1!==a.options.chart.ignoreHiddenSeries||(f.stackKey=f.type+n(f.options.stack,""))})};z.prototype.buildStacks=function(){var a=this.series,f,d=n(this.options.reversedStacks,!0),g=a.length,h;if(!this.isXAxis){this.usePercentage=!1;for(h=g;h--;)a[d?h:g-h-1].setStackedPoints();for(h=g;h--;)f=a[d?h:g-h-1],f.setStackCliffs&&
|
||||
f.setStackCliffs();if(this.usePercentage)for(h=0;h<g;h++)a[h].setPercentStacks()}};z.prototype.renderStackTotals=function(){var a=this.chart,f=a.renderer,d=this.stacks,g,h,n=this.stackTotalGroup;n||(this.stackTotalGroup=n=f.g("stack-labels").attr({visibility:"visible",zIndex:6}).add());n.translate(a.plotLeft,a.plotTop);for(g in d)for(h in a=d[g],a)a[h].render(n)};z.prototype.resetStacks=function(){var a=this.stacks,f,d;if(!this.isXAxis)for(f in a)for(d in a[f])a[f][d].touched<this.stacksTouched?(a[f][d].destroy(),
|
||||
delete a[f][d]):(a[f][d].total=null,a[f][d].cum=0)};z.prototype.cleanStacks=function(){var a,f,d;if(!this.isXAxis)for(f in this.oldStacks&&(a=this.stacks=this.oldStacks),a)for(d in a[f])a[f][d].cum=a[f][d].total};a.prototype.setStackedPoints=function(){if(this.options.stacking&&(!0===this.visible||!1===this.chart.options.chart.ignoreHiddenSeries)){var a=this.processedXData,f=this.processedYData,d=[],g=f.length,h=this.options,q=h.threshold,c=h.startFromThreshold?q:0,e=h.stack,h=h.stacking,l=this.stackKey,
|
||||
u="-"+l,z=this.negStacks,b=this.yAxis,t=b.stacks,y=b.oldStacks,K,x,I,r,G,H,F;b.stacksTouched+=1;for(G=0;G<g;G++)H=a[G],F=f[G],K=this.getStackIndicator(K,H,this.index),r=K.key,I=(x=z&&F<(c?0:q))?u:l,t[I]||(t[I]={}),t[I][H]||(y[I]&&y[I][H]?(t[I][H]=y[I][H],t[I][H].total=null):t[I][H]=new D(b,b.options.stackLabels,x,H,e)),I=t[I][H],null!==F&&(I.points[r]=I.points[this.index]=[n(I.cum,c)],m(I.cum)||(I.base=r),I.touched=b.stacksTouched,0<K.index&&!1===this.singleStacks&&(I.points[r][0]=I.points[this.index+
|
||||
","+H+",0"][0])),"percent"===h?(x=x?l:u,z&&t[x]&&t[x][H]?(x=t[x][H],I.total=x.total=Math.max(x.total,I.total)+Math.abs(F)||0):I.total=J(I.total+(Math.abs(F)||0))):I.total=J(I.total+(F||0)),I.cum=n(I.cum,c)+(F||0),null!==F&&(I.points[r].push(I.cum),d[G]=I.cum);"percent"===h&&(b.usePercentage=!0);this.stackedYData=d;b.oldStacks={}}};a.prototype.setPercentStacks=function(){var a=this,f=a.stackKey,d=a.yAxis.stacks,g=a.processedXData,n;h([f,"-"+f],function(f){for(var c=g.length,e,h;c--;)if(e=g[c],n=a.getStackIndicator(n,
|
||||
e,a.index,f),e=(h=d[f]&&d[f][e])&&h.points[n.key])h=h.total?100/h.total:0,e[0]=J(e[0]*h),e[1]=J(e[1]*h),a.stackedYData[c]=e[1]})};a.prototype.getStackIndicator=function(a,f,d,g){!m(a)||a.x!==f||g&&a.key!==g?a={x:f,index:0,key:g}:a.index++;a.key=[d,f,a.index].join();return a}})(M);(function(a){var D=a.addEvent,z=a.animate,F=a.Axis,J=a.createElement,m=a.css,f=a.defined,h=a.each,q=a.erase,n=a.extend,k=a.fireEvent,v=a.inArray,d=a.isNumber,g=a.isObject,w=a.merge,B=a.pick,c=a.Point,e=a.Series,l=a.seriesTypes,
|
||||
u=a.setAnimation,L=a.splat;n(a.Chart.prototype,{addSeries:function(a,c,d){var b,e=this;a&&(c=B(c,!0),k(e,"addSeries",{options:a},function(){b=e.initSeries(a);e.isDirtyLegend=!0;e.linkSeries();c&&e.redraw(d)}));return b},addAxis:function(a,c,d,e){var b=c?"xAxis":"yAxis",f=this.options;a=w(a,{index:this[b].length,isX:c});new F(this,a);f[b]=L(f[b]||{});f[b].push(a);B(d,!0)&&this.redraw(e)},showLoading:function(a){var b=this,c=b.options,d=b.loadingDiv,e=c.loading,f=function(){d&&m(d,{left:b.plotLeft+
|
||||
"px",top:b.plotTop+"px",width:b.plotWidth+"px",height:b.plotHeight+"px"})};d||(b.loadingDiv=d=J("div",{className:"highcharts-loading highcharts-loading-hidden"},null,b.container),b.loadingSpan=J("span",{className:"highcharts-loading-inner"},null,d),D(b,"redraw",f));d.className="highcharts-loading";b.loadingSpan.innerHTML=a||c.lang.loading;m(d,n(e.style,{zIndex:10}));m(b.loadingSpan,e.labelStyle);b.loadingShown||(m(d,{opacity:0,display:""}),z(d,{opacity:e.style.opacity||.5},{duration:e.showDuration||
|
||||
0}));b.loadingShown=!0;f()},hideLoading:function(){var a=this.options,c=this.loadingDiv;c&&(c.className="highcharts-loading highcharts-loading-hidden",z(c,{opacity:0},{duration:a.loading.hideDuration||100,complete:function(){m(c,{display:"none"})}}));this.loadingShown=!1},propsRequireDirtyBox:"backgroundColor borderColor borderWidth margin marginTop marginRight marginBottom marginLeft spacing spacingTop spacingRight spacingBottom spacingLeft borderRadius plotBackgroundColor plotBackgroundImage plotBorderColor plotBorderWidth plotShadow shadow".split(" "),
|
||||
propsRequireUpdateSeries:["chart.polar","chart.ignoreHiddenSeries","chart.type","colors","plotOptions"],update:function(a,c){var b,e={credits:"addCredits",title:"setTitle",subtitle:"setSubtitle"},g=a.chart,l,k;if(g){w(!0,this.options.chart,g);"className"in g&&this.setClassName(g.className);if("inverted"in g||"polar"in g)this.propFromSeries(),l=!0;for(b in g)g.hasOwnProperty(b)&&(-1!==v("chart."+b,this.propsRequireUpdateSeries)&&(k=!0),-1!==v(b,this.propsRequireDirtyBox)&&(this.isDirtyBox=!0));"style"in
|
||||
g&&this.renderer.setStyle(g.style)}for(b in a){if(this[b]&&"function"===typeof this[b].update)this[b].update(a[b],!1);else if("function"===typeof this[e[b]])this[e[b]](a[b]);"chart"!==b&&-1!==v(b,this.propsRequireUpdateSeries)&&(k=!0)}a.colors&&(this.options.colors=a.colors);a.plotOptions&&w(!0,this.options.plotOptions,a.plotOptions);h(["xAxis","yAxis","series"],function(b){a[b]&&h(L(a[b]),function(a){var c=f(a.id)&&this.get(a.id)||this[b][0];c&&c.coll===b&&c.update(a,!1)},this)},this);l&&h(this.axes,
|
||||
function(a){a.update({},!1)});k&&h(this.series,function(a){a.update({},!1)});a.loading&&w(!0,this.options.loading,a.loading);b=g&&g.width;g=g&&g.height;d(b)&&b!==this.chartWidth||d(g)&&g!==this.chartHeight?this.setSize(b,g):B(c,!0)&&this.redraw()},setSubtitle:function(a){this.setTitle(void 0,a)}});n(c.prototype,{update:function(a,c,d,e){function b(){f.applyOptions(a);null===f.y&&l&&(f.graphic=l.destroy());g(a,!0)&&(l&&l.element&&a&&a.marker&&a.marker.symbol&&(f.graphic=l.destroy()),a&&a.dataLabels&&
|
||||
f.dataLabel&&(f.dataLabel=f.dataLabel.destroy()));k=f.index;h.updateParallelArrays(f,k);m.data[k]=g(m.data[k],!0)?f.options:a;h.isDirty=h.isDirtyData=!0;!h.fixedBox&&h.hasCartesianSeries&&(n.isDirtyBox=!0);"point"===m.legendType&&(n.isDirtyLegend=!0);c&&n.redraw(d)}var f=this,h=f.series,l=f.graphic,k,n=h.chart,m=h.options;c=B(c,!0);!1===e?b():f.firePointEvent("update",{options:a},b)},remove:function(a,c){this.series.removePoint(v(this,this.series.data),a,c)}});n(e.prototype,{addPoint:function(a,c,
|
||||
d,e){var b=this.options,f=this.data,g=this.chart,h=this.xAxis&&this.xAxis.names,l=b.data,k,n,m=this.xData,u,t;c=B(c,!0);k={series:this};this.pointClass.prototype.applyOptions.apply(k,[a]);t=k.x;u=m.length;if(this.requireSorting&&t<m[u-1])for(n=!0;u&&m[u-1]>t;)u--;this.updateParallelArrays(k,"splice",u,0,0);this.updateParallelArrays(k,u);h&&k.name&&(h[t]=k.name);l.splice(u,0,a);n&&(this.data.splice(u,0,null),this.processData());"point"===b.legendType&&this.generatePoints();d&&(f[0]&&f[0].remove?f[0].remove(!1):
|
||||
(f.shift(),this.updateParallelArrays(k,"shift"),l.shift()));this.isDirtyData=this.isDirty=!0;c&&g.redraw(e)},removePoint:function(a,c,d){var b=this,e=b.data,f=e[a],g=b.points,h=b.chart,l=function(){g&&g.length===e.length&&g.splice(a,1);e.splice(a,1);b.options.data.splice(a,1);b.updateParallelArrays(f||{series:b},"splice",a,1);f&&f.destroy();b.isDirty=!0;b.isDirtyData=!0;c&&h.redraw()};u(d,h);c=B(c,!0);f?f.firePointEvent("remove",null,l):l()},remove:function(a,c,d){function b(){e.destroy();f.isDirtyLegend=
|
||||
f.isDirtyBox=!0;f.linkSeries();B(a,!0)&&f.redraw(c)}var e=this,f=e.chart;!1!==d?k(e,"remove",null,b):b()},update:function(a,c){var b=this,d=this.chart,e=this.userOptions,f=this.type,g=a.type||e.type||d.options.chart.type,k=l[f].prototype,m=["group","markerGroup","dataLabelsGroup"],u;if(g&&g!==f||void 0!==a.zIndex)m.length=0;h(m,function(a){m[a]=b[a];delete b[a]});a=w(e,{animation:!1,index:this.index,pointStart:this.xData[0]},{data:this.options.data},a);this.remove(!1,null,!1);for(u in k)this[u]=void 0;
|
||||
n(this,l[g||f].prototype);h(m,function(a){b[a]=m[a]});this.init(d,a);d.linkSeries();B(c,!0)&&d.redraw(!1)}});n(F.prototype,{update:function(a,c){var b=this.chart;a=b.options[this.coll][this.options.index]=w(this.userOptions,a);this.destroy(!0);this.init(b,n(a,{events:void 0}));b.isDirtyBox=!0;B(c,!0)&&b.redraw()},remove:function(a){for(var b=this.chart,c=this.coll,d=this.series,e=d.length;e--;)d[e]&&d[e].remove(!1);q(b.axes,this);q(b[c],this);b.options[c].splice(this.options.index,1);h(b[c],function(a,
|
||||
b){a.options.index=b});this.destroy();b.isDirtyBox=!0;B(a,!0)&&b.redraw()},setTitle:function(a,c){this.update({title:a},c)},setCategories:function(a,c){this.update({categories:a},c)}})})(M);(function(a){var D=a.color,z=a.each,F=a.map,J=a.pick,m=a.Series,f=a.seriesType;f("area","line",{softThreshold:!1,threshold:0},{singleStacks:!1,getStackPoints:function(){var a=[],f=[],n=this.xAxis,k=this.yAxis,m=k.stacks[this.stackKey],d={},g=this.points,w=this.index,B=k.series,c=B.length,e,l=J(k.options.reversedStacks,
|
||||
!0)?1:-1,u,L;if(this.options.stacking){for(u=0;u<g.length;u++)d[g[u].x]=g[u];for(L in m)null!==m[L].total&&f.push(L);f.sort(function(a,c){return a-c});e=F(B,function(){return this.visible});z(f,function(b,g){var h=0,t,q;if(d[b]&&!d[b].isNull)a.push(d[b]),z([-1,1],function(a){var h=1===a?"rightNull":"leftNull",k=0,n=m[f[g+a]];if(n)for(u=w;0<=u&&u<c;)t=n.points[u],t||(u===w?d[b][h]=!0:e[u]&&(q=m[b].points[u])&&(k-=q[1]-q[0])),u+=l;d[b][1===a?"rightCliff":"leftCliff"]=k});else{for(u=w;0<=u&&u<c;){if(t=
|
||||
m[b].points[u]){h=t[1];break}u+=l}h=k.toPixels(h,!0);a.push({isNull:!0,plotX:n.toPixels(b,!0),plotY:h,yBottom:h})}})}return a},getGraphPath:function(a){var f=m.prototype.getGraphPath,h=this.options,k=h.stacking,v=this.yAxis,d,g,w=[],B=[],c=this.index,e,l=v.stacks[this.stackKey],u=h.threshold,z=v.getThreshold(h.threshold),b,h=h.connectNulls||"percent"===k,t=function(b,d,f){var g=a[b];b=k&&l[g.x].points[c];var h=g[f+"Null"]||0;f=g[f+"Cliff"]||0;var n,m,g=!0;f||h?(n=(h?b[0]:b[1])+f,m=b[0]+f,g=!!h):!k&&
|
||||
a[d]&&a[d].isNull&&(n=m=u);void 0!==n&&(B.push({plotX:e,plotY:null===n?z:v.getThreshold(n),isNull:g}),w.push({plotX:e,plotY:null===m?z:v.getThreshold(m),doCurve:!1}))};a=a||this.points;k&&(a=this.getStackPoints());for(d=0;d<a.length;d++)if(g=a[d].isNull,e=J(a[d].rectPlotX,a[d].plotX),b=J(a[d].yBottom,z),!g||h)h||t(d,d-1,"left"),g&&!k&&h||(B.push(a[d]),w.push({x:d,plotX:e,plotY:b})),h||t(d,d+1,"right");d=f.call(this,B,!0,!0);w.reversed=!0;g=f.call(this,w,!0,!0);g.length&&(g[0]="L");g=d.concat(g);f=
|
||||
f.call(this,B,!1,h);g.xMap=d.xMap;this.areaPath=g;return f},drawGraph:function(){this.areaPath=[];m.prototype.drawGraph.apply(this);var a=this,f=this.areaPath,n=this.options,k=[["area","highcharts-area",this.color,n.fillColor]];z(this.zones,function(f,d){k.push(["zone-area-"+d,"highcharts-area highcharts-zone-area-"+d+" "+f.className,f.color||a.color,f.fillColor||n.fillColor])});z(k,function(h){var d=h[0],g=a[d];g?(g.endX=f.xMap,g.animate({d:f})):(g=a[d]=a.chart.renderer.path(f).addClass(h[1]).attr({fill:J(h[3],
|
||||
D(h[2]).setOpacity(J(n.fillOpacity,.75)).get()),zIndex:0}).add(a.group),g.isArea=!0);g.startX=f.xMap;g.shiftUnit=n.step?2:1})},drawLegendSymbol:a.LegendSymbolMixin.drawRectangle})})(M);(function(a){var D=a.extendClass,z=a.merge,F=a.pick,J=a.Series,m=a.seriesTypes;a.defaultPlotOptions.spline=z(a.defaultPlotOptions.line);m.spline=D(J,{type:"spline",getPointSpline:function(a,h,m){var f=h.plotX,k=h.plotY,q=a[m-1];m=a[m+1];var d,g,w,B;if(q&&!q.isNull&&!1!==q.doCurve&&m&&!m.isNull&&!1!==m.doCurve){a=q.plotY;
|
||||
w=m.plotX;m=m.plotY;var c=0;d=(1.5*f+q.plotX)/2.5;g=(1.5*k+a)/2.5;w=(1.5*f+w)/2.5;B=(1.5*k+m)/2.5;w!==d&&(c=(B-g)*(w-f)/(w-d)+k-B);g+=c;B+=c;g>a&&g>k?(g=Math.max(a,k),B=2*k-g):g<a&&g<k&&(g=Math.min(a,k),B=2*k-g);B>m&&B>k?(B=Math.max(m,k),g=2*k-B):B<m&&B<k&&(B=Math.min(m,k),g=2*k-B);h.rightContX=w;h.rightContY=B}h=["C",F(q.rightContX,q.plotX),F(q.rightContY,q.plotY),F(d,f),F(g,k),f,k];q.rightContX=q.rightContY=null;return h}})})(M);(function(a){var D=a.seriesTypes.area.prototype,z=a.seriesType;z("areaspline",
|
||||
"spline",a.defaultPlotOptions.area,{getStackPoints:D.getStackPoints,getGraphPath:D.getGraphPath,setStackCliffs:D.setStackCliffs,drawGraph:D.drawGraph,drawLegendSymbol:a.LegendSymbolMixin.drawRectangle})})(M);(function(a){var D=a.animObject,z=a.color,F=a.each,J=a.extend,m=a.isNumber,f=a.merge,h=a.pick,q=a.Series,n=a.seriesType,k=a.stop,v=a.svg;n("column","line",{borderRadius:0,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{halo:!1,brightness:.1,
|
||||
shadow:!1},select:{color:"#cccccc",borderColor:"#000000",shadow:!1}},dataLabels:{align:null,verticalAlign:null,y:null},softThreshold:!1,startFromThreshold:!0,stickyTracking:!1,tooltip:{distance:6},threshold:0,borderColor:"#ffffff"},{cropShoulder:0,directTouch:!0,trackerGroups:["group","dataLabelsGroup"],negStacks:!0,init:function(){q.prototype.init.apply(this,arguments);var a=this,f=a.chart;f.hasRendered&&F(f.series,function(d){d.type===a.type&&(d.isDirty=!0)})},getColumnMetrics:function(){var a=
|
||||
this,f=a.options,k=a.xAxis,m=a.yAxis,c=k.reversed,e,l={},n=0;!1===f.grouping?n=1:F(a.chart.series,function(b){var c=b.options,d=b.yAxis,f;b.type===a.type&&b.visible&&m.len===d.len&&m.pos===d.pos&&(c.stacking?(e=b.stackKey,void 0===l[e]&&(l[e]=n++),f=l[e]):!1!==c.grouping&&(f=n++),b.columnIndex=f)});var q=Math.min(Math.abs(k.transA)*(k.ordinalSlope||f.pointRange||k.closestPointRange||k.tickInterval||1),k.len),b=q*f.groupPadding,t=(q-2*b)/n,f=Math.min(f.maxPointWidth||k.len,h(f.pointWidth,t*(1-2*f.pointPadding)));
|
||||
a.columnMetrics={width:f,offset:(t-f)/2+(b+((a.columnIndex||0)+(c?1:0))*t-q/2)*(c?-1:1)};return a.columnMetrics},crispCol:function(a,f,h,k){var c=this.chart,d=this.borderWidth,g=-(d%2?.5:0),d=d%2?.5:1;c.inverted&&c.renderer.isVML&&(d+=1);h=Math.round(a+h)+g;a=Math.round(a)+g;k=Math.round(f+k)+d;g=.5>=Math.abs(f)&&.5<k;f=Math.round(f)+d;k-=f;g&&k&&(--f,k+=1);return{x:a,y:f,width:h-a,height:k}},translate:function(){var a=this,f=a.chart,k=a.options,m=a.dense=2>a.closestPointRange*a.xAxis.transA,m=a.borderWidth=
|
||||
h(k.borderWidth,m?0:1),c=a.yAxis,e=a.translatedThreshold=c.getThreshold(k.threshold),l=h(k.minPointLength,5),n=a.getColumnMetrics(),v=n.width,b=a.barW=Math.max(v,1+2*m),t=a.pointXOffset=n.offset;f.inverted&&(e-=.5);k.pointPadding&&(b=Math.ceil(b));q.prototype.translate.apply(a);F(a.points,function(d){var g=h(d.yBottom,e),k=999+Math.abs(g),k=Math.min(Math.max(-k,d.plotY),c.len+k),m=d.plotX+t,n=b,u=Math.min(k,g),q,y=Math.max(k,g)-u;Math.abs(y)<l&&l&&(y=l,q=!c.reversed&&!d.negative||c.reversed&&d.negative,
|
||||
u=Math.abs(u-e)>l?g-l:e-(q?l:0));d.barX=m;d.pointWidth=v;d.tooltipPos=f.inverted?[c.len+c.pos-f.plotLeft-k,a.xAxis.len-m-n/2,y]:[m+n/2,k+c.pos-f.plotTop,y];d.shapeType="rect";d.shapeArgs=a.crispCol.apply(a,d.isNull?[d.plotX,c.len/2,0,0]:[m,u,n,y])})},getSymbol:a.noop,drawLegendSymbol:a.LegendSymbolMixin.drawRectangle,drawGraph:function(){this.group[this.dense?"addClass":"removeClass"]("highcharts-dense-data")},pointAttribs:function(a,f){var d=this.options,g=this.pointAttrToOptions||{},c=g.stroke||
|
||||
"borderColor",e=g["stroke-width"]||"borderWidth",h=a&&a.color||this.color,k=a[c]||d[c]||this.color||h,g=d.dashStyle,m;a&&this.zones.length&&(h=(h=a.getZone())&&h.color||a.options.color||this.color);f&&(f=d.states[f],m=f.brightness,h=f.color||void 0!==m&&z(h).brighten(f.brightness).get()||h,k=f[c]||k,g=f.dashStyle||g);a={fill:h,stroke:k,"stroke-width":a[e]||d[e]||this[e]||0};d.borderRadius&&(a.r=d.borderRadius);g&&(a.dashstyle=g);return a},drawPoints:function(){var a=this,g=this.chart,h=a.options,
|
||||
n=g.renderer,c=h.animationLimit||250,e;F(a.points,function(d){var l=d.graphic;m(d.plotY)&&null!==d.y?(e=d.shapeArgs,l?(k(l),l[g.pointCount<c?"animate":"attr"](f(e))):d.graphic=l=n[d.shapeType](e).attr({"class":d.getClassName()}).add(d.group||a.group),l.attr(a.pointAttribs(d,d.selected&&"select")).shadow(h.shadow,null,h.stacking&&!h.borderRadius)):l&&(d.graphic=l.destroy())})},animate:function(a){var d=this,f=this.yAxis,h=d.options,c=this.chart.inverted,e={};v&&(a?(e.scaleY=.001,a=Math.min(f.pos+f.len,
|
||||
Math.max(f.pos,f.toPixels(h.threshold))),c?e.translateX=a-f.len:e.translateY=a,d.group.attr(e)):(e[c?"translateX":"translateY"]=f.pos,d.group.animate(e,J(D(d.options.animation),{step:function(a,c){d.group.attr({scaleY:Math.max(.001,c.pos)})}})),d.animate=null))},remove:function(){var a=this,f=a.chart;f.hasRendered&&F(f.series,function(d){d.type===a.type&&(d.isDirty=!0)});q.prototype.remove.apply(a,arguments)}})})(M);(function(a){a=a.seriesType;a("bar","column",null,{inverted:!0})})(M);(function(a){var D=
|
||||
a.Series;a=a.seriesType;a("scatter","line",{lineWidth:0,marker:{enabled:!0},tooltip:{headerFormat:'\x3cspan style\x3d"color:{point.color}"\x3e\u25cf\x3c/span\x3e \x3cspan style\x3d"font-size: 0.85em"\x3e {series.name}\x3c/span\x3e\x3cbr/\x3e',pointFormat:"x: \x3cb\x3e{point.x}\x3c/b\x3e\x3cbr/\x3ey: \x3cb\x3e{point.y}\x3c/b\x3e\x3cbr/\x3e"}},{sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:["group","markerGroup","dataLabelsGroup"],takeOrdinalPosition:!1,kdDimensions:2,drawGraph:function(){this.options.lineWidth&&
|
||||
D.prototype.drawGraph.call(this)}})})(M);(function(a){var D=a.pick,z=a.relativeLength;a.CenteredSeriesMixin={getCenter:function(){var a=this.options,J=this.chart,m=2*(a.slicedOffset||0),f=J.plotWidth-2*m,J=J.plotHeight-2*m,h=a.center,h=[D(h[0],"50%"),D(h[1],"50%"),a.size||"100%",a.innerSize||0],q=Math.min(f,J),n,k;for(n=0;4>n;++n)k=h[n],a=2>n||2===n&&/%$/.test(k),h[n]=z(k,[f,J,q,h[2]][n])+(a?m:0);h[3]>h[2]&&(h[3]=h[2]);return h}}})(M);(function(a){var D=a.addEvent,z=a.defined,F=a.each,J=a.extend,
|
||||
m=a.inArray,f=a.noop,h=a.pick,q=a.Point,n=a.Series,k=a.seriesType,v=a.setAnimation;k("pie","line",{center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return null===this.y?void 0:this.point.name},x:0},ignoreHiddenPoint:!0,legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10,stickyTracking:!1,tooltip:{followPointer:!0},borderColor:"#ffffff",borderWidth:1,states:{hover:{brightness:.1,shadow:!1}}},{isCartesian:!1,requireSorting:!1,directTouch:!0,
|
||||
noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],axisTypes:[],pointAttribs:a.seriesTypes.column.prototype.pointAttribs,animate:function(a){var d=this,f=d.points,h=d.startAngleRad;a||(F(f,function(a){var c=a.graphic,f=a.shapeArgs;c&&(c.attr({r:a.startR||d.center[3]/2,start:h,end:h}),c.animate({r:f.r,start:f.start,end:f.end},d.options.animation))}),d.animate=null)},updateTotals:function(){var a,f=0,h=this.points,k=h.length,c,e=this.options.ignoreHiddenPoint;for(a=0;a<k;a++)c=h[a],0>c.y&&
|
||||
(c.y=null),f+=e&&!c.visible?0:c.y;this.total=f;for(a=0;a<k;a++)c=h[a],c.percentage=0<f&&(c.visible||!e)?c.y/f*100:0,c.total=f},generatePoints:function(){n.prototype.generatePoints.call(this);this.updateTotals()},translate:function(a){this.generatePoints();var d=0,f=this.options,k=f.slicedOffset,c=k+(f.borderWidth||0),e,l,m,n=f.startAngle||0,b=this.startAngleRad=Math.PI/180*(n-90),n=(this.endAngleRad=Math.PI/180*(h(f.endAngle,n+360)-90))-b,t=this.points,q=f.dataLabels.distance,f=f.ignoreHiddenPoint,
|
||||
v,x=t.length,I;a||(this.center=a=this.getCenter());this.getX=function(b,c){m=Math.asin(Math.min((b-a[1])/(a[2]/2+q),1));return a[0]+(c?-1:1)*Math.cos(m)*(a[2]/2+q)};for(v=0;v<x;v++){I=t[v];e=b+d*n;if(!f||I.visible)d+=I.percentage/100;l=b+d*n;I.shapeType="arc";I.shapeArgs={x:a[0],y:a[1],r:a[2]/2,innerR:a[3]/2,start:Math.round(1E3*e)/1E3,end:Math.round(1E3*l)/1E3};m=(l+e)/2;m>1.5*Math.PI?m-=2*Math.PI:m<-Math.PI/2&&(m+=2*Math.PI);I.slicedTranslation={translateX:Math.round(Math.cos(m)*k),translateY:Math.round(Math.sin(m)*
|
||||
k)};e=Math.cos(m)*a[2]/2;l=Math.sin(m)*a[2]/2;I.tooltipPos=[a[0]+.7*e,a[1]+.7*l];I.half=m<-Math.PI/2||m>Math.PI/2?1:0;I.angle=m;c=Math.min(c,q/5);I.labelPos=[a[0]+e+Math.cos(m)*q,a[1]+l+Math.sin(m)*q,a[0]+e+Math.cos(m)*c,a[1]+l+Math.sin(m)*c,a[0]+e,a[1]+l,0>q?"center":I.half?"right":"left",m]}},drawGraph:null,drawPoints:function(){var a=this,f=a.chart.renderer,h,k,c,e,l=a.options.shadow;l&&!a.shadowGroup&&(a.shadowGroup=f.g("shadow").add(a.group));F(a.points,function(d){if(null!==d.y){k=d.graphic;
|
||||
e=d.shapeArgs;h=d.sliced?d.slicedTranslation:{};var g=d.shadowGroup;l&&!g&&(g=d.shadowGroup=f.g("shadow").add(a.shadowGroup));g&&g.attr(h);c=a.pointAttribs(d,d.selected&&"select");k?k.setRadialReference(a.center).attr(c).animate(J(e,h)):(d.graphic=k=f[d.shapeType](e).addClass(d.getClassName()).setRadialReference(a.center).attr(h).add(a.group),d.visible||k.attr({visibility:"hidden"}),k.attr(c).attr({"stroke-linejoin":"round"}).shadow(l,g))}})},searchPoint:f,sortByAngle:function(a,f){a.sort(function(a,
|
||||
d){return void 0!==a.angle&&(d.angle-a.angle)*f})},drawLegendSymbol:a.LegendSymbolMixin.drawRectangle,getCenter:a.CenteredSeriesMixin.getCenter,getSymbol:f},{init:function(){q.prototype.init.apply(this,arguments);var a=this,f;a.name=h(a.name,"Slice");f=function(d){a.slice("select"===d.type)};D(a,"select",f);D(a,"unselect",f);return a},setVisible:function(a,f){var d=this,g=d.series,c=g.chart,e=g.options.ignoreHiddenPoint;f=h(f,e);a!==d.visible&&(d.visible=d.options.visible=a=void 0===a?!d.visible:
|
||||
a,g.options.data[m(d,g.data)]=d.options,F(["graphic","dataLabel","connector","shadowGroup"],function(c){if(d[c])d[c][a?"show":"hide"](!0)}),d.legendItem&&c.legend.colorizeItem(d,a),a||"hover"!==d.state||d.setState(""),e&&(g.isDirty=!0),f&&c.redraw())},slice:function(a,f,k){var d=this.series;v(k,d.chart);h(f,!0);this.sliced=this.options.sliced=a=z(a)?a:!this.sliced;d.options.data[m(this,d.data)]=this.options;a=a?this.slicedTranslation:{translateX:0,translateY:0};this.graphic.animate(a);this.shadowGroup&&
|
||||
this.shadowGroup.animate(a)},haloPath:function(a){var d=this.shapeArgs;return this.sliced||!this.visible?[]:this.series.chart.renderer.symbols.arc(d.x,d.y,d.r+a,d.r+a,{innerR:this.shapeArgs.r,start:d.start,end:d.end})}})})(M);(function(a){var D=a.addEvent,z=a.arrayMax,F=a.defined,J=a.each,m=a.extend,f=a.format,h=a.map,q=a.merge,n=a.noop,k=a.pick,v=a.relativeLength,d=a.Series,g=a.seriesTypes,w=a.stableSort,B=a.stop;a.distribute=function(a,d){function c(a,b){return a.target-b.target}var e,f=!0,b=a,
|
||||
g=[],k;k=0;for(e=a.length;e--;)k+=a[e].size;if(k>d){w(a,function(a,b){return(b.rank||0)-(a.rank||0)});for(k=e=0;k<=d;)k+=a[e].size,e++;g=a.splice(e-1,a.length)}w(a,c);for(a=h(a,function(a){return{size:a.size,targets:[a.target]}});f;){for(e=a.length;e--;)f=a[e],k=(Math.min.apply(0,f.targets)+Math.max.apply(0,f.targets))/2,f.pos=Math.min(Math.max(0,k-f.size/2),d-f.size);e=a.length;for(f=!1;e--;)0<e&&a[e-1].pos+a[e-1].size>a[e].pos&&(a[e-1].size+=a[e].size,a[e-1].targets=a[e-1].targets.concat(a[e].targets),
|
||||
a[e-1].pos+a[e-1].size>d&&(a[e-1].pos=d-a[e-1].size),a.splice(e,1),f=!0)}e=0;J(a,function(a){var c=0;J(a.targets,function(){b[e].pos=a.pos+c;c+=b[e].size;e++})});b.push.apply(b,g);w(b,c)};d.prototype.drawDataLabels=function(){var a=this,d=a.options,g=d.dataLabels,h=a.points,n,b,t=a.hasRendered||0,y,v,x=k(g.defer,!0),w=a.chart.renderer;if(g.enabled||a._hasPointLabels)a.dlProcessOptions&&a.dlProcessOptions(g),v=a.plotGroup("dataLabelsGroup","data-labels",x&&!t?"hidden":"visible",g.zIndex||6),x&&(v.attr({opacity:+t}),
|
||||
t||D(a,"afterAnimate",function(){a.visible&&v.show(!0);v[d.animation?"animate":"attr"]({opacity:1},{duration:200})})),b=g,J(h,function(c){var e,h=c.dataLabel,l,t,r=c.connector,u=!0,x,I={};n=c.dlOptions||c.options&&c.options.dataLabels;e=k(n&&n.enabled,b.enabled)&&null!==c.y;if(h&&!e)c.dataLabel=h.destroy();else if(e){g=q(b,n);x=g.style;e=g.rotation;l=c.getLabelConfig();y=g.format?f(g.format,l):g.formatter.call(l,g);x.color=k(g.color,x.color,a.color,"#000000");if(h)F(y)?(h.attr({text:y}),u=!1):(c.dataLabel=
|
||||
h=h.destroy(),r&&(c.connector=r.destroy()));else if(F(y)){h={fill:g.backgroundColor,stroke:g.borderColor,"stroke-width":g.borderWidth,r:g.borderRadius||0,rotation:e,padding:g.padding,zIndex:1};"contrast"===x.color&&(I.color=g.inside||0>g.distance||d.stacking?w.getContrast(c.color||a.color):"#000000");d.cursor&&(I.cursor=d.cursor);for(t in h)void 0===h[t]&&delete h[t];h=c.dataLabel=w[e?"text":"label"](y,0,-9999,g.shape,null,null,g.useHTML,null,"data-label").attr(h);h.addClass("highcharts-data-label-color-"+
|
||||
c.colorIndex+" "+(g.className||""));h.css(m(x,I));h.add(v);h.shadow(g.shadow)}h&&a.alignDataLabel(c,h,g,null,u)}})};d.prototype.alignDataLabel=function(a,d,f,g,h){var b=this.chart,c=b.inverted,e=k(a.plotX,-9999),l=k(a.plotY,-9999),n=d.getBBox(),q,r=f.rotation,u=f.align,v=this.visible&&(a.series.forceDL||b.isInsidePlot(e,Math.round(l),c)||g&&b.isInsidePlot(e,c?g.x+1:g.y+g.height-1,c)),w="justify"===k(f.overflow,"justify");v&&(q=f.style.fontSize,q=b.renderer.fontMetrics(q,d).b,g=m({x:c?b.plotWidth-
|
||||
l:e,y:Math.round(c?b.plotHeight-e:l),width:0,height:0},g),m(f,{width:n.width,height:n.height}),r?(w=!1,c=b.renderer.rotCorr(q,r),c={x:g.x+f.x+g.width/2+c.x,y:g.y+f.y+{top:0,middle:.5,bottom:1}[f.verticalAlign]*g.height},d[h?"attr":"animate"](c).attr({align:u}),e=(r+720)%360,e=180<e&&360>e,"left"===u?c.y-=e?n.height:0:"center"===u?(c.x-=n.width/2,c.y-=n.height/2):"right"===u&&(c.x-=n.width,c.y-=e?0:n.height)):(d.align(f,null,g),c=d.alignAttr),w?this.justifyDataLabel(d,f,c,n,g,h):k(f.crop,!0)&&(v=b.isInsidePlot(c.x,
|
||||
c.y)&&b.isInsidePlot(c.x+n.width,c.y+n.height)),f.shape&&!r&&d.attr({anchorX:a.plotX,anchorY:a.plotY}));v||(B(d),d.attr({y:-9999}),d.placed=!1)};d.prototype.justifyDataLabel=function(a,d,f,g,h,b){var c=this.chart,e=d.align,k=d.verticalAlign,l,m,n=a.box?0:a.padding||0;l=f.x+n;0>l&&("right"===e?d.align="left":d.x=-l,m=!0);l=f.x+g.width-n;l>c.plotWidth&&("left"===e?d.align="right":d.x=c.plotWidth-l,m=!0);l=f.y+n;0>l&&("bottom"===k?d.verticalAlign="top":d.y=-l,m=!0);l=f.y+g.height-n;l>c.plotHeight&&("top"===
|
||||
k?d.verticalAlign="bottom":d.y=c.plotHeight-l,m=!0);m&&(a.placed=!b,a.align(d,null,h))};g.pie&&(g.pie.prototype.drawDataLabels=function(){var c=this,e=c.data,f,g=c.chart,m=c.options.dataLabels,b=k(m.connectorPadding,10),n=k(m.connectorWidth,1),q=g.plotWidth,v=g.plotHeight,x,w=m.distance,r=c.center,B=r[2]/2,H=r[1],D=0<w,p,A,F,O,C=[[],[]],E,M,Q,R,T=[0,0,0,0];c.visible&&(m.enabled||c._hasPointLabels)&&(d.prototype.drawDataLabels.apply(c),J(e,function(a){a.dataLabel&&a.visible&&(C[a.half].push(a),a.dataLabel._pos=
|
||||
null)}),J(C,function(d,e){var k,l,n=d.length,t,u,x;if(n)for(c.sortByAngle(d,e-.5),0<w&&(k=Math.max(0,H-B-w),l=Math.min(H+B+w,g.plotHeight),t=h(d,function(a){if(a.dataLabel)return x=a.dataLabel.getBBox().height||21,{target:a.labelPos[1]-k+x/2,size:x,rank:a.y}}),a.distribute(t,l+x-k)),R=0;R<n;R++)f=d[R],F=f.labelPos,p=f.dataLabel,Q=!1===f.visible?"hidden":"inherit",u=F[1],t?void 0===t[R].pos?Q="hidden":(O=t[R].size,M=k+t[R].pos):M=u,E=m.justify?r[0]+(e?-1:1)*(B+w):c.getX(M<k+2||M>l-2?u:M,e),p._attr=
|
||||
{visibility:Q,align:F[6]},p._pos={x:E+m.x+({left:b,right:-b}[F[6]]||0),y:M+m.y-10},F.x=E,F.y=M,null===c.options.size&&(A=p.width,E-A<b?T[3]=Math.max(Math.round(A-E+b),T[3]):E+A>q-b&&(T[1]=Math.max(Math.round(E+A-q+b),T[1])),0>M-O/2?T[0]=Math.max(Math.round(-M+O/2),T[0]):M+O/2>v&&(T[2]=Math.max(Math.round(M+O/2-v),T[2])))}),0===z(T)||this.verifyDataLabelOverflow(T))&&(this.placeDataLabels(),D&&n&&J(this.points,function(a){var b;x=a.connector;if((p=a.dataLabel)&&p._pos&&a.visible){Q=p._attr.visibility;
|
||||
if(b=!x)a.connector=x=g.renderer.path().addClass("highcharts-data-label-connector highcharts-color-"+a.colorIndex).add(c.dataLabelsGroup),x.attr({"stroke-width":n,stroke:m.connectorColor||a.color||"#666666"});x[b?"attr":"animate"]({d:c.connectorPath(a.labelPos)});x.attr("visibility",Q)}else x&&(a.connector=x.destroy())}))},g.pie.prototype.connectorPath=function(a){var c=a.x,d=a.y;return k(this.options.softConnector,!0)?["M",c+("left"===a[6]?5:-5),d,"C",c,d,2*a[2]-a[4],2*a[3]-a[5],a[2],a[3],"L",a[4],
|
||||
a[5]]:["M",c+("left"===a[6]?5:-5),d,"L",a[2],a[3],"L",a[4],a[5]]},g.pie.prototype.placeDataLabels=function(){J(this.points,function(a){var c=a.dataLabel;c&&a.visible&&((a=c._pos)?(c.attr(c._attr),c[c.moved?"animate":"attr"](a),c.moved=!0):c&&c.attr({y:-9999}))})},g.pie.prototype.alignDataLabel=n,g.pie.prototype.verifyDataLabelOverflow=function(a){var c=this.center,d=this.options,f=d.center,g=d.minSize||80,b,h;null!==f[0]?b=Math.max(c[2]-Math.max(a[1],a[3]),g):(b=Math.max(c[2]-a[1]-a[3],g),c[0]+=(a[3]-
|
||||
a[1])/2);null!==f[1]?b=Math.max(Math.min(b,c[2]-Math.max(a[0],a[2])),g):(b=Math.max(Math.min(b,c[2]-a[0]-a[2]),g),c[1]+=(a[0]-a[2])/2);b<c[2]?(c[2]=b,c[3]=Math.min(v(d.innerSize||0,b),b),this.translate(c),this.drawDataLabels&&this.drawDataLabels()):h=!0;return h});g.column&&(g.column.prototype.alignDataLabel=function(a,e,f,g,h){var b=this.chart.inverted,c=a.series,l=a.dlBox||a.shapeArgs,m=k(a.below,a.plotY>k(this.translatedThreshold,c.yAxis.len)),n=k(f.inside,!!this.options.stacking);l&&(g=q(l),0>
|
||||
g.y&&(g.height+=g.y,g.y=0),l=g.y+g.height-c.yAxis.len,0<l&&(g.height-=l),b&&(g={x:c.yAxis.len-g.y-g.height,y:c.xAxis.len-g.x-g.width,width:g.height,height:g.width}),n||(b?(g.x+=m?0:g.width,g.width=0):(g.y+=m?g.height:0,g.height=0)));f.align=k(f.align,!b||n?"center":m?"right":"left");f.verticalAlign=k(f.verticalAlign,b||n?"middle":m?"top":"bottom");d.prototype.alignDataLabel.call(this,a,e,f,g,h)})})(M);(function(a){var D=a.Chart,z=a.each,F=a.pick,J=a.addEvent;D.prototype.callbacks.push(function(a){function f(){var f=
|
||||
[];z(a.series,function(a){var h=a.options.dataLabels,k=a.dataLabelCollections||["dataLabel"];(h.enabled||a._hasPointLabels)&&!h.allowOverlap&&a.visible&&z(k,function(h){z(a.points,function(a){a[h]&&(a[h].labelrank=F(a.labelrank,a.shapeArgs&&a.shapeArgs.height),f.push(a[h]))})})});a.hideOverlappingLabels(f)}f();J(a,"redraw",f)});D.prototype.hideOverlappingLabels=function(a){var f=a.length,h,m,n,k,v,d,g,w,B,c=function(a,c,d,f,b,g,h,k){return!(b>a+d||b+h<a||g>c+f||g+k<c)};for(m=0;m<f;m++)if(h=a[m])h.oldOpacity=
|
||||
h.opacity,h.newOpacity=1;a.sort(function(a,c){return(c.labelrank||0)-(a.labelrank||0)});for(m=0;m<f;m++)for(n=a[m],h=m+1;h<f;++h)if(k=a[h],n&&k&&n.placed&&k.placed&&0!==n.newOpacity&&0!==k.newOpacity&&(v=n.alignAttr,d=k.alignAttr,g=n.parentGroup,w=k.parentGroup,B=2*(n.box?0:n.padding),v=c(v.x+g.translateX,v.y+g.translateY,n.width-B,n.height-B,d.x+w.translateX,d.y+w.translateY,k.width-B,k.height-B)))(n.labelrank<k.labelrank?n:k).newOpacity=0;z(a,function(a){var c,d;a&&(d=a.newOpacity,a.oldOpacity!==
|
||||
d&&a.placed&&(d?a.show(!0):c=function(){a.hide()},a.alignAttr.opacity=d,a[a.isOld?"animate":"attr"](a.alignAttr,null,c)),a.isOld=!0)})}})(M);(function(a){var D=a.addEvent,z=a.Chart,F=a.createElement,J=a.css,m=a.defaultOptions,f=a.defaultPlotOptions,h=a.each,q=a.extend,n=a.fireEvent,k=a.hasTouch,v=a.inArray,d=a.isObject,g=a.Legend,w=a.merge,B=a.pick,c=a.Point,e=a.Series,l=a.seriesTypes,u=a.svg,L;L=a.TrackerMixin={drawTrackerPoint:function(){var a=this,c=a.chart,d=c.pointer,e=function(a){for(var b=
|
||||
a.target,d;b&&!d;)d=b.point,b=b.parentNode;if(void 0!==d&&d!==c.hoverPoint)d.onMouseOver(a)};h(a.points,function(a){a.graphic&&(a.graphic.element.point=a);a.dataLabel&&(a.dataLabel.element.point=a)});a._hasTracking||(h(a.trackerGroups,function(b){if(a[b]){a[b].addClass("highcharts-tracker").on("mouseover",e).on("mouseout",function(a){d.onTrackerMouseOut(a)});if(k)a[b].on("touchstart",e);a.options.cursor&&a[b].css(J).css({cursor:a.options.cursor})}}),a._hasTracking=!0)},drawTrackerGraph:function(){var a=
|
||||
this,c=a.options,d=c.trackByArea,e=[].concat(d?a.areaPath:a.graphPath),f=e.length,g=a.chart,l=g.pointer,m=g.renderer,n=g.options.tooltip.snap,q=a.tracker,p,v=function(){if(g.hoverSeries!==a)a.onMouseOver()},w="rgba(192,192,192,"+(u?.0001:.002)+")";if(f&&!d)for(p=f+1;p--;)"M"===e[p]&&e.splice(p+1,0,e[p+1]-n,e[p+2],"L"),(p&&"M"===e[p]||p===f)&&e.splice(p,0,"L",e[p-2]+n,e[p-1]);q?q.attr({d:e}):a.graph&&(a.tracker=m.path(e).attr({"stroke-linejoin":"round",visibility:a.visible?"visible":"hidden",stroke:w,
|
||||
fill:d?w:"none","stroke-width":a.graph.strokeWidth()+(d?0:2*n),zIndex:2}).add(a.group),h([a.tracker,a.markerGroup],function(a){a.addClass("highcharts-tracker").on("mouseover",v).on("mouseout",function(a){l.onTrackerMouseOut(a)});c.cursor&&a.css({cursor:c.cursor});if(k)a.on("touchstart",v)}))}};l.column&&(l.column.prototype.drawTracker=L.drawTrackerPoint);l.pie&&(l.pie.prototype.drawTracker=L.drawTrackerPoint);l.scatter&&(l.scatter.prototype.drawTracker=L.drawTrackerPoint);q(g.prototype,{setItemEvents:function(a,
|
||||
c,d){var b=this,e=b.chart,f="highcharts-legend-"+(a.series?"point":"series")+"-active";(d?c:a.legendGroup).on("mouseover",function(){a.setState("hover");e.seriesGroup.addClass(f);c.css(b.options.itemHoverStyle)}).on("mouseout",function(){c.css(a.visible?b.itemStyle:b.itemHiddenStyle);e.seriesGroup.removeClass(f);a.setState()}).on("click",function(b){var c=function(){a.setVisible&&a.setVisible()};b={browserEvent:b};a.firePointEvent?a.firePointEvent("legendItemClick",b,c):n(a,"legendItemClick",b,c)})},
|
||||
createCheckboxForItem:function(a){a.checkbox=F("input",{type:"checkbox",checked:a.selected,defaultChecked:a.selected},this.options.itemCheckboxStyle,this.chart.container);D(a.checkbox,"click",function(b){n(a.series||a,"checkboxClick",{checked:b.target.checked,item:a},function(){a.select()})})}});m.legend.itemStyle.cursor="pointer";q(z.prototype,{showResetZoom:function(){var a=this,c=m.lang,d=a.options.chart.resetZoomButton,e=d.theme,f=e.states,g="chart"===d.relativeTo?null:"plotBox";this.resetZoomButton=
|
||||
a.renderer.button(c.resetZoom,null,null,function(){a.zoomOut()},e,f&&f.hover).attr({align:d.position.align,title:c.resetZoomTitle}).addClass("highcharts-reset-zoom").add().align(d.position,!1,g)},zoomOut:function(){var a=this;n(a,"selection",{resetSelection:!0},function(){a.zoom()})},zoom:function(a){var b,c=this.pointer,e=!1,f;!a||a.resetSelection?h(this.axes,function(a){b=a.zoom()}):h(a.xAxis.concat(a.yAxis),function(a){var d=a.axis,f=d.isXAxis;if(c[f?"zoomX":"zoomY"]||c[f?"pinchX":"pinchY"])b=
|
||||
d.zoom(a.min,a.max),d.displayBtn&&(e=!0)});f=this.resetZoomButton;e&&!f?this.showResetZoom():!e&&d(f)&&(this.resetZoomButton=f.destroy());b&&this.redraw(B(this.options.chart.animation,a&&a.animation,100>this.pointCount))},pan:function(a,c){var b=this,d=b.hoverPoints,e;d&&h(d,function(a){a.setState()});h("xy"===c?[1,0]:[1],function(c){c=b[c?"xAxis":"yAxis"][0];var d=c.horiz,f=a[d?"chartX":"chartY"],d=d?"mouseDownX":"mouseDownY",g=b[d],h=(c.pointRange||0)/2,k=c.getExtremes(),l=c.toValue(g-f,!0)+h,h=
|
||||
c.toValue(g+c.len-f,!0)-h,g=g>f;c.series.length&&(g||l>Math.min(k.dataMin,k.min))&&(!g||h<Math.max(k.dataMax,k.max))&&(c.setExtremes(l,h,!1,!1,{trigger:"pan"}),e=!0);b[d]=f});e&&b.redraw(!1);J(b.container,{cursor:"move"})}});q(c.prototype,{select:function(a,c){var b=this,d=b.series,e=d.chart;a=B(a,!b.selected);b.firePointEvent(a?"select":"unselect",{accumulate:c},function(){b.selected=b.options.selected=a;d.options.data[v(b,d.data)]=b.options;b.setState(a&&"select");c||h(e.getSelectedPoints(),function(a){a.selected&&
|
||||
a!==b&&(a.selected=a.options.selected=!1,d.options.data[v(a,d.data)]=a.options,a.setState(""),a.firePointEvent("unselect"))})})},onMouseOver:function(a,c){var b=this.series,d=b.chart,e=d.tooltip,f=d.hoverPoint;if(this.series){if(!c){if(f&&f!==this)f.onMouseOut();if(d.hoverSeries!==b)b.onMouseOver();d.hoverPoint=this}!e||e.shared&&!b.noSharedTooltip?e||this.setState("hover"):(this.setState("hover"),e.refresh(this,a));this.firePointEvent("mouseOver")}},onMouseOut:function(){var a=this.series.chart,
|
||||
c=a.hoverPoints;this.firePointEvent("mouseOut");c&&-1!==v(this,c)||(this.setState(),a.hoverPoint=null)},importEvents:function(){if(!this.hasImportedEvents){var a=w(this.series.options.point,this.options).events,c;this.events=a;for(c in a)D(this,c,a[c]);this.hasImportedEvents=!0}},setState:function(b,c){var d=Math.floor(this.plotX),e=this.plotY,g=this.series,h=g.options.states[b]||{},k=f[g.type].marker&&g.options.marker,l=k&&!1===k.enabled,m=k&&k.states&&k.states[b]||{},n=!1===m.enabled,p=g.stateMarkerGraphic,
|
||||
t=this.marker||{},u=g.chart,v=g.halo,w;b=b||"";if(!(b===this.state&&!c||this.selected&&"select"!==b||!1===h.enabled||b&&(n||l&&!1===m.enabled)||b&&t.states&&t.states[b]&&!1===t.states[b].enabled)){k&&g.markerAttribs&&(w=g.markerAttribs(this,b));if(this.graphic)this.state&&this.graphic.removeClass("highcharts-point-"+this.state),b&&this.graphic.addClass("highcharts-point-"+b),this.graphic.attr(g.pointAttribs(this,b)),w&&this.graphic.animate(w,B(u.options.chart.animation,m.animation,k.animation)),p&&
|
||||
p.hide();else{if(b&&m){k=t.symbol||g.symbol;p&&p.currentSymbol!==k&&(p=p.destroy());if(p)p[c?"animate":"attr"]({x:w.x,y:w.y});else k&&(g.stateMarkerGraphic=p=u.renderer.symbol(k,w.x,w.y,w.width,w.height).add(g.markerGroup),p.currentSymbol=k);p&&p.attr(g.pointAttribs(this,b))}p&&(p[b&&u.isInsidePlot(d,e,u.inverted)?"show":"hide"](),p.element.point=this)}(d=h.halo)&&d.size?(v||(g.halo=v=u.renderer.path().add(g.markerGroup||g.group)),a.stop(v),v[c?"animate":"attr"]({d:this.haloPath(d.size)}),v.attr({"class":"highcharts-halo highcharts-color-"+
|
||||
B(this.colorIndex,g.colorIndex)}),v.attr(q({fill:this.color||g.color,"fill-opacity":d.opacity,zIndex:-1},d.attributes))):v&&v.animate({d:this.haloPath(0)});this.state=b}},haloPath:function(a){return this.series.chart.renderer.symbols.circle(Math.floor(this.plotX)-a,this.plotY-a,2*a,2*a)}});q(e.prototype,{onMouseOver:function(){var a=this.chart,c=a.hoverSeries;if(c&&c!==this)c.onMouseOut();this.options.events.mouseOver&&n(this,"mouseOver");this.setState("hover");a.hoverSeries=this},onMouseOut:function(){var a=
|
||||
this.options,c=this.chart,d=c.tooltip,e=c.hoverPoint;c.hoverSeries=null;if(e)e.onMouseOut();this&&a.events.mouseOut&&n(this,"mouseOut");!d||a.stickyTracking||d.shared&&!this.noSharedTooltip||d.hide();this.setState()},setState:function(a){var b=this,c=b.options,d=b.graph,e=c.states,f=c.lineWidth,c=0;a=a||"";if(b.state!==a&&(h([b.group,b.markerGroup],function(c){c&&(b.state&&c.removeClass("highcharts-series-"+b.state),a&&c.addClass("highcharts-series-"+a))}),b.state=a,!e[a]||!1!==e[a].enabled)&&(a&&
|
||||
(f=e[a].lineWidth||f+(e[a].lineWidthPlus||0)),d&&!d.dashstyle))for(e={"stroke-width":f},d.attr(e);b["zone-graph-"+c];)b["zone-graph-"+c].attr(e),c+=1},setVisible:function(a,c){var b=this,d=b.chart,e=b.legendItem,f,g=d.options.chart.ignoreHiddenSeries,k=b.visible;f=(b.visible=a=b.options.visible=b.userOptions.visible=void 0===a?!k:a)?"show":"hide";h(["group","dataLabelsGroup","markerGroup","tracker","tt"],function(a){if(b[a])b[a][f]()});if(d.hoverSeries===b||(d.hoverPoint&&d.hoverPoint.series)===b)b.onMouseOut();
|
||||
e&&d.legend.colorizeItem(b,a);b.isDirty=!0;b.options.stacking&&h(d.series,function(a){a.options.stacking&&a.visible&&(a.isDirty=!0)});h(b.linkedSeries,function(b){b.setVisible(a,!1)});g&&(d.isDirtyBox=!0);!1!==c&&d.redraw();n(b,f)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(a){this.selected=a=void 0===a?!this.selected:a;this.checkbox&&(this.checkbox.checked=a);n(this,a?"select":"unselect")},drawTracker:L.drawTrackerGraph})})(M);(function(a){var D=a.Chart,
|
||||
z=a.each,F=a.inArray,J=a.isObject,m=a.pick,f=a.splat;D.prototype.setResponsive=function(a){var f=this.options.responsive;f&&f.rules&&z(f.rules,function(f){this.matchResponsiveRule(f,a)},this)};D.prototype.matchResponsiveRule=function(f,q){var h=this.respRules,k=f.condition,v;v=f.callback||function(){return this.chartWidth<=m(k.maxWidth,Number.MAX_VALUE)&&this.chartHeight<=m(k.maxHeight,Number.MAX_VALUE)&&this.chartWidth>=m(k.minWidth,0)&&this.chartHeight>=m(k.minHeight,0)};void 0===f._id&&(f._id=
|
||||
a.idCounter++);v=v.call(this);!h[f._id]&&v?f.chartOptions&&(h[f._id]=this.currentOptions(f.chartOptions),this.update(f.chartOptions,q)):h[f._id]&&!v&&(this.update(h[f._id],q),delete h[f._id])};D.prototype.currentOptions=function(a){function h(a,m,d){var g,k;for(g in a)if(-1<F(g,["series","xAxis","yAxis"]))for(a[g]=f(a[g]),d[g]=[],k=0;k<a[g].length;k++)d[g][k]={},h(a[g][k],m[g][k],d[g][k]);else J(a[g])?(d[g]={},h(a[g],m[g]||{},d[g])):d[g]=m[g]||null}var m={};h(a,this.options,m);return m}})(M);return M});
|
||||
21695
assets/plugin/chart/highcharts/highcharts.src.js
Executable file
21695
assets/plugin/chart/highcharts/highcharts.src.js
Executable file
File diff suppressed because it is too large
Load Diff
BIN
assets/plugin/chart/highcharts/js/._highcharts-3d.js
Executable file
BIN
assets/plugin/chart/highcharts/js/._highcharts-3d.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/js/._highcharts-3d.src.js
Executable file
BIN
assets/plugin/chart/highcharts/js/._highcharts-3d.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/js/._highcharts-more.js
Executable file
BIN
assets/plugin/chart/highcharts/js/._highcharts-more.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/js/._highcharts-more.src.js
Executable file
BIN
assets/plugin/chart/highcharts/js/._highcharts-more.src.js
Executable file
Binary file not shown.
BIN
assets/plugin/chart/highcharts/js/._highcharts.js
Executable file
BIN
assets/plugin/chart/highcharts/js/._highcharts.js
Executable file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user