Highcharts.setOptions({lang :{
rangeSelectorZoom : "",
/*rangeSelectorFrom : "",
rangeSelectorTo : "",*/
}});
$(termsChart).ajaxStart(function() {
$(termsChart.loadingContainer).show();
});
$(termsChart).ajaxStop(function() {
$(termsChart.loadingContainer).hide();
});
$(window).on('resize.termsChart', function(e) {
//console.log('resize');
termsChart.updateSeriesPosition();
});
var termsChart = {
chart : null,
cur_chart : null,
data : null,
period: 0,
usedSlot : ["","","","","",""],
usedMASlot : ["","","","",""],
//maColors : {10: "#F48B28", 20: "#FF68D3", 50: "#00DEBB", 100: "#9FA1F3",250:"#BC6BC6"},
maColors : ["#F48B28","#FF68D3","#00DEBB","#9FA1F3","#BC6BC6"],
maIndex : {10: 0, 20: 1, 50: 2, 100:3, 250:4},
maIndex2 : [10,20,50,100,250],
colors : {wntLine : "#4F8ABD",underlyingLine : "#000000"},
navigatorUpdated : null,
toolTipMoved : null,
selectedRange : [-1,-1],
stockcode: "",
ucode:'',
comparecode : "",
backgroundColor: "",
selected_ts:0,
loadingContainer:null,
lastTooltipPoint:null,
charttype: "candlestick",
isMobile: ($('div .header.scroll_down').is(':visible'))?false:true,
mobileHeight:{true:85, false:100},
mobileTop:{true:30, false:0},
lastObj: null,
isFx: 0,
init : function(code, callback, navUpdated, ttMoved){
var self = this;
self.navigatorUpdated = (navUpdated!==undefined)?navUpdated:null;
self.toolTipMoved = (ttMoved!==undefined)?ttMoved:null;
$('#termsChartContainer .highcharts-html-container .highcharts-loading').show();
$.getJSON('/'+lang+'/data/chart/termsChart/code/'+code+'/period/'+self.period, function(_data) {
self.data = self.decode(_data);
self.isFx = _data.isFx;
var htmlContainer = null;
if ($('#termsChartContainer .highcharts-html-container').length>0){
htmlContainer = $('#termsChartContainer .highcharts-html-container');
}
$("#stime_chart").html(self.labels()[lang].stime+_data.stime);
$('#termsChartContainer').highcharts('StockChart',self.getJSON(self.data), function (chart){
if ($(chart.renderTo).attr("id")){
if (!$('#termsChartContainer').hasClass("noSetting")){
if (htmlContainer){
$('#termsChartContainer').append(htmlContainer);
}else{
$('#termsChartContainer').append("
");
$('#termsChartContainer .highcharts-html-container').append("");
self.loadingContainer = $('#termsChartContainer .highcharts-html-container .highcharts-loading');
}
}
self.chart = chart;
self.cur_chart = chart;
self.stockcode = code;
self.drawBackground();
//self.setPeriod(self.data.last[self.data.last.length-1][0]- (60*60*24*1000)*180,self.data.last[self.data.last.length-1][0]);
if(self.data.last.length>0){
self.setPeriod(self.data.last[self.data.last.length-1][0]- (60*60*24*1000)*365,self.data.last[self.data.last.length-1][0]);
}
self.changeChartType(self.charttype);
if (callback){
callback();
}
}else{
chart.reflow();
}
$('#termsChartContainer .highcharts-html-container .highcharts-loading').hide();
});
});
},
decode : function(_data){
this.ucode = _data.mainData.ucode;
var udata = _data.mainData.underlying;
var uohlc = [], uvolume = [], uturnover = [],ulast = [];
for (i = 0; i < udata.length; i++) {
uohlc.push({
x: udata[i].ts,
y: udata[i].last,
high: udata[i].high,
low: udata[i].low,
open: udata[i].open,
close: udata[i].last,
});
ulast.push([
udata[i].ts, // the date
udata[i].last // close
]);
uvolume.push([
udata[i].ts, // the date
udata[i].vol // the volume
]);
uturnover.push([
udata[i].ts, // the date
udata[i].turnover // the turnover
]);
}
var data = _data.mainData.warrant;
var ohlc = [], volume = [], turnover = [],last = [], os=[];
for (i = 0; i < data.length; i++) {
// ohlc.push({
// x: data[i].ts,
// y: data[i].last,
// high: data[i].high,
// low: data[i].low,
// open: data[i].open,
// close: data[i].last,
// });
last.push([
data[i].ts, // the date
data[i].last // close
]);
volume.push([
data[i].ts, // the date
data[i].vol // the volume
]);
turnover.push([
data[i].ts, // the date
data[i].turnover // the turnover
]);
os.push([
data[i].ts, // the date
data[i].os // the turnover
]);
}
return {vol:volume, turnover: turnover, last:last, os:os, uohlc : uohlc, uvol:uvolume, uturnover: uturnover, ulast:ulast};
},
options : {
groupingUnits : [['day',[1]],],
chartHeight : 270,
chartTop : 23,
subChartTitle : 23,
},
getJSON : function(data){
var self = this;
return {
chart : {
animation: false,
renderTo: 'termsChartContainer',
backgroundColor : (self.toolTipMoved !=null)?"rgba(255, 255, 255, 0.0)":"#FFFFFF",
marginLeft: 50,
marginRight: 70,
marginTop: this.options.chartTop,
events: {
load: function(){
if (this == self.chart){
//self.refreshSeries();
}else{
//console.log("load: copy");
self.cur_chart = this;
//self.refreshSeries();
setTimeout(function(){ self.cur_chart = self.chart; }, 100);
}
},
redraw: function(event) {
if ((self.selectedRange[0]!=event.target.xAxis[0].min || self.selectedRange[1]!=event.target.xAxis[0].max) || (self.selectedRange[0]==-1 && self.selectedRange[1]==-1)){
//console.log("redraw",self.navigatorUpdated);
self.selectedRange[0] = event.target.xAxis[0].min;
self.selectedRange[1] = event.target.xAxis[0].max;
if (self.navigatorUpdated){
self.navigatorUpdated(event.target.xAxis[0].min,event.target.xAxis[0].max);
}
}
}
}
},
annotationsOptions: {
enabled: true,
noButtons: true,
/*buttonsElementId: "underlyingMasterTools",*/
},
exporting: {
enabled: false,
/*url: "http://hsbc2.dbpower.com.hk/highchart_export/export.php",*/
},
plotOptions: {
candlestick: {
oxymoronic: true,
color: '#e60028',
lineColor: '#e60028',
upColor: '#1a9656',
upLineColor: '#1a9656'
},
area: {
threshold: null,
},
series: {
//turboThreshold: 2000,
states:{
hover: {
enabled: false,
}
}
}
},
tooltip: {
backgroundColor: "rgba(0,0,0,0)",
borderWidth: 0,
borderRadius: 0,
useHTML: true,
positioner: function(width, height, point){
var pos = this.getPosition(width, height, point);
if (self.lastTooltipPoint && self.lastTooltipPoint.series.type == "line"){
var _point = self.lastTooltipPoint.point;
pos.y = _point.plotY;
}
return pos;
},
formatter : function(){
self.drawToolTip(this,false);
if (termsChart.chart.annotations.selected > 0){
return "";
}
var stime;
if (Highcharts.dateFormat('%H:%M', this.points[0].x) != "00:00"){
stime = Highcharts.dateFormat('%Y-%m-%d %H:%M', this.points[0].x);
}else{
stime = Highcharts.dateFormat('%Y-%m-%d', this.points[0].x);
}
var html = '';
for(var j = 0; j'+self.labels()[lang].toolTip.underlyinglast+''+this.points[j].y+"";
}else{
self.lastTooltipPoint = null;
html += ''+self.labels()[lang].toolTip.underlyinghigh+''+this.points[j].point.high+"
";
html += ''+self.labels()[lang].toolTip.underlyinglow+''+this.points[j].point.low+"
";
html += ''+self.labels()[lang].toolTip.underlyingopen+''+this.points[j].point.open+"
";
html += ''+self.labels()[lang].toolTip.underlyinglast+''+this.points[j].point.close+"
";
}
}else if (this.points[j].series.name == "w_primary"){
html += ''+self.labels()[lang].toolTip.wlast+''+this.points[j].y+"
";
}
}
var k=3;
for(var i =0; i0){
if (self.usedMASlot[i].indexOf("_bol-")>0){
while(_index>0 && typeof this.points[_index].point.high == "undefined"){
_index--;
}
var val = formatPrice(this.points[_index+1].y);
var _val1 = formatPrice(this.points[_index].point.high);
var _val2 = formatPrice(this.points[_index].point.low);
html += ''+self.labels()[lang].toolTip.MASlot[5][0]+'';
html += ''+val+"
";
html += ''+self.labels()[lang].toolTip.MASlot[5][2]+'';
html += ''+_val2+"
";
html += ''+self.labels()[lang].toolTip.MASlot[5][1]+'';
html += ''+_val1+"
";
//compare
}else if(self.usedMASlot[i].indexOf("_compare")>0){
var val = formatPrice(this.points[_index].y);
html += ''+self.labels()[lang].toolTip.MASlot[i]+'';
html += '
'+val+" ";
}else{
var val = formatPrice(this.points[_index].y);
html += ''+self.labels()[lang].toolTip.MASlot[i]+'';
html += ''+val+"
";
}
k++;
}
}
}
html = '';
return html;
},
shadow: false,
},
rangeSelector : {
enabled: false,
selected: 1
},
xAxis:{
type: 'datetime',
gridLineWidth: 0,
lineWidth: 0,
tickColor: '#00000000',
crosshair: {
width: 1,
color: "#000",
zIndex: 4
},
tickPixelInterval:200,
labels: {
formatter: function () {
if (Highcharts.dateFormat('%H:%M', this.value) != "00:00"){
if (lang == "en_hk"){
if (Highcharts.dateFormat('%H%M', this.value)*1 < 920){
return Highcharts.dateFormat('%b %d 09:20', this.value);
}
return Highcharts.dateFormat('%b %d %H:%M', this.value);
}else{
if (Highcharts.dateFormat('%H%M', this.value)*1 < 920){
return Highcharts.dateFormat('%m月%d日 09:20', this.value);
}
return Highcharts.dateFormat('%m月%d日 %H:%M', this.value);
}
}else{
if (lang == "en_hk"){
return Highcharts.dateFormat('%b %d', this.value);
}else{
return Highcharts.dateFormat('%m月%d日', this.value);
}
}
}
},
opposite: true,
offset: this.options.chartHeight*-1-30,
},
yAxis: [{
labels:{
formatter: function () {
return formatPrice(this.value);
},
align:'left',
x: 3,
y: 4,
},
gridLineWidth: (self.toolTipMoved !=null)?0:1,
tickAmount : 7,
height: this.options.chartHeight,
top:this.options.chartTop,
opposite: true,
showFirstLabel: false,
showLastLabel: true,
crosshair: {width: 1,color: "#000",snap:false,zIndex: 4},
},
{
labels:{
formatter: function () {
return formatPrice(this.value);
},
align:"right",
x: -3,
y: 4,
},
opposite: false,
showFirstLabel: false,
showLastLabel: true,
tickAmount : 7,
height: this.options.chartHeight,
top:this.options.chartTop,
},
{
top:this.options.chartHeight-43,
height: 90,
gridLineWidth: 0,
labels:{
enabled: false
},
},
{
top:0,height: 100,title: {text: null,},offset: 0,tickAmount : 5,opposite: true,showFirstLabel: false,showLastLabel: false,
labels:{formatter: this.subChartLabelFormatter,align:'left',x: 3,y: 4, style: { textOverflow: 'none', whiteSpace: 'nowrap'},}, crosshair: {width: 1,color: "#000",snap:false,zIndex: 4},
},{
top:0,height: 100,title: {text: null,},offset: 0,tickAmount : 5,opposite: true,showFirstLabel: false,showLastLabel: false,
labels:{formatter: this.subChartLabelFormatter,align:'left',x: 3,y: 4, style: { textOverflow: 'none', whiteSpace: 'nowrap'},}, crosshair: {width: 1,color: "#000",snap:false,zIndex: 4},
},{
top:0,height: 100,title: {text: null,},offset: 0,tickAmount : 5,opposite: true,showFirstLabel: false,showLastLabel: false,
labels:{formatter: this.subChartLabelFormatter,align:'left',x: 3,y: 4, style: { textOverflow: 'none', whiteSpace: 'nowrap'},}, crosshair: {width: 1,color: "#000",snap:false,zIndex: 4},
},{
top:0,height: 100,title: {text: null,},offset: 0,tickAmount : 5,opposite: true,showFirstLabel: false,showLastLabel: false,
labels:{formatter: this.subChartLabelFormatter,align:'left',x: 3,y: 4, style: { textOverflow: 'none', whiteSpace: 'nowrap'},}, crosshair: {width: 1,color: "#000",snap:false,zIndex: 4},
},{
top:0,height: 100,title: {text: null,},offset: 0,tickAmount : 5,opposite: true,showFirstLabel: false,showLastLabel: false,
labels:{formatter: this.subChartLabelFormatter,align:'left',x: 3,y: 4, style: { textOverflow: 'none', whiteSpace: 'nowrap'},}, crosshair: {width: 1,color: "#000",snap:false,zIndex: 4},
},{
top:0,height: 100,title: {text: null,},offset: 0,tickAmount : 5,opposite: true,showFirstLabel: false,showLastLabel: false,
labels:{formatter: this.subChartLabelFormatter,align:'left',x: 3,y: 4, style: { textOverflow: 'none', whiteSpace: 'nowrap'},}, crosshair: {width: 1,color: "#000",snap:false,zIndex: 4},
}],
navigator : {
enabled : true,
series: {
data: data.last,
},
height : 60,
},
scrollbar : {
enabled : false
},
series : [{
id : "vol",
type: 'column',
name: 'vol',
data: data.vol,
yAxis: 2,
color: "#cad3da",
dataGrouping: {
approximation: "sum",
units: self.options.groupingUnits,
groupPixelWidth: 1000
}
},{
name: 'primary',
type: 'candlestick',
id: 'primary',
data : data.uohlc,
yAxis: 0,
dataGrouping: {
units: self.options.groupingUnits,
groupPixelWidth: 1000
}
},{
name: 'w_primary',
//type: 'candlestick',
id: 'w_primary',
data : data.last,
yAxis: 1,
color: this.colors['wntLine'],
dataGrouping: {
units: self.options.groupingUnits,
//groupPixelWidth: 1000
}
}],
};
},
refreshSeries : function(){
var chart = this.cur_chart;
var _series = [];
for (var i=0;i0 && this.cur_chart!=this.chart){
for (var j=0;j0){
chart.tooltip.refresh(_series);
}
},
setPeriod : function(_from,_to){
if (this.data.last.length>0){
this.chart.xAxis[0].setExtremes(Math.max(_from,this.data.last[0][0]), _to);
}
},
drawToolTip: function(obj, isReset){
//console.log("start drawToolTip");
//console.log(obj);
//var chart = this.chart;
this.lastObj = obj;
var chart = this.cur_chart;
var fontstyle = {color: '#666666', fontSize: '13px'};
var textattr = {zIndex: 7, class: "tooltipElement"};
//if ($(".tooltipElement.s"+obj.points[0].x).length>0){
if(!isReset){
if ($(".tooltipElement.s"+obj.points[0].x).length>0 && this.cur_chart == this.chart){
return;
}
}
if (this.cur_chart == this.chart){
$(".tooltipElement").remove();
}
if (this.toolTipMoved){
this.toolTipMoved(obj.points[0].x);
}
//chart.renderer.text(Highcharts.dateFormat('%y/%m/%d',obj.points[0].x), 15, 18).css(fontstyle).attr(textattr).add();
try {
for(var j = 0; j0 || obj.points[j].series.name.indexOf("_ema")>0 ){
/*for(var i =0; i0){
chart.renderer.text("SMA("+days+"):"+formatPrice(obj.points[j].y), 130*_index+35, 36).css(fontstyle).attr(textattr).add();
}else{
chart.renderer.text("EMA("+days+"):"+formatPrice(obj.points[j].y), 130*_index+35, 36).css(fontstyle).attr(textattr).add();
}*/
}else if (obj.points[j].series.name.indexOf("_compare")>0){
/*chart.renderer.text(this.labels()[lang].toolTip.MASlot.compare, 15, 38).css(fontstyle).attr(textattr).add();
chart.renderer.text("C:"+formatPrice(obj.points[j].y), 90, 38).css(fontstyle).attr(textattr).add();
*/
}else if (obj.points[j].series.name.indexOf("_bol")>0 && obj.points[j].point.high){
/* var _label1 = this.labels()[lang].toolTip.MASlot.bol[0]+"("+obj.points[j].series.options.p1+","+obj.points[j].series.options.p2+"): ";
var _label2 = this.labels()[lang].toolTip.MASlot.bol[1]+": ";
var _label3 = this.labels()[lang].toolTip.MASlot.bol[2]+": ";
_label1 += (obj.points[j+1].y).toFixed(2);
_label2 += (obj.points[j].point.high).toFixed(2);
_label3 += (obj.points[j].point.low).toFixed(2);
chart.renderer.text(_label1, 15, 38).css(fontstyle).attr(textattr).add();
chart.renderer.text(_label2, 240, 38).css(fontstyle).attr(textattr).add();
chart.renderer.text(_label3, 390, 38).css(fontstyle).attr(textattr).add();
*/
}else if (obj.points[j].series.name.indexOf("_sar")>0){
/*var _label = this.labels()[lang].toolTip.MASlot.sar+"("+obj.points[j].series.options.p1+","+obj.points[j].series.options.p2+"): ";
_label += (obj.points[j].y).toFixed(3);
chart.renderer.text(_label, 15, 38).css(fontstyle).attr(textattr).add();
*/
}else{
var segment = obj.points[j].series.name.split("_");
if (segment.length==2){
textattr.class = "tooltipElement text_subchart";
var index = segment[0].replace("s","")*1;
var offset = (this.isMobile)?45:27;
var _top = (this.options.chartHeight+this.options.chartTop)+((this.mobileHeight[this.isMobile]+this.options.subChartTitle)*index)+(this.mobileTop[this.isMobile]*index)+offset;
for(var i =0; i" + val3;
}else{
_val = val1 + " " + val2 + " " + val3;
}
}else if (segment[1] == "turnover"){
_val = this.labels()[lang].toolTip.TASlot[segment[1]]+": "+(addcomma(obj.points[j].y));
}else if (segment[1] == "os"){
_val = this.labels()[lang].toolTip.TASlot[segment[1]]+": "+(addcomma(obj.points[j].y));
}else{
_val = this.labels()[lang].toolTip.TASlot[segment[1]]+": "+(obj.points[j].y).toFixed(3);
}
if(this.isMobile){
chart.renderer.text(_val, termsChart.chart.margin[3], _top+16).css(fontstyle).attr(textattr).add();
}else{
var clientwidth = chart.renderer.text(_val, 0, -100).css(fontstyle).attr(textattr).add().element.getBoundingClientRect().width;
chart.renderer.text(_val, chartWidth - termsChart.chart.margin[1] - clientwidth - 5, _top+16).css(fontstyle).attr(textattr).add();
}
}
}
}
}
} catch (err) {
//console.log(err);
}
$(".tooltipElement:eq(0)").attr("class",$(".tooltipElement:eq(0)").attr("class")+" s"+obj.points[0].x);
//console.log("end drawToolTip");
this.drawBackground();
},
drawBackground: function(){
if (this.cur_chart == this.chart){
$(".tooltipBackground").remove();
$(".tooltipLabel").remove();
}
//$(".tooltipBackground").remove();
//$(".tooltipLabel").remove();
//var chart = this.chart;
var chart = this.cur_chart;
var fontstyle = {color: '#666666', fontSize: '13px'};
var textattr = {zIndex: 7,class: "tooltipLabel"};
//var offsetx,offsety;
chart.renderer.rect(0, 0, 1920, 22, 0).attr({
fill: '#FFFFFF',
stroke: '#000',
'stroke-width': 0,
zIndex: 5,
class: "tooltipBackground"
}).add();
chart.renderer.text(this.labels()[lang].yTitle1, termsChart.chart.margin[3], 15).css({color: '#4F8ABD', fontSize: '13px'}).attr(textattr).add();
var j=0;
for (var i=0;i=0;k--){
if (chart.series[k].name && chart.series[k].name == this.usedSlot[i]){
if (chart.series[k].userOptions.p1){
days = "("+chart.series[k].userOptions.p1;
if (chart.series[k].userOptions.p2){
days += ","+chart.series[k].userOptions.p2;
if (chart.series[k].userOptions.p3){
days += ","+chart.series[k].userOptions.p3;
}
}
days += ")";
}
}
}
if(j==0){
chart.renderer.text(this.labels()[lang].subTitle[chartType]+days, termsChart.chart.margin[3], _top+16).css(fontstyle).attr(textattr).add();
}else{
chart.renderer.text(this.labels()[lang].subTitle2[chartType]+days, termsChart.chart.margin[3], _top+16).css(fontstyle).attr(textattr).add();
}
j++;
}
}
},
changeChartType: function (type){
var self = this;
if (type != this.chart.series[1].type){
if (self.period!=0 && (self.ucode.toUpperCase() == "NDX" || self.ucode.toUpperCase() == "SPX" || self.ucode.toUpperCase() == "DJI" || self.ucode.toUpperCase() == "RTY" || self.isFx==1)){
type = "line";
}
this.charttype = type;
if(type == "line") {
_width = 2;
} else {
_width = 1;
}
if(type == 'candlestick') {
_color = "#e60028";
}else{
_color = this.colors['underlyingLine'];
}
this.chart.series[1].update({
type: type,
lineWidth: _width,
color: _color,
});
}
},
changePeriodType: function (type,callback){
var self = this;
if (type.endsWith("min")){
$(".range").hide();
if (self.ucode.toUpperCase() == "NDX" || self.ucode.toUpperCase() == "SPX" || self.ucode.toUpperCase() == "DJI" || self.ucode.toUpperCase() == "RTY" || self.isFx==1){
$(".chart_type").hide();
self.charttype = "line";
}
this.period = type.replace("min","")*1;
this.options.groupingUnits = [["minute",[this.period]],];
this.init(this.stockcode,function(){
if(self.data.last.length>0){
self.setPeriod(self.data.last[Math.max(self.data.last.length-71,0)][0],self.data.last[self.data.last.length-1][0]);
}
callback();
},this.navigatorUpdated,this.toolTipMoved);
return;
}else if (this.period != 0){
$(".range").show();
this.period = 0;
this.options.groupingUnits = [[type,[1]],];
this.init(this.stockcode,callback,this.navigatorUpdated,this.toolTipMoved);
return;
}
this.chart.series.forEach(function(ser) {
ser.update({
dataGrouping: {
units: [ [type, [1]] ]
}
}, false);
});
this.options.groupingUnits = [[type,[1]],];
this.chart.redraw();
this.selected_ts = this.chart.xAxis[0].tickPositions[this.chart.xAxis[0].tickPositions.length-1];
},
addCompare: function (code,callback){
var self = this;
if (code==""){
this.chart.yAxis[1].setTitle({text:""});
this.addMAline("",0);
return;
}
$.getJSON('/'+lang+'/data/chart/termsChart/code/'+code+"/period/"+self.period, function(_data) {
var compare = [];
var data = _data.mainData;
for (i = 0; i < data.underlying.length; i++) {
compare.push({
x: data.underlying[i]["ts"],
y: data.underlying[i]["last"],
high: data.underlying[i]["high"],
low: data.underlying[i]["low"],
open: data.underlying[i]["open"],
close: data.underlying[i]["last"],
vol: data.underlying[i]["vol"],
});
}
if (compare.length>0){
for(var i =0; i=0;i--){
if (chart.series[i].name && (chart.series[i].name == this.usedMASlot[_id[j]] || chart.series[i].name.startsWith(this.usedMASlot[_id[j]]+"_"))){
chart.series[i].remove();
}
}
}
this.setUsedMASlot(_id[j], "");
}
},
addMAline: function(type, id){
var chart = this.chart;
var self = this;
//return;
if (type!=""){
var tempArr = type.split("-");
var _type = tempArr[0];
var _para = "?type="+_type;
for (var i=1; i0){
self.setUsedMASlot(_index, series[i].name);
}
}else{
series[i].name = "t"+id+"_"+type;
self.setUsedMASlot(id, "t"+id+"_"+type);
}
chart.addSeries(series[i]);
}
self.addSettingBox(_type);
chart.yAxis[0].update();
});
}
}else{
self.removeMAline(id);
}
//chart.setSize(this.options.chartWidth,this.getChartHeight());
},
removeSeries: function(id){
var chart = this.chart;
var yAxisID = id + 3;
if (this.usedSlot[id] != ""){
for (var i=chart.series.length-1;i>=0;i--){
if (chart.series[i].name && (chart.series[i].name == this.usedSlot[id] || chart.series[i].name.startsWith(this.usedSlot[id]+"_"))){
chart.series[i].remove();
chart.yAxis[yAxisID].userOptions.top = 0;
chart.yAxis[yAxisID].userOptions.min = null;
chart.yAxis[yAxisID].userOptions.max = null;
}
}
}
this.setUsedSlot(id, "");
},
addSeries: function(type, id){
var chart = this.chart;
var yAxisID = id + 3;
var self = this;
if (id>=0 && type!="" && !(type == "vol" || type == "turnover" || type == "os")){
var tempArr = type.split("-");
var _type = tempArr[0];
var _para = "?type="+_type;
for (var i=1; i0){
return;
}
var chartWidth = $('#termsChartContainer').width();
var sbox = ' ';
var cbox = ' ';
container.append(sbox+cbox);*/
},
updateSeriesPosition: function(){
var chart = this.chart;
this.isMobile = ($('div .header.scroll_down').is(':visible'))?false:true;
var j=0;
for (var i=0;i=0 && id=0 && id0 || self.usedMASlot[0].indexOf("_ema")>0 ){
// command = (self.usedMASlot[0].split("_"))[1];
// for(var i=1;i0){
var _value = (self.usedMASlot[i].split("-"));
for(var j=1; j<_value.length;j++){
command += "-"+_value[j];
}
}else{
if(self.usedMASlot[i]!=""){
command += "-"+(self.usedMASlot[i].split("-"))[1];
// self.addMAline(command, i);
}
}
}
if (command){
self.addMAline(command, -1);
}
for(var i=0;i0)?".HK":"")+"價格",
subTitle : {
macd : "移動平均匯聚背馳指標",
rsi : "相對強弱指數",
turnover : this.ucode + ((this.ucode*1>0)?".HK":"") + " 成交額",
},
subTitle2 : {
turnover : this.stockcode + ((this.stockcode*1>0)?".HK":"") + " 成交額",
os : this.stockcode + ((this.stockcode*1>0)?".HK":"") + " 街貨量",
},
toolTip : {
open:"O:",
high:"H:",
low:"L:",
last:"C:",
volume:"成交量:",
underlyinghigh: this.ucode + " 最高價",
underlyinglow: this.ucode + " 最低價",
underlyingopen: this.ucode + " 開市價",
underlyinglast: this.ucode + " 價格",
wlast: this.stockcode + " 價格",
MASlot: ["10天移動平均線","20天移動平均線","50天移動平均線","100天移動平均線","250天移動平均線",["保歷加平均線","保歷加下限線","保歷加上限線"],adddigit(this.comparecode) + " 價格"],
TASlot: {
os : "街貨量",
turnover:"成交額",
rsi:"RSI",
macd:["MACD-棒形圖","MACD","MACD-訊號"],
},
},
calllv : "收回價",
maturity : "到期日",
strike : "行使價",
gearing : "有效槓桿",
egearing : "有效槓桿",
x: "倍",
call : "認購",
put : "認沽",
bull : "牛證",
bear : "熊證",
stime: "最後更新時間: "
},
zh_cn :{
unit:{
K:"千",
M:"百万",
B:"十亿",
},
yTitle1 : this.stockcode + ((this.stockcode*1>0)?".HK":"")+"价格",
subTitle : {
macd : "移动平均汇聚背驰指标",
rsi : "相对强弱指数",
turnover : this.ucode + ((this.ucode*1>0)?".HK":"") + " 成交额",
},
subTitle2 : {
turnover : this.stockcode + ((this.stockcode*1>0)?".HK":"") + " 成交额",
os : this.stockcode + ((this.stockcode*1>0)?".HK":"") + " 街货量",
},
toolTip : {
open:"O:",
high:"H:",
low:"L:",
last:"C:",
volume:"成交量:",
underlyinghigh: this.ucode + " 最高价",
underlyinglow: this.ucode + " 最低价",
underlyingopen: this.ucode + " 开市价",
underlyinglast: this.ucode + " 价格",
wlast: this.stockcode + " 价格",
MASlot: ["10天移动平均线","20天移动平均线","50天移动平均线","100天移动平均线","250天移动平均线",["保历加平均线","保历加下限线","保历加上限线"],adddigit(this.comparecode) + " 价格"],
TASlot: {
os : "街货量",
turnover:"成交额",
rsi:"RSI",
macd:["MACD-棒形图","MACD","MACD-讯号"],
},
},
calllv : "收回价",
maturity : "到期日",
strike : "行使价",
gearing : "有效杠杆",
egearing : "有效杠杆",
x: "倍",
call : "认购",
put : "认沽",
bull : "牛证",
bear : "熊证",
stime: "最后更新时间: "
},
en_hk :{
unit:{
K:"K",
M:"M",
B:"B",
},
yTitle1 : this.stockcode + ((this.stockcode*1>0)?".HK":"")+ " last",
subTitle : {
macd : "MACD",
rsi : "RSI",
turnover : this.ucode + ((this.ucode*1>0)?".HK":"")+ " Turnover",
},
subTitle2 : {
turnover : this.stockcode + ((this.stockcode*1>0)?".HK":"") + " Turnover",
os : this.stockcode + ((this.stockcode*1>0)?".HK":"") + " Outstanding",
},
toolTip : {
open:"O:",
high:"H:",
low:"L:",
last:"C:",
volume:"Volume:",
underlyinghigh: this.ucode + " high",
underlyinglow: this.ucode + " low",
underlyingopen: this.ucode + " open",
underlyinglast: this.ucode + " last",
wlast: this.stockcode + " last",
MASlot: ["SMA-10","SMA-20","SMA-50","SMA-100","SMA-250",["Moving average","Bollinger lower bound","Bollinger upper bound"],adddigit(this.comparecode) + " last"],
TASlot: {
os : "Outstanding",
turnover:"Turnover",
rsi:"RSI",
macd:["MACD-histogram","MACD","MACD-signal"],
},
},
calllv : "Call level",
maturity : "Maturity",
strike : "Strike",
gearing : "Gearing",
egearing : "Eff.Gearing",
x: "X",
call : "Call",
put : "Put",
bull : "Bull",
bear : "Bear",
stime: "Last update: "
},
};
_out["edu"] = _out["zh_cn"];
return _out;
},
}