hqchart 1.1.12939 → 1.1.12951

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,7 @@ this.Get=function(id){if(!this.DataMap.has(id))return null;return this.DataMap.g
68
68
  ]);}JSIndexScript.AddIndex=function(aryIndex)//添加自定义指标
69
69
  {for(var i in aryIndex){g_CustomIndex.Add(aryIndex[i]);}};//修改指标属性
70
70
  JSIndexScript.ModifyAttribute=function(indexInfo,attribute){if(!attribute)return;if(attribute.Args)indexInfo.Args=attribute.Args;//外部可以设置参数
71
- if(IFrameSplitOperator.IsNumber(attribute.FloatPrecision))indexInfo.FloatPrecision=attribute.FloatPrecision;if(IFrameSplitOperator.IsNumber(attribute.StringFormat))indexInfo.StringFormat=attribute.StringFormat;if(IFrameSplitOperator.IsBool(attribute.IsSync))indexInfo.IsSync=attribute.IsSync;if(IFrameSplitOperator.IsBool(attribute.IsShortTitle))indexInfo.IsShortTitle=attribute.IsShortTitle;if(attribute.TitleFont)indexInfo.TitleFont=attribute.TitleFont;if(attribute.Lock)indexInfo.Lock=attribute.Lock;if(IFrameSplitOperator.IsNumber(attribute.YSplitType))indexInfo.YSplitType=attribute.YSplitType;if(attribute.YAxis){var item=attribute.YAxis;if(!indexInfo.YAxis)indexInfo.YAxis={};if(IFrameSplitOperator.IsNumber(item.FloatPrecision))indexInfo.YAxis.FloatPrecision=item.FloatPrecision;if(IFrameSplitOperator.IsNumber(item.StringFormat))indexInfo.YAxis.StringFormat=item.StringFormat;if(IFrameSplitOperator.IsBool(item.EnableRemoveZero))indexInfo.YAxis.EnableRemoveZero=item.EnableRemoveZero;}};JSIndexScript.prototype.Get=function(id){var data=g_CustomIndex.Get(id);if(data)return data;var func=this.DataMap.get(id);if(func){var data=func();data.ID=id;return data;}return null;};JSIndexScript.prototype.Search=function(name){var result=[];var reg=new RegExp(name,'i');this.DataMap.forEach(function(value,key){if(key.indexOf('交易系统-')!=0&&key.indexOf('五彩K线-')!=0&&key.search(reg)>=0)result.push(key);});return result;};JSIndexScript.prototype.MA=function(){var data={Name:'MA',Description:'均线',IsMainIndex:true,StringFormat:2,Args:[{Name:'M1',Value:5},{Name:'M2',Value:10},{Name:'M3',Value:20}],OutName:[{Name:'MA1',DynamicName:"MA{M1}"},{Name:'MA2',DynamicName:"MA{M2}"},{Name:'MA3',DynamicName:"MA{M3}"}],Script://脚本
71
+ if(IFrameSplitOperator.IsNumber(attribute.FloatPrecision))indexInfo.FloatPrecision=attribute.FloatPrecision;if(IFrameSplitOperator.IsNumber(attribute.StringFormat))indexInfo.StringFormat=attribute.StringFormat;if(IFrameSplitOperator.IsBool(attribute.IsSync))indexInfo.IsSync=attribute.IsSync;if(IFrameSplitOperator.IsBool(attribute.IsShortTitle))indexInfo.IsShortTitle=attribute.IsShortTitle;if(attribute.TitleFont)indexInfo.TitleFont=attribute.TitleFont;if(attribute.Lock)indexInfo.Lock=attribute.Lock;if(IFrameSplitOperator.IsNumber(attribute.YSplitType))indexInfo.YSplitType=attribute.YSplitType;if(IFrameSplitOperator.IsBool(attribute.IsShowIndexTitle))indexInfo.IsShowIndexTitle=attribute.IsShowIndexTitle;if(attribute.YAxis){var item=attribute.YAxis;if(!indexInfo.YAxis)indexInfo.YAxis={};if(IFrameSplitOperator.IsNumber(item.FloatPrecision))indexInfo.YAxis.FloatPrecision=item.FloatPrecision;if(IFrameSplitOperator.IsNumber(item.StringFormat))indexInfo.YAxis.StringFormat=item.StringFormat;if(IFrameSplitOperator.IsBool(item.EnableRemoveZero))indexInfo.YAxis.EnableRemoveZero=item.EnableRemoveZero;}};JSIndexScript.prototype.Get=function(id){var data=g_CustomIndex.Get(id);if(data)return data;var func=this.DataMap.get(id);if(func){var data=func();data.ID=id;return data;}return null;};JSIndexScript.prototype.Search=function(name){var result=[];var reg=new RegExp(name,'i');this.DataMap.forEach(function(value,key){if(key.indexOf('交易系统-')!=0&&key.indexOf('五彩K线-')!=0&&key.search(reg)>=0)result.push(key);});return result;};JSIndexScript.prototype.MA=function(){var data={Name:'MA',Description:'均线',IsMainIndex:true,StringFormat:2,Args:[{Name:'M1',Value:5},{Name:'M2',Value:10},{Name:'M3',Value:20}],OutName:[{Name:'MA1',DynamicName:"MA{M1}"},{Name:'MA2',DynamicName:"MA{M2}"},{Name:'MA3',DynamicName:"MA{M3}"}],Script://脚本
72
72
  'MA1:MA(CLOSE,M1);\n\
73
73
  MA2:MA(CLOSE,M2);\n\
74
74
  MA3:MA(CLOSE,M3);'};return data;};JSIndexScript.prototype.MA4=function(){var data={Name:'MA',Description:'均线',IsMainIndex:true,StringFormat:2,Args:[{Name:'M1',Value:5},{Name:'M2',Value:10},{Name:'M3',Value:20},{Name:'M4',Value:60}],OutName:[{Name:'MA1',DynamicName:"MA{M1}"},{Name:'MA2',DynamicName:"MA{M2}"},{Name:'MA3',DynamicName:"MA{M3}"},{Name:'MA4',DynamicName:"MA{M4}"}],Script://脚本
@@ -5775,6 +5775,7 @@ this.Buttons=[];//按钮
5775
5775
  //动态标题
5776
5776
  //动态标题
5777
5777
  this.DynamicTitle={OutName:null,OutValue:null};this.OverlayDynamicTitle=new _map2.default();//key , value={ OutName, OutValue }
5778
+ this.IsShowMainIndexTitle=true;//是否显示主图指标标题
5778
5779
  this.ReloadResource=function(){this.Font=g_JSChartResource.TitleFont;this.TitleColor=g_JSChartResource.DefaultTextColor;this.OverlayIndexType.BGColor=g_JSChartResource.OverlayIndexTitleBGColor;};this.SetDynamicTitleData=function(outName,args,data){if(!data.OutName)data.OutName=new _map2.default();else data.OutName.clear();if(!data.OutValue)data.OutValue=new _map2.default();else data.OutValue.clear();var mapArgs=new _map2.default();for(var i in args){var item=args[i];mapArgs.set('{'+item.Name+'}',item);}for(var i in outName){var item=outName[i];if(item.DynamicName){var aryFond=item.DynamicName.match(/{\w*}/i);if(!aryFond||aryFond.length<=0){data.OutName.set(item.Name,item.DynamicName);}else{var dyName=item.DynamicName;var bFind=true;for(var j=0;j<aryFond.length;++j){var findItem=aryFond[j];if(mapArgs.has(findItem)){var value=mapArgs.get(findItem).Value;dyName=dyName.replace(findItem,value.toString());}else{bFind=false;break;}}if(bFind)data.OutName.set(item.Name,dyName);}}if(item.DynamicValue){data.OutValue.set(item.Name,item.DynamicValue);}}};this.SetDynamicTitle=function(outName,args,overlayID){if(IFrameSplitOperator.IsString(overlayID)){var dynamicTitle=null;if(this.OverlayDynamicTitle.has(overlayID)){dynamicTitle=this.OverlayDynamicTitle.get(overlayID);}else{dynamicTitle={OutName:null,OutValue:null};this.OverlayDynamicTitle.set(overlayID,dynamicTitle);}this.SetDynamicTitleData(outName,args,dynamicTitle);}else{this.SetDynamicTitleData(outName,args,this.DynamicTitle);}};this.GetDynamicOutName=function(key,overlayID){if(IFrameSplitOperator.IsString(overlayID)){if(!this.OverlayDynamicTitle.has(overlayID))return null;var dynamicTitle=this.OverlayDynamicTitle.get(overlayID);var outName=dynamicTitle.OutName;}else{var outName=this.DynamicTitle.OutName;}if(!outName||outName.size<=0)return null;if(!outName.has(key))return null;return outName.get(key);};this.GetDynamicOutValue=function(key,value){var outValue=this.DynamicTitle.OutValue;if(!outValue||outValue.size<=0)return null;if(!outValue.has(key))return null;var strFormat=outValue.get(key);strFormat=strFormat.replace('{Value}',value);return strFormat;};this.IsClickTitle=function(x,y)//是否点击了指标标题
5779
5780
  {if(!this.TitleRect)return false;if(x>this.TitleRect.Left&&x<this.TitleRect.Left+this.TitleRect.Width&&y>this.TitleRect.Top&&y<this.TitleRect.Top+this.TitleRect.Height){return true;}return false;};this.FormatValue=function(value,item){if(item.StringFormat==STRING_FORMAT_TYPE.DEFAULT)return IFrameSplitOperator.FormatValueString(value,item.FloatPrecision,this.LanguageID);else if(item.StringFormat==STRING_FORMAT_TYPE.THOUSANDS)return IFrameSplitOperator.FormatValueThousandsString(value,item.FloatPrecision);else if(item.StringFormat==STRING_FORMAT_TYPE.ORIGINAL)return value.toFixed(item.FloatPrecision).toString();else if(item.StringFormat==STRING_FORMAT_TYPE.INTEGER)return IFrameSplitOperator.FromatIntegerString(value,item.FloatPrecision,this.LanguageID);};this.FormatMultiReport=function(data,format){var text="";for(var i in data){var item=data[i];var quarter=item.Quarter;var year=item.Year;var value=item.Value;if(text.length>0)text+=',';text+=year.toString();switch(quarter){case 1:text+='一季报 ';break;case 2:text+='半年报 ';break;case 3:text+='三季报 ';break;case 4:text+='年报 ';break;}text+=this.FormatValue(value,format);}return text;};this.FromatMultiDataLine=function(value,dataInfo){var text="";if(Array.isArray(value)){for(var i=0;i<value.length;++i){var item=value[i];if(item.Type==0)continue;if(!IFrameSplitOperator.IsNumber(item.Value))continue;var strValue=this.FormatValue(item.Value,dataInfo);if(text.length>0)text+=',';text+=strValue;}}else{if(value.Type!=0&&IFrameSplitOperator.IsNumber(value.Value)){text=this.FormatValue(value.Value,dataInfo);}}if(text.length<=0)return null;return text;};//多变量输出
5780
5781
  this.FromatStackedBarTitle=function(aryBar,dataInfo){if(!IFrameSplitOperator.IsNonEmptyArray(aryBar))return null;if(!IFrameSplitOperator.IsNonEmptyArray(dataInfo.Color))return null;var aryText=[];for(var i=0;i<aryBar.length;++i){var value=aryBar[i];if(!IFrameSplitOperator.IsNumber(value))continue;var item={Text:value.toFixed(2)};if(dataInfo.Name&&dataInfo.Name[i])item.Name=dataInfo.Name[i];item.Color=dataInfo.Color[i];aryText.push(item);}if(aryText.length<=0)return null;return aryText;};this.ForamtMultiLineTitle=function(dataIndex,dataInfo){if(!IFrameSplitOperator.IsNonEmptyArray(dataInfo.Lines))return null;var aryText=[];for(var i=0;i<dataInfo.Lines.length;++i){var line=dataInfo.Lines[i];for(var j=0;j<line.Point.length;++j){var item=line.Point[j];if(item.Index==dataIndex){var item={Text:item.Value.toFixed(2)};if(aryText.length==0)item.Name=dataInfo.Name;item.Color=line.Color;aryText.push(item);break;}}}if(!IFrameSplitOperator.IsNonEmptyArray(aryText))return null;return aryText;};this.ForamtMultiPointTitle=function(dataIndex,dataInfo){if(!IFrameSplitOperator.IsNonEmptyArray(dataInfo.PointGroup))return null;var aryText=[];for(var i=0;i<dataInfo.PointGroup.length;++i){var groupItem=dataInfo.PointGroup[i];for(var j=0;j<groupItem.Point.length;++j){var item=groupItem.Point[j];if(item.Index==dataIndex){var item={Text:item.Value.toFixed(2)};if(aryText.length==0)item.Name=dataInfo.Name;item.Color=groupItem.BGColor;aryText.push(item);break;}}}if(!IFrameSplitOperator.IsNonEmptyArray(aryText))return null;return aryText;};this.FormatVPVRTitle=function(pt,dataInfo){var chart=dataInfo.Chart;var aryText=[];if(chart.VolType==0){var item={Text:" Up/Down ",Color:this.TitleColor};aryText.push(item);}else{var item={Text:" Total ",Color:this.TitleColor};aryText.push(item);}if(!IFrameSplitOperator.IsNumber(pt.Y))return aryText;var top=this.Frame.ChartBorder.GetTopEx();var bottom=this.Frame.ChartBorder.GetBottomEx();if(pt.Y<top||pt.Y>bottom)return aryText;var yPrice=this.Frame.GetYData(pt.Y);var find=null;for(var i=0;i<dataInfo.Data.Data.length;++i){var item=dataInfo.Data.Data[i];if(yPrice>=item.Price-dataInfo.Data.PriceOffset/2&&yPrice<item.Price+dataInfo.Data.PriceOffset/2){find=item;break;}}if(!find)return null;if(chart.VolType==0){var total=0;for(var i=0;i<find.Vol.length;++i){var volItem=find.Vol[i];if(!IFrameSplitOperator.IsNumber(volItem.Value))continue;var item={Text:IFrameSplitOperator.FormatVolString(volItem.Value,this.LanguageID)};total+=volItem.Value;if(IFrameSplitOperator.IsNumber(volItem.ColorID))item.Color=chart.BarColor[volItem.ColorID];else if(volItem.Color)item.Color=volItem.Color;aryText.push(item);}var item={Text:IFrameSplitOperator.FormatVolString(total,this.LanguageID),Color:this.TitleColor};aryText.push(item);}else{if(find.TotalVol&&IFrameSplitOperator.IsNumber(find.TotalVol.Value)){var item={Text:IFrameSplitOperator.FormatVolString(find.TotalVol.Value,this.LanguageID)};if(IFrameSplitOperator.IsNumber(find.TotalVol.ColorID))item.Color=chart.BarColor[find.TotalVol.ColorID];else if(find.TotalVol.Color)item.Color=find.TotalVol.Color;aryText.push(item);}}return aryText;};this.IsShowLastData=function(){var isShowLastData=false;if(this.DrawStatus&&this.DrawStatus.IsTitleShowLatestData){var status=this.DrawStatus;if(!IFrameSplitOperator.IsNumber(status.FrameID)||status.FrameID<0)isShowLastData=true;else if(status.CorssCursorTouchEnd&&status.IsOnTouch==false)isShowLastData=true;}else if(this.GlobalOption&&this.GlobalOption.IsDisplayLatest){isShowLastData=true;}return isShowLastData;};this.OnDrawTitleEvent=function(){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_INDEXTITLE_DRAW);if(!event)return;var data={Index:null,Data:this.Data,Title:this.Title,Script:this.Script,FrameID:this.Frame.Identify,OverlayIndex:this.OverlayIndex,IsShowTitleOnly:false};if(this.ArgumentsText)data.ArgumentsText=this.ArgumentsText;if(this.Frame&&this.Frame.ChartBorder)data.IsShowTitleOnly=this.Frame.ChartBorder.IsShowTitleOnly;if(IFrameSplitOperator.IsNumber(this.CursorIndex)){var index=Math.abs(this.CursorIndex);index=parseInt(index.toFixed(0));data.Index=index;//当前屏数据索引
@@ -5785,15 +5786,15 @@ this.FromatStackedBarTitle=function(aryBar,dataInfo){if(!IFrameSplitOperator.IsN
5785
5786
  this.Canvas.strokeRect(ToFixedPoint(this.TitleRect.Left),ToFixedPoint(this.TitleRect.Top),ToFixedRect(this.TitleRect.Width),ToFixedRect(this.TitleRect.Height));
5786
5787
  }
5787
5788
  */return;}var left=this.Frame.ChartBorder.GetLeft()+this.MerginLeft;var bottom=this.Frame.ChartBorder.GetTop()+this.Frame.ChartBorder.TitleHeight/2;//上下居中显示
5788
- var right=this.Frame.ChartBorder.GetRight();var toolbarInfo={Width:0,YCenter:bottom};this.DrawToolbar(toolbarInfo,moveonPoint,mouseStatus);left+=toolbarInfo.Width;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.font=this.Font;var pixelRatio=GetDevicePixelRatio();if(this.Title&&this.IsShowIndexName){if(this.IsDrawTitleBG){var rtButton={Left:left,YCenter:bottom,Width:0};this.DrawNameButton(rtButton,moveonPoint,mouseStatus);this.Buttons.push({ID:JSCHART_BUTTON_ID.INDEX_NAME_BUTTON,Rect:rtButton,FrameID:this.Frame.Identify,Type:2});//Type 0=主图按钮 1=附图按钮 2=主图指标名字按钮
5789
- if(this.IsSelectedChart(this.Identify))this.DrawSelectedLine(left,bottom,textWidth);this.TitleRect=rtButton;left+=rtButton.Width+3*pixelRatio;left+=this.TitleSpace;}else{var textWidth=this.Canvas.measureText(this.Title).width+2;this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(this.Title,left,bottom,textWidth);if(this.IsSelectedChart(this.Identify))this.DrawSelectedLine(left,bottom,textWidth);left+=textWidth;left+=this.TitleSpace;}}if(this.ArgumentsText&&this.IsShowIndexName){var textWidth=this.Canvas.measureText(this.ArgumentsText).width+2;this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(this.ArgumentsText,left,bottom,textWidth);left+=textWidth;left+=this.TitleSpace;}var isShowLastData=this.IsShowLastData();var lockRect=this.Frame.GetLockRect();if(lockRect)//指标上锁区域不显示动态标题
5790
- {var index=Math.abs(this.CursorIndex);if(this.IsKLineFrame)index=this.CursorIndex;var x=this.Frame.GetXFromIndex(index.toFixed(0));if(x>=lockRect.Left)return;if(isShowLastData)return;}for(var i=0;i<this.Data.length;++i){var item=this.Data[i];var outText=this.GetTitleItem(item,isShowLastData,i);if(!outText)continue;var valueText=outText.Text;var aryText=outText.ArrayText;if(aryText)//多变量输出
5789
+ var right=this.Frame.ChartBorder.GetRight();var toolbarInfo={Width:0,YCenter:bottom};this.DrawToolbar(toolbarInfo,moveonPoint,mouseStatus);left+=toolbarInfo.Width;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.font=this.Font;var pixelRatio=GetDevicePixelRatio();if(this.Title&&this.IsShowIndexName&&this.IsShowMainIndexTitle){if(this.IsDrawTitleBG){var rtButton={Left:left,YCenter:bottom,Width:0};this.DrawNameButton(rtButton,moveonPoint,mouseStatus);this.Buttons.push({ID:JSCHART_BUTTON_ID.INDEX_NAME_BUTTON,Rect:rtButton,FrameID:this.Frame.Identify,Type:2});//Type 0=主图按钮 1=附图按钮 2=主图指标名字按钮
5790
+ if(this.IsSelectedChart(this.Identify))this.DrawSelectedLine(left,bottom,textWidth);this.TitleRect=rtButton;left+=rtButton.Width+3*pixelRatio;left+=this.TitleSpace;}else{var textWidth=this.Canvas.measureText(this.Title).width+2;this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(this.Title,left,bottom,textWidth);if(this.IsSelectedChart(this.Identify))this.DrawSelectedLine(left,bottom,textWidth);left+=textWidth;left+=this.TitleSpace;}}if(this.ArgumentsText&&this.IsShowIndexName&&this.IsShowMainIndexTitle){var textWidth=this.Canvas.measureText(this.ArgumentsText).width+2;this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(this.ArgumentsText,left,bottom,textWidth);left+=textWidth;left+=this.TitleSpace;}var isShowLastData=this.IsShowLastData();var lockRect=this.Frame.GetLockRect();if(lockRect)//指标上锁区域不显示动态标题
5791
+ {var index=Math.abs(this.CursorIndex);if(this.IsKLineFrame)index=this.CursorIndex;var x=this.Frame.GetXFromIndex(index.toFixed(0));if(x>=lockRect.Left)return;if(isShowLastData)return;}for(var i=0;i<this.Data.length&&this.IsShowMainIndexTitle;++i){var item=this.Data[i];var outText=this.GetTitleItem(item,isShowLastData,i);if(!outText)continue;var valueText=outText.Text;var aryText=outText.ArrayText;if(aryText)//多变量输出
5791
5792
  {var text;for(var k=0;k<aryText.length;++k){var titleItem=aryText[k];if(titleItem.Name)text=titleItem.Name+":"+titleItem.Text;else text=titleItem.Text;var space=this.ParamSpace*GetDevicePixelRatio();var textWidth=this.Canvas.measureText(text).width+space;if(left+textWidth>right)break;if(titleItem.BG)//背景
5792
5793
  {var textHeight=this.Canvas.measureText("擎").width+2;var textWidth=this.Canvas.measureText(text).width+2;var rtBG={Left:left,Top:bottom-textHeight/2,Width:textWidth,Height:textHeight};this.Canvas.fillStyle=titleItem.BG;this.Canvas.fillRect(rtBG.Left,rtBG.Top-1,rtBG.Width,rtBG.Height);this.Canvas.fillStyle=titleItem.Color;this.Canvas.fillText(text,rtBG.Left+1,bottom,textWidth);left+=textWidth+space;}else{this.Canvas.fillStyle=titleItem.Color;this.Canvas.fillText(text,left,bottom,textWidth);left+=textWidth;}}}else{this.Canvas.fillStyle=item.Color;var text=valueText;if(item.Name){var dyTitle=this.GetDynamicOutName(item.Name);if(dyTitle)text=dyTitle+":"+valueText;else text=item.Name+":"+valueText;}var space=this.ParamSpace*GetDevicePixelRatio();var textWidth=this.Canvas.measureText(text).width+space;if(left+textWidth>right)break;this.Canvas.fillText(text,left,bottom,textWidth);left+=textWidth;}}if(this.Explain)//说明信息
5793
5794
  {this.Canvas.fillStyle=this.TitleColor;var text="说明:"+this.Explain;var textWidth=this.Canvas.measureText(text).width+2;if(left+textWidth<right){this.Canvas.fillText(text,left,bottom,textWidth);left+=textWidth;}}if(this.ColorIndex&&this.IsShowColorIndexTitle){this.Canvas.fillStyle=g_JSChartResource.Title.ColorIndexColor;var tradeName=this.ColorIndex.Name+this.ColorIndex.Param;var textWidth=this.Canvas.measureText(tradeName).width+2;//后空2个像素
5794
5795
  this.Canvas.fillText(tradeName,left,bottom,textWidth);left+=textWidth;}if(this.TradeIndex&&this.IsShowTradeIndexTitle){this.Canvas.fillStyle=g_JSChartResource.Title.TradeIndexColor;var tradeName=this.TradeIndex.Name+this.TradeIndex.Param;var textWidth=this.Canvas.measureText(tradeName).width+2;//后空2个像素
5795
- this.Canvas.fillText(tradeName,left,bottom,textWidth);left+=textWidth;}if(this.OverlayIndexType.Position==1){if(!this.Frame.ChartBorder.IsShowTitleOnly)this.DrawOverlayIndexSingleLine(moveonPoint,mouseStatus);}else{this.DrawOverlayIndex(left+10*GetDevicePixelRatio());//间距多空点 和主指标区分开
5796
- }};this.GetTitleItem=function(item,isShowLastData,titleIndex){if(!item||!item.Data||!item.Data.Data)return null;;if(Array.isArray(item.Data.Data)&&item.Data.Data.length<=0)return null;if(item.IsShow===false)return null;if(item.IsVisible===false)return null;var valueText=null;//单值
5796
+ this.Canvas.fillText(tradeName,left,bottom,textWidth);left+=textWidth;}if(this.OverlayIndexType.Position==1){if(!this.Frame.ChartBorder.IsShowTitleOnly)this.DrawOverlayIndexSingleLine(moveonPoint,mouseStatus);}else{var xOffset=10*GetDevicePixelRatio();//主指标区分开 间距多空点
5797
+ if(!this.IsShowMainIndexTitle)xOffset=0;this.DrawOverlayIndex(left+xOffset);}};this.GetTitleItem=function(item,isShowLastData,titleIndex){if(!item||!item.Data||!item.Data.Data)return null;;if(Array.isArray(item.Data.Data)&&item.Data.Data.length<=0)return null;if(item.IsShow===false)return null;if(item.IsVisible===false)return null;var valueText=null;//单值
5797
5798
  var aryText=null;//多值
5798
5799
  var value=null;var preVaildItem=null;if(item.DataType=="StraightLine")//直线只有1个数据
5799
5800
  {value=item.Data.Data[0];valueText=this.FormatValue(value,item);}else if(item.ChartClassName=="ChartVolProfileVisibleRange"){aryText=this.FormatVPVRTitle(this.LastPoint,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else{if(isShowLastData){var dataIndex=item.Data.Data.length-1;//显示最后一个数据
@@ -5802,7 +5803,7 @@ var value=null;var preVaildItem=null;if(item.DataType=="StraightLine")//直线
5802
5803
  {preVaildItem=this.GetPreVaildItem(item.Data.Data,dataIndex);if(!preVaildItem)return null;preText=this.FormatValue(preVaildItem.Item,item);if(item.Name){var dyValue=this.GetDynamicOutValue(item.Name,preText);if(dyValue)preText=dyValue;}valueText='--('+preText+')';return{Text:valueText,ArrayText:aryText};}if(value==null)return null;if(item.DataType=="HistoryData-Vol"){value=value.Vol;valueText=this.FormatValue(value,item);}else if(item.DataType=="MultiReport"){valueText=this.FormatMultiReport(value,item);}else if(item.DataType=="MULTI_POINT_LINE"){valueText=this.FromatMultiDataLine(value,item);if(!valueText)return null;}else if(item.DataType=="ChartStackedBar"){aryText=this.FromatStackedBarTitle(value,item);if(!aryText)return null;return{Text:null,ArrayText:aryText};}else if(g_ScriptIndexChartFactory.Has(item.DataType))//外部挂接
5803
5804
  {var find=g_ScriptIndexChartFactory.Get(item.DataType);if(find&&find.FormatTitleCallback)return find.FormatTitleCallback(value,item,dataIndex);}else{if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_INDEX_OUT_TEXT);if(event){var data={Item:item,Index:titleIndex,Data:this.Data,FrameID:this.Frame.Identify,DataIndex:dataIndex,Value:value,Out:null};event.Callback(event,data,this);if(data.Out)return data.Out;}}var arrow=null;if(this.IsShowUpDownArrow){var preValue=null;if(dataIndex-1>=0)preValue=item.Data.Data[dataIndex-1];if(IFrameSplitOperator.IsNumber(preValue)){if(preValue>value)arrow='↓';else if(preValue<value)arrow='↑';else arrow='→';}}valueText=this.FormatValue(value,item);if(item.Name){var dyValue=this.GetDynamicOutValue(item.Name,valueText);if(dyValue)valueText=dyValue;}if(arrow)valueText+=arrow;}}return{Text:valueText,ArrayText:aryText};};//获取上一个有效数据
5804
5805
  this.GetPreVaildItem=function(data,start){for(var i=start;i>=0;--i){var item=data[i];if(item)return{Item:item,Index:i};}return null;};this.DrawSelectedLine=function(left,bottom,textWidth){this.Canvas.save();var fontHeight=this.GetFontHeight();this.Canvas.strokeStyle=this.SelectedColor;var lineWidth=4;var lineBottom=ToFixedPoint2(lineWidth,bottom+fontHeight/2);this.Canvas.lineWidth=lineWidth;this.Canvas.beginPath();this.Canvas.moveTo(left,lineBottom);this.Canvas.lineTo(left+textWidth,lineBottom);this.Canvas.stroke();this.Canvas.restore();};this.DrawOverlayIndexSingleLine=function(moveonPoint,mouseStatus)//叠加指标1个指标一行
5805
- {var pixelRatio=GetDevicePixelRatio();var border=this.Frame.GetBorder();if(this.Frame.IsHScreen===true){var left=1;var top=2*pixelRatio;var right=this.Frame.ChartBorder.GetHeight();var bottom=this.Frame.ChartBorder.GetWidthEx();}else{var top=border.TopTitle+2*pixelRatio;var left=this.Frame.ChartBorder.GetLeft()+this.MerginLeft;var right=border.Right;var bottom=border.Bottom;}var lineSpace=this.OverlayIndexType.LineSpace*pixelRatio;var x=left,y=top;var fontHeight=GetFontHeight(this.Canvas,this.Font,"擎");y=top+fontHeight/2;var _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{for(var _iterator10=(0,_getIterator3.default)(this.OverlayIndex),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){item=_step10.value;var overlayItem=item[1];var overlayID=item[0];var toolbarInfo={Width:0,YCenter:y,ID:overlayID};this.DrawOverlayToolbar(overlayItem,toolbarInfo,moveonPoint,mouseStatus);if(!overlayItem.Frame.IsShowIndexTitle)continue;x=left+toolbarInfo.Width;this.Canvas.font=this.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";if(overlayItem.Title&&this.IsShowOverlayIndexName){var textWidth=this.Canvas.measureText(overlayItem.Title).width+2;if(x+textWidth<right){if(this.OverlayIndexType.BGColor){this.Canvas.fillStyle=this.OverlayIndexType.BGColor;var rtBG={Left:x,Top:y-fontHeight/2,Width:textWidth,Height:fontHeight+lineSpace};//保存下标题的坐标
5806
+ {var pixelRatio=GetDevicePixelRatio();var border=this.Frame.GetBorder();if(this.Frame.IsHScreen===true){var left=1;var top=2*pixelRatio;var right=this.Frame.ChartBorder.GetHeight();var bottom=this.Frame.ChartBorder.GetWidthEx();}else{var top=border.TopTitle+2*pixelRatio;if(!this.IsShowMainIndexTitle)top=this.Frame.ChartBorder.GetTop()+2*pixelRatio;var left=this.Frame.ChartBorder.GetLeft()+this.MerginLeft;var right=border.Right;var bottom=border.Bottom;}var lineSpace=this.OverlayIndexType.LineSpace*pixelRatio;var x=left,y=top;var fontHeight=GetFontHeight(this.Canvas,this.Font,"擎");y=top+fontHeight/2;var _iteratorNormalCompletion10=true;var _didIteratorError10=false;var _iteratorError10=undefined;try{for(var _iterator10=(0,_getIterator3.default)(this.OverlayIndex),_step10;!(_iteratorNormalCompletion10=(_step10=_iterator10.next()).done);_iteratorNormalCompletion10=true){item=_step10.value;var overlayItem=item[1];var overlayID=item[0];var toolbarInfo={Width:0,YCenter:y,ID:overlayID};this.DrawOverlayToolbar(overlayItem,toolbarInfo,moveonPoint,mouseStatus);if(!overlayItem.IsShowIndexTitle)continue;if(!overlayItem.Frame.IsShowIndexTitle)continue;x=left+toolbarInfo.Width;this.Canvas.font=this.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";if(overlayItem.Title&&this.IsShowOverlayIndexName){var textWidth=this.Canvas.measureText(overlayItem.Title).width+2;if(x+textWidth<right){if(this.OverlayIndexType.BGColor){this.Canvas.fillStyle=this.OverlayIndexType.BGColor;var rtBG={Left:x,Top:y-fontHeight/2,Width:textWidth,Height:fontHeight+lineSpace};//保存下标题的坐标
5806
5807
  this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}if(this.IsSelectedChart(overlayID))this.DrawSelectedLine(x,y,textWidth,overlayItem.Title);this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(overlayItem.Title,x,y,textWidth);}x+=textWidth;}for(var i=0;i<overlayItem.Data.length;++i){var item=overlayItem.Data[i];if(!item||!item.Data||!item.Data.Data||!item.Name)continue;if(item.IsVisible===false)continue;if(item.Data.Data.length<=0)continue;var value=null;var valueText=null;var aryText=null;if(item.DataType=="StraightLine")//直线只有1个数据
5807
5808
  {value=item.Data.Data[0];valueText=this.FormatValue(value,item);}else{var index=Math.abs(this.CursorIndex-0.5);index=parseInt(index.toFixed(0));if(this.IsKLineFrame)index=this.CursorIndex;var dataIndex=item.Data.DataOffset+index;if(dataIndex>=item.Data.Data.length)dataIndex=item.Data.Data.length-1;if(dataIndex<0)continue;value=item.Data.Data[dataIndex];if(value==null)continue;if(item.DataType=="HistoryData-Vol"){value=value.Vol;valueText=this.FormatValue(value,item);}else if(item.DataType=="MultiReport"){valueText=this.FormatMultiReport(value,item);}else if(item.DataType=="ChartStackedBar"){aryText=this.FromatStackedBarTitle(value,item);if(!aryText)continue;}else{valueText=this.FormatValue(value,item);}}if(aryText){var text;for(var k=0;k<aryText.length;++k){var titleItem=aryText[k];if(titleItem.Name)text=titleItem.Name+":"+titleItem.Text;else text=titleItem.Text;var textWidth=this.Canvas.measureText(text).width+2;//后空2个像素
5808
5809
  if(x+textWidth>right)break;if(this.OverlayIndexType.BGColor){this.Canvas.fillStyle=this.OverlayIndexType.BGColor;var rtBG={Left:x,Top:y-fontHeight/2,Width:textWidth,Height:fontHeight+lineSpace};//保存下标题的坐标
@@ -5810,9 +5811,9 @@ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}this.Canvas.fil
5810
5811
  if(x+textWidth>right)break;if(this.OverlayIndexType.BGColor){this.Canvas.fillStyle=this.OverlayIndexType.BGColor;var rtBG={Left:x,Top:y-fontHeight/2,Width:textWidth,Height:fontHeight+lineSpace};//保存下标题的坐标
5811
5812
  this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}this.Canvas.fillStyle=item.Color;this.Canvas.fillText(text,x,y,textWidth);x+=textWidth;}}y+=fontHeight+lineSpace;if(y+fontHeight+lineSpace>=bottom)break;}}catch(err){_didIteratorError10=true;_iteratorError10=err;}finally{try{if(!_iteratorNormalCompletion10&&_iterator10.return){_iterator10.return();}}finally{if(_didIteratorError10){throw _iteratorError10;}}}};this.DrawOverlayIndex=function(left)//叠加指标标题
5812
5813
  {var bottom=this.Frame.ChartBorder.GetTop()+this.Frame.ChartBorder.TitleHeight/2;//上下居中显示
5813
- var right=this.Frame.ChartBorder.GetRight();if(this.Frame.IsHScreen===true){bottom=-this.Frame.ChartBorder.TitleHeight/2;right=this.Frame.ChartBorder.GetHeight();}if(left>right)return;var spaceWidth=5*GetDevicePixelRatio();var drawLeft=left;var _iteratorNormalCompletion11=true;var _didIteratorError11=false;var _iteratorError11=undefined;try{for(var _iterator11=(0,_getIterator3.default)(this.OverlayIndex),_step11;!(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done);_iteratorNormalCompletion11=true){item=_step11.value;left+=spaceWidth;var overlayItem=item[1];var overlayID=item[0];if(overlayItem.Title&&this.IsShowOverlayIndexName){this.Canvas.fillStyle=this.TitleColor;var textWidth=this.Canvas.measureText(overlayItem.Title).width+2;drawLeft=left;left+=textWidth;if(left>right)break;this.Canvas.fillText(overlayItem.Title,drawLeft,bottom,textWidth);if(this.IsSelectedChart(overlayID))this.DrawSelectedLine(drawLeft,bottom,textWidth);}for(var i in overlayItem.Data){var item=overlayItem.Data[i];if(!item||!item.Data||!item.Data.Data||!item.Name)continue;if(item.Data.Data.length<=0)continue;var value=null;var valueText=null;if(item.DataType=="StraightLine")//直线只有1个数据
5814
+ var right=this.Frame.ChartBorder.GetRight();if(this.Frame.IsHScreen===true){bottom=-this.Frame.ChartBorder.TitleHeight/2;right=this.Frame.ChartBorder.GetHeight();}if(left>right)return;var spaceWidth=5*GetDevicePixelRatio();var drawLeft=left;var indexCount=0;var _iteratorNormalCompletion11=true;var _didIteratorError11=false;var _iteratorError11=undefined;try{for(var _iterator11=(0,_getIterator3.default)(this.OverlayIndex),_step11;!(_iteratorNormalCompletion11=(_step11=_iterator11.next()).done);_iteratorNormalCompletion11=true){item=_step11.value;if(indexCount>0)left+=spaceWidth;var overlayItem=item[1];var overlayID=item[0];if(overlayItem.Title&&this.IsShowOverlayIndexName){this.Canvas.fillStyle=this.TitleColor;var textWidth=this.Canvas.measureText(overlayItem.Title).width+2;drawLeft=left;left+=textWidth;if(left>right)break;this.Canvas.fillText(overlayItem.Title,drawLeft,bottom,textWidth);if(this.IsSelectedChart(overlayID))this.DrawSelectedLine(drawLeft,bottom,textWidth);}for(var i in overlayItem.Data){var item=overlayItem.Data[i];if(!item||!item.Data||!item.Data.Data||!item.Name)continue;if(item.Data.Data.length<=0)continue;var value=null;var valueText=null;if(item.DataType=="StraightLine")//直线只有1个数据
5814
5815
  {value=item.Data.Data[0];valueText=this.FormatValue(value,item);}else{var index=Math.abs(this.CursorIndex-0.5);index=parseInt(index.toFixed(0));if(this.IsKLineFrame)index=this.CursorIndex;var dataIndex=item.Data.DataOffset+index;if(dataIndex>=item.Data.Data.length)dataIndex=item.Data.Data.length-1;if(dataIndex<0)continue;value=item.Data.Data[dataIndex];if(value==null)continue;if(item.DataType=="HistoryData-Vol"){value=value.Vol;valueText=this.FormatValue(value,item);}else if(item.DataType=="MultiReport"){valueText=this.FormatMultiReport(value,item);}else{valueText=this.FormatValue(value,item);}}this.Canvas.fillStyle=item.Color;var text=item.Name+":"+valueText;var textWidth=this.Canvas.measureText(text).width+2;//后空2个像素
5815
- drawLeft=left;left+=textWidth;if(left>right)break;this.Canvas.fillText(text,drawLeft,bottom,textWidth);}if(left>right)break;}}catch(err){_didIteratorError11=true;_iteratorError11=err;}finally{try{if(!_iteratorNormalCompletion11&&_iterator11.return){_iterator11.return();}}finally{if(_didIteratorError11){throw _iteratorError11;}}}};this.HScreenDraw=function(){var border=this.Frame.ChartBorder.GetHScreenBorder();var xText=this.Frame.ChartBorder.GetRightTitle();var yText=border.TopEx;this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);var left=1;var bottom=-this.Frame.ChartBorder.TitleHeight/2;//上下居中显示
5816
+ drawLeft=left;left+=textWidth;if(left>right)break;this.Canvas.fillText(text,drawLeft,bottom,textWidth);}if(left>right)break;++indexCount;}}catch(err){_didIteratorError11=true;_iteratorError11=err;}finally{try{if(!_iteratorNormalCompletion11&&_iterator11.return){_iterator11.return();}}finally{if(_didIteratorError11){throw _iteratorError11;}}}};this.HScreenDraw=function(){var border=this.Frame.ChartBorder.GetHScreenBorder();var xText=this.Frame.ChartBorder.GetRightTitle();var yText=border.TopEx;this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);var left=1;var bottom=-this.Frame.ChartBorder.TitleHeight/2;//上下居中显示
5816
5817
  var right=this.Frame.ChartBorder.GetHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.font=this.Font;var pixelRatio=GetDevicePixelRatio();if(this.Title&&this.IsShowIndexName){var textWidth=this.Canvas.measureText(this.Title).width+2;if(this.IsDrawTitleBG){var title=this.Title;if(this.IsShowNameArrow)title+='▼';var textWidth=this.Canvas.measureText(title).width;var bgHeight=this.Canvas.measureText("擎").width+4*pixelRatio;var bgWidth=textWidth+4*pixelRatio;this.TitleRect={Top:border.Top,Left:this.Frame.ChartBorder.GetRightTitle()+this.Frame.ChartBorder.TitleHeight/2-bgHeight/2,Width:bgHeight,Height:bgWidth};//保存下标题的坐标
5817
5818
  this.Canvas.fillStyle=this.BGColor;var drawRect={Left:left,Top:bottom-bgHeight/2,Width:bgWidth,Height:bgHeight};this.Canvas.fillRect(drawRect.Left,drawRect.Top,drawRect.Width,drawRect.Height);if(this.BGBorderColor){this.Canvas.strokeStyle=this.BGBorderColor;this.Canvas.strokeRect(ToFixedPoint(drawRect.Left),ToFixedPoint(drawRect.Top),ToFixedRect(drawRect.Width),ToFixedRect(drawRect.Height));}this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(title,left+2*pixelRatio,bottom,textWidth);left+=bgWidth+2*pixelRatio;left+=this.TitleSpace;}else{this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(this.Title,left,bottom,textWidth);left+=textWidth;left+=this.TitleSpace;}}if(this.ArgumentsText&&this.IsShowIndexName){var textWidth=this.Canvas.measureText(this.ArgumentsText).width+2;this.Canvas.fillStyle=this.TitleColor;this.Canvas.fillText(this.ArgumentsText,left,bottom,textWidth);left+=textWidth;left+=this.TitleSpace;}var isShowLastData=this.IsShowLastData();var lockRect=this.Frame.GetLockRect();if(lockRect)//指标上锁区域不显示动态标题
5818
5819
  {var index=Math.abs(this.CursorIndex-0.5);if(this.IsKLineFrame)index=this.CursorIndex;var x=this.Frame.GetXFromIndex(index.toFixed(0));if(x>=lockRect.Top)return;if(isShowLastData)return;}for(var i in this.Data){var item=this.Data[i];var outText=this.GetTitleItem(item,isShowLastData);if(!outText)continue;var valueText=outText.Text;var aryText=outText.ArrayText;if(aryText){var text;for(var k=0;k<aryText.length;++k){var titleItem=aryText[k];if(titleItem.Name)text=titleItem.Name+":"+titleItem.Text;else text=titleItem.Text;var space=this.ParamSpace*GetDevicePixelRatio();var textWidth=this.Canvas.measureText(text).width+space;if(left+textWidth>right)break;this.Canvas.fillStyle=titleItem.Color;this.Canvas.fillText(text,left,bottom,textWidth);left+=textWidth;}}else{this.Canvas.fillStyle=item.Color;var text=valueText;if(item.Name){var dyTitle=this.GetDynamicOutName(item.Name);if(dyTitle)text=dyTitle+":"+valueText;else text=item.Name+":"+valueText;}var space=this.ParamSpace*GetDevicePixelRatio();var textWidth=this.Canvas.measureText(text).width+space;//后空2个像素
@@ -7297,7 +7298,8 @@ if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
7297
7298
  if(!indexCustom){console.warn('[KLineChartContainer::CreateOverlayIndex] can not find index['+indexName+']');return null;}}}var subFrame=this.Frame.SubFrame[windowIndex];var overlayFrame=new OverlayIndexItem();if(obj.Identify)overlayFrame.Identify=obj.Identify;//由外部指定id
7298
7299
  //var frame= this.ClassName==='KLineChartHScreenContainer' ? new OverlayKLineHScreenFrame() : new OverlayKLineFrame();
7299
7300
  var frame=this.CreateOverlayFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GetEventCallback=function(id){return _this21.GetEventCallback(id);};if(obj.ShowRightText===true)frame.IsShow=true;else if(obj.ShowRightText===false)frame.IsShow=false;if(IFrameSplitOperator.IsBool(obj.ShowToolbar))frame.IsShowToolbar=obj.ShowToolbar;//废弃
7300
- if(IFrameSplitOperator.IsBool(obj.IsShareY))frame.IsShareY=obj.IsShareY;if(IFrameSplitOperator.IsBool(obj.IsShowIndexTitle))frame.IsShowIndexTitle=obj.IsShowIndexTitle;if(IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin))frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin;//是否计算Y最大最小值
7301
+ if(IFrameSplitOperator.IsBool(obj.IsShareY))frame.IsShareY=obj.IsShareY;//if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
7302
+ if(IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin))frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin;//是否计算Y最大最小值
7301
7303
  frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this21.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this21.GetKLineChart();};frame.YSplitOperator.OverlayIndex=overlayFrame;frame.YSplitOperator.HQChart=this;frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;if(obj.Frame){var item=obj.Frame;if(item.Custom)frame.YSplitOperator.Custom=item.Custom;if(IFrameSplitOperator.IsBool(item.IsYDrawMainFrame))frame.IsYDrawMainFrame=item.IsYDrawMainFrame;//自定义刻度绘制在主图上
7302
7304
  if(IFrameSplitOperator.IsBool(item.IsShowToolbar))frame.IsShowToolbar=item.IsShowToolbar;//是否显示工具栏
7303
7305
  }overlayFrame.Frame=frame;if(apiItem){var apiIndex=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,obj,true);apiIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
@@ -7344,9 +7346,9 @@ if(item.Script)//自定义指标脚本
7344
7346
  {var apiItem=item.API;this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,item);}else{var indexID=item.Index;var indexItem=JSIndexMap.Get(indexID);if(indexItem){this.WindowIndex[i]=indexItem.Create();this.CreateWindowIndex(windowIndex);}else{var systemScript=new JSIndexScript();var indexInfo=systemScript.Get(indexID);if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,item);this.WindowIndex[i]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
7345
7347
  }}}this.SetSubFrameAttribute(frame,item,frameItem);}//最后一个显示X轴坐标
7346
7348
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}//叠加指标
7347
- var aryOverlayIndex=[];if(IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex)){for(var i=0;i<option.OverlayIndex.length;++i){var item=option.OverlayIndex[i];if(item.Index)item.IndexName=item.Index;if(item.Windows>=0)item.WindowIndex=item.Windows;var overlay=this.CreateOverlayWindowsIndex(item);if(!overlay)continue;aryOverlayIndex.push(overlay);}}if(!bRefreshData){var bindData=this.ChartPaint[0].Data;for(var i=0;i<count;++i)//请求指标
7348
- {this.BindIndexData(i,bindData);}for(var i=0;i<aryOverlayIndex.length;++i){var item=aryOverlayIndex[i];this.BindOverlayIndexData(item,item.WindowIndex,bindData);}this.UpdataDataoffset();//更新数据偏移
7349
- this.Frame.SetSizeChage(true);this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
7349
+ var aryOverlayIndex=[];if(IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex)){for(var i=0;i<option.OverlayIndex.length;++i){var item=option.OverlayIndex[i];if(item.Index)item.IndexName=item.Index;if(item.Windows>=0)item.WindowIndex=item.Windows;var overlay=this.CreateOverlayWindowsIndex(item);if(!overlay)continue;aryOverlayIndex.push({WindowsIndex:item.WindowIndex,Overlay:overlay});}}this.Frame.SetSizeChage(true);if(!bRefreshData){var bindData=this.ChartPaint[0].Data;for(var i=0;i<count;++i)//请求指标
7350
+ {this.BindIndexData(i,bindData);}for(var i=0;i<aryOverlayIndex.length;++i){var item=aryOverlayIndex[i];this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);}this.UpdataDataoffset();//更新数据偏移
7351
+ this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
7350
7352
  this.Draw();}else{if(!symbol)symbol=this.Symbol;var optionData={KLine:{}};if(IFrameSplitOperator.IsNumber(period))optionData.KLine.Period=period;if(IFrameSplitOperator.IsNumber(right))optionData.KLine.Right=right;this.ChangeSymbol(symbol,optionData);}};this.RemoveIndexWindow=function(id,option){JSConsole.Chart.Log('[KLineChartContainer::RemoveIndexWindow] remove id',id);if(id==0){if(option&&option.DeleteMainIndex)//删除指标
7351
7353
  {this.DeleteIndexPaint(id);this.WindowIndex[id]=null;this.Frame.SetSizeChage(true);this.UpdateFrameMaxMin();this.ResetFrameXYSplit();this.Draw();}return;}if(!this.Frame.SubFrame)return;if(id>=this.Frame.SubFrame.length)return;this.Frame.RestoreIndexWindows();var delFrame=this.Frame.SubFrame[id].Frame;this.DeleteIndexPaint(id);this.Frame.SubFrame[id].Frame.ClearToolbar();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[id],WindowIndex:id};event.Callback(event,sendData,this);}this.Frame.SubFrame.splice(id,1);this.WindowIndex.splice(id,1);this.TitlePaint.splice(id+1,1);//删除对应的动态标题
7352
7354
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;item.Identify=i;}if(this.ChartDrawPicture.length>0){var aryDrawPicture=[];for(var i in this.ChartDrawPicture){var item=this.ChartDrawPicture[i];if(item.Frame==delFrame)continue;aryDrawPicture.push(item);}this.ChartDrawPicture=aryDrawPicture;}this.Frame.SetSizeChage(true);this.UpdateFrameMaxMin();this.ResetFrameXYSplit();this.Draw();};//获取当前的显示的指标
@@ -7811,7 +7813,7 @@ this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.C
7811
7813
  this.Frame=new HQTradeFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=25;this.Frame.ChartBorder.TitleHeight=0;this.Frame.ChartBorder.Left=50;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.Frame.GetExtendChartRightWidth=function(){return _this26.GetExtendChartRightWidth();};this.Frame.GetEventCallback=function(id){return _this26.GetEventCallback(id);};this.Frame.ZoomStartWindowIndex=2;this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
7812
7814
  this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
7813
7815
  if(this.EnableIndexChartDrag)this.CreateExtendChart("DragMovePaint");//子窗口动态标题
7814
- for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this26.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;if(this.ChartCorssCursor.CallAcutionXOperator)this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;var bRegisterKeydown=true;var bRegisterWheel=true;if(option&&option.Listener){var item=option.Listener;if(item.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');}if(item.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this26.OnKeyDown(e);},true);//键盘消息
7816
+ for(var i=0;i<this.Frame.SubFrame.length;++i){var titlePaint=new DynamicChartTitlePainting();if(i==0||i==1)titlePaint.IsShowMainIndexTitle=false;titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this26.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;if(this.ChartCorssCursor.CallAcutionXOperator)this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;var bRegisterKeydown=true;var bRegisterWheel=true;if(option&&option.Listener){var item=option.Listener;if(item.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');}if(item.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this26.OnKeyDown(e);},true);//键盘消息
7815
7817
  if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this26.OnWheel(e);},true);//上下滚动消息
7816
7818
  };//创建子窗口
7817
7819
  this.CreateChildWindow=function(windowCount){var _this27=this;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=new MinuteFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;frame.GlobalOption=this.GlobalOption;if(i<2)frame.ChartBorder.TitleHeight=0;frame.XPointCount=243;if(i>=2){if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
@@ -7856,16 +7858,18 @@ for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Fr
7856
7858
  this.Draw();};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标, 只能从第3个指标窗口开始设置,前面2个指标窗口固定无法设置
7857
7859
  {var _this32=this;if(!Array.isArray(option.Windows))return;var count=option.Windows.length;var currentLength=this.Frame.SubFrame.length;var startWindowIndex=2;count+=startWindowIndex;var dayCount=null;if(IFrameSplitOperator.IsNumber(option.DayCount)&&option.DayCount!=this.DayCount)dayCount=option.DayCount;//天数
7858
7860
  var bRefreshData=dayCount!=null;//清空所有的指标图型
7859
- for(var i=startWindowIndex;i<currentLength;++i){this.DeleteIndexPaint(i);var frame=this.Frame.SubFrame[i];frame.YSpecificMaxMin=null;frame.IsLocked=false;frame.YSplitScale=null;}if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.Frame.SubFrame[i].Frame.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);}else{for(var i=currentLength;i<count;++i)//创建新的指标窗口
7861
+ for(var i=startWindowIndex;i<currentLength;++i){this.DeleteIndexPaint(i);var frame=this.Frame.SubFrame[i];frame.YSpecificMaxMin=null;frame.IsLocked=false;frame.YSplitScale=null;}if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.Frame.SubFrame[i].Frame.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);this.TitlePaint.splice(count+1,currentLength-count);}else{for(var i=currentLength;i<count;++i)//创建新的指标窗口
7860
7862
  {var subFrame=this.CreateSubFrameItem(i);this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this32.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}}for(var i=0;i<count;++i){var windowIndex=i;var item=null,frameItem=null;if(option.Frame&&option.Frame.length>i)frameItem=option.Frame[windowIndex];if(windowIndex>=startWindowIndex)item=option.Windows[windowIndex-startWindowIndex];var titleIndex=windowIndex+1;this.TitlePaint[titleIndex].Data=[];this.TitlePaint[titleIndex].Title=null;if(item){if(item.Script)//自定义指标脚本
7861
7863
  {this.WindowIndex[windowIndex]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
7862
7864
  }else if(item.API)//后台指标
7863
7865
  {var apiItem=item.API;this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,item);}else{var indexID=item.Index;var indexItem=JSIndexMap.Get(indexID);if(indexItem){this.WindowIndex[windowIndex]=indexItem.Create();this.CreateWindowIndex(windowIndex);}else{var systemScript=new JSIndexScript();var indexInfo=systemScript.Get(indexID);if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,item);this.WindowIndex[windowIndex]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
7864
- }}}}this.SetSubFrameAttribute(this.Frame.SubFrame[windowIndex],item,frameItem);}//最后一个显示X轴坐标
7865
- for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}if(!bRefreshData){var bindData=this.SourceData;for(var i=0;i<count;++i){this.BindIndexData(i,bindData);//执行脚本
7866
- }this.UpdataDataoffset();//更新数据偏移
7867
- this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
7868
- this.Draw();}else{this.Frame.SetSizeChage(true);if(dayCount!=null)this.ChangeDayCount(dayCount);}};this.RemoveIndexWindow=function(id){JSConsole.Chart.Log('[MinuteChartContainer::RemoveIndexWindow] remove id',id);if(id<2)return;if(!this.Frame.SubFrame)return;if(id>=this.Frame.SubFrame.length)return;this.Frame.RestoreIndexWindows();var delFrame=this.Frame.SubFrame[id].Frame;this.DeleteIndexPaint(id);this.Frame.SubFrame[id].Frame.ClearToolbar();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[id],WindowIndex:id};event.Callback(event,sendData,this);}this.Frame.SubFrame.splice(id,1);this.WindowIndex.splice(id,1);this.TitlePaint.splice(id+1,1);//删除对应的动态标题
7866
+ }}}}this.SetSubFrameAttribute(this.Frame.SubFrame[windowIndex],item,frameItem);}//清空叠加指标
7867
+ for(var i=0;i<this.Frame.SubFrame.length;++i){this.DeleteWindowsOverlayIndex(i);}//最后一个显示X轴坐标
7868
+ for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}//叠加指标
7869
+ var aryOverlayIndex=[];if(IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex)){for(var i=0;i<option.OverlayIndex.length;++i){var item=option.OverlayIndex[i];if(item.Index)item.IndexName=item.Index;if(item.Windows>=0)item.WindowIndex=item.Windows;var overlay=this.CreateOverlayWindowsIndex(item);if(!overlay)continue;aryOverlayIndex.push({WindowsIndex:item.WindowIndex,Overlay:overlay});}}this.Frame.SetSizeChage(true);if(!bRefreshData){var bindData=this.SourceData;for(var i=0;i<count;++i){this.BindIndexData(i,bindData);//执行脚本
7870
+ }for(var i=0;i<aryOverlayIndex.length;++i){var item=aryOverlayIndex[i];this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);}this.UpdataDataoffset();//更新数据偏移
7871
+ if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
7872
+ this.Draw();}else{if(dayCount!=null)this.ChangeDayCount(dayCount);}};this.RemoveIndexWindow=function(id){JSConsole.Chart.Log('[MinuteChartContainer::RemoveIndexWindow] remove id',id);if(id<2)return;if(!this.Frame.SubFrame)return;if(id>=this.Frame.SubFrame.length)return;this.Frame.RestoreIndexWindows();var delFrame=this.Frame.SubFrame[id].Frame;this.DeleteIndexPaint(id);this.Frame.SubFrame[id].Frame.ClearToolbar();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[id],WindowIndex:id};event.Callback(event,sendData,this);}this.Frame.SubFrame.splice(id,1);this.WindowIndex.splice(id,1);this.TitlePaint.splice(id+1,1);//删除对应的动态标题
7869
7873
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;item.Identify=i;}/*
7870
7874
  if (this.ChartDrawPicture.length>0)
7871
7875
  {
@@ -11378,7 +11382,8 @@ this.Add=function(name,option){this.DataMap.set(name,{MinuteFittingCallback:opti
11378
11382
  function ScriptIndex(name,script,args,option){this.newMethod=BaseIndex;//派生
11379
11383
  this.newMethod(name);delete this.newMethod;this.ClassName="ScriptIndex";this.Script=script;this.Arguments=[];this.OutVar=[];this.ID;//指标ID
11380
11384
  this.FloatPrecision=2;//小数位数
11381
- this.StringFormat;this.KLineType=null;//K线显示类型
11385
+ this.StringFormat;this.IsShowIndexTitle=true;//是否显示指标标题
11386
+ this.KLineType=null;//K线显示类型
11382
11387
  this.InstructionType;//五彩K线, 交易指标
11383
11388
  this.YSpecificMaxMin=null;//最大最小值
11384
11389
  this.YSplitScale=null;//固定刻度
@@ -11397,7 +11402,7 @@ this.IsSync=false;//是否是同步计算 (无数据请求)
11397
11402
  this.IsShow=true;//是否显示图形
11398
11403
  this.RunCount=0;//已执行次数
11399
11404
  this.MaxRunCount=-1;//最大执行次数 -1=无限
11400
- if(option){if(option.FloatPrecision>=0)this.FloatPrecision=option.FloatPrecision;if(option.StringFormat>0)this.StringFormat=option.StringFormat;if(option.ID)this.ID=option.ID;if(option.KLineType>=0||option.KLineType===-1)this.KLineType=option.KLineType;if(option.InstructionType)this.InstructionType=option.InstructionType;if(option.YSpecificMaxMin)this.YSpecificMaxMin=option.YSpecificMaxMin;if(option.YSplitScale)this.YSplitScale=option.YSplitScale;if(option.Condition)this.Condition=option.Condition;if(option.TitleFont)this.TitleFont=option.TitleFont;if(option.IsShortTitle)this.IsShortTitle=option.IsShortTitle;if(option.OutName)this.OutName=option.OutName;if(IFrameSplitOperator.IsNumber(option.YSplitType))this.YSplitType=option.YSplitType;if(IFrameSplitOperator.IsBool(option.IsSync))this.IsSync=option.IsSync;if(IFrameSplitOperator.IsNumber(option.MaxRunCount))this.MaxRunCount=option.MaxRunCount;if(option.Debug){if(IFrameSplitOperator.IsPlusNumber(option.Debug.Count)&&option.Debug.Callback){this.Debug={Count:option.Debug.Count,Callback:option.Debug.Callback};}}}if(option&&option.Lock){if(option.Lock.IsLocked==true)this.IsLocked=true;//指标上锁
11405
+ if(option){if(option.FloatPrecision>=0)this.FloatPrecision=option.FloatPrecision;if(option.StringFormat>0)this.StringFormat=option.StringFormat;if(IFrameSplitOperator.IsBool(option.IsShowIndexTitle))this.IsShowIndexTitle=option.IsShowIndexTitle;if(option.ID)this.ID=option.ID;if(option.KLineType>=0||option.KLineType===-1)this.KLineType=option.KLineType;if(option.InstructionType)this.InstructionType=option.InstructionType;if(option.YSpecificMaxMin)this.YSpecificMaxMin=option.YSpecificMaxMin;if(option.YSplitScale)this.YSplitScale=option.YSplitScale;if(option.Condition)this.Condition=option.Condition;if(option.TitleFont)this.TitleFont=option.TitleFont;if(option.IsShortTitle)this.IsShortTitle=option.IsShortTitle;if(option.OutName)this.OutName=option.OutName;if(IFrameSplitOperator.IsNumber(option.YSplitType))this.YSplitType=option.YSplitType;if(IFrameSplitOperator.IsBool(option.IsSync))this.IsSync=option.IsSync;if(IFrameSplitOperator.IsNumber(option.MaxRunCount))this.MaxRunCount=option.MaxRunCount;if(option.Debug){if(IFrameSplitOperator.IsPlusNumber(option.Debug.Count)&&option.Debug.Callback){this.Debug={Count:option.Debug.Count,Callback:option.Debug.Callback};}}}if(option&&option.Lock){if(option.Lock.IsLocked==true)this.IsLocked=true;//指标上锁
11401
11406
  if(option.Lock.Callback)this.LockCallback=option.Lock.Callback;//锁回调
11402
11407
  if(option.Lock.ID)this.LockID=option.Lock.ID;//锁ID
11403
11408
  if(option.Lock.BG)this.LockBG=option.Lock.BG;if(option.Lock.TextColor)this.LockTextColor=option.Lock.TextColor;if(option.Lock.Text)this.LockText=option.Lock.Text;if(option.Lock.Font)this.LockFont=option.Lock.Font;if(option.Lock.Count)this.LockCount=option.Lock.Count;if(option.Lock.MinWidth)this.LockMinWidth=option.Lock.MinWidth*GetDevicePixelRatio();}if(option&&option.YAxis){this.YAxis={};if(IFrameSplitOperator.IsNumber(option.YAxis.FloatPrecision))this.YAxis.FloatPrecision=option.YAxis.FloatPrecision;if(IFrameSplitOperator.IsNumber(option.YAxis.StringFormat))this.YAxis.StringFormat=option.YAxis.StringFormat;if(IFrameSplitOperator.IsBool(option.YAxis.EnableRemoveZero))this.YAxis.EnableRemoveZero=option.YAxis.EnableRemoveZero;}if(args)this.Arguments=args;this.CopyTo=function(dest)//赋值到新实例出来
@@ -11506,12 +11511,12 @@ if(this.YSplitScale)hqChart.Frame.SubFrame[windowIndex].Frame.YSplitScale=this.Y
11506
11511
  var testData={ Name:'MULTI_LINE', Type:1,Draw:{ DrawType:'MULTI_LINE', DrawData:[point1,point2] } };
11507
11512
  this.OutVar.push(testData);
11508
11513
  }
11509
- */for(var _i136 in this.OutVar){var _item27=this.OutVar[_i136];if(_item27.IsExData===true)continue;//扩展数据不显示图形
11514
+ */for(var _i136=0;_i136<this.OutVar.length;++_i136){var _item27=this.OutVar[_i136];if(_item27.IsExData===true)continue;//扩展数据不显示图形
11510
11515
  if(_item27.Type==1000||_item27.Type==1001)continue;//数据集合, 字符串
11511
11516
  if(_item27.Type==0){if(_item27.IsOverlayLine)this.CreateOverlayLine(hqChart,windowIndex,_item27,_i136,_item27.Type);else this.CreateLine(hqChart,windowIndex,_item27,_i136,_item27.Type);}else if(_item27.Type==1){switch(_item27.Draw.DrawType){case'STICKLINE':this.CreateBar(hqChart,windowIndex,_item27,_i136);break;case'DRAWTEXT':this.CreateDrawTextV2(hqChart,windowIndex,_item27,_i136);break;case'SUPERDRAWTEXT':this.CreateText(hqChart,windowIndex,_item27,_i136);break;case'DRAWLINE':this.CreateStraightLine(hqChart,windowIndex,_item27,_i136);break;case'DRAWBAND':this.CreateBand(hqChart,windowIndex,_item27,_i136);break;case"FILLRGN":this.CreateFillRGN(hqChart,windowIndex,_item27,_i136);break;case"FILLRGN2":this.CreateFillRGN2(hqChart,windowIndex,_item27,_i136);break;case"FILLTOPRGN":case"FILLBOTTOMRGN":case"FILLVERTICALRGN":this.CreateFillBGRGN(hqChart,windowIndex,_item27,_i136);break;case"FLOATRGN":this.CreateFLOATRGN(hqChart,windowIndex,_item27,_i136);break;case'DRAWKLINE':case"DRAWKLINE1":this.CreateKLine(hqChart,windowIndex,_item27,_i136);break;case"DRAWOVERLAYKLINE":this.CreateOverlayKLine(hqChart,windowIndex,_item27,_i136);break;case"DRAWCOLORKLINE":this.CreateDrawColorKLine(hqChart,windowIndex,_item27,_i136);break;case'DRAWKLINE_IF':this.CreateKLine(hqChart,windowIndex,_item27,_i136);break;case'POLYLINE':this.CreatePolyLine(hqChart,windowIndex,_item27,_i136);break;case'DRAWGBK':case"DRAWGBK2":this.CreateBackgroud(hqChart,windowIndex,_item27,_i136);break;case"DRAWGBK_DIV":this.CreateBackgroundDiv(hqChart,windowIndex,_item27,_i136);break;case'DRAWTEXT_LINE':this.CreateTextLine(hqChart,windowIndex,_item27,_i136);break;case'DRAWNUMBER':this.CreateDrawNumber(hqChart,windowIndex,_item27,_i136);break;case"DRAWNUMBER_FIX":case'DRAWTEXT_FIX':this.CreateNumberText(hqChart,windowIndex,_item27,_i136);break;case'DRAWICON':this.CreateIcon(hqChart,windowIndex,_item27,_i136);break;case"ICON":this.CreateIcon(hqChart,windowIndex,_item27,_i136);break;case"TIPICON":this.CreateTipIcon(hqChart,windowIndex,_item27,_i136);break;case'DRAWCHANNEL':this.CreateChannel(hqChart,windowIndex,_item27,_i136);break;case'PARTLINE':this.CreatePartLine(hqChart,windowIndex,_item27,_i136);break;case'DRAWRECTREL':this.CreateRectangle(hqChart,windowIndex,_item27,_i136);break;case"DRAWTEXTABS":case"DRAWTEXTREL":this.CreateDrawText(hqChart,windowIndex,_item27,_i136);break;case"DRAWOVERLAYLINE":this.CreateScriptOverlayLine(hqChart,windowIndex,_item27,_i136);break;case"DRAWSL":this.CreateChartSlopeLine(hqChart,windowIndex,_item27,_i136);break;case"VERTLINE":this.CreateChartVericaltLine(hqChart,windowIndex,_item27,_i136);break;case"HORLINE":this.CreateChartHorizontalLine(hqChart,windowIndex,_item27,_i136);break;case'MULTI_LINE':this.CreateMultiLine(hqChart,windowIndex,_item27,_i136);break;case"MULTI_POINT":this.CreateMultiPoint(hqChart,windowIndex,_item27,_i136);break;case'MULTI_BAR':this.CreateMultiBar(hqChart,windowIndex,_item27,_i136);break;case'MULTI_TEXT':this.CreateMultiText(hqChart,windowIndex,_item27,_i136);break;case'MULTI_SVGICON':this.CreateMultiSVGIcon(hqChart,windowIndex,_item27,_i136);break;case"DRAWSVG":this.CreateChartDrawSVG(hqChart,windowIndex,_item27,_i136);break;case"MULTI_HTMLDOM":this.CreateMulitHtmlDom(hqChart,windowIndex,_item27,_i136);break;case"COLOR_KLINE":this.CreateColorKLine(hqChart,windowIndex,_item27,_i136);break;case"KLINE_BG":this.CreateBackgroud(hqChart,windowIndex,_item27,_i136);break;case"MULTI_POINT_LINE":this.CreateLineMultiData(hqChart,windowIndex,_item27,_i136);break;case"BUY":case"SELL":case"SELLSHORT":case"BUYSHORT":this.CreateTradeIcon(hqChart,windowIndex,_item27,_i136);break;case SCRIPT_CHART_NAME.OVERLAY_BARS:this.CreateStackedBar(hqChart,windowIndex,_item27,_i136);break;case SCRIPT_CHART_NAME.KLINE_TABLE:this.CreateKLineTable(hqChart,windowIndex,_item27,_i136);break;case SCRIPT_CHART_NAME.SCATTER_PLOT:this.CreateScatterPlot(hqChart,windowIndex,_item27,_i136);break;default:{var find=g_ScriptIndexChartFactory.Get(_item27.Draw.DrawType);//外部挂接
11512
11517
  if(find&&find.CreateChartCallback)find.CreateChartCallback(hqChart,windowIndex,_item27,_i136,this);}break;}}else if(_item27.Type==2){this.CreateMACD(hqChart,windowIndex,_item27,_i136);}else if(_item27.Type==3){this.CreatePointDot(hqChart,windowIndex,_item27,_i136,hisData);}else if(_item27.Type==4){this.CreateLineStick(hqChart,windowIndex,_item27,_i136);}else if(_item27.Type==5){this.CreateStick(hqChart,windowIndex,_item27,_i136);}else if(_item27.Type==6){this.CreateVolStick(hqChart,windowIndex,_item27,_i136,hisData);}else if(_item27.Type==7){this.CreateLine(hqChart,windowIndex,_item27,_i136,_item27.Type);}else if(_item27.Type==8){this.CreateLine(hqChart,windowIndex,_item27,_i136,_item27.Type);}else if(_item27.Type==9){this.CreateArea(hqChart,windowIndex,_item27,_i136);}var titlePaint=hqChart.TitlePaint[windowIndex+1];if(titlePaint&&titlePaint.Data&&_i136<titlePaint.Data.length)//设置标题数值 小数位数和格式
11513
- {if(this.StringFormat>0)titlePaint.Data[_i136].StringFormat=this.StringFormat;if(this.FloatPrecision>=0)titlePaint.Data[_i136].FloatPrecision=this.FloatPrecision;if(this.OutName&&this.OutName.length>0&&this.Arguments&&this.Arguments.length>0){titlePaint.SetDynamicTitle(this.OutName,this.Arguments);}}}var titleIndex=windowIndex+1;hqChart.TitlePaint[titleIndex].Title=this.Name;hqChart.TitlePaint[titleIndex].Identify=this.Guid;//指标ID
11514
- hqChart.TitlePaint[titleIndex].ArgumentsText=null;hqChart.TitlePaint[titleIndex].Script=this;if(!this.IsShortTitle){var indexParam='';for(var _i137=0;_i137<this.Arguments.length;++_i137){var _item28=this.Arguments[_i137];if(indexParam.length>0)indexParam+=',';indexParam+=_item28.Value.toString();}if(indexParam.length>0)hqChart.TitlePaint[titleIndex].ArgumentsText='('+indexParam+')';}if(this.TitleFont)hqChart.TitlePaint[titleIndex].Font=this.TitleFont;return true;};//给一个默认的颜色
11518
+ {if(this.StringFormat>0)titlePaint.Data[_i136].StringFormat=this.StringFormat;if(this.FloatPrecision>=0)titlePaint.Data[_i136].FloatPrecision=this.FloatPrecision;if(this.OutName&&this.OutName.length>0&&this.Arguments&&this.Arguments.length>0){titlePaint.SetDynamicTitle(this.OutName,this.Arguments);}}}var titleIndex=windowIndex+1;var titlePaint=hqChart.TitlePaint[titleIndex];titlePaint.Title=this.Name;titlePaint.Identify=this.Guid;//指标ID
11519
+ titlePaint.ArgumentsText=null;titlePaint.Script=this;titlePaint.IsShowMainIndexTitle=this.IsShowIndexTitle;if(!this.IsShortTitle){var indexParam='';for(var _i137=0;_i137<this.Arguments.length;++_i137){var _item28=this.Arguments[_i137];if(indexParam.length>0)indexParam+=',';indexParam+=_item28.Value.toString();}if(indexParam.length>0)titlePaint.ArgumentsText='('+indexParam+')';}if(this.TitleFont)titlePaint.Font=this.TitleFont;return true;};//给一个默认的颜色
11515
11520
  this.GetDefaultColor=function(id){var COLOR_ARRAY=null;//使用全局线段配置
11516
11521
  if(g_JSChartResource&&g_JSChartResource.Index&&g_JSChartResource.Index.LineColor){COLOR_ARRAY=g_JSChartResource.Index.LineColor;}if(!COLOR_ARRAY||!Array.isArray(COLOR_ARRAY)){COLOR_ARRAY=["rgb(255,174,0)","rgb(25,199,255)","rgb(175,95,162)","rgb(236,105,65)","rgb(68,114,196)","rgb(229,0,79)","rgb(0,128,255)","rgb(252,96,154)","rgb(42,230,215)","rgb(24,71,178)"];}var number=parseInt(id);return COLOR_ARRAY[number%(COLOR_ARRAY.length-1)];};//获取颜色
11517
11522
  this.GetColor=function(colorName){if(colorName.indexOf("RGB(")==0)return colorName.toLowerCase();if(colorName.indexOf("rgb(")==0)return colorName;if(colorName.indexOf("RGBA(")==0)return colorName.toLowerCase();if(colorName.indexOf("rgba(")==0)return colorName;var color=JSComplier.ColorVarToRGB(colorName);if(color)return color;return'rgb(30,144,255)';/*
@@ -11548,7 +11553,7 @@ this.OverlayIndex=null;// { IsOverlay:true, Identify:overlayFrame.Identify, Wind
11548
11553
  //显示指标不符合条件
11549
11554
  this.ShowConditionError=function(param,msg){var hqChart=param.HQChart;var windowIndex=param.WindowIndex;var message='指标不支持当前品种或周期';if(msg)message=msg;var overlayIndex=this.OverlayIndex;var frame=overlayIndex.Frame;frame.ChartPaint=[];var chart=new ChartLine();chart.Canvas=hqChart.Canvas;chart.ChartBorder=frame.Frame.ChartBorder;chart.ChartFrame=frame.Frame;chart.Identify=overlayIndex.Identify;chart.NotSupportMessage=message;frame.ChartPaint.push(chart);hqChart.Draw();};this.BindData=function(hqChart,windowIndex,hisData){if(!this.OverlayIndex||this.OverlayIndex.IsOverlay!=true)return;this.OverlayIndex.Frame.ChartPaint=[];if(!IFrameSplitOperator.IsNonEmptyArray(this.OutVar))return;//修改Y轴分割方式
11550
11555
  var ySpliter=this.OverlayIndex.Frame.Frame.YSplitOperator;if(ySpliter){ySpliter.Reset();ySpliter.FloatPrecision=this.FloatPrecision;if(IFrameSplitOperator.IsNumber(this.YSplitType))ySpliter.SplitType=this.YSplitType;if(this.YAxis)ySpliter.SetOption(this.YAxis);}//指标名字
11551
- var titleInfo={Data:[],Title:this.Name,Frame:this.OverlayIndex.Frame.Frame,Script:this};var indexParam='';for(var i in this.Arguments){var _item29=this.Arguments[i];if(indexParam.length>0)indexParam+=',';indexParam+=_item29.Value.toString();}if(indexParam.length>0)titleInfo.Title=this.Name+'('+indexParam+')';var titleIndex=windowIndex+1;var titlePaint=hqChart.TitlePaint[titleIndex];titlePaint.OverlayIndex.set(this.OverlayIndex.Identify,titleInfo);if(this.OutName&&this.OutName.length>0&&this.Arguments&&this.Arguments.length>0){titlePaint.SetDynamicTitle(this.OutName,this.Arguments,this.OverlayIndex.Identify);}this.OverlayIndex.Frame.Frame.Title=this.Name;//给子框架设置标题
11556
+ var titleInfo={Data:[],Title:this.Name,Frame:this.OverlayIndex.Frame.Frame,Script:this,IsShowIndexTitle:this.IsShowIndexTitle};var indexParam='';for(var i in this.Arguments){var _item29=this.Arguments[i];if(indexParam.length>0)indexParam+=',';indexParam+=_item29.Value.toString();}if(indexParam.length>0)titleInfo.Title=this.Name+'('+indexParam+')';var titleIndex=windowIndex+1;var titlePaint=hqChart.TitlePaint[titleIndex];titlePaint.OverlayIndex.set(this.OverlayIndex.Identify,titleInfo);if(this.OutName&&this.OutName.length>0&&this.Arguments&&this.Arguments.length>0){titlePaint.SetDynamicTitle(this.OutName,this.Arguments,this.OverlayIndex.Identify);}this.OverlayIndex.Frame.Frame.Title=this.Name;//给子框架设置标题
11552
11557
  if(hqChart.Frame.SubFrame[windowIndex]){var mainFrame=hqChart.Frame.SubFrame[windowIndex].Frame;if(mainFrame)this.OverlayIndex.Frame.Frame.XPointCount=mainFrame.XPointCount;//跟主窗口同步下页面显示数据个数
11553
11558
  }for(var i=0;i<this.OutVar.length;++i){var _item30=this.OutVar[i];if(_item30.IsExData===true)continue;//扩展数据不显示图形
11554
11559
  if(_item30.Type==0){this.CreateLine(hqChart,windowIndex,_item30,i,_item30.Type);}else if(_item30.Type==1){switch(_item30.Draw.DrawType){case'STICKLINE':this.CreateBar(hqChart,windowIndex,_item30,i);break;case'DRAWTEXT':this.CreateDrawTextV2(hqChart,windowIndex,_item30,i);break;case'SUPERDRAWTEXT':this.CreateText(hqChart,windowIndex,_item30,i);break;case'DRAWLINE':this.CreateStraightLine(hqChart,windowIndex,_item30,i);break;case'DRAWBAND':this.CreateBand(hqChart,windowIndex,_item30,i);break;case'DRAWKLINE':this.CreateKLine(hqChart,windowIndex,_item30,i);break;case'DRAWKLINE_IF':this.CreateKLine(hqChart,windowIndex,_item30,i);break;case'POLYLINE':this.CreatePolyLine(hqChart,windowIndex,_item30,i);break;case'DRAWGBK':case"DRAWGBK2":this.CreateBackgroud(hqChart,windowIndex,_item30,i);break;case'DRAWNUMBER':case"DRAWNUMBER_FIX":case'DRAWTEXT_FIX':this.CreateNumberText(hqChart,windowIndex,_item30,i);break;case'DRAWICON':this.CreateIcon(hqChart,windowIndex,_item30,i);break;case"TIPICON":this.CreateTipIcon(hqChart,windowIndex,_item30,i);break;case'DRAWCHANNEL':this.CreateChannel(hqChart,windowIndex,_item30,i);break;case'DRAWTEXT_LINE':this.CreateTextLine(hqChart,windowIndex,_item30,i);break;case"VERTLINE":this.CreateChartVericaltLine(hqChart,windowIndex,_item30,i);break;case"HORLINE":this.CreateChartHorizontalLine(hqChart,windowIndex,_item30,i);break;case'MULTI_LINE':this.CreateMultiLine(hqChart,windowIndex,_item30,i);break;case"MULTI_POINT":this.CreateMultiPoint(hqChart,windowIndex,_item30,i);break;case'MULTI_BAR':this.CreateMultiBar(hqChart,windowIndex,_item30,i);break;case'MULTI_TEXT':this.CreateMultiText(hqChart,windowIndex,_item30,i);break;case'MULTI_SVGICON':this.CreateMultiSVGIcon(hqChart,windowIndex,_item30,i);break;case"DRAWSVG":this.CreateChartDrawSVG(hqChart,windowIndex,_item30,i);break;case"MULTI_HTMLDOM":this.CreateMulitHtmlDom(hqChart,windowIndex,_item30,i);break;case"KLINE_BG":this.CreateBackgroud(hqChart,windowIndex,_item30,i);break;case'PARTLINE':this.CreatePartLine(hqChart,windowIndex,_item30,i);break;case"DRAWTEXTABS":case"DRAWTEXTREL":this.CreateDrawText(hqChart,windowIndex,_item30,i);break;case SCRIPT_CHART_NAME.OVERLAY_BARS:this.CreateStackedBar(hqChart,windowIndex,_item30,i);break;default:{var find=g_ScriptIndexChartFactory.Get(_item30.Draw.DrawType);//外部挂接
@@ -12808,7 +12813,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
12808
12813
  this.ExecuteScript(item,data);}this.Status=0;}};this.OnExecuteFinish=function(data,indexInfo,jsExectute,jobInfo){var message={Data:data,IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.FINISH_EXECUTE_SCRIPT,JobInfo:jobInfo};postMessage(message);};this.OnExecuteError=function(error,indexInfo,jobData){var message={IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.ERROR_EXECUTE_SCRIPT,Error:error};postMessage(message);};}/********************************************************************************
12809
12814
  * 版本信息输出
12810
12815
  *
12811
- */var HQCHART_VERSION="1.1.12938";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
12816
+ */var HQCHART_VERSION="1.1.12950";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
12812
12817
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12813
12818
  // BaseIndex:BaseIndex,
12814
12819
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.12939",
3
+ "version": "1.1.12951",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -19539,6 +19539,7 @@ function ScriptIndex(name,script,args,option)
19539
19539
  this.ID; //指标ID
19540
19540
  this.FloatPrecision=2; //小数位数
19541
19541
  this.StringFormat;
19542
+ this.IsShowIndexTitle=true; //是否显示指标标题
19542
19543
  this.KLineType=null; //K线显示类型
19543
19544
  this.InstructionType; //五彩K线, 交易指标
19544
19545
  this.YSpecificMaxMin=null; //最大最小值
@@ -19576,6 +19577,7 @@ function ScriptIndex(name,script,args,option)
19576
19577
  {
19577
19578
  if (option.FloatPrecision>=0) this.FloatPrecision=option.FloatPrecision;
19578
19579
  if (option.StringFormat>0) this.StringFormat=option.StringFormat;
19580
+ if (IFrameSplitOperator.IsBool(option.IsShowIndexTitle)) this.IsShowIndexTitle=option.IsShowIndexTitle;
19579
19581
  if (option.ID) this.ID=option.ID;
19580
19582
  if (option.KLineType>=0 || option.KLineType===-1) this.KLineType=option.KLineType;
19581
19583
  if (option.InstructionType) this.InstructionType=option.InstructionType;
@@ -21322,7 +21324,7 @@ function ScriptIndex(name,script,args,option)
21322
21324
  }
21323
21325
  */
21324
21326
 
21325
- for(let i in this.OutVar)
21327
+ for(let i=0; i<this.OutVar.length; ++i)
21326
21328
  {
21327
21329
  let item=this.OutVar[i];
21328
21330
  if (item.IsExData===true) continue; //扩展数据不显示图形
@@ -21535,11 +21537,13 @@ function ScriptIndex(name,script,args,option)
21535
21537
  }
21536
21538
 
21537
21539
  let titleIndex=windowIndex+1;
21538
- hqChart.TitlePaint[titleIndex].Title=this.Name;
21539
- hqChart.TitlePaint[titleIndex].Identify=this.Guid; //指标ID
21540
- hqChart.TitlePaint[titleIndex].ArgumentsText=null;
21541
- hqChart.TitlePaint[titleIndex].Script=this;
21542
-
21540
+ var titlePaint=hqChart.TitlePaint[titleIndex];
21541
+ titlePaint.Title=this.Name;
21542
+ titlePaint.Identify=this.Guid; //指标ID
21543
+ titlePaint.ArgumentsText=null;
21544
+ titlePaint.Script=this;
21545
+ titlePaint.IsShowMainIndexTitle=this.IsShowIndexTitle;
21546
+
21543
21547
  if (!this.IsShortTitle)
21544
21548
  {
21545
21549
  let indexParam='';
@@ -21550,10 +21554,10 @@ function ScriptIndex(name,script,args,option)
21550
21554
  indexParam+=item.Value.toString();
21551
21555
  }
21552
21556
 
21553
- if (indexParam.length>0) hqChart.TitlePaint[titleIndex].ArgumentsText=`(${indexParam})`;
21557
+ if (indexParam.length>0) titlePaint.ArgumentsText=`(${indexParam})`;
21554
21558
  }
21555
21559
 
21556
- if (this.TitleFont) hqChart.TitlePaint[titleIndex].Font=this.TitleFont;
21560
+ if (this.TitleFont) titlePaint.Font=this.TitleFont;
21557
21561
 
21558
21562
  return true;
21559
21563
  }
@@ -21687,7 +21691,7 @@ function OverlayScriptIndex(name,script,args,option)
21687
21691
  }
21688
21692
 
21689
21693
  //指标名字
21690
- var titleInfo={ Data:[], Title:this.Name, Frame:this.OverlayIndex.Frame.Frame, Script:this };
21694
+ var titleInfo={ Data:[], Title:this.Name, Frame:this.OverlayIndex.Frame.Frame, Script:this, IsShowIndexTitle:this.IsShowIndexTitle };
21691
21695
  let indexParam='';
21692
21696
  for(var i in this.Arguments)
21693
21697
  {
@@ -181,6 +181,7 @@ JSIndexScript.ModifyAttribute=function(indexInfo, attribute)
181
181
  if (attribute.TitleFont) indexInfo.TitleFont=attribute.TitleFont;
182
182
  if (attribute.Lock) indexInfo.Lock=attribute.Lock;
183
183
  if (IFrameSplitOperator.IsNumber(attribute.YSplitType)) indexInfo.YSplitType=attribute.YSplitType;
184
+ if (IFrameSplitOperator.IsBool(attribute.IsShowIndexTitle)) indexInfo.IsShowIndexTitle=attribute.IsShowIndexTitle;
184
185
 
185
186
  if (attribute.YAxis)
186
187
  {
@@ -50293,6 +50293,8 @@ function DynamicChartTitlePainting()
50293
50293
  this.DynamicTitle={ OutName:null, OutValue:null };
50294
50294
  this.OverlayDynamicTitle=new Map(); //key , value={ OutName, OutValue }
50295
50295
 
50296
+ this.IsShowMainIndexTitle=true; //是否显示主图指标标题
50297
+
50296
50298
  this.ReloadResource=function()
50297
50299
  {
50298
50300
  this.Font=g_JSChartResource.TitleFont;
@@ -50756,7 +50758,7 @@ function DynamicChartTitlePainting()
50756
50758
  this.Canvas.textBaseline="middle";
50757
50759
  this.Canvas.font=this.Font;
50758
50760
  var pixelRatio=GetDevicePixelRatio();
50759
- if (this.Title && this.IsShowIndexName)
50761
+ if (this.Title && this.IsShowIndexName && this.IsShowMainIndexTitle)
50760
50762
  {
50761
50763
  if (this.IsDrawTitleBG)
50762
50764
  {
@@ -50785,7 +50787,7 @@ function DynamicChartTitlePainting()
50785
50787
  }
50786
50788
  }
50787
50789
 
50788
- if (this.ArgumentsText && this.IsShowIndexName)
50790
+ if (this.ArgumentsText && this.IsShowIndexName && this.IsShowMainIndexTitle)
50789
50791
  {
50790
50792
  var textWidth=this.Canvas.measureText(this.ArgumentsText).width+2;
50791
50793
  this.Canvas.fillStyle=this.TitleColor;
@@ -50805,7 +50807,7 @@ function DynamicChartTitlePainting()
50805
50807
  if (isShowLastData) return;
50806
50808
  }
50807
50809
 
50808
- for(var i=0; i<this.Data.length; ++i)
50810
+ for(var i=0; i<this.Data.length && this.IsShowMainIndexTitle; ++i)
50809
50811
  {
50810
50812
  var item=this.Data[i];
50811
50813
  var outText=this.GetTitleItem(item, isShowLastData, i);
@@ -50904,7 +50906,9 @@ function DynamicChartTitlePainting()
50904
50906
  }
50905
50907
  else
50906
50908
  {
50907
- this.DrawOverlayIndex(left+10*GetDevicePixelRatio()); //间距多空点 和主指标区分开
50909
+ var xOffset=10*GetDevicePixelRatio(); //主指标区分开 间距多空点
50910
+ if (!this.IsShowMainIndexTitle) xOffset=0;
50911
+ this.DrawOverlayIndex(left+xOffset);
50908
50912
  }
50909
50913
  }
50910
50914
 
@@ -51094,6 +51098,7 @@ function DynamicChartTitlePainting()
51094
51098
  else
51095
51099
  {
51096
51100
  var top=border.TopTitle+2*pixelRatio;
51101
+ if (!this.IsShowMainIndexTitle) top=this.Frame.ChartBorder.GetTop()+2*pixelRatio;
51097
51102
  var left=this.Frame.ChartBorder.GetLeft()+this.MerginLeft;
51098
51103
  var right=border.Right;
51099
51104
  var bottom=border.Bottom;
@@ -51111,6 +51116,7 @@ function DynamicChartTitlePainting()
51111
51116
  var toolbarInfo={ Width:0, YCenter:y, ID:overlayID };
51112
51117
  this.DrawOverlayToolbar(overlayItem,toolbarInfo,moveonPoint, mouseStatus);
51113
51118
 
51119
+ if (!overlayItem.IsShowIndexTitle) continue;
51114
51120
  if (!overlayItem.Frame.IsShowIndexTitle) continue;
51115
51121
 
51116
51122
  x=left+toolbarInfo.Width;
@@ -51250,9 +51256,10 @@ function DynamicChartTitlePainting()
51250
51256
 
51251
51257
  var spaceWidth=5*GetDevicePixelRatio();
51252
51258
  var drawLeft=left;
51259
+ var indexCount=0;
51253
51260
  for(item of this.OverlayIndex)
51254
51261
  {
51255
- left+=spaceWidth;
51262
+ if (indexCount>0) left+=spaceWidth;
51256
51263
  var overlayItem=item[1];
51257
51264
  var overlayID=item[0];
51258
51265
  if (overlayItem.Title && this.IsShowOverlayIndexName)
@@ -51318,6 +51325,8 @@ function DynamicChartTitlePainting()
51318
51325
  }
51319
51326
 
51320
51327
  if (left>right) break;
51328
+
51329
+ ++indexCount;
51321
51330
  }
51322
51331
  }
51323
51332
 
@@ -68011,7 +68020,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68011
68020
  else if (obj.ShowRightText===false) frame.IsShow=false;
68012
68021
  if (IFrameSplitOperator.IsBool(obj.ShowToolbar)) frame.IsShowToolbar=obj.ShowToolbar; //废弃
68013
68022
  if (IFrameSplitOperator.IsBool(obj.IsShareY)) frame.IsShareY=obj.IsShareY;
68014
- if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
68023
+ //if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
68015
68024
  if (IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin)) frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin; //是否计算Y最大最小值
68016
68025
 
68017
68026
  frame.YSplitOperator=new FrameSplitY();
@@ -68449,10 +68458,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68449
68458
  var overlay=this.CreateOverlayWindowsIndex(item);
68450
68459
  if (!overlay) continue;
68451
68460
 
68452
- aryOverlayIndex.push(overlay);
68461
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
68453
68462
  }
68454
68463
  }
68455
68464
 
68465
+ this.Frame.SetSizeChage(true);
68466
+
68456
68467
  if (!bRefreshData)
68457
68468
  {
68458
68469
  var bindData=this.ChartPaint[0].Data;
@@ -68464,11 +68475,10 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68464
68475
  for(var i=0;i<aryOverlayIndex.length;++i)
68465
68476
  {
68466
68477
  var item=aryOverlayIndex[i];
68467
- this.BindOverlayIndexData(item,item.WindowIndex,bindData);
68478
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
68468
68479
  }
68469
68480
 
68470
68481
  this.UpdataDataoffset(); //更新数据偏移
68471
- this.Frame.SetSizeChage(true);
68472
68482
  this.ResetFrameXYSplit();
68473
68483
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
68474
68484
  this.Draw();
@@ -68476,7 +68486,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68476
68486
  else
68477
68487
  {
68478
68488
  if (!symbol) symbol=this.Symbol;
68479
-
68480
68489
  var optionData={ KLine:{} };
68481
68490
  if (IFrameSplitOperator.IsNumber(period)) optionData.KLine.Period=period;
68482
68491
  if (IFrameSplitOperator.IsNumber(right)) optionData.KLine.Right=right;
@@ -73298,9 +73307,10 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73298
73307
  if (this.EnableIndexChartDrag) this.CreateExtendChart("DragMovePaint");
73299
73308
 
73300
73309
  //子窗口动态标题
73301
- for(var i in this.Frame.SubFrame)
73310
+ for(var i=0;i<this.Frame.SubFrame.length; ++i)
73302
73311
  {
73303
73312
  var titlePaint=new DynamicChartTitlePainting();
73313
+ if (i==0 || i==1) titlePaint.IsShowMainIndexTitle=false;
73304
73314
  titlePaint.Frame=this.Frame.SubFrame[i].Frame;
73305
73315
  titlePaint.Canvas=this.Canvas;
73306
73316
  titlePaint.LanguageID=this.LanguageID;
@@ -73817,6 +73827,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73817
73827
 
73818
73828
  this.Frame.SubFrame.splice(count,currentLength-count);
73819
73829
  this.WindowIndex.splice(count,currentLength-count);
73830
+ this.TitlePaint.splice(count+1,currentLength-count);
73820
73831
  }
73821
73832
  else
73822
73833
  {
@@ -73834,8 +73845,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73834
73845
  }
73835
73846
  }
73836
73847
 
73837
-
73838
-
73839
73848
  for(var i=0;i<count;++i)
73840
73849
  {
73841
73850
  var windowIndex=i;
@@ -73883,6 +73892,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73883
73892
  this.SetSubFrameAttribute(this.Frame.SubFrame[windowIndex], item, frameItem);
73884
73893
  }
73885
73894
 
73895
+ //清空叠加指标
73896
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
73897
+ {
73898
+ this.DeleteWindowsOverlayIndex(i);
73899
+ }
73900
+
73886
73901
  //最后一个显示X轴坐标
73887
73902
  for(var i=0;i<this.Frame.SubFrame.length;++i)
73888
73903
  {
@@ -73891,6 +73906,25 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73891
73906
  else item.XSplitOperator.ShowText=false;
73892
73907
  }
73893
73908
 
73909
+ //叠加指标
73910
+ var aryOverlayIndex=[];
73911
+ if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
73912
+ {
73913
+ for(var i=0;i<option.OverlayIndex.length;++i)
73914
+ {
73915
+ var item=option.OverlayIndex[i];
73916
+ if (item.Index) item.IndexName=item.Index;
73917
+ if (item.Windows>=0) item.WindowIndex=item.Windows;
73918
+
73919
+ var overlay=this.CreateOverlayWindowsIndex(item);
73920
+ if (!overlay) continue;
73921
+
73922
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
73923
+ }
73924
+ }
73925
+
73926
+ this.Frame.SetSizeChage(true);
73927
+
73894
73928
  if (!bRefreshData)
73895
73929
  {
73896
73930
  var bindData=this.SourceData;
@@ -73898,8 +73932,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73898
73932
  {
73899
73933
  this.BindIndexData(i,bindData); //执行脚本
73900
73934
  }
73935
+
73936
+ for(var i=0;i<aryOverlayIndex.length;++i)
73937
+ {
73938
+ var item=aryOverlayIndex[i];
73939
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
73940
+ }
73941
+
73901
73942
  this.UpdataDataoffset(); //更新数据偏移
73902
- this.Frame.SetSizeChage(true);
73943
+
73903
73944
  if (this.UpdateXShowText) this.UpdateXShowText();
73904
73945
  this.ResetFrameXYSplit();
73905
73946
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
@@ -73907,7 +73948,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73907
73948
  }
73908
73949
  else
73909
73950
  {
73910
- this.Frame.SetSizeChage(true);
73911
73951
  if (dayCount!=null) this.ChangeDayCount(dayCount);
73912
73952
  }
73913
73953
  }
@@ -193,6 +193,7 @@ JSIndexScript.ModifyAttribute=function(indexInfo, attribute)
193
193
  if (attribute.TitleFont) indexInfo.TitleFont=attribute.TitleFont;
194
194
  if (attribute.Lock) indexInfo.Lock=attribute.Lock;
195
195
  if (IFrameSplitOperator.IsNumber(attribute.YSplitType)) indexInfo.YSplitType=attribute.YSplitType;
196
+ if (IFrameSplitOperator.IsBool(attribute.IsShowIndexTitle)) indexInfo.IsShowIndexTitle=attribute.IsShowIndexTitle;
196
197
 
197
198
  if (attribute.YAxis)
198
199
  {
@@ -54485,6 +54486,8 @@ function DynamicChartTitlePainting()
54485
54486
  this.DynamicTitle={ OutName:null, OutValue:null };
54486
54487
  this.OverlayDynamicTitle=new Map(); //key , value={ OutName, OutValue }
54487
54488
 
54489
+ this.IsShowMainIndexTitle=true; //是否显示主图指标标题
54490
+
54488
54491
  this.ReloadResource=function()
54489
54492
  {
54490
54493
  this.Font=g_JSChartResource.TitleFont;
@@ -54948,7 +54951,7 @@ function DynamicChartTitlePainting()
54948
54951
  this.Canvas.textBaseline="middle";
54949
54952
  this.Canvas.font=this.Font;
54950
54953
  var pixelRatio=GetDevicePixelRatio();
54951
- if (this.Title && this.IsShowIndexName)
54954
+ if (this.Title && this.IsShowIndexName && this.IsShowMainIndexTitle)
54952
54955
  {
54953
54956
  if (this.IsDrawTitleBG)
54954
54957
  {
@@ -54977,7 +54980,7 @@ function DynamicChartTitlePainting()
54977
54980
  }
54978
54981
  }
54979
54982
 
54980
- if (this.ArgumentsText && this.IsShowIndexName)
54983
+ if (this.ArgumentsText && this.IsShowIndexName && this.IsShowMainIndexTitle)
54981
54984
  {
54982
54985
  var textWidth=this.Canvas.measureText(this.ArgumentsText).width+2;
54983
54986
  this.Canvas.fillStyle=this.TitleColor;
@@ -54997,7 +55000,7 @@ function DynamicChartTitlePainting()
54997
55000
  if (isShowLastData) return;
54998
55001
  }
54999
55002
 
55000
- for(var i=0; i<this.Data.length; ++i)
55003
+ for(var i=0; i<this.Data.length && this.IsShowMainIndexTitle; ++i)
55001
55004
  {
55002
55005
  var item=this.Data[i];
55003
55006
  var outText=this.GetTitleItem(item, isShowLastData, i);
@@ -55096,7 +55099,9 @@ function DynamicChartTitlePainting()
55096
55099
  }
55097
55100
  else
55098
55101
  {
55099
- this.DrawOverlayIndex(left+10*GetDevicePixelRatio()); //间距多空点 和主指标区分开
55102
+ var xOffset=10*GetDevicePixelRatio(); //主指标区分开 间距多空点
55103
+ if (!this.IsShowMainIndexTitle) xOffset=0;
55104
+ this.DrawOverlayIndex(left+xOffset);
55100
55105
  }
55101
55106
  }
55102
55107
 
@@ -55286,6 +55291,7 @@ function DynamicChartTitlePainting()
55286
55291
  else
55287
55292
  {
55288
55293
  var top=border.TopTitle+2*pixelRatio;
55294
+ if (!this.IsShowMainIndexTitle) top=this.Frame.ChartBorder.GetTop()+2*pixelRatio;
55289
55295
  var left=this.Frame.ChartBorder.GetLeft()+this.MerginLeft;
55290
55296
  var right=border.Right;
55291
55297
  var bottom=border.Bottom;
@@ -55303,6 +55309,7 @@ function DynamicChartTitlePainting()
55303
55309
  var toolbarInfo={ Width:0, YCenter:y, ID:overlayID };
55304
55310
  this.DrawOverlayToolbar(overlayItem,toolbarInfo,moveonPoint, mouseStatus);
55305
55311
 
55312
+ if (!overlayItem.IsShowIndexTitle) continue;
55306
55313
  if (!overlayItem.Frame.IsShowIndexTitle) continue;
55307
55314
 
55308
55315
  x=left+toolbarInfo.Width;
@@ -55442,9 +55449,10 @@ function DynamicChartTitlePainting()
55442
55449
 
55443
55450
  var spaceWidth=5*GetDevicePixelRatio();
55444
55451
  var drawLeft=left;
55452
+ var indexCount=0;
55445
55453
  for(item of this.OverlayIndex)
55446
55454
  {
55447
- left+=spaceWidth;
55455
+ if (indexCount>0) left+=spaceWidth;
55448
55456
  var overlayItem=item[1];
55449
55457
  var overlayID=item[0];
55450
55458
  if (overlayItem.Title && this.IsShowOverlayIndexName)
@@ -55510,6 +55518,8 @@ function DynamicChartTitlePainting()
55510
55518
  }
55511
55519
 
55512
55520
  if (left>right) break;
55521
+
55522
+ ++indexCount;
55513
55523
  }
55514
55524
  }
55515
55525
 
@@ -72203,7 +72213,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72203
72213
  else if (obj.ShowRightText===false) frame.IsShow=false;
72204
72214
  if (IFrameSplitOperator.IsBool(obj.ShowToolbar)) frame.IsShowToolbar=obj.ShowToolbar; //废弃
72205
72215
  if (IFrameSplitOperator.IsBool(obj.IsShareY)) frame.IsShareY=obj.IsShareY;
72206
- if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
72216
+ //if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
72207
72217
  if (IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin)) frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin; //是否计算Y最大最小值
72208
72218
 
72209
72219
  frame.YSplitOperator=new FrameSplitY();
@@ -72641,10 +72651,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72641
72651
  var overlay=this.CreateOverlayWindowsIndex(item);
72642
72652
  if (!overlay) continue;
72643
72653
 
72644
- aryOverlayIndex.push(overlay);
72654
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
72645
72655
  }
72646
72656
  }
72647
72657
 
72658
+ this.Frame.SetSizeChage(true);
72659
+
72648
72660
  if (!bRefreshData)
72649
72661
  {
72650
72662
  var bindData=this.ChartPaint[0].Data;
@@ -72656,11 +72668,10 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72656
72668
  for(var i=0;i<aryOverlayIndex.length;++i)
72657
72669
  {
72658
72670
  var item=aryOverlayIndex[i];
72659
- this.BindOverlayIndexData(item,item.WindowIndex,bindData);
72671
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
72660
72672
  }
72661
72673
 
72662
72674
  this.UpdataDataoffset(); //更新数据偏移
72663
- this.Frame.SetSizeChage(true);
72664
72675
  this.ResetFrameXYSplit();
72665
72676
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
72666
72677
  this.Draw();
@@ -72668,7 +72679,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72668
72679
  else
72669
72680
  {
72670
72681
  if (!symbol) symbol=this.Symbol;
72671
-
72672
72682
  var optionData={ KLine:{} };
72673
72683
  if (IFrameSplitOperator.IsNumber(period)) optionData.KLine.Period=period;
72674
72684
  if (IFrameSplitOperator.IsNumber(right)) optionData.KLine.Right=right;
@@ -77490,9 +77500,10 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77490
77500
  if (this.EnableIndexChartDrag) this.CreateExtendChart("DragMovePaint");
77491
77501
 
77492
77502
  //子窗口动态标题
77493
- for(var i in this.Frame.SubFrame)
77503
+ for(var i=0;i<this.Frame.SubFrame.length; ++i)
77494
77504
  {
77495
77505
  var titlePaint=new DynamicChartTitlePainting();
77506
+ if (i==0 || i==1) titlePaint.IsShowMainIndexTitle=false;
77496
77507
  titlePaint.Frame=this.Frame.SubFrame[i].Frame;
77497
77508
  titlePaint.Canvas=this.Canvas;
77498
77509
  titlePaint.LanguageID=this.LanguageID;
@@ -78009,6 +78020,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78009
78020
 
78010
78021
  this.Frame.SubFrame.splice(count,currentLength-count);
78011
78022
  this.WindowIndex.splice(count,currentLength-count);
78023
+ this.TitlePaint.splice(count+1,currentLength-count);
78012
78024
  }
78013
78025
  else
78014
78026
  {
@@ -78026,8 +78038,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78026
78038
  }
78027
78039
  }
78028
78040
 
78029
-
78030
-
78031
78041
  for(var i=0;i<count;++i)
78032
78042
  {
78033
78043
  var windowIndex=i;
@@ -78075,6 +78085,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78075
78085
  this.SetSubFrameAttribute(this.Frame.SubFrame[windowIndex], item, frameItem);
78076
78086
  }
78077
78087
 
78088
+ //清空叠加指标
78089
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
78090
+ {
78091
+ this.DeleteWindowsOverlayIndex(i);
78092
+ }
78093
+
78078
78094
  //最后一个显示X轴坐标
78079
78095
  for(var i=0;i<this.Frame.SubFrame.length;++i)
78080
78096
  {
@@ -78083,6 +78099,25 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78083
78099
  else item.XSplitOperator.ShowText=false;
78084
78100
  }
78085
78101
 
78102
+ //叠加指标
78103
+ var aryOverlayIndex=[];
78104
+ if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
78105
+ {
78106
+ for(var i=0;i<option.OverlayIndex.length;++i)
78107
+ {
78108
+ var item=option.OverlayIndex[i];
78109
+ if (item.Index) item.IndexName=item.Index;
78110
+ if (item.Windows>=0) item.WindowIndex=item.Windows;
78111
+
78112
+ var overlay=this.CreateOverlayWindowsIndex(item);
78113
+ if (!overlay) continue;
78114
+
78115
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
78116
+ }
78117
+ }
78118
+
78119
+ this.Frame.SetSizeChage(true);
78120
+
78086
78121
  if (!bRefreshData)
78087
78122
  {
78088
78123
  var bindData=this.SourceData;
@@ -78090,8 +78125,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78090
78125
  {
78091
78126
  this.BindIndexData(i,bindData); //执行脚本
78092
78127
  }
78128
+
78129
+ for(var i=0;i<aryOverlayIndex.length;++i)
78130
+ {
78131
+ var item=aryOverlayIndex[i];
78132
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
78133
+ }
78134
+
78093
78135
  this.UpdataDataoffset(); //更新数据偏移
78094
- this.Frame.SetSizeChage(true);
78136
+
78095
78137
  if (this.UpdateXShowText) this.UpdateXShowText();
78096
78138
  this.ResetFrameXYSplit();
78097
78139
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
@@ -78099,7 +78141,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78099
78141
  }
78100
78142
  else
78101
78143
  {
78102
- this.Frame.SetSizeChage(true);
78103
78144
  if (dayCount!=null) this.ChangeDayCount(dayCount);
78104
78145
  }
78105
78146
  }
@@ -112430,6 +112471,7 @@ function ScriptIndex(name,script,args,option)
112430
112471
  this.ID; //指标ID
112431
112472
  this.FloatPrecision=2; //小数位数
112432
112473
  this.StringFormat;
112474
+ this.IsShowIndexTitle=true; //是否显示指标标题
112433
112475
  this.KLineType=null; //K线显示类型
112434
112476
  this.InstructionType; //五彩K线, 交易指标
112435
112477
  this.YSpecificMaxMin=null; //最大最小值
@@ -112467,6 +112509,7 @@ function ScriptIndex(name,script,args,option)
112467
112509
  {
112468
112510
  if (option.FloatPrecision>=0) this.FloatPrecision=option.FloatPrecision;
112469
112511
  if (option.StringFormat>0) this.StringFormat=option.StringFormat;
112512
+ if (IFrameSplitOperator.IsBool(option.IsShowIndexTitle)) this.IsShowIndexTitle=option.IsShowIndexTitle;
112470
112513
  if (option.ID) this.ID=option.ID;
112471
112514
  if (option.KLineType>=0 || option.KLineType===-1) this.KLineType=option.KLineType;
112472
112515
  if (option.InstructionType) this.InstructionType=option.InstructionType;
@@ -114213,7 +114256,7 @@ function ScriptIndex(name,script,args,option)
114213
114256
  }
114214
114257
  */
114215
114258
 
114216
- for(let i in this.OutVar)
114259
+ for(let i=0; i<this.OutVar.length; ++i)
114217
114260
  {
114218
114261
  let item=this.OutVar[i];
114219
114262
  if (item.IsExData===true) continue; //扩展数据不显示图形
@@ -114426,11 +114469,13 @@ function ScriptIndex(name,script,args,option)
114426
114469
  }
114427
114470
 
114428
114471
  let titleIndex=windowIndex+1;
114429
- hqChart.TitlePaint[titleIndex].Title=this.Name;
114430
- hqChart.TitlePaint[titleIndex].Identify=this.Guid; //指标ID
114431
- hqChart.TitlePaint[titleIndex].ArgumentsText=null;
114432
- hqChart.TitlePaint[titleIndex].Script=this;
114433
-
114472
+ var titlePaint=hqChart.TitlePaint[titleIndex];
114473
+ titlePaint.Title=this.Name;
114474
+ titlePaint.Identify=this.Guid; //指标ID
114475
+ titlePaint.ArgumentsText=null;
114476
+ titlePaint.Script=this;
114477
+ titlePaint.IsShowMainIndexTitle=this.IsShowIndexTitle;
114478
+
114434
114479
  if (!this.IsShortTitle)
114435
114480
  {
114436
114481
  let indexParam='';
@@ -114441,10 +114486,10 @@ function ScriptIndex(name,script,args,option)
114441
114486
  indexParam+=item.Value.toString();
114442
114487
  }
114443
114488
 
114444
- if (indexParam.length>0) hqChart.TitlePaint[titleIndex].ArgumentsText=`(${indexParam})`;
114489
+ if (indexParam.length>0) titlePaint.ArgumentsText=`(${indexParam})`;
114445
114490
  }
114446
114491
 
114447
- if (this.TitleFont) hqChart.TitlePaint[titleIndex].Font=this.TitleFont;
114492
+ if (this.TitleFont) titlePaint.Font=this.TitleFont;
114448
114493
 
114449
114494
  return true;
114450
114495
  }
@@ -114578,7 +114623,7 @@ function OverlayScriptIndex(name,script,args,option)
114578
114623
  }
114579
114624
 
114580
114625
  //指标名字
114581
- var titleInfo={ Data:[], Title:this.Name, Frame:this.OverlayIndex.Frame.Frame, Script:this };
114626
+ var titleInfo={ Data:[], Title:this.Name, Frame:this.OverlayIndex.Frame.Frame, Script:this, IsShowIndexTitle:this.IsShowIndexTitle };
114582
114627
  let indexParam='';
114583
114628
  for(var i in this.Arguments)
114584
114629
  {
@@ -129356,7 +129401,7 @@ function ScrollBarBGChart()
129356
129401
 
129357
129402
 
129358
129403
 
129359
- var HQCHART_VERSION="1.1.12938";
129404
+ var HQCHART_VERSION="1.1.12950";
129360
129405
 
129361
129406
  function PrintHQChartVersion()
129362
129407
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12938";
8
+ var HQCHART_VERSION="1.1.12950";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -237,6 +237,7 @@ JSIndexScript.ModifyAttribute=function(indexInfo, attribute)
237
237
  if (attribute.TitleFont) indexInfo.TitleFont=attribute.TitleFont;
238
238
  if (attribute.Lock) indexInfo.Lock=attribute.Lock;
239
239
  if (IFrameSplitOperator.IsNumber(attribute.YSplitType)) indexInfo.YSplitType=attribute.YSplitType;
240
+ if (IFrameSplitOperator.IsBool(attribute.IsShowIndexTitle)) indexInfo.IsShowIndexTitle=attribute.IsShowIndexTitle;
240
241
 
241
242
  if (attribute.YAxis)
242
243
  {
@@ -54529,6 +54530,8 @@ function DynamicChartTitlePainting()
54529
54530
  this.DynamicTitle={ OutName:null, OutValue:null };
54530
54531
  this.OverlayDynamicTitle=new Map(); //key , value={ OutName, OutValue }
54531
54532
 
54533
+ this.IsShowMainIndexTitle=true; //是否显示主图指标标题
54534
+
54532
54535
  this.ReloadResource=function()
54533
54536
  {
54534
54537
  this.Font=g_JSChartResource.TitleFont;
@@ -54992,7 +54995,7 @@ function DynamicChartTitlePainting()
54992
54995
  this.Canvas.textBaseline="middle";
54993
54996
  this.Canvas.font=this.Font;
54994
54997
  var pixelRatio=GetDevicePixelRatio();
54995
- if (this.Title && this.IsShowIndexName)
54998
+ if (this.Title && this.IsShowIndexName && this.IsShowMainIndexTitle)
54996
54999
  {
54997
55000
  if (this.IsDrawTitleBG)
54998
55001
  {
@@ -55021,7 +55024,7 @@ function DynamicChartTitlePainting()
55021
55024
  }
55022
55025
  }
55023
55026
 
55024
- if (this.ArgumentsText && this.IsShowIndexName)
55027
+ if (this.ArgumentsText && this.IsShowIndexName && this.IsShowMainIndexTitle)
55025
55028
  {
55026
55029
  var textWidth=this.Canvas.measureText(this.ArgumentsText).width+2;
55027
55030
  this.Canvas.fillStyle=this.TitleColor;
@@ -55041,7 +55044,7 @@ function DynamicChartTitlePainting()
55041
55044
  if (isShowLastData) return;
55042
55045
  }
55043
55046
 
55044
- for(var i=0; i<this.Data.length; ++i)
55047
+ for(var i=0; i<this.Data.length && this.IsShowMainIndexTitle; ++i)
55045
55048
  {
55046
55049
  var item=this.Data[i];
55047
55050
  var outText=this.GetTitleItem(item, isShowLastData, i);
@@ -55140,7 +55143,9 @@ function DynamicChartTitlePainting()
55140
55143
  }
55141
55144
  else
55142
55145
  {
55143
- this.DrawOverlayIndex(left+10*GetDevicePixelRatio()); //间距多空点 和主指标区分开
55146
+ var xOffset=10*GetDevicePixelRatio(); //主指标区分开 间距多空点
55147
+ if (!this.IsShowMainIndexTitle) xOffset=0;
55148
+ this.DrawOverlayIndex(left+xOffset);
55144
55149
  }
55145
55150
  }
55146
55151
 
@@ -55330,6 +55335,7 @@ function DynamicChartTitlePainting()
55330
55335
  else
55331
55336
  {
55332
55337
  var top=border.TopTitle+2*pixelRatio;
55338
+ if (!this.IsShowMainIndexTitle) top=this.Frame.ChartBorder.GetTop()+2*pixelRatio;
55333
55339
  var left=this.Frame.ChartBorder.GetLeft()+this.MerginLeft;
55334
55340
  var right=border.Right;
55335
55341
  var bottom=border.Bottom;
@@ -55347,6 +55353,7 @@ function DynamicChartTitlePainting()
55347
55353
  var toolbarInfo={ Width:0, YCenter:y, ID:overlayID };
55348
55354
  this.DrawOverlayToolbar(overlayItem,toolbarInfo,moveonPoint, mouseStatus);
55349
55355
 
55356
+ if (!overlayItem.IsShowIndexTitle) continue;
55350
55357
  if (!overlayItem.Frame.IsShowIndexTitle) continue;
55351
55358
 
55352
55359
  x=left+toolbarInfo.Width;
@@ -55486,9 +55493,10 @@ function DynamicChartTitlePainting()
55486
55493
 
55487
55494
  var spaceWidth=5*GetDevicePixelRatio();
55488
55495
  var drawLeft=left;
55496
+ var indexCount=0;
55489
55497
  for(item of this.OverlayIndex)
55490
55498
  {
55491
- left+=spaceWidth;
55499
+ if (indexCount>0) left+=spaceWidth;
55492
55500
  var overlayItem=item[1];
55493
55501
  var overlayID=item[0];
55494
55502
  if (overlayItem.Title && this.IsShowOverlayIndexName)
@@ -55554,6 +55562,8 @@ function DynamicChartTitlePainting()
55554
55562
  }
55555
55563
 
55556
55564
  if (left>right) break;
55565
+
55566
+ ++indexCount;
55557
55567
  }
55558
55568
  }
55559
55569
 
@@ -72247,7 +72257,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72247
72257
  else if (obj.ShowRightText===false) frame.IsShow=false;
72248
72258
  if (IFrameSplitOperator.IsBool(obj.ShowToolbar)) frame.IsShowToolbar=obj.ShowToolbar; //废弃
72249
72259
  if (IFrameSplitOperator.IsBool(obj.IsShareY)) frame.IsShareY=obj.IsShareY;
72250
- if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
72260
+ //if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
72251
72261
  if (IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin)) frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin; //是否计算Y最大最小值
72252
72262
 
72253
72263
  frame.YSplitOperator=new FrameSplitY();
@@ -72685,10 +72695,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72685
72695
  var overlay=this.CreateOverlayWindowsIndex(item);
72686
72696
  if (!overlay) continue;
72687
72697
 
72688
- aryOverlayIndex.push(overlay);
72698
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
72689
72699
  }
72690
72700
  }
72691
72701
 
72702
+ this.Frame.SetSizeChage(true);
72703
+
72692
72704
  if (!bRefreshData)
72693
72705
  {
72694
72706
  var bindData=this.ChartPaint[0].Data;
@@ -72700,11 +72712,10 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72700
72712
  for(var i=0;i<aryOverlayIndex.length;++i)
72701
72713
  {
72702
72714
  var item=aryOverlayIndex[i];
72703
- this.BindOverlayIndexData(item,item.WindowIndex,bindData);
72715
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
72704
72716
  }
72705
72717
 
72706
72718
  this.UpdataDataoffset(); //更新数据偏移
72707
- this.Frame.SetSizeChage(true);
72708
72719
  this.ResetFrameXYSplit();
72709
72720
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
72710
72721
  this.Draw();
@@ -72712,7 +72723,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72712
72723
  else
72713
72724
  {
72714
72725
  if (!symbol) symbol=this.Symbol;
72715
-
72716
72726
  var optionData={ KLine:{} };
72717
72727
  if (IFrameSplitOperator.IsNumber(period)) optionData.KLine.Period=period;
72718
72728
  if (IFrameSplitOperator.IsNumber(right)) optionData.KLine.Right=right;
@@ -77534,9 +77544,10 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77534
77544
  if (this.EnableIndexChartDrag) this.CreateExtendChart("DragMovePaint");
77535
77545
 
77536
77546
  //子窗口动态标题
77537
- for(var i in this.Frame.SubFrame)
77547
+ for(var i=0;i<this.Frame.SubFrame.length; ++i)
77538
77548
  {
77539
77549
  var titlePaint=new DynamicChartTitlePainting();
77550
+ if (i==0 || i==1) titlePaint.IsShowMainIndexTitle=false;
77540
77551
  titlePaint.Frame=this.Frame.SubFrame[i].Frame;
77541
77552
  titlePaint.Canvas=this.Canvas;
77542
77553
  titlePaint.LanguageID=this.LanguageID;
@@ -78053,6 +78064,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78053
78064
 
78054
78065
  this.Frame.SubFrame.splice(count,currentLength-count);
78055
78066
  this.WindowIndex.splice(count,currentLength-count);
78067
+ this.TitlePaint.splice(count+1,currentLength-count);
78056
78068
  }
78057
78069
  else
78058
78070
  {
@@ -78070,8 +78082,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78070
78082
  }
78071
78083
  }
78072
78084
 
78073
-
78074
-
78075
78085
  for(var i=0;i<count;++i)
78076
78086
  {
78077
78087
  var windowIndex=i;
@@ -78119,6 +78129,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78119
78129
  this.SetSubFrameAttribute(this.Frame.SubFrame[windowIndex], item, frameItem);
78120
78130
  }
78121
78131
 
78132
+ //清空叠加指标
78133
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
78134
+ {
78135
+ this.DeleteWindowsOverlayIndex(i);
78136
+ }
78137
+
78122
78138
  //最后一个显示X轴坐标
78123
78139
  for(var i=0;i<this.Frame.SubFrame.length;++i)
78124
78140
  {
@@ -78127,6 +78143,25 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78127
78143
  else item.XSplitOperator.ShowText=false;
78128
78144
  }
78129
78145
 
78146
+ //叠加指标
78147
+ var aryOverlayIndex=[];
78148
+ if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
78149
+ {
78150
+ for(var i=0;i<option.OverlayIndex.length;++i)
78151
+ {
78152
+ var item=option.OverlayIndex[i];
78153
+ if (item.Index) item.IndexName=item.Index;
78154
+ if (item.Windows>=0) item.WindowIndex=item.Windows;
78155
+
78156
+ var overlay=this.CreateOverlayWindowsIndex(item);
78157
+ if (!overlay) continue;
78158
+
78159
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
78160
+ }
78161
+ }
78162
+
78163
+ this.Frame.SetSizeChage(true);
78164
+
78130
78165
  if (!bRefreshData)
78131
78166
  {
78132
78167
  var bindData=this.SourceData;
@@ -78134,8 +78169,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78134
78169
  {
78135
78170
  this.BindIndexData(i,bindData); //执行脚本
78136
78171
  }
78172
+
78173
+ for(var i=0;i<aryOverlayIndex.length;++i)
78174
+ {
78175
+ var item=aryOverlayIndex[i];
78176
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
78177
+ }
78178
+
78137
78179
  this.UpdataDataoffset(); //更新数据偏移
78138
- this.Frame.SetSizeChage(true);
78180
+
78139
78181
  if (this.UpdateXShowText) this.UpdateXShowText();
78140
78182
  this.ResetFrameXYSplit();
78141
78183
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
@@ -78143,7 +78185,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78143
78185
  }
78144
78186
  else
78145
78187
  {
78146
- this.Frame.SetSizeChage(true);
78147
78188
  if (dayCount!=null) this.ChangeDayCount(dayCount);
78148
78189
  }
78149
78190
  }
@@ -112474,6 +112515,7 @@ function ScriptIndex(name,script,args,option)
112474
112515
  this.ID; //指标ID
112475
112516
  this.FloatPrecision=2; //小数位数
112476
112517
  this.StringFormat;
112518
+ this.IsShowIndexTitle=true; //是否显示指标标题
112477
112519
  this.KLineType=null; //K线显示类型
112478
112520
  this.InstructionType; //五彩K线, 交易指标
112479
112521
  this.YSpecificMaxMin=null; //最大最小值
@@ -112511,6 +112553,7 @@ function ScriptIndex(name,script,args,option)
112511
112553
  {
112512
112554
  if (option.FloatPrecision>=0) this.FloatPrecision=option.FloatPrecision;
112513
112555
  if (option.StringFormat>0) this.StringFormat=option.StringFormat;
112556
+ if (IFrameSplitOperator.IsBool(option.IsShowIndexTitle)) this.IsShowIndexTitle=option.IsShowIndexTitle;
112514
112557
  if (option.ID) this.ID=option.ID;
112515
112558
  if (option.KLineType>=0 || option.KLineType===-1) this.KLineType=option.KLineType;
112516
112559
  if (option.InstructionType) this.InstructionType=option.InstructionType;
@@ -114257,7 +114300,7 @@ function ScriptIndex(name,script,args,option)
114257
114300
  }
114258
114301
  */
114259
114302
 
114260
- for(let i in this.OutVar)
114303
+ for(let i=0; i<this.OutVar.length; ++i)
114261
114304
  {
114262
114305
  let item=this.OutVar[i];
114263
114306
  if (item.IsExData===true) continue; //扩展数据不显示图形
@@ -114470,11 +114513,13 @@ function ScriptIndex(name,script,args,option)
114470
114513
  }
114471
114514
 
114472
114515
  let titleIndex=windowIndex+1;
114473
- hqChart.TitlePaint[titleIndex].Title=this.Name;
114474
- hqChart.TitlePaint[titleIndex].Identify=this.Guid; //指标ID
114475
- hqChart.TitlePaint[titleIndex].ArgumentsText=null;
114476
- hqChart.TitlePaint[titleIndex].Script=this;
114477
-
114516
+ var titlePaint=hqChart.TitlePaint[titleIndex];
114517
+ titlePaint.Title=this.Name;
114518
+ titlePaint.Identify=this.Guid; //指标ID
114519
+ titlePaint.ArgumentsText=null;
114520
+ titlePaint.Script=this;
114521
+ titlePaint.IsShowMainIndexTitle=this.IsShowIndexTitle;
114522
+
114478
114523
  if (!this.IsShortTitle)
114479
114524
  {
114480
114525
  let indexParam='';
@@ -114485,10 +114530,10 @@ function ScriptIndex(name,script,args,option)
114485
114530
  indexParam+=item.Value.toString();
114486
114531
  }
114487
114532
 
114488
- if (indexParam.length>0) hqChart.TitlePaint[titleIndex].ArgumentsText=`(${indexParam})`;
114533
+ if (indexParam.length>0) titlePaint.ArgumentsText=`(${indexParam})`;
114489
114534
  }
114490
114535
 
114491
- if (this.TitleFont) hqChart.TitlePaint[titleIndex].Font=this.TitleFont;
114536
+ if (this.TitleFont) titlePaint.Font=this.TitleFont;
114492
114537
 
114493
114538
  return true;
114494
114539
  }
@@ -114622,7 +114667,7 @@ function OverlayScriptIndex(name,script,args,option)
114622
114667
  }
114623
114668
 
114624
114669
  //指标名字
114625
- var titleInfo={ Data:[], Title:this.Name, Frame:this.OverlayIndex.Frame.Frame, Script:this };
114670
+ var titleInfo={ Data:[], Title:this.Name, Frame:this.OverlayIndex.Frame.Frame, Script:this, IsShowIndexTitle:this.IsShowIndexTitle };
114626
114671
  let indexParam='';
114627
114672
  for(var i in this.Arguments)
114628
114673
  {
@@ -129514,7 +129559,7 @@ function HQChartScriptWorker()
129514
129559
 
129515
129560
 
129516
129561
 
129517
- var HQCHART_VERSION="1.1.12938";
129562
+ var HQCHART_VERSION="1.1.12950";
129518
129563
 
129519
129564
  function PrintHQChartVersion()
129520
129565
  {