hqchart 1.1.14722 → 1.1.14731

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.
@@ -3678,6 +3678,7 @@ this.DrawKRange={Start:null,End:null};//当前屏K线的索引{ Start: , End:}
3678
3678
  this.IsThinAKBar=true;//美国线 柱子是否是线段 (false=柱子)
3679
3679
  this.OneLimitBarType=0;//一字板颜色类型 4个价格全部都在同一个价位上 0=使用平盘颜色 1=跟昨收比较
3680
3680
  this.UnchangeBarType=0;//0=使用unchange color 1=和昨收比较
3681
+ this.EnableColorBar=false;//K线柱子是否支持自定义颜色
3681
3682
  this.HighLowBarColor=g_JSChartResource.HighLowBarColor;this.HighLowTextConfig={FontName:g_JSChartResource.HighLowText.FontName,MaxSize:g_JSChartResource.HighLowText.MaxSize,MinSize:g_JSChartResource.HighLowText.MinSize,Color:g_JSChartResource.HighLowText.Color,//未用
3682
3683
  MaxText:g_JSChartResource.HighLowText.MaxText};this.HLCAreaConfig={HighLineColor:g_JSChartResource.HLCArea.HighLineColor,LowLineColor:g_JSChartResource.HLCArea.LowLineColor,CloseLineColor:g_JSChartResource.HLCArea.CloseLineColor,LineWidth:g_JSChartResource.HLCArea.LineWidth,UpAreaColor:g_JSChartResource.HLCArea.UpAreaColor,DownAreaColor:g_JSChartResource.HLCArea.DownAreaColor//虚线柱子 (非交易日)
3683
3684
  };this.VirtualBarConfig={Color:g_JSChartResource.VirtualKLine.Color,LineDash:g_JSChartResource.VirtualKLine.LineDash};//预测线配置
@@ -3742,7 +3743,7 @@ for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++
3742
3743
  {ptMax.X=x;ptMax.Y=yHigh;ptMax.Value=data.High;ptMax.Align=j<xPointCount/2?'left':'right';}if(ptMin.Value==null||ptMin.Value>data.Low)//求最小值
3743
3744
  {ptMin.X=x;ptMin.Y=yLow;ptMin.Value=data.Low;ptMin.Align=j<xPointCount/2?'left':'right';}if(this.ColorData)///五彩K线颜色设置
3744
3745
  {if(i<this.ColorData.length)upColor=downColor=unchagneColor=this.ColorData[i]>0?this.UpColor:this.DownColor;else upColor=downColor=unchagneColor=this.DownColor;}var kLineOption=this.GetCustomKLine(data);if(data.IsNonTrade)//非交易日 绘制虚线柱子
3745
- {this.DrawVirtualBar(data,dataWidth,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}else if(data.IsVirtual&&this.PredictionConfig.Enable){this.DrawPredictionBar(data,dataWidth,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}else if(kLineOption){var barColor=kLineOption.Color;if(!barColor){if(data.Open<data.Close)barColor=upColor;else if(data.Open>data.Close)barColor=downColor;else barColor=unchagneColor;}var drawType=this.DrawType;if(IFrameSplitOperator.IsNumber(kLineOption.DrawType))drawType=kLineOption.DrawType;this.DrawKBar_Custom(data,dataWidth,barColor,drawType,kLineOption,x,y,left,right,yLow,yHigh,yOpen,yClose,border,isHScreen);}else if(this.DrawType==9&&data.ColorData){this.DrawColorKBar(data,data.ColorData,dataWidth,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}else if(data.Open<data.Close)//阳线
3746
+ {this.DrawVirtualBar(data,dataWidth,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}else if(data.IsVirtual&&this.PredictionConfig.Enable){this.DrawPredictionBar(data,dataWidth,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}else if(kLineOption){var barColor=kLineOption.Color;if(!barColor){if(data.Open<data.Close)barColor=upColor;else if(data.Open>data.Close)barColor=downColor;else barColor=unchagneColor;}var drawType=this.DrawType;if(IFrameSplitOperator.IsNumber(kLineOption.DrawType))drawType=kLineOption.DrawType;this.DrawKBar_Custom(data,dataWidth,barColor,drawType,kLineOption,x,y,left,right,yLow,yHigh,yOpen,yClose,border,isHScreen);}else if((this.DrawType==9||this.EnableColorBar)&&data.ColorData){this.DrawColorKBar(data,data.ColorData,dataWidth,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}else if(data.Open<data.Close)//阳线
3746
3747
  {this.DrawKBar_Up(data,dataWidth,upColor,this.DrawType,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}else if(data.Open>data.Close)//阴线
3747
3748
  {this.DrawKBar_Down(data,dataWidth,downColor,this.DrawType,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}else// 平线
3748
3749
  {var barColor=unchagneColor;if(eventUnchangeKLine&&eventUnchangeKLine.Callback){var sendData={KItem:data,DataIndex:i,DefaultColor:barColor,BarColor:null};eventUnchangeKLine.Callback(eventUnchangeKLine,sendData,this);if(sendData.BarColor)barColor=sendData.BarColor;}this.DrawKBar_Unchagne(data,dataWidth,barColor,this.DrawType,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen);}if(this.IsShowKTooltip&&!isHScreen)//添加tooltip区域
@@ -5716,7 +5717,8 @@ if(barWidth>2*pixel)this.Canvas.lineWidth=barWidth;}this.Canvas.beginPath();if(t
5716
5717
  //this.StringFormatX.Value=xValue;
5717
5718
  this.StringFormatX.Value=this.CursorIndex;this.StringFormatX.Point={X:x,Y:y};this.StringFormatX.ClientPos=clientPos;this.StringFormatY.Value=yValue;this.StringFormatY.RValue=yValueExtend.RightYValue;//右侧子坐标
5718
5719
  this.StringFormatY.FrameID=yValueExtend.FrameID;this.StringFormatY.Point={X:x,Y:y};this.StringFormatY.ClientPos=clientPos;this.Canvas.font=this.Font;var textHeight=this.GetFontHeight();if(textHeight>this.TextHeight)this.TextHeight=textHeight;//Y轴
5719
- if((this.ShowTextMode.Left==1&&this.Frame.ChartBorder.Left>=30||this.ShowTextMode.Left==2||this.ShowTextMode.Right==1&&this.Frame.ChartBorder.Right>=30||this.ShowTextMode.Right==2)&&this.StringFormatY.Operator()){var text=this.StringFormatY.Text;this.Canvas.font=this.Font;var textWidth=this.Canvas.measureText(text).width;//前后各空2个像素
5720
+ if((this.ShowTextMode.Left==1&&this.Frame.ChartBorder.Left>=30||this.ShowTextMode.Left==2||this.ShowTextMode.Right==1&&this.Frame.ChartBorder.Right>=30||this.ShowTextMode.Right==2)&&this.StringFormatY.Operator()){//计算右侧文本输出顶部位置
5721
+ var _Temp_CalculateRightTextBGTop=function _Temp_CalculateRightTextBGTop(rtBG,complexText,defaultTextHeight){if(complexText.ShowType==1){var yValue=defaultTextHeight/2;if(IFrameSplitOperator.IsNonEmptyArray(textSize.Text)&&textSize.Text[0]){var itemSize=textSize.Text[0];if(IFrameSplitOperator.IsNumber(itemSize.Height))yValue=itemSize.Height/2;}rtBG.Top=rtBG.YCenter-yValue;rtBG.Bottom=rtBG.Top+rtBG.Height;}else{rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;}};var text=this.StringFormatY.Text;this.Canvas.font=this.Font;var textWidth=this.Canvas.measureText(text).width;//前后各空2个像素
5720
5722
  var textSize={Width:textWidth+4,Height:this.TextHeight,Text:[]};var buttonData={Y:y,YValue:yValue,FrameID:yValueExtend.FrameID};var margin=this.LeftConfig.Margin;var textOffset=this.LeftConfig.TextOffset;var rtBG=null;if(this.Frame.ChartBorder.Left>=30&&this.ShowTextMode.Left==1)//左边
5721
5723
  {var rtBG={Right:left,Width:textWidth+margin.Left+margin.Right,YCenter:y,Height:textHeight+margin.Top+margin.Bottom};rtBG.Left=rtBG.Right-rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;if(rtBG.Left<0){rtBG.Left=0;rtBG.Right=rtBG.Left+rtBG.Width;}}else if(this.ShowTextMode.Left==2)//在框架内显示
5722
5724
  {var rtBG={Left:left,Width:textWidth+margin.Left+margin.Right,YCenter:y,Height:textHeight+margin.Top+margin.Bottom};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;}if(rtBG){this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y);}var complexText={ShowType:0,//0=单行(默认) 1=多行
@@ -5724,8 +5726,8 @@ Font:this.Font,Color:this.TextColor,Text:[{Text:text,Margin:this.RightConfig.Mar
5724
5726
  var overlayIndexInterval=null;//子坐标间距
5725
5727
  if(yValueExtend.FrameID>=0){var frame=this.Frame.SubFrame[yValueExtend.FrameID];isOverlayIndex=frame.OverlayIndex.length>0;overlayIndexInterval=null;if(isOverlayIndex){for(var i=0;i<=frame.OverlayIndex.length;++i){var item=frame.OverlayIndex[i];if(!item||!item.Frame)continue;if(item.Frame.IsShow===false)continue;if(!item.Frame.GetXHorizontal)continue;var overlayLeft=item.Frame.GetXHorizontal();overlayIndexInterval=overlayLeft-right;break;}}}//叠加坐标
5726
5728
  if(isOverlayIndex&&textSize.Width>overlayIndexInterval&&overlayIndexInterval>0)//大于子坐标宽度
5727
- {var rtBG={Right:right+overlayIndexInterval,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Left=rtBG.Right-rtBG.Width;if(complexText.ShowType==1){rtBG.Top=rtBG.YCenter-this.TextHeight/2;rtBG.Bottom=rtBG.Top+rtBG.Height;}else{rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;}if(rtBG.Right>chartRight){rtBG.Right=chartRight;rtBG.Left=rtBG.Right-rtBG.Width;}var drawRight=right+overlayIndexInterval;if(drawRight>chartRight)drawRight=chartRight;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}else{var rtBG={Left:right+1,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Right=rtBG.Left+rtBG.Width;if(complexText.ShowType==1){rtBG.Top=rtBG.YCenter-this.TextHeight/2;rtBG.Bottom=rtBG.Top+rtBG.Height;}else{rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;}if(rtBG.Right>chartRight){rtBG.Right=chartRight;rtBG.Left=rtBG.Right-rtBG.Width;}this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}}else if(this.ShowTextMode.Right==2)//框架内侧显示
5728
- {var rtBG={Right:right,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Left=rtBG.Right-rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;this.Canvas.fillStyle=this.TextBGColor;var showLeft=right-textSize.Width;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}}//X轴 Bottom==8 自定义
5729
+ {var rtBG={Right:right+overlayIndexInterval,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Left=rtBG.Right-rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);if(rtBG.Right>chartRight){rtBG.Right=chartRight;rtBG.Left=rtBG.Right-rtBG.Width;}var drawRight=right+overlayIndexInterval;if(drawRight>chartRight)drawRight=chartRight;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}else{var rtBG={Left:right+1,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Right=rtBG.Left+rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);if(rtBG.Right>chartRight){rtBG.Right=chartRight;rtBG.Left=rtBG.Right-rtBG.Width;}this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}}else if(this.ShowTextMode.Right==2)//框架内侧显示
5730
+ {var rtBG={Right:right,Width:textSize.Width,YCenter:y,Height:textSize.Height};rtBG.Left=rtBG.Right-rtBG.Width;_Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);this.Canvas.fillStyle=this.TextBGColor;this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawComplexRightText(rtBG,complexText,textSize);if(this.RightButton.Enable)this.DrawRightButtonV2(rtBG,complexText,textSize,buttonData);}}//X轴 Bottom==8 自定义
5729
5731
  if((this.ShowTextMode.Bottom==1||this.ShowTextMode.Bottom==2||this.ShowTextMode.Bottom==8)&&this.StringFormatX.Operator()){var text=this.StringFormatX.Text;this.Canvas.font=this.Font;this.Canvas.fillStyle=this.TextBGColor;var textWidth=this.Canvas.measureText(text).width;//前后各空2个像素
5730
5732
  var margin=this.BottomConfig.Margin;var textOffset=this.BottomConfig.TextOffset;var rtBG={Top:bottom,Height:margin.Top+margin.Bottom+textHeight,XCenter:x,Width:textWidth+margin.Left+margin.Right};rtBG.Bottom=rtBG.Top+rtBG.Height;rtBG.Left=rtBG.XCenter-rtBG.Width/2;rtBG.Right=rtBG.Left+rtBG.Width;if(rtBG.Left<=0){rtBG.Left=0;rtBG.Right=rtBG.Left+rtBG.Width;}else if(rtBG.Right>=right){rtBG.Right=right;rtBG.Left=rtBG.Right-rtBG.Width;}var bShowText=true;if(this.ShowTextMode.Bottom==2){rtBG.Bottom=bottom;rtBG.Top=rtBG.Bottom-rtBG.Height;}else if(this.ShowTextMode.Bottom==8){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_CORSSCURSOR_POSITION);if(event&&event.Callback){var sendData={RectText:rtBG,IsShowText:bShowText,X:x,Y:y};event.Callback(event,sendData,this);bShowText=sendData.IsShowText;}}//JSConsole.Chart.Log('[ChartCorssCursor::Draw] ',yCenter);
5731
5733
  if(bShowText){this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+textOffset.X,rtBG.Bottom+textOffset.Y,textWidth);var buttonData={X:x,Y:y,XValue:xValue,FrameID:yValueExtend.FrameID};if(this.StringFormatX.KItem)buttonData.KItem=this.StringFormatX.KItem;this.BottomButton.Rect=rtBG;this.BottomButton.Data=buttonData;}}//子坐标Y轴
@@ -14766,7 +14768,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
14766
14768
  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);};}/********************************************************************************
14767
14769
  * 版本信息输出
14768
14770
  *
14769
- */var HQCHART_VERSION="1.1.14721";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();//把给外界调用的方法暴露出来
14771
+ */var HQCHART_VERSION="1.1.14730";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();//把给外界调用的方法暴露出来
14770
14772
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
14771
14773
  // BaseIndex:BaseIndex,
14772
14774
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.14722",
3
+ "version": "1.1.14731",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -26651,6 +26651,7 @@ function ChartKLine()
26651
26651
  this.IsThinAKBar=true; //美国线 柱子是否是线段 (false=柱子)
26652
26652
  this.OneLimitBarType=0; //一字板颜色类型 4个价格全部都在同一个价位上 0=使用平盘颜色 1=跟昨收比较
26653
26653
  this.UnchangeBarType=0; //0=使用unchange color 1=和昨收比较
26654
+ this.EnableColorBar=false; //K线柱子是否支持自定义颜色
26654
26655
 
26655
26656
  this.HighLowBarColor=g_JSChartResource.HighLowBarColor;
26656
26657
  this.HighLowTextConfig=
@@ -27583,7 +27584,7 @@ function ChartKLine()
27583
27584
 
27584
27585
  this.DrawKBar_Custom(data, dataWidth, barColor, drawType, kLineOption, x, y, left, right, yLow, yHigh, yOpen, yClose, border, isHScreen);
27585
27586
  }
27586
- else if (this.DrawType==9 && data.ColorData)
27587
+ else if ((this.DrawType==9 || this.EnableColorBar) && data.ColorData)
27587
27588
  {
27588
27589
  this.DrawColorKBar(data, data.ColorData, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
27589
27590
  }
@@ -56370,6 +56371,28 @@ function ChartCorssCursor()
56370
56371
 
56371
56372
  this.CalculateComplexTextSize(complexText, textSize);
56372
56373
 
56374
+ //计算右侧文本输出顶部位置
56375
+ function _Temp_CalculateRightTextBGTop(rtBG, complexText, defaultTextHeight)
56376
+ {
56377
+ if (complexText.ShowType==1)
56378
+ {
56379
+ var yValue=defaultTextHeight/2;
56380
+ if (IFrameSplitOperator.IsNonEmptyArray(textSize.Text) && textSize.Text[0])
56381
+ {
56382
+ var itemSize=textSize.Text[0];
56383
+ if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
56384
+ }
56385
+
56386
+ rtBG.Top=rtBG.YCenter-yValue;
56387
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
56388
+ }
56389
+ else
56390
+ {
56391
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
56392
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
56393
+ }
56394
+ }
56395
+
56373
56396
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
56374
56397
  {
56375
56398
  var isOverlayIndex=false; //是否有叠加子坐标
@@ -56400,17 +56423,8 @@ function ChartCorssCursor()
56400
56423
  {
56401
56424
  var rtBG={ Right:right+overlayIndexInterval, Width:textSize.Width, YCenter:y, Height:textSize.Height };
56402
56425
  rtBG.Left=rtBG.Right-rtBG.Width;
56403
- if (complexText.ShowType==1)
56404
- {
56405
- rtBG.Top=rtBG.YCenter-this.TextHeight/2;
56406
- rtBG.Bottom=rtBG.Top+rtBG.Height;
56407
- }
56408
- else
56409
- {
56410
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
56411
- rtBG.Bottom=rtBG.Top+rtBG.Height;
56412
- }
56413
-
56426
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
56427
+
56414
56428
  if (rtBG.Right>chartRight)
56415
56429
  {
56416
56430
  rtBG.Right=chartRight;
@@ -56429,16 +56443,7 @@ function ChartCorssCursor()
56429
56443
  {
56430
56444
  var rtBG={ Left:right+1, Width:textSize.Width, YCenter:y, Height:textSize.Height };
56431
56445
  rtBG.Right=rtBG.Left+rtBG.Width;
56432
- if (complexText.ShowType==1)
56433
- {
56434
- rtBG.Top=rtBG.YCenter-this.TextHeight/2;
56435
- rtBG.Bottom=rtBG.Top+rtBG.Height;
56436
- }
56437
- else
56438
- {
56439
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
56440
- rtBG.Bottom=rtBG.Top+rtBG.Height;
56441
- }
56446
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
56442
56447
 
56443
56448
  if (rtBG.Right>chartRight)
56444
56449
  {
@@ -56456,11 +56461,9 @@ function ChartCorssCursor()
56456
56461
  {
56457
56462
  var rtBG={ Right:right, Width:textSize.Width, YCenter:y, Height:textSize.Height };
56458
56463
  rtBG.Left=rtBG.Right-rtBG.Width;
56459
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
56460
- rtBG.Bottom=rtBG.Top+rtBG.Height;
56461
-
56464
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
56465
+
56462
56466
  this.Canvas.fillStyle=this.TextBGColor;
56463
- var showLeft=right-textSize.Width;
56464
56467
  this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
56465
56468
  this.DrawComplexRightText(rtBG,complexText,textSize);
56466
56469
 
@@ -30747,6 +30747,7 @@ function ChartKLine()
30747
30747
  this.IsThinAKBar=true; //美国线 柱子是否是线段 (false=柱子)
30748
30748
  this.OneLimitBarType=0; //一字板颜色类型 4个价格全部都在同一个价位上 0=使用平盘颜色 1=跟昨收比较
30749
30749
  this.UnchangeBarType=0; //0=使用unchange color 1=和昨收比较
30750
+ this.EnableColorBar=false; //K线柱子是否支持自定义颜色
30750
30751
 
30751
30752
  this.HighLowBarColor=g_JSChartResource.HighLowBarColor;
30752
30753
  this.HighLowTextConfig=
@@ -31679,7 +31680,7 @@ function ChartKLine()
31679
31680
 
31680
31681
  this.DrawKBar_Custom(data, dataWidth, barColor, drawType, kLineOption, x, y, left, right, yLow, yHigh, yOpen, yClose, border, isHScreen);
31681
31682
  }
31682
- else if (this.DrawType==9 && data.ColorData)
31683
+ else if ((this.DrawType==9 || this.EnableColorBar) && data.ColorData)
31683
31684
  {
31684
31685
  this.DrawColorKBar(data, data.ColorData, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
31685
31686
  }
@@ -60466,6 +60467,28 @@ function ChartCorssCursor()
60466
60467
 
60467
60468
  this.CalculateComplexTextSize(complexText, textSize);
60468
60469
 
60470
+ //计算右侧文本输出顶部位置
60471
+ function _Temp_CalculateRightTextBGTop(rtBG, complexText, defaultTextHeight)
60472
+ {
60473
+ if (complexText.ShowType==1)
60474
+ {
60475
+ var yValue=defaultTextHeight/2;
60476
+ if (IFrameSplitOperator.IsNonEmptyArray(textSize.Text) && textSize.Text[0])
60477
+ {
60478
+ var itemSize=textSize.Text[0];
60479
+ if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
60480
+ }
60481
+
60482
+ rtBG.Top=rtBG.YCenter-yValue;
60483
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60484
+ }
60485
+ else
60486
+ {
60487
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60488
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60489
+ }
60490
+ }
60491
+
60469
60492
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
60470
60493
  {
60471
60494
  var isOverlayIndex=false; //是否有叠加子坐标
@@ -60496,17 +60519,8 @@ function ChartCorssCursor()
60496
60519
  {
60497
60520
  var rtBG={ Right:right+overlayIndexInterval, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60498
60521
  rtBG.Left=rtBG.Right-rtBG.Width;
60499
- if (complexText.ShowType==1)
60500
- {
60501
- rtBG.Top=rtBG.YCenter-this.TextHeight/2;
60502
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60503
- }
60504
- else
60505
- {
60506
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60507
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60508
- }
60509
-
60522
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
60523
+
60510
60524
  if (rtBG.Right>chartRight)
60511
60525
  {
60512
60526
  rtBG.Right=chartRight;
@@ -60525,16 +60539,7 @@ function ChartCorssCursor()
60525
60539
  {
60526
60540
  var rtBG={ Left:right+1, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60527
60541
  rtBG.Right=rtBG.Left+rtBG.Width;
60528
- if (complexText.ShowType==1)
60529
- {
60530
- rtBG.Top=rtBG.YCenter-this.TextHeight/2;
60531
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60532
- }
60533
- else
60534
- {
60535
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60536
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60537
- }
60542
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
60538
60543
 
60539
60544
  if (rtBG.Right>chartRight)
60540
60545
  {
@@ -60552,11 +60557,9 @@ function ChartCorssCursor()
60552
60557
  {
60553
60558
  var rtBG={ Right:right, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60554
60559
  rtBG.Left=rtBG.Right-rtBG.Width;
60555
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60556
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60557
-
60560
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
60561
+
60558
60562
  this.Canvas.fillStyle=this.TextBGColor;
60559
- var showLeft=right-textSize.Width;
60560
60563
  this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60561
60564
  this.DrawComplexRightText(rtBG,complexText,textSize);
60562
60565
 
@@ -147994,7 +147997,7 @@ function ScrollBarBGChart()
147994
147997
 
147995
147998
 
147996
147999
 
147997
- var HQCHART_VERSION="1.1.14721";
148000
+ var HQCHART_VERSION="1.1.14730";
147998
148001
 
147999
148002
  function PrintHQChartVersion()
148000
148003
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.14721";
8
+ var HQCHART_VERSION="1.1.14730";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -30791,6 +30791,7 @@ function ChartKLine()
30791
30791
  this.IsThinAKBar=true; //美国线 柱子是否是线段 (false=柱子)
30792
30792
  this.OneLimitBarType=0; //一字板颜色类型 4个价格全部都在同一个价位上 0=使用平盘颜色 1=跟昨收比较
30793
30793
  this.UnchangeBarType=0; //0=使用unchange color 1=和昨收比较
30794
+ this.EnableColorBar=false; //K线柱子是否支持自定义颜色
30794
30795
 
30795
30796
  this.HighLowBarColor=g_JSChartResource.HighLowBarColor;
30796
30797
  this.HighLowTextConfig=
@@ -31723,7 +31724,7 @@ function ChartKLine()
31723
31724
 
31724
31725
  this.DrawKBar_Custom(data, dataWidth, barColor, drawType, kLineOption, x, y, left, right, yLow, yHigh, yOpen, yClose, border, isHScreen);
31725
31726
  }
31726
- else if (this.DrawType==9 && data.ColorData)
31727
+ else if ((this.DrawType==9 || this.EnableColorBar) && data.ColorData)
31727
31728
  {
31728
31729
  this.DrawColorKBar(data, data.ColorData, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
31729
31730
  }
@@ -60510,6 +60511,28 @@ function ChartCorssCursor()
60510
60511
 
60511
60512
  this.CalculateComplexTextSize(complexText, textSize);
60512
60513
 
60514
+ //计算右侧文本输出顶部位置
60515
+ function _Temp_CalculateRightTextBGTop(rtBG, complexText, defaultTextHeight)
60516
+ {
60517
+ if (complexText.ShowType==1)
60518
+ {
60519
+ var yValue=defaultTextHeight/2;
60520
+ if (IFrameSplitOperator.IsNonEmptyArray(textSize.Text) && textSize.Text[0])
60521
+ {
60522
+ var itemSize=textSize.Text[0];
60523
+ if (IFrameSplitOperator.IsNumber(itemSize.Height)) yValue=itemSize.Height/2;
60524
+ }
60525
+
60526
+ rtBG.Top=rtBG.YCenter-yValue;
60527
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60528
+ }
60529
+ else
60530
+ {
60531
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60532
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60533
+ }
60534
+ }
60535
+
60513
60536
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
60514
60537
  {
60515
60538
  var isOverlayIndex=false; //是否有叠加子坐标
@@ -60540,17 +60563,8 @@ function ChartCorssCursor()
60540
60563
  {
60541
60564
  var rtBG={ Right:right+overlayIndexInterval, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60542
60565
  rtBG.Left=rtBG.Right-rtBG.Width;
60543
- if (complexText.ShowType==1)
60544
- {
60545
- rtBG.Top=rtBG.YCenter-this.TextHeight/2;
60546
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60547
- }
60548
- else
60549
- {
60550
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60551
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60552
- }
60553
-
60566
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
60567
+
60554
60568
  if (rtBG.Right>chartRight)
60555
60569
  {
60556
60570
  rtBG.Right=chartRight;
@@ -60569,16 +60583,7 @@ function ChartCorssCursor()
60569
60583
  {
60570
60584
  var rtBG={ Left:right+1, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60571
60585
  rtBG.Right=rtBG.Left+rtBG.Width;
60572
- if (complexText.ShowType==1)
60573
- {
60574
- rtBG.Top=rtBG.YCenter-this.TextHeight/2;
60575
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60576
- }
60577
- else
60578
- {
60579
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60580
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60581
- }
60586
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
60582
60587
 
60583
60588
  if (rtBG.Right>chartRight)
60584
60589
  {
@@ -60596,11 +60601,9 @@ function ChartCorssCursor()
60596
60601
  {
60597
60602
  var rtBG={ Right:right, Width:textSize.Width, YCenter:y, Height:textSize.Height };
60598
60603
  rtBG.Left=rtBG.Right-rtBG.Width;
60599
- rtBG.Top=rtBG.YCenter-rtBG.Height/2;
60600
- rtBG.Bottom=rtBG.Top+rtBG.Height;
60601
-
60604
+ _Temp_CalculateRightTextBGTop(rtBG,complexText,this.TextHeight);
60605
+
60602
60606
  this.Canvas.fillStyle=this.TextBGColor;
60603
- var showLeft=right-textSize.Width;
60604
60607
  this.DrawTextBGRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
60605
60608
  this.DrawComplexRightText(rtBG,complexText,textSize);
60606
60609
 
@@ -158809,7 +158812,7 @@ function HQChartScriptWorker()
158809
158812
 
158810
158813
 
158811
158814
 
158812
- var HQCHART_VERSION="1.1.14721";
158815
+ var HQCHART_VERSION="1.1.14730";
158813
158816
 
158814
158817
  function PrintHQChartVersion()
158815
158818
  {