Highcharts.setOptions({lang:{rangeSelectorZoom:"",noData:"沒有相關資料",}});var flowChart={chart:null,container:"",wtype:null,type:null,mode:"desktop",chartheight:{mobile:257,desktop:277},margin:{mobile:70,desktop:90},init:function(code,wtype,type){var self=this;self.mode=(window.innerWidth<991)?"mobile":"desktop";self.wtype=wtype;self.type=type;$.getJSON('/'+lang+'/data/chart/flowChart/code/'+code+'/wtype/'+wtype+'/type/'+type,function(_data){var data=self.decode(_data);$((self.container=='')?'#flowChartContainer':'#'+self.container).highcharts('StockChart',self.getJSON(data),function(chart){self.chart=chart;self.drawBackground()})})},decode:function(_data){return _data.mainData},colors:{line1:"#007DB7",line2:"#DC6801"},getJSON:function(data){var diff=[];var last=[];var date=[];var maxdiff=0;var maxlast=0;var tickInterval=0;for(i=0;imaxdiff){maxdiff=Math.abs(data[i]["diff"])}if(data[i]["last"]>maxlast){maxlast=data[i]["last"]}diff.push([data[i]["udate"],data[i]["diff"]]);last.push([data[i]["udate"],data[i]["last"]])}maxdiff=maxdiff*1.5;maxlast=maxlast*1.1;tickInterval=Math.round(maxdiff/7);var self=this;return{chart:{marginLeft:self.margin[self.mode],marginRight:self.margin[self.mode],spacingTop:0,events:{redraw:function(event){self.drawBackground()}}},plotOptions:{line:{events:{legendItemClick:function(){return false}}}},tooltip:{useHTML:true,formatter:function(){var _html='
'+Highcharts.dateFormat('%Y/%m/%d',this.x)+'';_html+='
'+self.labels[lang][self.wtype][self.type].yTitle1Tooltip+': '+addcomma(this.points[0].y)+'';_html+='
'+self.labels[lang].yTitle2Tooltip+': '+addcomma(this.points[1].y)+'';return _html}},rangeSelector:{inputEnabled:false,enabled:false},xAxis:{type:'datetime',lineWidth:0,gridLineWidth:0,tickColor:'#00000000',lineColor:'#00000000',labels:{style:{color:"#000"},y:-70,formatter:function(){return Highcharts.dateFormat('%d/%m',this.value)}}},yAxis:[{max:maxlast,title:{text:this.labels[lang].yTitle2,rotation:((lang=="en")?90:0),y:0,margin:18,useHTML:true,style:{color:"#000"}},labels:{align:'left',x:10,y:5,style:{color:"#000"},},tickAmount:7,showFirstLabel:false,showLastLabel:false,height:self.chartheight[self.mode]},{max:maxdiff,min:-maxdiff,title:{text:this.labels[lang][self.wtype][self.type].yTitle1,rotation:((lang=="en")?90:0),y:((lang=="en")?0:-70),margin:45,useHTML:true,style:{color:"#000"}},labels:{align:'left',x:-30,y:5,style:{color:"#000"},},tickAmount:7,showFirstLabel:false,showLastLabel:false,height:self.chartheight[self.mode],opposite:false,}],navigator:{enabled:false,},scrollbar:{enabled:false},series:[{name:this.labels[lang][self.wtype][self.type].legend1,type:'column',data:diff,color:this.colors["line1"],yAxis:1,},{name:this.labels[lang].legend2,data:last,color:this.colors["line2"],}],exporting:{enabled:false}}},drawBackground:function(){var chart=this.chart;var offsetx,offsety;$("#chart.chartBackground").remove();$("#chart.drawLegendLine").remove();$("#chart.drawLegendText").remove();offsetx=60;offsety=0;chart.renderer.rect(this.margin[this.mode],offsety,chart.plotWidth,this.chartheight[this.mode],0).attr({fill:'#F9F9F9',stroke:'#C0C0C0','stroke-width':1,id:'chartBackground',}).add();chart.renderer.rect(offsetx+35,offsety+10,15,2,0).attr({fill:this.colors["line1"],'stroke-width':0,id:'drawLegendLine',}).add();chart.renderer.text(this.labels[lang][this.wtype][this.type].legend1,offsetx+55,offsety+15).css({fontSize:'12px',id:'drawLegendText',}).add();chart.renderer.rect(offsetx+35+140,offsety+10,15,2,-3).attr({fill:this.colors["line2"],'stroke-width':0,}).add();chart.renderer.text(this.labels[lang].legend2,offsetx+55+140,offsety+15).css({fontSize:'12px',}).add()},labels:{tc:{cbbc:{bull:{yTitle1:"









",yTitle1Tooltip:"牛證資金流(百萬港元)",legend1:"牛證資金流"},bear:{yTitle1:"









",yTitle1Tooltip:"熊證資金流(百萬港元)",legend1:"熊證資金流"}},wnt:{call:{yTitle1:"










",yTitle1Tooltip:"認購證資金流(百萬港元)",legend1:"認購證資金流"},put:{yTitle1:"










",yTitle1Tooltip:"認沽證資金流(百萬港元)",legend1:"認沽證資金流"}},yTitle2:"


",yTitle2Tooltip:"歷史股價",legend2:"歷史股價",},sc:{cbbc:{bull:{yTitle1:"









",yTitle1Tooltip:"牛证资金流(百万港元)",legend1:"牛证资金流"},bear:{yTitle1:"









",yTitle1Tooltip:"熊证资金流(百万港元)",legend1:"熊证资金流"}},wnt:{call:{yTitle1:"










",yTitle1Tooltip:"认购证资金流(百万港元)",legend1:"认购证资金流"},put:{yTitle1:"










",yTitle1Tooltip:"认沽证资金流(百万港元)",legend1:"认沽证资金流"}},yTitle2:"


",yTitle2Tooltip:"历史股价",legend2:"历史股价",},en:{cbbc:{bull:{yTitle1:"Bull money flow (Millions)",yTitle1Tooltip:"Bull money flow (Millions)",legend1:"Bull money flow"},bear:{yTitle1:"Bear money flow (Millions)",yTitle1Tooltip:"Bear money flow (Millions)",legend1:"Bear money flow"}},wnt:{call:{yTitle1:"Call money flow (Millions)",yTitle1Tooltip:"Call money flow (Millions)",legend1:"Call money flow"},put:{yTitle1:"Put money flow (Millions)",yTitle1Tooltip:"Put money flow (Millions)",legend1:"Put money flow"}},yTitle2:"Historical price",yTitle2Tooltip:"Historical price",legend2:"Historical price",},},}