hqchart 1.1.14100 → 1.1.14104

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.
@@ -1508,7 +1508,8 @@ ON_CLICK_HORIZONTAL_LABEL:158,//点击Y轴刻度标签
1508
1508
  ON_FORMAT_DIALOG_TOOLTIP:159,//格式化Tooltip对话框显示文字
1509
1509
  ON_CHANGE_KLINE_RIGHT:160,//切换复权
1510
1510
  ON_FORMAT_KLINE_FLOAT_TOOLTIP:161,//格式化k线浮动框显示文字
1511
- ON_FORMAT_KLINE_INFO_FLOAT_TOOLTIP:162//格式化信息地雷显示文字
1511
+ ON_FORMAT_KLINE_INFO_FLOAT_TOOLTIP:162,//格式化信息地雷显示文字
1512
+ SEARCH_DIALOG_ON_CLICK_INDEX:163//切换指标-指标对话框
1512
1513
  };var JSCHART_OPERATOR_ID={OP_SCROLL_LEFT:1,//往左移动
1513
1514
  OP_SCROLL_RIGHT:2,//往右移动
1514
1515
  OP_ZOOM_OUT:3,//缩小
@@ -13013,7 +13014,8 @@ this.Canvas.clip();if(this.TextOverflowStyle==1){var count=text.length+5;text=""
13013
13014
  this.DrawItemTextEx=function(drawInfo,left,top,width){var text=drawInfo.Text;var clrText=drawInfo.TextColor;var symbol=drawInfo.Symbol;//符号
13014
13015
  var textAlign=drawInfo.TextAlign;var textWidth=this.Canvas.measureText(text).width+1;;var totalWidth=textWidth;var font=symbol.Size*GetDevicePixelRatio()+'px '+symbol.Family;this.Canvas.font=font;var aryIconWidth=[];for(var i=0;i<symbol.Data.length;++i){var item=symbol.Data[i];var iconWidth=this.Canvas.measureText(item.Text).width+1;if(totalWidth+iconWidth>width)break;totalWidth+=iconWidth;aryIconWidth[i]=iconWidth;}var x=left;var y=top+this.ItemMergin.Top+this.RowHeight/2;if(textAlign=='center'){x=left+(width-totalWidth)/2;}else if(textAlign=='right'){x=left+(width-totalWidth);}else{x+=2;}this.Canvas.textBaseline="middle";this.Canvas.textAlign="left";this.Canvas.font=this.ItemFont;this.Canvas.fillStyle=clrText;this.Canvas.fillText(text,x,y);x+=textWidth;this.Canvas.font=font;for(var i=0;i<aryIconWidth.length;++i){var item=symbol.Data[i];this.Canvas.fillStyle=item.Color;this.Canvas.fillText(item.Text,x,y);x+=aryIconWidth[i];}this.Canvas.font=this.ItemFont;};this.DrawIconItem=function(drawInfo,left,top,width){if(!drawInfo||!drawInfo.Font||!drawInfo.Text)return;var text=drawInfo.Text;var clrText=drawInfo.TextColor;var textAlign=drawInfo.TextAlign;this.Canvas.font=drawInfo.Font;var textWidth=this.Canvas.measureText(text).width+1;;var x=left;var y=top+this.ItemMergin.Top+this.RowHeight/2;if(textAlign=='center'){x=left+(width-textWidth)/2;}else if(textAlign=='right'){x=left+(width-textWidth);}else{x+=2;}this.Canvas.textBaseline="middle";this.Canvas.textAlign="left";this.Canvas.fillStyle=clrText;this.Canvas.fillText(text,x,y);this.Canvas.font=this.ItemFont;};this.DrawCheckbox=function(drawInfo,left,top,width){if(!IFrameSplitOperator.IsBool(drawInfo.Checked))return;if(!drawInfo.CheckBox)return;var config=drawInfo.CheckBox;drawInfo.Font=config.Size*this.DevicePixelRatio+'px '+config.Family;var textAlign=drawInfo.TextAlign;var size=drawInfo.CheckBox.Size*this.DevicePixelRatio;var x=left+drawInfo.CheckBox.Margin.Left;var y=top+this.RowHeight-drawInfo.CheckBox.Margin.Bottom;if(textAlign=='center')x=left+width/2-size/2;else if(textAlign=='right')x=left+width-config.Margin.Right;var rtBox={Left:x,Bottom:y,Width:size,Height:size};rtBox.Right=rtBox.Left+rtBox.Width;rtBox.Top=rtBox.Bottom-rtBox.Height;//鼠标在上面
13015
13016
  var bMouseOn=false;if(drawInfo.Enable&&this.LastMouseStatus&&this.LastMouseStatus.OnMouseMove){var xMouse=this.LastMouseStatus.OnMouseMove.X;var yMouse=this.LastMouseStatus.OnMouseMove.Y;if(xMouse>rtBox.Left&&xMouse<rtBox.Right&&yMouse>rtBox.Top&&yMouse<rtBox.Bottom){bMouseOn=true;this.LastMouseStatus.MouseOnStatus={Index:drawInfo.Index,ColumnIndex:drawInfo.ColumnIndex,Type:0};}}this.Canvas.font=drawInfo.Font;this.Canvas.textBaseline="bottom";this.Canvas.textAlign="left";if(drawInfo.Checked===true){var textColor=config.Checked.Color;if(drawInfo.Enable===false)textColor=config.Checked.DisableColor;else if(bMouseOn)textColor=config.Checked.MouseOnColor;this.Canvas.fillStyle=textColor;this.Canvas.fillText(config.Checked.Symbol,x,y);}else if(drawInfo.Checked===false){var textColor=config.Unchecked.Color;if(drawInfo.Enable===false)textColor=config.Unchecked.DisableColor;else if(bMouseOn)textColor=config.Unchecked.MouseOnColor;this.Canvas.fillStyle=textColor;this.Canvas.fillText(config.Unchecked.Symbol,x,y);}if(drawInfo.Enable){drawInfo.Botton={Rect:rtBox,Type:0};}};this.DrawButton=function(drawInfo,left,top,width){if(!drawInfo.Button)return;var config=drawInfo.Button;var rtBG={Left:left+drawInfo.Button.Margin.Left,Top:top+drawInfo.Button.Margin.Top,Height:this.RowHeight-drawInfo.Button.Margin.Top-drawInfo.Button.Margin.Bottom,Width:width-drawInfo.Button.Margin.Left-drawInfo.Button.Margin.Right};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;var bgColor=config.BGColor,textColor=config.TextColor;if(drawInfo.Enable===false){bgColor=config.Disable.BGColor;textColor=config.Disable.TextColor;}else{if(this.LastMouseStatus&&this.LastMouseStatus.OnMouseMove&&config.MouseOn){var x=this.LastMouseStatus.OnMouseMove.X;var y=this.LastMouseStatus.OnMouseMove.Y;if(x>rtBG.Left&&x<rtBG.Right&&y>rtBG.Top&&y<rtBG.Bottom){bgColor=config.MouseOn.BGColor;textColor=config.MouseOn.TextColor;this.LastMouseStatus.MouseOnStatus={Index:drawInfo.Index,ColumnIndex:drawInfo.ColumnIndex,Type:1};}}}this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.font=drawInfo.Font;this.Canvas.textBaseline="bottom";this.Canvas.textAlign="left";this.Canvas.fillStyle=textColor;var textWidth=this.Canvas.measureText(drawInfo.Text).width;var x=rtBG.Left;if(textWidth<rtBG.Width)x+=(rtBG.Width-textWidth)/2;var y=rtBG.Bottom-drawInfo.Button.TextMargin.Bottom;this.Canvas.fillText(drawInfo.Text,x,y);if(drawInfo.Enable){drawInfo.Botton={Rect:rtBG,Type:1};}};this.DrawProgressBar=function(drawInfo,left,top,width){if(!drawInfo.ProgressBar)return;var config=drawInfo.ProgressBar;var rtBG={Left:left+config.Margin.Left,Top:top+config.Margin.Top,Height:this.RowHeight-config.Margin.Top-config.Margin.Bottom,Width:width-config.Margin.Left-config.Margin.Right};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;var bgColor=config.BGColor;var barColor=config.BarColor;var textColor=config.TextColor;if(drawInfo.Enable===false){bgColor=config.Disable.BGColor;barColor=config.Disable.BarColor;textColor=config.Disable.TextColor;}if(drawInfo.BGColor)bgColor=drawInfo.BGColor;if(drawInfo.TextColor)textColor=drawInfo.TextColor;if(drawInfo.BarColor)barColor=drawInfo.BarColor;if(bgColor){this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}var fullBarWidth=rtBG.Width-config.BarMargin.Left-config.BarMargin.Right;var value=drawInfo.Value;// 0-1 进度条
13016
- var rtBar={Left:rtBG.Left+config.BarMargin.Left,Top:rtBG.Top+config.BarMargin.Top,Bottom:rtBG.Bottom-config.BarMargin.Bottom,Width:0};if(value>0){if(value>1)value=1;rtBar.Width=fullBarWidth*value;rtBar.Height=rtBar.Bottom-rtBar.Top;if(rtBar.Width<1)rtBG.Width=1;this.Canvas.fillStyle=barColor;this.Canvas.fillRect(rtBar.Left,rtBar.Top,rtBar.Width,rtBar.Height);}if(textColor&&drawInfo.Text){this.Canvas.font=config.Font;this.Canvas.textBaseline="bottom";this.Canvas.textAlign="left";this.Canvas.fillStyle=textColor;var xText=rtBar.Left+config.TextMargin.Left;var yText=rtBar.Bottom-config.TextMargin.Bottom;this.Canvas.fillText(drawInfo.Text,xText,yText);}};this.DrawLinkText=function(drawInfo,left,top,width){if(!drawInfo.Link||!drawInfo.Text)return;var config=drawInfo.Link;var text=drawInfo.Text;var textAlign=drawInfo.TextAlign;var font=config.Font;var color=config.TextColor;this.Canvas.font=font;var textWidth=this.Canvas.measureText(text).width;var textHeight=this.Canvas.measureText("擎").width;var x=left;if(width>=textWidth){if(textAlign=='center')x=left+(width-textWidth)/2;else if(textAlign=='right')x=left+width-textWidth;}else{text=this.TextEllipsis(text,width,drawInfo.MaxText);textWidth=this.Canvas.measureText(text).width;//数据截断提示信息
13017
+ var rtBar={Left:rtBG.Left+config.BarMargin.Left,Top:rtBG.Top+config.BarMargin.Top,Bottom:rtBG.Bottom-config.BarMargin.Bottom,Width:0};if(value>0){if(value>1)value=1;rtBar.Width=fullBarWidth*value;rtBar.Height=rtBar.Bottom-rtBar.Top;if(rtBar.Width<1)rtBG.Width=1;if(Array.isArray(barColor))this.Canvas.fillStyle=this.CreateLinearGradient(barColor,rtBG.Left,rtBG.Top,rtBG.Right,rtBG.Top);else this.Canvas.fillStyle=barColor;this.Canvas.fillRect(rtBar.Left,rtBar.Top,rtBar.Width,rtBar.Height);}if(textColor&&drawInfo.Text){this.Canvas.font=config.Font;this.Canvas.textBaseline="bottom";this.Canvas.textAlign="left";this.Canvas.fillStyle=textColor;var xText=rtBar.Left+config.TextMargin.Left;var yText=rtBar.Bottom-config.TextMargin.Bottom;this.Canvas.fillText(drawInfo.Text,xText,yText);}};//创建渐近色
13018
+ this.CreateLinearGradient=function(aryColor,x0,y0,x1,y1){var gradient=this.Canvas.createLinearGradient(x0,y0,x1,y1);var offset=1/(aryColor.length-1);for(var i=0;i<aryColor.length;++i){var value=i*offset;gradient.addColorStop(value,aryColor[i]);}return gradient;};this.DrawLinkText=function(drawInfo,left,top,width){if(!drawInfo.Link||!drawInfo.Text)return;var config=drawInfo.Link;var text=drawInfo.Text;var textAlign=drawInfo.TextAlign;var font=config.Font;var color=config.TextColor;this.Canvas.font=font;var textWidth=this.Canvas.measureText(text).width;var textHeight=this.Canvas.measureText("擎").width;var x=left;if(width>=textWidth){if(textAlign=='center')x=left+(width-textWidth)/2;else if(textAlign=='right')x=left+width-textWidth;}else{text=this.TextEllipsis(text,width,drawInfo.MaxText);textWidth=this.Canvas.measureText(text).width;//数据截断提示信息
13017
13019
  drawInfo.Tooltip={Type:2,Data:{AryText:[{Text:drawInfo.Text}]}};}var rtText={Left:x,Bottom:top+this.RowHeight-this.ItemMergin.Bottom,Height:textHeight,Width:textWidth};rtText.Right=rtText.Left+rtText.Width;rtText.Top=rtText.Bottom-rtText.Height;var drawLine=false;//下划线
13018
13020
  if(drawInfo.Enable===false){color=config.Disable.TextColor;}else if(this.LastMouseStatus&&this.LastMouseStatus.OnMouseMove&&config.MouseOn){var x=this.LastMouseStatus.OnMouseMove.X;var y=this.LastMouseStatus.OnMouseMove.Y;if(x>rtText.Left&&x<rtText.Right&&y>rtText.Top&&y<rtText.Bottom){color=config.MouseOn.TextColor;drawLine=true;this.LastMouseStatus.MouseOnStatus={Index:drawInfo.Index,ColumnIndex:drawInfo.ColumnIndex,Type:2};}}this.Canvas.textBaseline="bottom";this.Canvas.textAlign="left";this.Canvas.fillStyle=color;this.Canvas.fillText(text,rtText.Left,rtText.Bottom);if(drawLine){this.Canvas.strokeStyle=color;this.Canvas.beginPath();this.Canvas.moveTo(rtText.Left,rtText.Bottom);this.Canvas.lineTo(rtText.Right,rtText.Bottom);this.Canvas.stroke();}if(drawInfo.Enable){drawInfo.Botton={Rect:rtText,Type:2};}};//字体由外面设置
13019
13021
  this.TextEllipsis=function(text,maxWidth,maxText){if(!text)return null;if(text.length<maxText.length)return text;var start=maxText.length-3;if(start<0)return null;var newText=text.slice(0,start);for(var i=start;i<text.length;++i){var value=newText+text[i]+"...";var width=this.Canvas.measureText(value).width;if(width>maxWidth){newText+="...";break;}newText+=text[i];}return newText;};this.DrawMultiBar=function(colunmInfo,data,rtItem){if(!data.Source||!IFrameSplitOperator.IsNonEmptyArray(data.Source))return false;var barData=data.Source[colunmInfo.DataIndex];//{ Value:[0.4,0,2], Color:[0,1] };
@@ -13998,7 +14000,8 @@ var divInput=document.createElement("div");divInput.className="UMyChart_SearchIn
13998
14000
  var divContainer=document.createElement("div");divContainer.className="UMyChart_SearchIndex_Container_Div";divDom.appendChild(divContainer);//分类
13999
14001
  var divGroup=document.createElement("div");divGroup.className="UMyChart_SearchIndex_GroupList_Div";divContainer.appendChild(divGroup);for(var i=0,j=0;i<this.MaxGroupCount;++i){var groupItem={Div:null,Span:null};var divItem=document.createElement("div");divItem.className="UMyChart_SearchIndex_Group_Div";divGroup.appendChild(divItem);groupItem.Div=divItem;var spanDom=document.createElement("span");spanDom.className='UMyChart_SearchIndex_Group_Span';spanDom.innerText='分类名称';divItem.appendChild(spanDom);groupItem.Span=spanDom;spanDom.onmousedown=function(e){_this96.OnClickGroup(e);};this.AryGroup.push(groupItem);}//表格
14000
14002
  var divTable=document.createElement("div");divTable.className='UMyChart_SearchIndex_Table_Div';divContainer.appendChild(divTable);var table=document.createElement("table");table.className="UMyChart_SearchIndex_Table";divTable.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_SearchIndex_Tbody";table.appendChild(tbody);this.AryData=[];for(var i=0,j=0;i<this.MaxRowCount;++i){var rowItem={Tr:null,AryCell:[]};var trDom=document.createElement("tr");trDom.className='UMyChart_SearchIndex_Group_Tr';tbody.appendChild(trDom);rowItem.Tr=trDom;for(j=0;j<this.ColCount;++j){var cellItem=this.CreateCellDOM(i,j,trDom);rowItem.AryCell.push(cellItem);}this.AryData.push(rowItem);}document.body.appendChild(divDom);this.DivName=divName;this.DivDialog=divDom;this.TitleBox={DivTitle:divTitle,DivName:divName,DivColor:divClose};this.UpdateStyle();};this.CreateCellDOM=function(rowID,colID,trDom){var _this97=this;var cellItem={Td:null,Span:null,RowID:rowID,ColID:colID,IndexItem:null};var tdDom=document.createElement("td");tdDom.className="UMyChart_SearchIndex_Text_Td";//指标名称
14001
- trDom.appendChild(tdDom);cellItem.Td=tdDom;var spanDom=document.createElement("span");spanDom.className='UMyChart_SearchIndex_Text_Span';spanDom.innerText='指标名称';spanDom.onmousedown=function(e){_this97.OnClickIndex(e,cellItem);};tdDom.appendChild(spanDom);cellItem.Span=spanDom;return cellItem;};this.OnClickIndex=function(e,cellItem){if(!this.OpData)return;if(!cellItem||!cellItem.IndexItem)return;if(this.OpData.OpType==1){if(!IFrameSplitOperator.IsNumber(this.OpData.WindowIndex))return;var indexItem=cellItem.IndexItem;if(indexItem.Type==0)//系统指标
14003
+ trDom.appendChild(tdDom);cellItem.Td=tdDom;var spanDom=document.createElement("span");spanDom.className='UMyChart_SearchIndex_Text_Span';spanDom.innerText='指标名称';spanDom.onmousedown=function(e){_this97.OnClickIndex(e,cellItem);};tdDom.appendChild(spanDom);cellItem.Span=spanDom;return cellItem;};this.OnClickIndex=function(e,cellItem){if(!this.OpData)return;if(!cellItem||!cellItem.IndexItem)return;var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.SEARCH_DIALOG_ON_CLICK_INDEX);if(event&&event.Callback){var sendData={OpData:this.OpData,IndexData:cellItem.IndexItem,HQChart:this.HQChart,PreventDefault:false};event.Callback(event,sendData,this);if(sendData.PreventDefault==true)return;//已被上层处理了
14004
+ }if(this.OpData.OpType==1){if(!IFrameSplitOperator.IsNumber(this.OpData.WindowIndex))return;var indexItem=cellItem.IndexItem;if(indexItem.Type==0)//系统指标
14002
14005
  {this.HQChart.ChangeIndex(this.OpData.WindowIndex,indexItem.ID);}else if(indexItem.Type==1)//自定义脚本指标
14003
14006
  {var indexData={ID:indexItem.ID,Name:indexItem.Name,Script:indexItem.Script,Args:indexItem.Args};this.HQChart.ChangeScriptIndex(this.OpData.WindowIndex,indexData);}else if(indexItem.Type==2)//api指标
14004
14007
  {var indedData={API:{ID:indexItem.ID,Name:indexItem.Name,Args:indexItem.Args,Url:'local'}};this.HQChart.ChangeAPIIndex(this.OpData.WindowIndex,indedData);}}else if(this.OpData.OpType==2){if(!IFrameSplitOperator.IsNumber(this.OpData.WindowIndex))return;var indexItem=cellItem.IndexItem;if(indexItem.Type==0)//系统指标
@@ -14062,7 +14065,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
14062
14065
  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);};}/********************************************************************************
14063
14066
  * 版本信息输出
14064
14067
  *
14065
- */var HQCHART_VERSION="1.1.14099";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
14068
+ */var HQCHART_VERSION="1.1.14103";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
14066
14069
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
14067
14070
  // BaseIndex:BaseIndex,
14068
14071
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.14100",
3
+ "version": "1.1.14104",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -286,6 +286,15 @@ function JSDialogSearchIndex()
286
286
  if (!this.OpData) return;
287
287
  if (!cellItem || !cellItem.IndexItem) return;
288
288
 
289
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.SEARCH_DIALOG_ON_CLICK_INDEX);
290
+ if (event && event.Callback)
291
+ {
292
+ var sendData={ OpData:this.OpData, IndexData:cellItem.IndexItem, HQChart:this.HQChart, PreventDefault:false };
293
+ event.Callback(event, sendData, this);
294
+
295
+ if (sendData.PreventDefault==true) return; //已被上层处理了
296
+ }
297
+
289
298
  if (this.OpData.OpType==1)
290
299
  {
291
300
  if (!IFrameSplitOperator.IsNumber(this.OpData.WindowIndex)) return;
@@ -2633,6 +2633,8 @@ var JSCHART_EVENT_ID=
2633
2633
 
2634
2634
  ON_FORMAT_KLINE_FLOAT_TOOLTIP:161, //格式化k线浮动框显示文字
2635
2635
  ON_FORMAT_KLINE_INFO_FLOAT_TOOLTIP:162, //格式化信息地雷显示文字
2636
+
2637
+ SEARCH_DIALOG_ON_CLICK_INDEX:163, //切换指标-指标对话框
2636
2638
  }
2637
2639
 
2638
2640
  var JSCHART_OPERATOR_ID=
@@ -6931,8 +6931,9 @@ function ChartReport()
6931
6931
  rtBar.Width=fullBarWidth*value;
6932
6932
  rtBar.Height=rtBar.Bottom-rtBar.Top;
6933
6933
  if (rtBar.Width<1) rtBG.Width=1;
6934
-
6935
- this.Canvas.fillStyle=barColor;
6934
+
6935
+ if (Array.isArray(barColor)) this.Canvas.fillStyle=this.CreateLinearGradient(barColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
6936
+ else this.Canvas.fillStyle=barColor;
6936
6937
  this.Canvas.fillRect(rtBar.Left, rtBar.Top,rtBar.Width,rtBar.Height);
6937
6938
  }
6938
6939
 
@@ -6949,6 +6950,20 @@ function ChartReport()
6949
6950
  }
6950
6951
  }
6951
6952
 
6953
+ //创建渐近色
6954
+ this.CreateLinearGradient=function(aryColor, x0, y0, x1, y1)
6955
+ {
6956
+ var gradient = this.Canvas.createLinearGradient(x0, y0, x1, y1);
6957
+ var offset=1/(aryColor.length-1);
6958
+ for(var i=0; i<aryColor.length; ++i)
6959
+ {
6960
+ var value=i*offset;
6961
+ gradient.addColorStop(value, aryColor[i]);
6962
+ }
6963
+
6964
+ return gradient;
6965
+ }
6966
+
6952
6967
  this.DrawLinkText=function(drawInfo, left, top, width)
6953
6968
  {
6954
6969
  if (!drawInfo.Link || !drawInfo.Text) return;
@@ -6558,6 +6558,8 @@ var JSCHART_EVENT_ID=
6558
6558
 
6559
6559
  ON_FORMAT_KLINE_FLOAT_TOOLTIP:161, //格式化k线浮动框显示文字
6560
6560
  ON_FORMAT_KLINE_INFO_FLOAT_TOOLTIP:162, //格式化信息地雷显示文字
6561
+
6562
+ SEARCH_DIALOG_ON_CLICK_INDEX:163, //切换指标-指标对话框
6561
6563
  }
6562
6564
 
6563
6565
  var JSCHART_OPERATOR_ID=
@@ -133868,8 +133870,9 @@ function ChartReport()
133868
133870
  rtBar.Width=fullBarWidth*value;
133869
133871
  rtBar.Height=rtBar.Bottom-rtBar.Top;
133870
133872
  if (rtBar.Width<1) rtBG.Width=1;
133871
-
133872
- this.Canvas.fillStyle=barColor;
133873
+
133874
+ if (Array.isArray(barColor)) this.Canvas.fillStyle=this.CreateLinearGradient(barColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
133875
+ else this.Canvas.fillStyle=barColor;
133873
133876
  this.Canvas.fillRect(rtBar.Left, rtBar.Top,rtBar.Width,rtBar.Height);
133874
133877
  }
133875
133878
 
@@ -133886,6 +133889,20 @@ function ChartReport()
133886
133889
  }
133887
133890
  }
133888
133891
 
133892
+ //创建渐近色
133893
+ this.CreateLinearGradient=function(aryColor, x0, y0, x1, y1)
133894
+ {
133895
+ var gradient = this.Canvas.createLinearGradient(x0, y0, x1, y1);
133896
+ var offset=1/(aryColor.length-1);
133897
+ for(var i=0; i<aryColor.length; ++i)
133898
+ {
133899
+ var value=i*offset;
133900
+ gradient.addColorStop(value, aryColor[i]);
133901
+ }
133902
+
133903
+ return gradient;
133904
+ }
133905
+
133889
133906
  this.DrawLinkText=function(drawInfo, left, top, width)
133890
133907
  {
133891
133908
  if (!drawInfo.Link || !drawInfo.Text) return;
@@ -139169,7 +139186,7 @@ function ScrollBarBGChart()
139169
139186
 
139170
139187
 
139171
139188
 
139172
- var HQCHART_VERSION="1.1.14099";
139189
+ var HQCHART_VERSION="1.1.14103";
139173
139190
 
139174
139191
  function PrintHQChartVersion()
139175
139192
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14099";
8
+ var HQCHART_VERSION="1.1.14103";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -6602,6 +6602,8 @@ var JSCHART_EVENT_ID=
6602
6602
 
6603
6603
  ON_FORMAT_KLINE_FLOAT_TOOLTIP:161, //格式化k线浮动框显示文字
6604
6604
  ON_FORMAT_KLINE_INFO_FLOAT_TOOLTIP:162, //格式化信息地雷显示文字
6605
+
6606
+ SEARCH_DIALOG_ON_CLICK_INDEX:163, //切换指标-指标对话框
6605
6607
  }
6606
6608
 
6607
6609
  var JSCHART_OPERATOR_ID=
@@ -133912,8 +133914,9 @@ function ChartReport()
133912
133914
  rtBar.Width=fullBarWidth*value;
133913
133915
  rtBar.Height=rtBar.Bottom-rtBar.Top;
133914
133916
  if (rtBar.Width<1) rtBG.Width=1;
133915
-
133916
- this.Canvas.fillStyle=barColor;
133917
+
133918
+ if (Array.isArray(barColor)) this.Canvas.fillStyle=this.CreateLinearGradient(barColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
133919
+ else this.Canvas.fillStyle=barColor;
133917
133920
  this.Canvas.fillRect(rtBar.Left, rtBar.Top,rtBar.Width,rtBar.Height);
133918
133921
  }
133919
133922
 
@@ -133930,6 +133933,20 @@ function ChartReport()
133930
133933
  }
133931
133934
  }
133932
133935
 
133936
+ //创建渐近色
133937
+ this.CreateLinearGradient=function(aryColor, x0, y0, x1, y1)
133938
+ {
133939
+ var gradient = this.Canvas.createLinearGradient(x0, y0, x1, y1);
133940
+ var offset=1/(aryColor.length-1);
133941
+ for(var i=0; i<aryColor.length; ++i)
133942
+ {
133943
+ var value=i*offset;
133944
+ gradient.addColorStop(value, aryColor[i]);
133945
+ }
133946
+
133947
+ return gradient;
133948
+ }
133949
+
133933
133950
  this.DrawLinkText=function(drawInfo, left, top, width)
133934
133951
  {
133935
133952
  if (!drawInfo.Link || !drawInfo.Text) return;
@@ -147282,6 +147299,15 @@ function JSDialogSearchIndex()
147282
147299
  if (!this.OpData) return;
147283
147300
  if (!cellItem || !cellItem.IndexItem) return;
147284
147301
 
147302
+ var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.SEARCH_DIALOG_ON_CLICK_INDEX);
147303
+ if (event && event.Callback)
147304
+ {
147305
+ var sendData={ OpData:this.OpData, IndexData:cellItem.IndexItem, HQChart:this.HQChart, PreventDefault:false };
147306
+ event.Callback(event, sendData, this);
147307
+
147308
+ if (sendData.PreventDefault==true) return; //已被上层处理了
147309
+ }
147310
+
147285
147311
  if (this.OpData.OpType==1)
147286
147312
  {
147287
147313
  if (!IFrameSplitOperator.IsNumber(this.OpData.WindowIndex)) return;
@@ -148157,7 +148183,7 @@ function HQChartScriptWorker()
148157
148183
 
148158
148184
 
148159
148185
 
148160
- var HQCHART_VERSION="1.1.14099";
148186
+ var HQCHART_VERSION="1.1.14103";
148161
148187
 
148162
148188
  function PrintHQChartVersion()
148163
148189
  {