var leafHandlerLoaded = void 0;
var rootHandlerLoaded = void 0;
$(document).ready(function(){
/* SD 2012-03-13 The dropdowns had an onchange event
* that redirected the page to selected value. If you hit
* the browser back button the page went back to the original
* page, except for the dropdown that stayed the same. This
* was because the browser caches the form values; particularly IE.
* In order to avoid caching of the form elements we shall..
* 1. remove the onchange attributes on the dropdown
* 2. transfer the onchange to a JQuery onchange event
* 3. When an onchange is triggered, capture the new selected value
* 4. Revert the dropdowns to the original values, then
* 5. redirect the page to the newly selected values.
* This is an ugly solution. It could have been put in the
* meta tags in the original html files.
*/
if($('select[name="Drop1"]').length > 0)
{
/*
*SD 2012-03-13 The following 5 lines may not be necessary, but they do make the html valid-html.
*/
var dropdown = $('select[name="Drop1"]').html();
dropdown = dropdown.replace('SELECTED=""','selected="selected"');
dropdown = dropdown.replace('SELECTED','selected="selected"');
dropdown = dropdown.replace('selected=""','selected="selected"');
$('select[name="Drop1"]').html(dropdown);
//Drop1
$('select[name="Drop1"]').removeAttr('onchange');
var originalSelection = $('select[name="Drop1"] option:selected').attr('value');
$('select[name="Drop1"]').change(function(){
var currentSelection = $(this).attr('value');
$('select[name="Drop1"]').find('option[value="'+originalSelection+'"]').attr('selected','selected');
window.location = currentSelection;
return false;
});
}
//DropF
if($('select[name="DropF"]').length > 0)
{
$('select[name="DropF"]').removeAttr('onchange');
var originalSelectionF = $('select[name="DropF"] option:selected').attr('value');
$('select[name="DropF"]').change(function(){
var currentSelectionF = $(this).attr('value');
$('select[name="DropF"]').find('option[value="'+originalSelectionF+'"]').attr('selected','selected');
window.location = currentSelectionF;
return false;
});
}
});
(function(){
!function(e){function t(e,t,i){return $(t.chart.container).width()<300&&!(t.chart.width&&t.chart.width>=300)&&(t.exporting.buttons.contextButton.text=null),t}function o(t){var i,o,r=[];if(t.yAxis instanceof Array){if(t.yAxis.length>1){for(i=0;i
2&&("undefined"==typeof t.yAxis[i].title&&(t.yAxis[i].title={}),t.yAxis[i].title.align="middle")}for(i=0;i1&&t.userGenerated&&($.extend(!0,t,{chart:{logo:Highcharts.logos.none}}),t.credits.text==e.eiaTheme.credits.text&&(t.credits.text=t.credits.text.replace("Source","Data source"))),t.yAxis.length>1&&t.yAxis.length<=4)t.yAxis.length>2&&$.extend(!0,t,{captions:{items:[{text:"Warning: Please take care in interpreting this chart. You have selected series with different units resulting in a chart with "+t.yAxis.length+" axes.",style:{color:"red"}}]}});else if(t.yAxis.length>4)return!1}return!0}function r(t){var i,o=this,r=(o.options,new e.Series);r.init(o.dummyChart,$.extend(!0,{},t)),o.dummyChart.series.push(r),i=f.call(o.dummyChart,r),t.xType=r.options.xType=void 0!==t.xType?t.xType:i.xType,t.yType=r.options.yType=void 0!==t.yType?t.yType:i.yType}function n(t){var i=this;if(i.dummyChart.series){var o=$.isArray(t.yAxis)?t.yAxis:[t.yAxis];Y(o,function(e){e.yType=null}),Y(i.dummyChart.series,function(t){var i="undefined"!=typeof t.options.yAxis?t.options.yAxis:0;o[i].yType=null==o[i].yType||t.options.yType==o[i].yType?t.options.yType:e.yTypes.mixed}),Y(o,function(t,o){switch(t.yType){case e.yTypes.negative:t.min=void 0!==t.min?t.min:null,t.max=void 0!==t.max?t.max:0;break;case e.yTypes.positive:t.min=void 0!==t.min?t.min:0,t.max=void 0!==t.max?t.max:null;break;case e.yTypes.mixed:default:t.min=void 0!==t.min?t.min:null,t.max=void 0!==t.max?t.max:null}$.isArray(i.yAxis)&&(i.yAxis[o].min=i.yAxis[o].options.min=t.min,i.yAxis[o].max=i.yAxis[o].options.max=t.max)})}switch(t.minXType=b.call(i.dummyChart,ie),t.maxXType=b.call(i.dummyChart,te),xAxis=J(t.xAxis),xAxis[0].minRange=void 0!==xAxis[0].minRange?xAxis[0].minRange:e.xMinRanges[t.minXType],t.minXType){case e.xTypes.annual:xAxis[0].minTickInterval=31536e6;break;case e.xTypes.monthly:xAxis[0].minTickInterval=24192e5;break;case e.xTypes.weekly:xAxis[0].minTickInterval=6048e5;break;case e.xTypes.daily:xAxis[0].minTickInterval=864e5;break;case e.xTypes.quarterly:xAxis[0].minTickInterval=7776e6;break;case e.xTypes.hourly:xAxis[0].minTickInterval=36e5}}function s(e){return 4==e.length&&(e+="01"),6==e.length&&(e+="01"),8==e.length&&(e+="00"),e.indexOf("Q")>=0&&(e=e.substr(0,e.indexOf("Q"))+("00"+(3*e[e.indexOf("Q")+1]-2)).slice(-2)+e.substr(e.indexOf("Q")+2,e.length-e.indexOf("Q")+2)),e}function a(){this.seriesColorQueue=Highcharts.getOptions().colors.slice(0)}function l(){return 0==this.seriesColorQueue.length&&a.apply(this),this.seriesColorQueue.shift()}function p(e){if("undefined"!=typeof e.lastHistoricalPeriod){var t=s(String(e.lastHistoricalPeriod)),i=e.data.length;e.data.reverse();var o=$.extend(!0,{},e,{linkedTo:":previous",dashStyle:"Dash",projection:!0,id:e.id?e.id+"-projection":null});for(delete o.lastHistoricalPeriod,o.data=[];i--;){var n=Array.isArray(e.data[i])?e.data[i][0]:e.data[i].x,a=new Date(n).toISOString().replace(/-/g,"").replace(/:/g,"").replace(/T/g,"").substr(0,10);a>=t&&(o.data.push(e.data[i]),a>t&&e.data.splice(i,1))}return e.data.reverse(),r.call(this,o),o}return null}function h(e){var t=0,i=0,o=0;switch(e.xType){case 4:i=7;break;case 3:t=1;break;case 2:t=3;break;case 1:o=1}for(var r=void 0,n=void 0,s=!1,a=0;a=300)&&(i.exporting.buttons.contextButton.text=null);var a=o(i);if(!a)return i.lang.noData="
You have chosen data series resulting in more than 4 axes. Series with the same units will be plotted on the same axis. Axes will be added for each unique unit. You must select series that result in 4 or fewer axes.
",i.noData.style={fontSize:"14px",fontWeight:"bold",color:"red"},i.series=[],i;var d,c,c=this,u=i.chart.renderTo,y="string"==typeof u?$("#"+u):$(u),m=0,f=0,b=$.isArray(i.yAxis)?i.yAxis:[i.yAxis],T=$("").appendTo("body").css({position:"absolute",top:-9999}),A=new e.Renderer(T[0],0,0);c.dummyChart={options:i,counters:{wrapColor:function(e){this.color>=e&&(this.color=0)},wrapSymbol:function(e){this.symbol>=e&&(this.symbol=0)},color:0,symbol:0},series:[],xAxis:[],yAxis:[]};var d;if(i.xAxis instanceof Array)for(d=0;d=1&&i.chart.breakLines&&h(i.series[d]),C&&(i.series.splice(d+1,0,C),d++)}n.call(c,i),$.support.touch?i.chart.zoomType="none":i.chart.zoomType=void 0!==i.chart.zoomType?i.chart.zoomType:v.call(c.dummyChart)}for(i.tooltip.shared&&(i.tooltip.crosshairs=i.tooltip.shared),d=0;d0?(i.title.margin+=f,i.subtitle.y=(isNaN(i.subtitle.y)?0:i.subtitle.y)+f+(isNaN(i.chart.spacingTop)?i.chart.spacing[0]:i.chart.spacingTop)+5):i.chart.spacing[0]=i.chart.spacingTop=(isNaN(i.chart.spacingTop)?i.chart.spacing[0]:i.chart.spacingTop)+m,i}function u(e){if(!e.chart.outerContainer&&!e.chart.printContainer){var t=e.chart.renderTo,i="string"==typeof t?$("#"+t):$(t),o=i.closest(".outerChartContainer"),r=i.closest(".printChartContainer");0==o.length&&0==r.length&&(o=$("").css({height:"auto",width:"auto"}).addClass("outerChartContainer"),r=$("").css({height:"auto",width:"auto"}).addClass("printChartContainer"),i.before(o),r.appendTo(o),i.appendTo(r)),e.chart.outerContainer=o[0],e.chart.printContainer=r[0],e.chart.container=i[0]}}function g(t,i){var o,r=this,n=jQuery.extend(!0,{},U,t),s=n.title,a=0,l=0,p=s.originalAlign||s.align.toLowerCase(),d=0;if("above"==p){o=i.text(s.text,0,0).attr({rotation:0}).css(s.style).add();var h=o.getBBox();"above"==s.align&&(r.dummyChart.options.chart&&r.dummyChart.options.chart.type&&"bar"==r.dummyChart.options.chart.type?jQuery.extend(!0,t,{title:{align:"low"}}):jQuery.extend(!0,t,{title:{offset:-1*h.width+(t.opposite?20:10),rotation:0,align:"high",x:t.opposite?h.width-20:0,y:-1*h.height}})),d=h.height}return jQuery.extend(!0,t,{title:{originalAlign:p}}),t.labels&&t.labels.formatter||jQuery.extend(!0,t,{labels:{formatter:function(){var t=this.value.toString(),i=/\d+\.?(\d*)/;return i.test(t)&&(l=Math.max(this.value.toString().match(i)[1].length,l),void 0===a&&(a=l),this.isLast?(l!=a&&(a=l,N=!0),l=0,t=e.numberFormat(this.value,a,".",",")):t=e.numberFormat(this.value,a,".",",")),t}}}),d}function x(e,t,o){var r,n=0;if(e&&e.text)for(e.text=e.text.replace(/ /gi," "),r=R.prototype.splitText(e.text,e.style,o,t),e.text=$.map(r,function(e){return e.line}).join(" "),i=0;iC,v|=C>0}return g=f?i&&o&&n?e.xTypes.annual:o&&n&&threeMonth?e.xTypes.quarterly:o&&n?e.xTypes.monthly:r&&n?e.xTypes.weekly:n?e.xTypes.daily:e.xTypes.hourly:e.xTypes.category,{xType:g,yType:b&&v||"value"==t.options.compare||"percent"==t.options.compare?e.yTypes.mixed:b?e.yTypes.negative:e.yTypes.positive}}function b(e){var t,i,o,r,n=this;for(t=0;t1){for(i=0;ix)&&(h=x,c={positiveRatio:g,negativeRatio:y}))}for(1!=h||p||d||(c={positiveRatio:.5,negativeRatio:.5}),i=0;i0?u+" : ":"")+e.parseXValue(c,this.point.options&&void 0!==this.point.options.tooltipX?this.point.options.tooltipX:this.x,s.userOptions.timezone),this.series.userOptions&&this.series.userOptions.projection&&this.series.data.indexOf(this.point)>0&&(i+=" (Projected)"),o=null!=n.options.compare?e.numberFormat(this.point.change,l.precision||void 0)+" "+g:e.numberFormat(this.y,l.precision||void 0)+" "+g),t=(n.options.tooltip.showName?""+r+" ":"")+i+(""!=i?" ":"")+o}else{var i,r,y,n,x,g,a,l,o="",m=this.points,s=m[0].series.chart,d="pie"==s.options.chart.type,c=(d?!1:"datetime"==s.options.xAxis.type,s.options.maxXType),u=e.tooltipXLabels[c];if(d)for(y=0;y" +r+"< b> "+o,y");else for(i=(""!=u?u+" : ":"")+e.parseXValue(c,this.x,s.userOptions.timezone),t+=i+" ",y=0;y" +r+"< b> "+o,y")}return t},generateEIAExportOptions:function(){var e={};return e},numberFormat:function(t,i,o,r){if(null===t||void 0===t||""===t||isNaN(t)||Math.abs(t)===1/0)return"";var n=e.getOptions().lang,s=t,a=isNaN(i=Math.abs(i))?Math.min(s.toString().match(/\d+\.?(\d*)/)[1].length,20):i,l=void 0===o?n.decimalPoint:o,p=void 0===r?n.thousandsSep:r,d=0>s?"-":"",h=String(parseInt(s=Math.abs(+s||0).toFixed(a))),c=h.length>3?h.length%3:0;return d+(c?h.substr(0,c)+p:"")+h.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+p)+(a?l+Math.abs(s-h).toFixed(a).slice(2):"")}}),e.setOptions($.extend(!0,e.eiaTheme,{exporting:{csvOptions:{overrideURL:null,postURL:"/global/scripts/jquery/highcharts/exporting-server/csv_exporter.cfm"}}})),X(R.prototype,{resetZoom:function(){var e=this,t=e.xAxis;Y(t,function(e){e.setExtremes(null,null,!1)})},resetSeries:function(e){var t,i=this;for(void 0===e&&(e=!0),i.removeAllSeries(e),t=0;t]*>.*?<\s*\/\2\s*>|<\s*\/[^>]+>|[^<>\s]+|(<[^>]+>))/g;for(words=e.match(u).concat("");c/)){words.splice(c-1,1);break}p=r.getBBox().width}while(i>p&&c\s+/g,">")),h=c-1),d.push({line:a,lineHeight:n}),r.destroy(),r=null}return d},generateCSV:function(){function t(e){if(!M.hasOwnProperty(e)){if(S){for(r=_.length-1;r>=0&&!(e<_[r]);r--);_.splice(r+1,0,e)}else _.push(e);M[e]=1}}var i,o,r,n,s,a,l,p,d,h,c,u,g,y,x,m,f=this,b=f.options.exporting.csvOptions.overrideURL,v="--",T=/,/g,A=/\n/g,C=/<[\/\w\s]+>/g,k=J(f.options.xAxis)[0],w=!0,S=!1,_=[],L={},O={},M={},P=!1,D=!1,E=this.cleanTitleForCSVExport();if(b)return window.location=b;try{S="datetime"==k.type}catch(F){}try{void 0!==k.title.text&&k.title.text.length>0&&(l=k.title.text)}catch(F){}for(i=0;i=0&&!(n<_[r]);r--);_.splice(r+1,0,n)}else _.push(n);M[n]=1}}else if(null==a.linkedParent){var U=a.name+(a.yAxis&&a.yAxis.axisTitle?" "+a.yAxis.axisTitle.textStr:"");g=L[U]={},O[U]={sourceKey:a.options.sourceKey,sourceLink:a.options.sourceLink},P|="undefined"!=typeof O[U].sourceLink,D|="undefined"!=typeof O[U].sourceKey;for(var I=a.data,N=0;N=0&&!(n<_[r]);r--);_.splice(r+1,0,n)}else _.push(n);M[n]=1}}for(x=f.options.maxXType,void 0===l&&(l=e.csvXLabels[x]||e.csvXLabels[e.xTypes.category]),h=[[E]],h=h.concat(this.generateCSVHeaders()),P&&h.push(d=["Series Link"]),D&&h.push(m=["Series Key"]),h.push(c=[l]),y=h.length,i=0;i<_.length;i++){o=_[i],u=h[i+y]=[e.parseXValue(x,o,f.userOptions.timezone)];for(r in L)L.hasOwnProperty(r)&&(g=L[r],p=O[r],w&&(c.push(r.replace(T,"").replace(A," ").replace(C," ")),P&&d.push("undefined"!=typeof p.sourceLink?p.sourceLink:""),D&&m.push("undefined"!=typeof p.sourceKey?p.sourceKey:"")),g.hasOwnProperty(o)?null==g[o]?u.push(v):u.push(g[o]):u.push(""));w=!1}this.postCSVData(h,E.replace(/\s+/g,"_"))},cleanTitleForCSVExport:function(){var e=this,t="chartData",i=/[\?%\*:\|"\<\>\\,]/g,o=/\//g,r=/\s+/g,n=/<[\/\w]+>/gi;try{void 0!==e.options.title.text&&e.options.title.text.length>0&&(t=e.options.title.text.replace(n," ").replace(i,"").replace(o," per ").replace(r," ")),void 0!==e.options.subtitle.text&&e.options.subtitle.text.length>0&&(t+=" ("+e.options.subtitle.text.replace(n," ").replace(i,"").replace(o," per ").replace(r," ")+")")}catch(s){}return t},generateCSVHeaders:function(){var e=[],t=this;return e.push([window.location.href.toString()]),e.push([(new Date).toTimeString()]),e.push([t.options.credits.text]),e},postCSVData:function(e,t){var i,o,r=this,n=r.options.exporting.csvOptions.postURL;i=$('').val(JSON.stringify(e)),o=$('').val(t),jQuery('').append(i).append(o).appendTo("body").submit().remove()},addButton:function(e){var t,i,o,r=this,n=r.renderer,s=ee(r.options.navigation.buttonOptions,e),a=s.onclick,l=s.menuItems,p={stroke:s.symbolStroke,fill:s.symbolFill},d=s.symbolSize||12;if(r.btnCount||(r.btnCount=0),o=r.btnCount++,r.exportDivElements||(r.exportDivElements=[],r.exportSVGElements=[],r.exportEmbedElements=[]),s.enabled!==!1){r.buttonGroup||(r.buttonGroup=n.g("buttonGroup").add(),r.exportSVGElements.push(r.buttonGroup));var h,c=s.theme,u=c.states,g=u&&u.hover,y=u&&u.select;delete c.states,a?h=function(){a.apply(r,arguments);for(var e=0;eM;){for(s=[],a=!1,r=0;r1&&(u.staggerLines=M)}Y(m,function(e){0!==v&&2!==v&&{1:"left",3:"right"}[v]!==u.labelAlign||(S=K(f[e].getLabelSize(),S))}),u.staggerLines&&(S*=u.staggerLines,u.labelOffset=S)}else for(o in f)f[o].destroy(),delete f[o];k&&k.text&&k.enabled!==!1&&(u.axisTitle||(u.axisTitle=y.text(k.text,0,0,k.useHTML).attr({zIndex:7,rotation:k.rotation||0,align:k.textAlign||{low:"left",middle:"center",high:"right"}[k.align]}).addClass(V+this.coll.toLowerCase()+"-title").css(k.style).add(u.axisGroup),u.axisTitle.isNew=!0),t&&(A=u.axisTitle.getBBox()[b?"height":"width"],C=B(k.margin,b?5:10),i=k.offset),u.axisTitle[t?"show":"hide"]()),u.offset=O*B(x.offset,_[v]),u.axisTitleMargin=B(isNaN(i)?i:i+S+C,S+C+(2!==v&&S&&O*x.labels[b?"y":"x"])),_[v]=K(_[v],u.axisTitleMargin+A+O*u.offset),L[T]=K(L[T],2*G(x.lineWidth/2))}}),U=e.eiaTheme.yAxis,I=e.eiaTheme.xAxis,e.setOptions(e.eiaTheme);var se=.15,ae=138*se,le=188*se,pe=5,de="/global/images/logos/Thomson_Reuters_logo.png",he=30,ce=135,ue=5;bloomberg_logoURL="/global/images/logos/Bloomberg_logo.png",bloomberg_logoHeight=30,bloomberg_logoWidth=135,bloomberg_logoPadding=5,e.Renderer.prototype.symbols.download=function(e,t,i,o){var r=15,n=13;return["M",(e+12.006*i/r).toString()+","+(t+12.598*o/n).toString(),"L",(e+19.004*i/r).toString()+","+(t+12.598*o/n).toString(),"L",(e+19.004*i/r).toString()+","+(t+15*o/n).toString(),"L",(e+4.004*i/r).toString()+","+(t+15*o/n).toString(),"L",(e+4.004*i/r).toString()+","+(t+12.598*o/n).toString(),"L",(e+11.003*i/r).toString()+","+(t+12.598*o/n).toString(),"L",(e+11.002*i/r).toString()+","+(t+12.597*o/n).toString(),"L",(e+7.694*i/r).toString()+","+(t+7.597*o/n).toString(),"L",(e+10.575*i/r).toString()+","+(t+7.597*o/n).toString(),"L",(e+10.575*i/r).toString()+","+(t+2.597*o/n).toString(),"L",(e+12.574*i/r).toString()+","+(t+2.597*o/n).toString(),"L",(e+12.574*i/r).toString()+","+(t+7.597*o/n).toString(),"L",(e+15.316*i/r).toString()+","+(t+7.597*o/n).toString(),"Z"]},R.prototype.callbacks.push(O),e.Chart.prototype.openAPIEmbed=function(){var e=this;window.open("/opendata/embed.cfm?"+e.getEmbedParams())},e.Chart.prototype.getEmbedOptions=function(){var e=this.options;return"undefined"!=typeof e.exporting&&"undefined"!=typeof e.exporting.embedOptions?e.exporting.embedOptions:null},e.Chart.prototype.setEmbedOptions=function(e){var t=this.options;"undefined"!=typeof t.exporting?"undefined"!=typeof t.exporting.embedOptions?t.exporting.embedOptions=$.extend(!0,t.exporting.embedOptions,e):t.exporting.embedOptions=e:t.exporting={embedOptions:e}},e.Chart.prototype.getEmbedParams=function(){var e=this,t=this.options.exporting.embedOptions,i=["type=chart"];for(var o in t)t.hasOwnProperty(o)&&"start"!=o&&"end"!=o&&"date_mode"!=o&&i.push(o+"="+t[o]);if("datetime"==this.xAxis[0].options.type){var r=this.xAxis[0].dataMin,n=this.xAxis[0].dataMax,s=this.xAxis[0].min,a=this.xAxis[0].max,l=Math.max(e.xAxis[0].min,e.xAxis[0].dataMin),p=Math.min(e.xAxis[0].max,e.xAxis[0].dataMax);s>r&&a>=n?(i.push("date_mode=periods"),i.push("start="+E(e.options.minXType,l)),i.push("end="+E(e.options.minXType,p))):s>r&&n>a?(i.push("date_mode=range"),i.push("start="+E(e.options.minXType,l)),i.push("end="+E(e.options.minXType,p))):t.hasOwnProperty("date_mode")?(i.push("date_mode="+t.date_mode),"range"!=t.date_mode&&"start"!=t.date_mode||(t.hasOwnProperty("start")?i.push("start="+t.start):i.push("start="+E(e.options.minXType,l))),"range"==t.date_mode&&(t.hasOwnProperty("end")?i.push("end="+t.end):i.push("end="+E(e.options.minXType,p))),"periods"==t.date_mode&&t.hasOwnProperty("periods")&&i.push("periods="+t.periods)):i.push("date_mode=all")}return i.join("&")},e.wrap(e.Chart.prototype,"init",function(i,o,r){var n=o,s=this,a=o||{};if(z=void 0!=n.chart.type&&"pie"==n.chart.type,this.axisZerosAligned=0,s.seriesColorQueue=Highcharts.getOptions().colors.slice(0),H=0,ops=jQuery.extend(!0,{},e.getOptions(),n),"undefined"!=typeof ops.exporting.embedOptions){for(var l=ops.exporting.buttons.contextButton.menuItems,p=!1,d={text:"Embed Chart",onclick:function(){this.openAPIEmbed()}},h=0;h=1&&u.chart.breakLines&&h(c);var y=t.call(this,i,o,r);if(g){g.linkedTo=y.index;var x=this.addSeries(g);y.linkedSeries.push(x)}return S.call(a),y}),e.wrap(e.Series.prototype,"setData",function(e,t,i,o,r){var n=this.chart,s=this.options,a=$.extend(!0,{},s,{data:t}),l=null;!a.projection&&n.dummyChart&&(l=p.call(n,a),this.linkedSeries&&this.linkedSeries.length>0&&e.call(this.linkedSeries[0],l.data,i,o,r));var d=e.call(this,a.data,i,o,r);return S.call(n),d}),e.wrap(e.Series.prototype,"remove",function(e,t,i){var o=this,r=o.chart,s=r.options;if(o.linkedSeries)for(var a=o.linkedSeries.length-1;a>=0;a--)o.linkedSeries[a].remove();r.dummyChart.series.splice(o.index,1);var l=e.call(this,t,i);n.call(r,s);for(var p=-(1/0),a=0;a=0?p:0,S.call(r),l}),e.wrap(e.Series.prototype,"getColor",function(e){return e.call(this)}),e.wrap(e.Chart.prototype,"setTitle",function(t,i,o,r){var n=$("").appendTo("body").css({position:"absolute",top:-9999}),s=new e.Renderer(n[0],0,0),a=this,l=a.options,p=l.chart.titleAdjust,d=a.container;"undefined"!=typeof i&&null!=i&&(p=x.call(a,i.title,s,(l.chart.width||$(d).width()||600)-(l.exporting.enabled!==!1?44+(null==l.exporting.buttons.contextButton.text?0:100):0)),"undefined"!=typeof l.chart.title&&(l.chart.title.margin=(isNaN(l.chart.title.margin)?0:l.chart.title.mragin)+(p-l.chart.titleAdjust)),l.chart.titleAdjust=p),"undefined"!=typeof o&&null!=o&&(o.y=(isNaN(p)?0:p)+(isNaN(l.chart.spacingTop)?l.chart.spacing[0]:l.chart.spacingTop)+5),n.remove();var h=t.call(this,i,o,r);return h}),e.wrap(e.Axis.prototype,"adjustTickAmount",function(e){var t=this,i=t.tickPositions?t.tickPositions.length:t.tickAmount,o=t._maxTicksKey,r=t.chart.maxTicks,n=e.call(this);if(r&&r[o]&&i!=t.tickPositions.length&&this.chart.axisZerosAligned&&this.chart.options.chart.lineUpYAxisZeros){for(var s,a=(t.tickPositions.length-i,t.tickInterval,0);a=0&&p>=0&&l!=p){for(var a=0;a\r\n<")})}(Highcharts);
if(/\/hist\//.test(window.location.pathname)){
/**
* The Petroleum Navigator leaf page charting function
**/
var leafHandler = function($){
return function(){
// Is this the Natural Gas Navigator?
var isNG, sourcekey, frequency, navigatorPrefix;
//min must not be zero if negative values
negativeValues = false;
// An array of months for performing lookups
var monthsArray = [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
];
// Returns the Chart Title and Units as an array
var getTitleMatch = function(){
//var titleRegex = /[^\(\)]+/g;
var title = $('.Title1').html();
//return title.match(titleRegex); <- this didn't work as some series name have parenthical phrases
var aTitle = [title.substring(0,title.lastIndexOf('(')-1), title.substring(title.lastIndexOf('(')+1,title.lastIndexOf(')')) ];
return aTitle;
}
// Returns the table rows in a page for iteration
var getTableRows = function(){
if(isNG)
return $('body > table:eq(2) tr');
else
return $('table.FloatTitle tr');
}
// Trims null values from the beginning and end of data
// arrays
var trimNulls = function(data){
var i;
var dataCopy = data.slice(0);
for(i=data.length - 1; i>0; i--){
if(data[i][1] === null) dataCopy.pop();
else break;
}
for(i=0; i -1)console.info(JSON.stringify(ret));
return ret;
}
//Indicates whether this is a Reutures series
var isReuters = function(){
var tr_series = ['RWTC','RBRTE','EER_EPMRU_PF4_Y35NY_DPG','EER_EPMRU_PF4_RGC_DPG','EER_EPMRR_PF4_Y05LA_DPG','EER_EPD2F_PF4_Y35NY_DPG','EER_EPJK_PF4_RGC_DPG','EER_EPLLPA_PF4_Y44MB_DPG', 'RNGWHHD'];
for(var j=0;j').width('100%').appendTo(imageParent);
// Make the chart 100% width
chartTable.width('100%');
// Hide the chart during processing
chartParent.children().hide();
return chartParent;
}
//This copies the referring pages div at the bottom of the page to the top of the page
var copyReferringPages = function() {
$('').html($('#refer').html()).insertAfter($('#contsub'));
// remove first in body
$('body > br').first().remove();
}();
// Add the source key and link to the api for this series
var addSourceKeyIcon = function(chartParent) {
var navigatorPrefix = isNG ? 'NG' : 'PET';
$('
This series is available through the EIA open data API and can be downloaded to Excel or embedded as an interactive chart or map on your website.
')
.insertAfter(chartParent.closest('tr'));
}
// This is the function that creates the chart object.
// Executes immediately i.e.: function(args){/*do*/}(args);
var createLeafChart = function(){
isNG = window.location.pathname.match(/\/ng\//) !== null;
var chartParent = prepareChartParent();
var titleMatch = getTitleMatch();
var data = processData();
addSourceKeyIcon(chartParent);
leafChart = new Highcharts.Chart(
createOptions(
chartParent.get(0),
titleMatch[0],
titleMatch[1],
data
)
);
}();
}
}(jQuery); /**
* Created by Shivan Computers Corporation on behalf of the
* U.S. Energy Information Administration:
* Author : Ryan Lynch (Ryan.Lynch@eia.gov)
*
* EIA Analyis Module:
*
* This module extend the EIA Theme to add various analytical
* functions to the chart, along with a set of controls to
* activate them.
*
* Depends on: highcharts.js, eia-theme.js
**/
(function(){
// Shortcuts
var HC = Highcharts,
Chart = HC.Chart;
each = HC.each,
extend = HC.extend,
map = HC.map,
eiaTheme = HC.eiaTheme,
seasonalPalletAlpha = 0.3;
// Default Analysis Options
HC.setOptions(extend(eiaTheme, {
analysis: {
enableMovingAverage:true,
enableSeasonalAnalysis:true
}
}));
function seasonalPalletConverter(h){
return 'rgba(' +
parseInt(h.substring(1,3), 16) + ',' +
parseInt(h.substring(3,5), 16) + ',' +
parseInt(h.substring(5), 16) + ',' +
seasonalPalletAlpha + ')';
}
// Colors for seasonal analysis
extend(HC, {
eia_seasonal_pallet : map(eiaTheme.colors.slice(1), seasonalPalletConverter)
});
//////////////////////////
// Analytical Functions //
//////////////////////////
extend(Chart.prototype,{
addMovingAverage : function(index, duration){
var chart = this, baseSeries = chart.series[index],
interval = baseSeries.options.xType, baseXData = baseSeries.xData,
baseYData = baseSeries.yData, avgData = [], helperArray = [],
dayInterval, durationTitle, avg = total = i = j = calcDuration = 0;
// If we are dealing with a series that has been destroyed, then
// return
if(!baseXData) return;
// else
switch(interval){
case HC.xTypes.Annual:
case HC.xTypes.Quarterly:
case HC.xTypes.Monthly:
return;
break;
case HC.xTypes.weekly:
durationTitle = duration + ' Week';
dayInterval = 7 * 24 * 60 * 60 * 1000;
break;
case HC.xTypes.daily:
durationTitle = duration + ' Day';
dayInterval = 1 * 24 * 60 * 60 * 1000;
break;
}
for(i = duration; helperArray.length == 0; i++){
for(j = i - duration; j < i; j++){
if(
baseYData[j] != null &&
baseXData[j] >= baseXData[i] - dayInterval * duration
){
total += baseYData[j];
helperArray.push({
x : baseXData[j],
y : baseYData[j]
});
}
}
}
avgData.push([baseXData[i], total/helperArray.length]);
for(i = duration + 1; i < baseXData.length; i++){
if(
helperArray[0].x <= baseXData[i] - dayInterval * duration
){
total -= helperArray[0].y;
helperArray.shift();
}
j = i - 1
if(
baseYData[j] != null &&
baseXData[j] >= baseXData[i] - dayInterval * duration
){
total += baseYData[j];
helperArray.push({
x : baseXData[j],
y : baseYData[j]
});
}
avgData.push([baseXData[i], total / helperArray.length]);
}
//chart.legend.enabled = true;
return chart.addSeries({
//name : baseSeries.name + durationTitle + ' Moving Average',
name : durationTitle + ' Moving Average',
data : avgData
});
},
createSeasonalAnalysis : function(index, interval){
var chart = this, baseSeries = chart.series[index], yearOffset,
baseXData = baseSeries.xData, baseYData = baseSeries.yData,
i = j = 0, series = [], seriesData, xType = baseSeries.options.xType,
serie, startDate, currentDate, firstDate, originalStartDate, lastDate,
dateString;
if(!baseXData) return;
j = baseXData.length - 1;
startDate = originalStartDate = new Date(baseXData[j]);
for(i = 0; i <= interval && j > 0; i++){
endDate = new Date(
startDate.getUTCFullYear() - 1,
startDate.getUTCMonth(),
startDate.getUTCDate()
)
seriesData = [];
lastDate = new Date(baseXData[j]);
while(
j >= 0 &&
(!currentDate || currentDate.getTime() >= endDate.getTime())
){
currentDate = new Date(baseXData[j]);
seriesData.push({
x: Date.UTC(
currentDate.getUTCFullYear() + i,
currentDate.getUTCMonth(),
currentDate.getUTCDate()),
tooltipX : currentDate.getTime(),
y: baseYData[j]
});
firstDate = currentDate;
j--;
}
j++;
switch(xType){
case HC.xTypes.daily:
dateString = HC.dateFormat('%m/%d/%Y', firstDate.getTime()) +
' to ' + HC.dateFormat('%m/%d/%Y', lastDate.getTime());
break;
case HC.xTypes.weekly:
dateString = HC.dateFormat('%m/%d/%Y', firstDate.getTime()) +
' to ' + HC.dateFormat('%m/%d/%Y', lastDate.getTime());
break;
case HC.xTypes.monthly:
dateString = HC.dateFormat('%m/%Y', firstDate.getTime()) + ' to ' +
HC.dateFormat('%m/%Y', lastDate.getTime());
break;
}
serie = {
//name:baseSeries.options.name + ' ' + dateString,
name: dateString,
data:seriesData,
legendIndex:i
};
if(i > 0) serie.color = HC.eia_seasonal_pallet[i-1];
series.push(serie);
startDate = endDate;
}
chart.removeAllSeries(false);
for(j=series.length - 1; j>=0; j--){
chart.addSeries(series[j], false);
}
chart.resetZoom();
chart.redraw();
}
});
function createSeasonalAnalysisOptions(s, index){
var chart = this, xType = s.options.xType;
if(s.type == 'line' && xType != HC.xTypes.category){
var link, durations, maxInterval;
if(xType > HC.xTypes.annual){
maxInterval = (s.data[s.data.length - 1].x - s.data[0].x) / 31536E6 /*365 days*/;
// Add moving averages
each([5, 10], function(interval){
if(interval < maxInterval){
//option = $('').html(s.name + ': ' + interval + ' Year Seasonal Analysis')
option = $('').html(interval + ' Year Seasonal Analysis')
.data({
method:chart.createSeasonalAnalysis,
arguments:[index, interval]
});
option.appendTo(chart.options.chart.analysisSelect);
}
});
}
}
}
function createMovingAverageOptions(s, index){
var chart = this, xType = s.options.xType;
if(s.type == 'line' && xType != HC.xTypes.category){
var link, durations,
maxDuration = s.data.length;
if(xType == HC.xTypes.daily){
// Add moving averages
each([30, 60, 90], function(duration){
if(duration < maxDuration){
//option = $('').html(s.name + ': ' + duration + ' Day Moving Average ')
option = $('').html(duration + ' Day Moving Average ')
.data({
method:chart.addMovingAverage,
arguments:[index, duration]
});
option.appendTo(chart.options.chart.analysisSelect);
}
});
}
if(xType == HC.xTypes.weekly){
each([4, 8, 12], function(duration){
if(duration < maxDuration){
//option = $('').html(s.name + ': ' + duration + ' Week Moving Average ')
option = $('').html(duration + ' Week Moving Average ')
.data({
method:chart.addMovingAverage,
arguments:[index, duration]
});
option.appendTo(chart.options.chart.analysisSelect);
}
});
}
}
}
function processAnalysis(){
var chart = this, ops = chart.options,
container = $(chart.options.chart.container),
outerContainer = $(chart.options.chart.outerContainer);
analysisContainer = $('').css({
height:'auto',
width:'auto',
// We set the margin and padding on the
// captions container to match the chart
// container so that the links are
// lined up correctly
marginLeft:container.css('marginLeft'),
marginRight:container.css('marginRight')
/*paddingLeft:container.css('paddingLeft'),
paddingRight:container.css('paddingRight')*/
}).addClass('chartAnalysisContainer').append(''),
analysisSelect = $(''),
analysisTable = $('
');
// Enable or disable analysis based on maxXType
switch(ops.maxXType){
case HC.xTypes.annual:
ops.analysis.enableMovingAverage &= false;
ops.analysis.enableSeasonalAnalysis &= false;
break;
case HC.xTypes.monthly:
ops.analysis.enableMovingAverage &= false;
ops.analysis.enableSeasonalAnalysis &= true;
break;
case HC.xTypes.weekly:
ops.analysis.enableMovingAverage &= true;
ops.analysis.enableSeasonalAnalysis &= true;
break;
case HC.xTypes.daily:
ops.analysis.enableMovingAverage &= true;
ops.analysis.enableSeasonalAnalysis &= true;
break;
default:
ops.analysis.enableMovingAverage &= false;
ops.analysis.enableSeasonalAnalysis &= false;
break;
}
if((
ops.analysis.enableMovingAverage ||
ops.analysis.enableSeasonalAnalysis
) && !ops.chart.analysisContainer){
analysisContainer.appendTo(outerContainer);
analysisTable.append(
$('