var stockconnectChart={mode:"desktop",lasttradedate:null,init:function(market,type,callback){var self=this;self.mode=(window.innerWidth<991)?"mobile":"desktop";$.getJSON('?q=/'+lang+'/data/chart/stockconnectChart/market/'+market+'/type/'+type,function(_data){var data=self.decode(_data);var unit=self.decode_unit(_data);self.lasttradedate=self.decode_lasttradedate(_data);$('#stockconnectChartContainer').highcharts(self.getJSON(data,unit),function(chart){self.chart=chart;self.drawBackground()})})},decode:function(_data){return _data.mainData.data},decode_unit:function(_data){return _data.mainData.unit},decode_lasttradedate:function(_data){return _data.mainData.lasttradedate},colors:{up:"#00BDD0",down:"#FFCD39"},margin:{mobile:70,desktop:190},chartheight:{mobile:323,desktop:323},getJSON:function(data,unit){var categories=[];var diff=[];var recomme=[];var recommeLinks=[];for(i=0;i'+this.value+''}}}],yAxis:[{title:{text:this.labels[lang].yTitle1_1+unit+this.labels[lang].yTitle1_2,y:15,rotation:0,useHTML:true,style:{color:"#000"}},tickPositioner:function(){var maxDeviation=Math.ceil(Math.max(Math.abs(this.dataMax),Math.abs(this.dataMin)));var halfMaxDeviation=Math.ceil(maxDeviation/2);maxDeviation=Math.ceil(maxDeviation/10)*20;halfMaxDeviation=Math.ceil(halfMaxDeviation/10)*20;return[-maxDeviation,-halfMaxDeviation,0,halfMaxDeviation,maxDeviation]},tickAmount:7,}],credits:{enabled:false},tooltip:{useHTML:true,formatter:function(){var _html='
'+this.x+'';_html+='
'+this.y+"";return _html}},plotOptions:{column:{minPointLength:2,dataLabels:{enabled:true,color:'black'},zones:[{value:0,color:this.colors["down"]},{color:this.colors["up"]}]}},series:[{showInLegend:false,data:diff,}],exporting:{enabled:false},}},redraw:function(){var chart=this.chart;var offsetx,offsety;var self=this;offsetx=chart.plotLeft;offsety=345;$("#stockconnectchartBackground1").remove();$("#stockconnectchartLegend1").remove();$("#stockconnectchartLegend2").remove();$("#stockconnectchartLegend3").remove();chart.renderer.rect(self.margin[self.mode],20,chart.plotWidth,self.chartheight[self.mode],0).attr({fill:'#F9F9F9',stroke:'#C0C0C0','stroke-width':1,id:'stockconnectchartBackground1',}).add();chart.renderer.text(this.labels[lang].legend1,offsetx,offsety+35).css({fontSize:'12px',}).attr({id:'stockconnectchartLegend1',}).add();offsetx=chart.plotLeft+chart.plotWidth;chart.renderer.text(this.labels[lang].legend2,offsetx-40,offsety+35).css({fontSize:'12px',}).attr({id:'stockconnectchartLegend2',}).add();offsety=0;chart.renderer.text(this.labels[lang].legend3[self.mode],offsetx+15,offsety+(self.mode=="mobile"?10:25)).css({fontSize:'12px',}).attr({id:'stockconnectchartLegend3',}).add()},drawBackground:function(){var chart=this.chart;var offsetx,offsety;var self=this;var extremes=chart.xAxis[0].getExtremes();chart.xAxis[1].setExtremes(extremes.min-0.5,extremes.max+0.5);this.redraw()},labels:{tc:{xTitle:"",yTitle1_1:"淨買入/賣出金額(",yTitle1_2:"港元)",legend1:"流出(-)",legend2:"流入(+)",legend3:{mobile:"麥格理
輪證",desktop:"麥格理輪證"},yTitleTooltip:"",},sc:{xTitle:"",yTitle1_1:"净买入/卖出金额(",yTitle1_2:"港元)流入(+)",legend1:"流出(-)",legend2:"流入(+)",legend3:{mobile:"麦格理
轮证",desktop:"麦格理轮证"},yTitleTooltip:"",},en:{xTitle:"",yTitle1_1:"Net Capital/Outflow(",yTitle1_2:" HKD)",legend1:"Outflow(-)",legend2:"Inflow(+)",legend3:{mobile:"MQ Pick",desktop:"MQ Pick"},yTitleTooltip:"",},},}