hqchart 1.1.13246 → 1.1.13253

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.
@@ -1986,8 +1986,7 @@ case JSCHART_MENU_ID.CMD_DELETE_TRADE_INDEX_ID://删除专家系统(交易指标
1986
1986
  if(this.CancelInstructionIndex)this.CancelInstructionIndex();break;case JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID://切换K线类型
1987
1987
  if(this.ChangeKLineDrawType&&param!=null)this.ChangeKLineDrawType(param,aryArgs[1],aryArgs[2]);break;case JSCHART_MENU_ID.CMD_CHANGE_PRICE_GAP_ID://缺口提示
1988
1988
  if(this.ChangePriceGap&&IFrameSplitOperator.IsBool(aryArgs[0])){if(aryArgs[0]==false){this.ChangePriceGap({Enable:aryArgs[0]});}else{if(IFrameSplitOperator.IsNumber(aryArgs[1]))this.ChangePriceGap({Enable:aryArgs[0],Count:aryArgs[1]});}}break;case JSCHART_MENU_ID.CMD_OVERLAY_SYMBOL_ID:if(aryArgs[1]===true){if(this.OverlaySymbol&&aryArgs[0])this.OverlaySymbol(aryArgs[0]);}else if(aryArgs[1]===false){if(this.DeleteOverlaySymbol&&aryArgs[0])this.DeleteOverlaySymbol(aryArgs[0]);}break;case JSCHART_MENU_ID.CMD_DELETE_ALL_OVERLAY_SYMBOL_ID:if(this.ClearOverlaySymbol)this.ClearOverlaySymbol();break;case JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID:if(this.ChangeCoordinateType&&aryArgs[0])this.ChangeCoordinateType(aryArgs[0]);break;case JSCHART_MENU_ID.CMD_CHANGE_KLINE_INFO_ID:if(aryArgs[0]&&IFrameSplitOperator.IsBool(aryArgs[1])){if(aryArgs[1]==true&&this.AddKLineInfo)this.AddKLineInfo(aryArgs[0],true);else if(aryArgs[1]==false&&this.DeleteKLineInfo)this.DeleteKLineInfo(aryArgs[0]);}break;case JSCHART_MENU_ID.CMD_DELETE_ALL_KLINE_INFO_ID:if(this.ClearKLineInfo)this.ClearKLineInfo();break;case JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID:if(param!=null)this.DragMode=param;break;case JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID:if(IFrameSplitOperator.IsBool(srcParam)){if(srcParam){this.CreateExtendChart("SessionBreaksPaint",{});this.Draw();}else{var finder=this.GetExtendChartByClassName("SessionBreaksPaint");if(finder){this.DeleteExtendChartByID(finder.Chart.ID);this.Draw();}}}break;case JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID:if(!this.IsShowDrawToolDialog())this.ShowDrawToolDialog();break;case JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID:var option={Name:'筹码分布',ShowType:1,Width:230};var extendChart=this.CreateExtendChart(option.Name,option);//创建扩展图形
1989
- this.SetSizeChange(true);this.Draw();break;case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:var StockChip=chart.GetExtendChartByClassName('StockChip');if(StockChip){var chipWidth=StockChip.Chart.Width;var chipIndex=parseInt(StockChip.Index);for(var i=chipIndex+1;i<this.ExtendChartPaint.length;++i)//在筹码后面创建的需要筹码的宽度
1990
- {var item=this.ExtendChartPaint[i];if(item.ClassName=='DrawToolsButton'){item.Left-=chipWidth;}}this.DeleteExtendChart(StockChip);this.Frame.ChartBorder.Right-=chipWidth;this.SetSizeChange(true);this.Draw();}break;case JSCHART_MENU_ID.CMD_ENABLE_SELECT_RECT_ID:if(IFrameSplitOperator.IsBool(srcParam))this.EnableSelectRect=srcParam;break;case JSCHART_MENU_ID.CMD_CHANGE_DAY_COUNT_ID:if(this.ChangeDayCount&&param!=null)this.ChangeDayCount(param);break;case JSCHART_MENU_ID.CMD_SHOW_BEFORE_DATA_ID:if(this.ShowCallAuctionData&&IFrameSplitOperator.IsBool(srcParam))this.ShowCallAuctionData({Left:srcParam,MultiDay:{Left:srcParam}});break;case JSCHART_MENU_ID.CMD_SELECTED_ZOOM_ID:if(this.ShowSelectData&&srcParam)this.ShowSelectData(srcParam);break;case JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID:var dlg=new KLineSelectRectDialog(this.DivElement);dlg.DoModal(srcParam);break;case JSCHART_MENU_ID.CMD_SHOW_INDEX_ID://显示隐藏指标 [0]=windowIndex [1]=0=自动 1=隐藏 2=显示
1989
+ this.SetSizeChange(true);this.Draw();break;case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:var StockChip=this.GetExtendChartByClassName('StockChip');if(StockChip){var chipWidth=StockChip.Chart.Width;this.DeleteExtendChart(StockChip);this.Frame.ChartBorder.Right-=chipWidth;this.SetSizeChange(true);this.Draw();}break;case JSCHART_MENU_ID.CMD_ENABLE_SELECT_RECT_ID:if(IFrameSplitOperator.IsBool(srcParam))this.EnableSelectRect=srcParam;break;case JSCHART_MENU_ID.CMD_CHANGE_DAY_COUNT_ID:if(this.ChangeDayCount&&param!=null)this.ChangeDayCount(param);break;case JSCHART_MENU_ID.CMD_SHOW_BEFORE_DATA_ID:if(this.ShowCallAuctionData&&IFrameSplitOperator.IsBool(srcParam))this.ShowCallAuctionData({Left:srcParam,MultiDay:{Left:srcParam}});break;case JSCHART_MENU_ID.CMD_SELECTED_ZOOM_ID:if(this.ShowSelectData&&srcParam)this.ShowSelectData(srcParam);break;case JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID:var dlg=new KLineSelectRectDialog(this.DivElement);dlg.DoModal(srcParam);break;case JSCHART_MENU_ID.CMD_SHOW_INDEX_ID://显示隐藏指标 [0]=windowIndex [1]=0=自动 1=隐藏 2=显示
1991
1990
  if(param==null||!IFrameSplitOperator.IsNumber(aryArgs[1]))return false;var windowIndex=param,showType=aryArgs[1];var script=this.WindowIndex[windowIndex];if(!script)return false;if(showType==1)script.IsShow=false;else if(showType==2)script.IsShow=true;else script.IsShow=!script.IsShow;this.UpdateWindowIndex(windowIndex);break;case JSCHART_MENU_ID.CMD_SHOW_OVERLAY_INDEX_ID://显示隐藏叠加指标 [0]=indexGuid [1]=0=自动 1=隐藏 2=显示
1992
1991
  if(!srcParam||!IFrameSplitOperator.IsNumber(aryArgs[1]))return false;var indexGuid=srcParam,showType=aryArgs[1];var overlay=this.GetOverlayIndexByIdentify(indexGuid);if(!overlay||!overlay.OverlayItem||!overlay.OverlayItem.Script)return false;var script=overlay.OverlayItem.Script;if(showType==1)script.IsShow=false;else if(showType==2)script.IsShow==true;else script.IsShow=!script.IsShow;this.UpdateOverlayIndex(indexGuid);break;case JSCHART_MENU_ID.CMD_DELETE_OVERLAY_INDEX_ID:if(srcParam&&this.DeleteOverlayWindowsIndex)this.DeleteOverlayWindowsIndex(srcParam);break;case JSCHART_MENU_ID.CMD_SHOW_OVERLAY_Y_AXIS_ID:if(!srcParam||!IFrameSplitOperator.IsNumber(aryArgs[1]))return false;if(!this.GetOverlayIndexByIdentify)return false;var indexGuid=srcParam,showType=aryArgs[1];var finder=this.GetOverlayIndexByIdentify(indexGuid);if(!finder||!finder.OverlayItem)return false;var frame=finder.OverlayItem.Frame;if(showType==1)frame.IsShow=false;else if(showType==2)frame.IsShow==true;else frame.IsShow=!frame.IsShow;this.UpdataDataoffset();//更新数据偏移
1993
1992
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
@@ -2031,6 +2030,7 @@ this.ExtendLine;//延长线长度[ ] { Width:长度 } [0]=左 [1]=右 实例: [
2031
2030
  this.ExtendData;//扩展属性
2032
2031
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
2033
2032
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
2033
+ this.AreaData;//区域: { Start:, End:, BGColor:, Position:[0=左, 1=右] }
2034
2034
  }//边框信息
2035
2035
  function ChartBorder(){this.UIElement;//四周间距
2036
2036
  this.Left=50;this.Right=80;this.Top=50;this.Bottom=50;this.TitleHeight=24;//标题高度
@@ -2230,7 +2230,14 @@ var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i
2230
2230
  if(itemText.TextColor)this.Canvas.fillStyle=itemText.TextColor;else this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);if(i==0)this.DrawLine(left,textLeft,yText,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;}}}if(item.Type==3||item.Type==4){if(item.Title){var width=this.Canvas.measureText(item.Title).width+2*pixelTatio;if(this.IsHScreen){var bgTop=bottom-itemText.Width-width;var textLeft=y-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,width);this.DrawHScreenText({X:y,Y:bgTop},{Text:item.Title,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});}else{var bgTop=y-textHeight/2-1*pixelTatio;var textLeft=right-textWidth-width-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Title,textLeft+1*pixelTatio,y);}}}}else{if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var preTextRect=null;if(mapTextRect&&mapTextRect.has(3))preTextRect=mapTextRect.get(3);var yText=y;var rtText={};for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=bottom;//bgTop+=(textWidth-itemText.Width);
2231
2231
  var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,itemText.Width);this.DrawHScreenText({X:yText,Y:bgTop},{Text:itemText.Text,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});if(i==0)this.DrawLine(top,bgTop,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){if(this.GetEventCallback){var bgTop=yText-textHeight/2-1*pixelTatio;var sendData={Top:bgTop,Left:right,Right:this.ChartBorder.GetChartWidth(),Height:null,IsShow:true,BGColor:item.LineColor,TextColor:item.TextColor,PixelTatio:pixelTatio,Position:"Right",IsInside:false};if(this.SendDrawCountDownEvent(sendData)){if(IFrameSplitOperator.IsPlusNumber(sendData.Height))yText+=textHeight+1*pixelTatio;}}}else{var bgTop=yText-textHeight/2-1*pixelTatio;if(i==0&&textInfo.Text.length==0){var textLeft=right;rtText.Left=textLeft;if(preTextRect&&bgTop<preTextRect.Rect.Bottom){yText=preTextRect.Rect.Bottom;bgTop=yText-textHeight/2-1*pixelTatio;}}else{var textLeft=right+textWidth-itemText.Width;}if(item.ExtendLine&&item.ExtendLine[1])//右侧延长线
2232
2232
  {var exLine=item.ExtendLine[1];if(IFrameSplitOperator.IsNumber(exLine.Width)){if(i==0)this.DrawLine(right,textLeft+exLine.Width,y,item.LineColor,item.LineType,item);textLeft+=exLine.Width;}}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(textLeft),ToFixedPoint(bgTop),ToFixedRect(itemText.Width+1),ToFixedRect(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft+2*pixelTatio,yText);}else{this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);if(itemText.TextColor)this.Canvas.fillStyle=itemText.TextColor;else this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,y,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;rtText.Bottom=yText;}}}if(mapTextRect&&IFrameSplitOperator.IsNumber(rtText.Left)&&IFrameSplitOperator.IsNumber(rtText.Bottom)){mapTextRect.set(3,{Rect:rtText,Item:item});}if(item.Type==3||item.Type==4){if(item.Title){var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
2233
- var width=this.Canvas.measureText(item.Title).width+2*pixelTatio;if(this.IsHScreen){var bgTop=bottom-width;var textLeft=y-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,width);this.DrawHScreenText({X:y,Y:bgTop},{Text:item.Title,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});}else{var bgTop=y-textHeight/2-1*pixelTatio;var textLeft=right-width-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Title,textLeft+1*pixelTatio,y);}}}}}};this.SendDrawCountDownEvent=function(sendData){if(!this.GetEventCallback)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_COUNTDOWN);if(!event||!event.Callback)return false;event.Callback(event,sendData,this);return true;};this.DrawDotLine=function(left,right,y,color,option){var pixelTatio=GetDevicePixelRatio();this.Canvas.save();this.Canvas.strokeStyle=color;if(option&&IFrameSplitOperator.IsPlusNumber(option.LineWidth))this.Canvas.lineWidth=option.LineWidth*pixelTatio;if(option.LineDash)this.Canvas.setLineDash(option.LineDash);else this.Canvas.setLineDash([5*pixelTatio,5*pixelTatio]);//虚线
2233
+ var width=this.Canvas.measureText(item.Title).width+2*pixelTatio;if(this.IsHScreen){var bgTop=bottom-width;var textLeft=y-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,width);this.DrawHScreenText({X:y,Y:bgTop},{Text:item.Title,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});}else{var bgTop=y-textHeight/2-1*pixelTatio;var textLeft=right-width-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Title,textLeft+1*pixelTatio,y);}}}}}};this.DrawCustomAreaItem=function(item)//自定义Y轴区域
2234
+ {if(!item.AreaData)return;if(this.IsHScreen)return;//暂时不支持横屏
2235
+ //item.AreaData; //区域: { Value[], BGColor:, Position:[0=左, 1=右] }
2236
+ if(!IFrameSplitOperator.IsNonEmptyArray(item.AreaData.Value)||item.AreaData.Value.length!=2)return;var max=Math.max(item.AreaData.Value[0],item.AreaData.Value[1]);var min=Math.min(item.AreaData.Value[0],item.AreaData.Value[1]);if(min>=this.HorizontalMax)return;if(max<=this.HorizontalMin)return;if(max>this.HorizontalMax)max=this.HorizontalMax;if(min<this.HorizontalMin)min=this.HorizontalMin;var border=this.GetBorder();var left=border.Left;var right=border.Right;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var yTop=this.GetYFromData(max);var yBottom=this.GetYFromData(min);if(item.AreaData.Position.includes(0)&&borderLeft>10)//左
2237
+ {var rtBG={Left:0,Right:left-1,Top:yTop,Bottom:yBottom};rtBG.Height=rtBG.Bottom-rtBG.Top;rtBG.Width=rtBG.Right-rtBG.Left;this.Canvas.fillStyle=item.AreaData.BGColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawCustomAreaText(rtBG,item,0);}if(item.AreaData.Position.includes(1)&&borderRight>10)//右
2238
+ {var rtBG={Left:right+1,Top:yTop,Bottom:yBottom};rtBG.Height=rtBG.Bottom-rtBG.Top;if(this.YRightTextInfo&&IFrameSplitOperator.IsNumber(this.YRightTextInfo.MainTextWidth))//右侧自动调整 可以获取宽度
2239
+ {rtBG.Width=this.YRightTextInfo.MainTextWidth-1;rtBG.Right=rtBG.Left+rtBG.Width;}else{rtBG.Right=border.ChartWidth;rtBG.Width=rtBG.Right-rtBG.Left;}this.Canvas.fillStyle=item.AreaData.BGColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.DrawCustomAreaText(rtBG,item,1);}};this.DrawCustomAreaText=function(rtBG,item,position)//position 0=左 1=右
2240
+ {if(item.Font!=null)this.Canvas.font=item.Font;var fontHeight=this.GetFontHeight();if(rtBG.Height<fontHeight)return;var pixelTatio=GetDevicePixelRatio();var text,xText;if(position==0){if(!item.Message[0])return;this.Canvas.textAlign="right";text=item.Message[0];xText=rtBG.Right-2*pixelTatio;}else if(position==1){if(!item.Message[1])return;this.Canvas.textAlign="left";text=item.Message[1];xText=rtBG.Left+2*pixelTatio;}var yText=rtBG.Top+rtBG.Height/2;this.Canvas.textBaseline="middle";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(text,xText,yText);};this.SendDrawCountDownEvent=function(sendData){if(!this.GetEventCallback)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_COUNTDOWN);if(!event||!event.Callback)return false;event.Callback(event,sendData,this);return true;};this.DrawDotLine=function(left,right,y,color,option){var pixelTatio=GetDevicePixelRatio();this.Canvas.save();this.Canvas.strokeStyle=color;if(option&&IFrameSplitOperator.IsPlusNumber(option.LineWidth))this.Canvas.lineWidth=option.LineWidth*pixelTatio;if(option.LineDash)this.Canvas.setLineDash(option.LineDash);else this.Canvas.setLineDash([5*pixelTatio,5*pixelTatio]);//虚线
2234
2241
  this.Canvas.beginPath();if(this.IsHScreen){this.Canvas.moveTo(ToFixedPoint(y),left);this.Canvas.lineTo(ToFixedPoint(y),right);}else{this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));}this.Canvas.stroke();this.Canvas.restore();};this.DrawLine=function(left,right,y,color,lineType,option){if(lineType==-1)return;if(lineType==0){var pixelRatio=GetDevicePixelRatio();this.Canvas.strokeStyle=color;var bChangeLineWidth=false;if(option&&IFrameSplitOperator.IsPlusNumber(option.LineWidth)){this.Canvas.lineWidth=option.LineWidth*pixelRatio;bChangeLineWidth=true;}this.Canvas.beginPath();if(this.IsHScreen){this.Canvas.moveTo(ToFixedPoint(y),left);this.Canvas.lineTo(ToFixedPoint(y),right);}else{this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));}this.Canvas.stroke();if(bChangeLineWidth){this.Canvas.lineWidth=pixelRatio;}}else{this.DrawDotLine(left,right,y,color,option);}};this.DrawHScreenText=function(center,data){this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=data.Color;this.Canvas.save();this.Canvas.translate(center.X,center.Y);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillText(data.Text,data.XOffset,data.YOffset);this.Canvas.restore();};this.RGBToStruct=function(rgb){if(/^(rgb|RGB)/.test(rgb)){var aColor=rgb.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",");var result={};if(aColor.length!=3)return null;result.R=Number(aColor[0]);result.G=Number(aColor[1]);result.B=Number(aColor[2]);return result;}return null;};this.GetMulitTextMaxWidth=function(aryData){var width=null;for(var i=0;i<aryData.length;++i){var item=aryData[i];var text=item.Text;if(!text)continue;var value=this.Canvas.measureText(text).width;if(width==null)width=value;else if(width<value)width=value;}return width;};this.GetScaleTextWidth=function(){var border=this.ChartBorder.GetBorder();var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
2235
2242
  if(this.IsHScreen){var borderTop=this.ChartBorder.Top;var borderBottom=this.ChartBorder.Bottom;var isDrawLeft=borderTop>10*pixelTatio&&this.IsShowYText[0]===true&&this.YTextPosition[0]!=2;var isDrawRight=borderBottom>10*pixelTatio&&this.IsShowYText[1]===true&&this.YTextPosition[1]!=2;}else{var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var isDrawLeft=borderLeft>10&&this.IsShowYText[0]===true&&this.YTextPosition[0]!=2;var isDrawRight=borderRight>10&&this.IsShowYText[1]===true&&this.YTextPosition[1]!=2;}if(!isDrawRight&&!isDrawLeft)return null;var width={Left:null,Right:null};var rightExtendWidth=0;var isYPercentage=false;//是否是百分比坐标
2236
2243
  if(this.YSplitOperator&&this.YSplitOperator.CoordinateType==1)isYPercentage=true;var leftExtendLineWidth=0;var rightExtendLineWidth=0;if(IFrameSplitOperator.IsNonEmptyArray(this.YLineExtend)){if(this.YLineExtend[0]&&this.YLineExtend[0].Width>1)leftExtendLineWidth=this.YLineExtend[0].Width;if(this.YLineExtend[1]&&this.YLineExtend[1].Width>1)rightExtendLineWidth=this.YLineExtend[1].Width;}for(var i=0;i<this.HorizontalInfo.length;++i){var textWidth=null;var item=this.HorizontalInfo[i];if(!item)continue;if(item.Font!=null)this.Canvas.font=item.Font;if(item.Message[0]!=null&&isDrawLeft){if(Array.isArray(item.Message[0])){textWidth=this.GetMulitTextMaxWidth(item.Message[0]);}else{textWidth=this.Canvas.measureText(item.Message[0]).width;}if(width.Left==null||width.Left<textWidth)width.Left=textWidth;//JSConsole.Chart.Log(`[ChartData::GetScaleTextWidth] ${item.Message[0]} ${textWidth}`);
@@ -2443,7 +2450,7 @@ case 1://固定价格刻度
2443
2450
  this.DrawCustomItem(item,mapTextRect);break;case 2://当前屏最后一个K线价格刻度
2444
2451
  case 3://主图K线涨幅刻度
2445
2452
  case 4://叠加K线涨幅刻度
2446
- this.DrawCustomItem(item,mapTextRect);break;}}};this.DrawCustomVerticalItem=function(item){this.Canvas.save();if(item.Data.Line.Type==1)this.Canvas.setLineDash([5,5]);//虚线
2453
+ this.DrawCustomItem(item,mapTextRect);break;case 5:this.DrawCustomAreaItem(item);break;}}};this.DrawCustomVerticalItem=function(item){this.Canvas.save();if(item.Data.Line.Type==1)this.Canvas.setLineDash([5,5]);//虚线
2447
2454
  this.Canvas.strokeStyle=item.Data.Line.Color;this.Canvas.beginPath();if(item.IsHScreen){this.Canvas.moveTo(item.Top,ToFixedPoint(item.X));this.Canvas.lineTo(item.Bottom,ToFixedPoint(item.X));}else{this.Canvas.moveTo(ToFixedPoint(item.X),item.Top);this.Canvas.lineTo(ToFixedPoint(item.X),item.Bottom);}this.Canvas.stroke();this.Canvas.restore();};this.DrawCustomVertical=function()//X轴定制刻度显示
2448
2455
  {if(!this.CustomVerticalInfo)return;if(this.CustomVerticalInfo.length<=0)return;if(!this.Data)return;var isHScreen=this.IsHScreen;var top=this.ChartBorder.GetTopEx();var bottom=this.ChartBorder.GetBottomEx();var dataWidth=this.DataWidth;var distanceWidth=this.DistanceWidth;var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+2.0;if(isHScreen){xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+2.0;top=this.ChartBorder.GetLeftEx();bottom=this.ChartBorder.GetRightEx();}var j=0;for(var i=this.Data.DataOffset;i<this.Data.Data.length&&j<this.XPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){var kItem=this.Data.Data[i];for(var k in this.CustomVerticalInfo){var item=this.CustomVerticalInfo[k];if(item.Type!=0)continue;if(IFrameSplitOperator.IsNumber(item.Time)){if(kItem.Date!=item.Date||kItem.Time!=item.Time)continue;}else{if(kItem.Date!=item.Date)continue;}var left=xOffset;var right=xOffset+dataWidth;var x=left+(right-left)/2;var DrawData={X:x,Top:top,Bottom:bottom,Data:item,IsHScreen:isHScreen};this.DrawCustomVerticalItem(DrawData);if(this.DrawCustomVerticalEvent)this.DrawCustomVerticalEvent.Callback(this.DrawCustomVerticalEvent,DrawData,this);break;}}for(var i=1;j<this.XPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){for(var k in this.CustomVerticalInfo){var item=this.CustomVerticalInfo[k];if(item.Type!=1)continue;if(item.Space!=i)continue;var left=xOffset;var right=xOffset+dataWidth;var x=left+(right-left)/2;var DrawData={X:x,Top:top,Bottom:bottom,Data:item,IsHScreen:isHScreen};this.DrawCustomVerticalItem(DrawData);if(this.DrawCustomVerticalEvent)this.DrawCustomVerticalEvent.Callback(this.DrawCustomVerticalEvent,DrawData,this);break;}}};this.DrawSelectedBorder=function(option){if(this.Identify===0)return;var border=this.IsHScreen==true?this.ChartBorder.GetHScreenBorder():this.ChartBorder.GetBorder();var left=ToFixedPoint(border.Left);var top=ToFixedPoint(border.Top);var right=ToFixedPoint(border.Right);var bottom=ToFixedPoint(border.Bottom);var height=bottom-top;this.Canvas.strokeStyle=this.SelBorderColor;if(option.Mode==1){var xRight=ToFixedPoint(border.ChartWidth);this.Canvas.strokeRect(right,top,xRight-right-1,height);//少一个像素让边框显示出来
2449
2456
  }else{this.Canvas.strokeRect(left,top,right-left-1,height);//少一个像素让边框显示出来
@@ -13130,13 +13137,13 @@ this.SelectedClassName="UMyChart_MenuItem_Tr_Selected";this.AryTDClassName=["UMy
13130
13137
  "UMyChart_MenuItem_Td_Arrow"//箭头
13131
13138
  ];this.Inital=function(){var _this67=this;window.addEventListener('mousedown',function(e){_this67.OnWindowMouseDown(e);});};//创建菜单
13132
13139
  this.CreatePopMenu=function(data){this.Clear();if(!IFrameSplitOperator.IsNonEmptyArray(data.Menu))return;var root=document.createElement("div");root.className="UMyChart_PopMenu";var table=document.createElement("table");table.className="UMyChart_PopMenu_Table";root.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_PopMenu_Tbody";table.appendChild(tbody);var rootData={Root:root,TBody:tbody,Table:table};for(var i=0;i<data.Menu.length;++i){var item=data.Menu[i];if(item.Name==JSPopMenu.SEPARATOR_LINE_NAME){var trSeparator=this.CreateSeparatorTr();if(trSeparator)tbody.appendChild(trSeparator);continue;}var trDom=this.CreateMenu(rootData,item);tbody.appendChild(trDom);}document.body.appendChild(root);this.RootDOM=root;this.TBodyDOM=tbody;if(IFrameSplitOperator.IsNumber(data.Position))this.Data.Position=data.Position;if(data.ClickCallback)this.ClickCallback=data.ClickCallback;};//清除菜单
13133
- this.Clear=function(){this.Data.Menu=[];this.Data.Position=JSPopMenu.POSITION_ID.RIGHT_MENU_ID;this.ClickCallback=null;if(!this.RootDOM)return;document.body.removeChild(this.RootDOM);this.RootDOM=null;this.TBodyDOM=null;for(var i=0;i<this.ArySubRootDOM.length;++i){document.body.removeChild(this.ArySubRootDOM[i]);}this.ArySubRootDOM=[];};this.CreateMenu=function(parentItem,item){var _this68=this;var trDom=document.createElement("tr");trDom.className='UMyChart_MenuItem_Tr';var prtTdDom=null;for(var i=0;i<this.AryTDClassName.length;++i){var tdDom=document.createElement("td");tdDom.className=this.AryTDClassName[i];if(i==0)//图标
13140
+ this.Clear=function(){this.Data.Menu=[];this.Data.Position=JSPopMenu.POSITION_ID.RIGHT_MENU_ID;this.ClickCallback=null;if(!this.RootDOM)return;document.body.removeChild(this.RootDOM);this.RootDOM=null;this.TBodyDOM=null;for(var i=0;i<this.ArySubRootDOM.length;++i){document.body.removeChild(this.ArySubRootDOM[i]);}this.ArySubRootDOM=[];};this.CreateMenu=function(parentItem,item){var _this68=this;var trDom=document.createElement("tr");trDom.className='UMyChart_MenuItem_Tr';if(item.Disable===true)trDom.classList.add('UMyChart_DrawTool_Disable_Tr');var prtTdDom=null;for(var i=0;i<this.AryTDClassName.length;++i){var tdDom=document.createElement("td");tdDom.className=this.AryTDClassName[i];if(i==0)//图标
13134
13141
  {if(item.Checked){var spanDom=document.createElement("span");spanDom.className=this.CheckedClassName;spanDom.style["font-size"]="10px";tdDom.appendChild(spanDom);}}else if(i==1)//内容
13135
13142
  {tdDom.innerText=item.Name;}else if(i==2)//快捷方式
13136
13143
  {}else if(i==3)//箭头
13137
13144
  {if(IFrameSplitOperator.IsNonEmptyArray(item.SubMenu)){var spanDom=document.createElement("span");spanDom.className=this.RightArrowClassName;spanDom.style["font-size"]="10px";tdDom.appendChild(spanDom);}}trDom.appendChild(tdDom);}if(IFrameSplitOperator.IsNonEmptyArray(item.SubMenu))//子菜单
13138
- {var subRoot=document.createElement("div");subRoot.className="UMyChart_PopSubMenu";var subTable=document.createElement("table");subTable.className="UMyChart_PopMenu_Table";subRoot.appendChild(subTable);var subTbody=document.createElement("tbody");subTbody.className="UMyChart_PopMenu_TBody";subTable.appendChild(subTbody);var subRootData={Root:subRoot,TBody:subTbody,Table:subTable};var preTrDom=null;for(var i=0;i<item.SubMenu.length;++i){var subItem=item.SubMenu[i];if(subItem.Name==JSPopMenu.SEPARATOR_LINE_NAME){var trSeparator=this.CreateSeparatorTr();if(trSeparator)subTbody.appendChild(trSeparator);continue;}var subTrDom=this.CreateMenu(subRootData,subItem);preTrDom=subTrDom;subTbody.appendChild(subTrDom);}trDom.onmouseover=function(e){_this68.OnMouseOver(e,parentItem,trDom,subRoot);};document.body.appendChild(subRoot);this.ArySubRootDOM.push(subRoot);}else{trDom.onmousedown=function(e){_this68.OnClickMenu(e,item,false);};//菜单点击
13139
- trDom.onmouseover=function(e){_this68.OnMouseOver(e,parentItem);};}return trDom;};this.CreateSeparatorTr=function(){var trSeparator=document.createElement("tr");trSeparator.className='UMyChart_MenuItem_Tr_Separator';var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Status_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);return trSeparator;};//弹tab菜单
13145
+ {var subRoot=document.createElement("div");subRoot.className="UMyChart_PopSubMenu";var subTable=document.createElement("table");subTable.className="UMyChart_PopMenu_Table";subRoot.appendChild(subTable);var subTbody=document.createElement("tbody");subTbody.className="UMyChart_PopMenu_TBody";subTable.appendChild(subTbody);var subRootData={Root:subRoot,TBody:subTbody,Table:subTable};var preTrDom=null;for(var i=0;i<item.SubMenu.length;++i){var subItem=item.SubMenu[i];if(subItem.Name==JSPopMenu.SEPARATOR_LINE_NAME){var trSeparator=this.CreateSeparatorTr();if(trSeparator)subTbody.appendChild(trSeparator);continue;}var subTrDom=this.CreateMenu(subRootData,subItem);preTrDom=subTrDom;subTbody.appendChild(subTrDom);}trDom.onmouseover=function(e){_this68.OnMouseOver(e,parentItem,trDom,subRoot);};document.body.appendChild(subRoot);this.ArySubRootDOM.push(subRoot);}else{if(item.Disable===true){}else{trDom.onmousedown=function(e){_this68.OnClickMenu(e,item,false);};//菜单点击
13146
+ trDom.onmouseover=function(e){_this68.OnMouseOver(e,parentItem);};}}return trDom;};this.CreateSeparatorTr=function(){var trSeparator=document.createElement("tr");trSeparator.className='UMyChart_MenuItem_Tr_Separator';var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Status_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);return trSeparator;};//弹tab菜单
13140
13147
  this.PopupMenuByTab=function(rtTab){if(!this.RootDOM)return;if(!rtTab)return;var xLeft=rtTab.Left;var yTop=rtTab.Top-this.RootDOM.offsetHeight;this.RootDOM.style.visibility='visible';this.RootDOM.style.top=yTop+"px";this.RootDOM.style.left=xLeft+"px";};//弹右键菜单
13141
13148
  this.PopupMenuByRight=function(x,y){if(!this.RootDOM)return;if(!IFrameSplitOperator.IsNumber(x)||!IFrameSplitOperator.IsNumber(y))return;//菜单在当前屏幕无法显示需要调整
13142
13149
  var menuHeight=this.RootDOM.offsetHeight;var yMenuBottom=y+menuHeight;var yBottom=window.innerHeight-15;if(yMenuBottom>yBottom)y=yBottom-menuHeight;var menuWidth=this.RootDOM.offsetWidth;var yMenuRight=x+menuWidth;var yRight=window.innerWidth-15;if(yMenuRight>yRight)x=yRight-menuWidth;this.RootDOM.style.visibility='visible';this.RootDOM.style.top=y+"px";this.RootDOM.style.left=x+"px";};//下拉菜单
@@ -13165,7 +13172,7 @@ JSPopMenu.SEPARATOR_LINE_NAME="MENU_SEPARATOR";//分割线
13165
13172
  jones_2000@163.com
13166
13173
 
13167
13174
  内置画图工具 设置框
13168
- */JS_DRAWTOOL_MENU_ID={CMD_SELECTED_ID:1,CMD_CHANGE_LINE_COLOR_ID:2,CMD_DELETE_ALL_RAW_CHART_ID:3};function JSDialogDrawTool(){this.AryChartGroup=[{Title:"线段",AryChart:[{Title:'线段',ClassName:'hqchart_drawtool icon-draw_line',Type:0,Data:{ID:"线段"}},{Title:'射线',ClassName:'hqchart_drawtool icon-draw_rays',Type:0,Data:{ID:"射线"}},{Title:'标价线',ClassName:'hqchart_drawtool icon-price_line',Type:0,Data:{ID:"标价线"}},{Title:'垂直线',ClassName:'hqchart_drawtool icon-vertical_line',Type:0,Data:{ID:"垂直线"}},{Title:'箭头',ClassName:'hqchart_drawtool icon-draw_rays',Type:0,Data:{ID:"箭头"}},{Title:'趋势线',ClassName:'hqchart_drawtool icon-draw_trendline',Type:0,Data:{ID:"趋势线"}},{Title:'水平线',ClassName:'hqchart_drawtool icon-draw_hline',Type:0,Data:{ID:"水平线"}},{Title:'涂鸦线段',ClassName:'hqchart_drawtool icon-draw_line',Type:0,Data:{ID:"涂鸦线段"}}]},{Title:"通道",AryChart:[{Title:'平行线',ClassName:'hqchart_drawtool icon-draw_parallel_lines',Type:0,Data:{ID:"平行线"}},{Title:'水平线段',ClassName:'hqchart_drawtool icon-draw_hlinesegment',Type:0,Data:{ID:"水平线段"}},{Title:'平行射线',ClassName:'hqchart_drawtool icon-draw_p_rays_lines',Type:0,Data:{ID:"平行射线"}},{Title:'平行通道',ClassName:'hqchart_drawtool icon-draw_parallelchannel',Type:0,Data:{ID:"平行通道"}},{Title:'价格通道线',ClassName:'hqchart_drawtool icon-draw_pricechannel',Type:0,Data:{ID:"价格通道线"}},{Title:'箱型线',ClassName:'iconfont icon-draw_box',Type:0,Data:{ID:"箱型线"}},{Title:"不相交通道",ClassName:"hqchart_drawtool icon-buxiangjiaojiao",Type:0,Data:{ID:"DisjointChannel"}},{Title:"平滑顶/底",ClassName:"hqchart_drawtool icon-tubiao_buxiangjiaotongdao",Type:0,Data:{ID:"FlatTop"}}]},{Title:"多边形",AryChart:[{Title:'圆弧线',ClassName:'hqchart_drawtool icon-draw_arc',Type:0,Data:{ID:"圆弧线"}},{Title:'矩形',ClassName:'hqchart_drawtool icon-rectangle',Type:0,Data:{ID:"矩形"}},{Title:'平行四边形',ClassName:'hqchart_drawtool icon-draw_quadrangle',Type:0,Data:{ID:"平行四边形"}},{Title:'三角形',ClassName:'hqchart_drawtool icon-draw_triangle',Type:0,Data:{ID:"三角形"}},{Title:'圆',ClassName:'hqchart_drawtool icon-draw_circle',Type:0,Data:{ID:"圆"}},{Title:'对称角度',ClassName:'hqchart_drawtool icon-draw_symangle',Type:0,Data:{ID:"对称角度"}}]},{Title:"波浪线",AryChart:[{Title:'M头W底',ClassName:'hqchart_drawtool icon-draw_wavemw',Type:0,Data:{ID:"M头W底"}},{Title:'头肩型',ClassName:'hqchart_drawtool icon-draw_head_shoulders_bt',Type:0,Data:{ID:"头肩型"}},{Title:'波浪尺',ClassName:'hqchart_drawtool icon-waveruler',Type:0,Data:{ID:"波浪尺"}},{Title:'AB波浪尺',ClassName:'hqchart_drawtool icon-waveruler',Type:0,Data:{ID:"AB波浪尺"}}]},{Title:"测量工具",AryChart:[{Title:'价格范围',ClassName:'hqchart_drawtool icon-shijianfanwei',Type:0,Data:{ID:"PriceRange"}},{Title:'时间范围',ClassName:'hqchart_drawtool icon-jiagefanwei',Type:0,Data:{ID:"DateRange"}}]},{Title:"文字",AryChart:[{Title:'价格标签',ClassName:'hqchart_drawtool icon-Tooltip',Type:0,Data:{ID:"PriceLabel"}},{Title:'价格注释',ClassName:'hqchart_drawtool icon-tooltiptext',Type:0,Data:{ID:"PriceNote"}},{Title:'向上箭头',ClassName:'iconfont icon-arrow_up',Type:0,Data:{ID:"icon-arrow_up"}},{Title:'向下箭头',ClassName:'iconfont icon-arrow_down',Type:0,Data:{ID:"icon-arrow_down"}},{Title:'向左箭头',ClassName:'iconfont icon-arrow_left',Type:0,Data:{ID:"icon-arrow_left"}},{Title:'向右箭头',ClassName:'iconfont icon-arrow_right',Type:0,Data:{ID:"icon-arrow_right"}}]}];this.ToolConfig={Title:"工具",AryTool:[{Title:"选中",ClassName:'hqchart_drawtool icon-arrow',Type:1,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_SELECTED_ID}},{Title:'尺子',ClassName:'hqchart_drawtool icon-ruler',Type:0,Data:{ID:"尺子"}},{Title:"点击切换颜色",ClassName:'hqchart_drawtool icon-fangkuai',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID}},{Title:"删除所有画线",ClassName:'hqchart_drawtool icon-recycle_bin',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_ALL_RAW_CHART_ID}}]};this.DivDialog=null;this.AryDivChart=[];this.HQChart=null;this.LineColor='rgb(255,140,0)';this.LineColorIndex=0;this.RandomLineColor=["rgb(255,69,0)","rgb(0,191,255)","rgb(255,0,255)","rgb(255,105,180)"];this.LineWidth=1*GetDevicePixelRatio();this.ColumnCount=4;this.DragTitle=null;this.Inital=function(hqchart){this.LineColor=g_JSChartResource.DrawPicture.LineColor[0];this.RandomLineColor.splice(0,0,this.LineColor);this.HQChart=hqchart;};this.Create=function(){var _this69=this;var divDom=document.createElement("div");divDom.className='UMyChart_DrawTool_Dialog_Div';var divTitle=document.createElement("div");divTitle.className='UMyChart_DrawTool_Title_Div';divTitle.innerText="画图工具";divTitle.onmousedown=function(e){_this69.OnMouseDownTitle(e);};var divClose=document.createElement("div");divClose.className='UMyChart_DrawTool_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this69.Close(e);};divTitle.appendChild(divClose);divDom.appendChild(divTitle);var table=document.createElement("table");table.className="UMyChart_DrawTool_Table";divDom.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_DrawTool_Tbody";table.appendChild(tbody);for(var i=0;i<this.AryChartGroup.length;++i){var item=this.AryChartGroup[i];if(!IFrameSplitOperator.IsNonEmptyArray(item.AryChart))continue;this.CreateChartGroupItem(item,tbody);var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_End_Tr';tbody.appendChild(trDom);}//工具栏
13175
+ */var JS_DRAWTOOL_MENU_ID={CMD_SELECTED_ID:1,CMD_CHANGE_LINE_COLOR_ID:2,CMD_DELETE_ALL_RAW_CHART_ID:3};function JSDialogDrawTool(){this.AryChartGroup=[{Title:"线段",AryChart:[{Title:'线段',ClassName:'hqchart_drawtool icon-draw_line',Type:0,Data:{ID:"线段"}},{Title:'射线',ClassName:'hqchart_drawtool icon-draw_rays',Type:0,Data:{ID:"射线"}},{Title:'标价线',ClassName:'hqchart_drawtool icon-price_line',Type:0,Data:{ID:"标价线"}},{Title:'垂直线',ClassName:'hqchart_drawtool icon-vertical_line',Type:0,Data:{ID:"垂直线"}},{Title:'箭头',ClassName:'hqchart_drawtool icon-draw_rays',Type:0,Data:{ID:"箭头"}},{Title:'趋势线',ClassName:'hqchart_drawtool icon-draw_trendline',Type:0,Data:{ID:"趋势线"}},{Title:'水平线',ClassName:'hqchart_drawtool icon-draw_hline',Type:0,Data:{ID:"水平线"}},{Title:'涂鸦线段',ClassName:'hqchart_drawtool icon-draw_line',Type:0,Data:{ID:"涂鸦线段"}}]},{Title:"通道",AryChart:[{Title:'平行线',ClassName:'hqchart_drawtool icon-draw_parallel_lines',Type:0,Data:{ID:"平行线"}},{Title:'水平线段',ClassName:'hqchart_drawtool icon-draw_hlinesegment',Type:0,Data:{ID:"水平线段"}},{Title:'平行射线',ClassName:'hqchart_drawtool icon-draw_p_rays_lines',Type:0,Data:{ID:"平行射线"}},{Title:'平行通道',ClassName:'hqchart_drawtool icon-draw_parallelchannel',Type:0,Data:{ID:"平行通道"}},{Title:'价格通道线',ClassName:'hqchart_drawtool icon-draw_pricechannel',Type:0,Data:{ID:"价格通道线"}},{Title:'箱型线',ClassName:'iconfont icon-draw_box',Type:0,Data:{ID:"箱型线"}},{Title:"不相交通道",ClassName:"hqchart_drawtool icon-buxiangjiaojiao",Type:0,Data:{ID:"DisjointChannel"}},{Title:"平滑顶/底",ClassName:"hqchart_drawtool icon-tubiao_buxiangjiaotongdao",Type:0,Data:{ID:"FlatTop"}}]},{Title:"多边形",AryChart:[{Title:'圆弧线',ClassName:'hqchart_drawtool icon-draw_arc',Type:0,Data:{ID:"圆弧线"}},{Title:'矩形',ClassName:'hqchart_drawtool icon-rectangle',Type:0,Data:{ID:"矩形"}},{Title:'平行四边形',ClassName:'hqchart_drawtool icon-draw_quadrangle',Type:0,Data:{ID:"平行四边形"}},{Title:'三角形',ClassName:'hqchart_drawtool icon-draw_triangle',Type:0,Data:{ID:"三角形"}},{Title:'圆',ClassName:'hqchart_drawtool icon-draw_circle',Type:0,Data:{ID:"圆"}},{Title:'对称角度',ClassName:'hqchart_drawtool icon-draw_symangle',Type:0,Data:{ID:"对称角度"}}]},{Title:"波浪线",AryChart:[{Title:'M头W底',ClassName:'hqchart_drawtool icon-draw_wavemw',Type:0,Data:{ID:"M头W底"}},{Title:'头肩型',ClassName:'hqchart_drawtool icon-draw_head_shoulders_bt',Type:0,Data:{ID:"头肩型"}},{Title:'波浪尺',ClassName:'hqchart_drawtool icon-waveruler',Type:0,Data:{ID:"波浪尺"}},{Title:'AB波浪尺',ClassName:'hqchart_drawtool icon-waveruler',Type:0,Data:{ID:"AB波浪尺"}}]},{Title:"测量工具",AryChart:[{Title:'价格范围',ClassName:'hqchart_drawtool icon-shijianfanwei',Type:0,Data:{ID:"PriceRange"}},{Title:'时间范围',ClassName:'hqchart_drawtool icon-jiagefanwei',Type:0,Data:{ID:"DateRange"}}]},{Title:"文字",AryChart:[{Title:'价格标签',ClassName:'hqchart_drawtool icon-Tooltip',Type:0,Data:{ID:"PriceLabel"}},{Title:'价格注释',ClassName:'hqchart_drawtool icon-tooltiptext',Type:0,Data:{ID:"PriceNote"}},{Title:'向上箭头',ClassName:'iconfont icon-arrow_up',Type:0,Data:{ID:"icon-arrow_up"}},{Title:'向下箭头',ClassName:'iconfont icon-arrow_down',Type:0,Data:{ID:"icon-arrow_down"}},{Title:'向左箭头',ClassName:'iconfont icon-arrow_left',Type:0,Data:{ID:"icon-arrow_left"}},{Title:'向右箭头',ClassName:'iconfont icon-arrow_right',Type:0,Data:{ID:"icon-arrow_right"}}]}];this.ToolConfig={Title:"工具",AryTool:[{Title:"选中",ClassName:'hqchart_drawtool icon-arrow',Type:1,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_SELECTED_ID}},{Title:'尺子',ClassName:'hqchart_drawtool icon-ruler',Type:0,Data:{ID:"尺子"}},{Title:"点击切换颜色",ClassName:'hqchart_drawtool icon-fangkuai',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID}},{Title:"删除所有画线",ClassName:'hqchart_drawtool icon-recycle_bin',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_ALL_RAW_CHART_ID}}]};this.DivDialog=null;this.AryDivChart=[];this.HQChart=null;this.LineColor='rgb(255,140,0)';this.LineColorIndex=0;this.RandomLineColor=["rgb(255,69,0)","rgb(0,191,255)","rgb(255,0,255)","rgb(255,105,180)"];this.LineWidth=1*GetDevicePixelRatio();this.ColumnCount=4;this.DragTitle=null;this.Inital=function(hqchart){this.LineColor=g_JSChartResource.DrawPicture.LineColor[0];this.RandomLineColor.splice(0,0,this.LineColor);this.HQChart=hqchart;};this.Create=function(){var _this69=this;var divDom=document.createElement("div");divDom.className='UMyChart_DrawTool_Dialog_Div';var divTitle=document.createElement("div");divTitle.className='UMyChart_DrawTool_Title_Div';divTitle.innerText="画图工具";divTitle.onmousedown=function(e){_this69.OnMouseDownTitle(e);};var divClose=document.createElement("div");divClose.className='UMyChart_DrawTool_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this69.Close(e);};divTitle.appendChild(divClose);divDom.appendChild(divTitle);var table=document.createElement("table");table.className="UMyChart_DrawTool_Table";divDom.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_DrawTool_Tbody";table.appendChild(tbody);for(var i=0;i<this.AryChartGroup.length;++i){var item=this.AryChartGroup[i];if(!IFrameSplitOperator.IsNonEmptyArray(item.AryChart))continue;this.CreateChartGroupItem(item,tbody);var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_End_Tr';tbody.appendChild(trDom);}//工具栏
13169
13176
  this.CreateToolGroup(tbody);this.DivDialog=divDom;document.body.appendChild(divDom);};this.Destroy=function(){this.AryDivChart=[];document.body.remove(this.DivDialog);this.DivDialog=null;};this.CreateChartGroupItem=function(groupItem,tbody){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_Tr';tbody.appendChild(trDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Group_Td";tdDom.innerText=groupItem.Title;tdDom.colSpan=this.ColumnCount;trDom.appendChild(tdDom);var chartCount=groupItem.AryChart.length;for(var i=0,j=0;i<chartCount;){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Tr';for(j=0;j<this.ColumnCount&&i<chartCount;++j,++i){var item=groupItem.AryChart[i];this.CreateChartItem(item,trDom);}tbody.appendChild(trDom);}};this.CreateChartItem=function(item,trDom){var _this70=this;var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Td";tdDom.title=item.Title;trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className=item.ClassName;spanDom.classList.add("UMyChart_DrawTool_Span");tdDom.appendChild(spanDom);var data={Item:item,TD:tdDom,Span:spanDom};tdDom.onmousedown=function(e){_this70.OnClickItem(e,data);};//点击
13170
13177
  this.AryDivChart.push(data);};this.OnClickItem=function(e,data){console.log('[JSDialogDrawTool::OnClickChartItem] ',data);if(!data.Item||!data.Item.Data)return;var type=data.Item.Type;var id=data.Item.Data.ID;if(type==2&&id==JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID){this.OnChangeLineColor(data);}else if(type==2&&id==JS_DRAWTOOL_MENU_ID.CMD_DELETE_ALL_RAW_CHART_ID){this.DeleteAllChart();}else if(type==1&&id==JS_DRAWTOOL_MENU_ID.CMD_SELECTED_ID){this.ClearAllSelectedChart();this.ClearCurrnetDrawPicture();}else if(type==0){this.ClearAllSelectedChart();data.Span.classList.add("UMyChart_DrawTool_Span_Selected");this.CreateDrawPicture(data);}};//清空选中状态
13171
13178
  this.ClearAllSelectedChart=function(){for(var i=0;i<this.AryDivChart.length;++i){var item=this.AryDivChart[i];item.Span.classList.remove("UMyChart_DrawTool_Span_Selected");}};this.CreateToolGroup=function(tbody){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_Tr';tbody.appendChild(trDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Group_Td";tdDom.innerText=this.ToolConfig.Title;tdDom.colSpan=this.ColumnCount;trDom.appendChild(tdDom);var chartCount=this.ToolConfig.AryTool.length;for(var i=0,j=0;i<chartCount;){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Tr';for(j=0;j<this.ColumnCount&&i<chartCount;++j,++i){var item=this.ToolConfig.AryTool[i];this.CreateToolItem(item,trDom);}tbody.appendChild(trDom);}};this.CreateToolItem=function(item,trDom){var _this71=this;var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Td";tdDom.title=item.Title;trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className=item.ClassName;spanDom.classList.add("UMyChart_DrawTool_Span");tdDom.appendChild(spanDom);var data={Item:item,TD:tdDom,Span:spanDom};if(item.Type==2&&item.Data.ID==JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID)//颜色
@@ -13187,7 +13194,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
13187
13194
  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);};}/********************************************************************************
13188
13195
  * 版本信息输出
13189
13196
  *
13190
- */var HQCHART_VERSION="1.1.13244";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();//把给外界调用的方法暴露出来
13197
+ */var HQCHART_VERSION="1.1.13252";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();//把给外界调用的方法暴露出来
13191
13198
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
13192
13199
  // BaseIndex:BaseIndex,
13193
13200
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13246",
3
+ "version": "1.1.13253",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -10,7 +10,7 @@
10
10
  内置画图工具 设置框
11
11
  */
12
12
 
13
- JS_DRAWTOOL_MENU_ID=
13
+ var JS_DRAWTOOL_MENU_ID=
14
14
  {
15
15
  CMD_SELECTED_ID:1,
16
16
  CMD_CHANGE_LINE_COLOR_ID:2,
@@ -9257,19 +9257,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9257
9257
  this.Draw();
9258
9258
  break;
9259
9259
  case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:
9260
- var StockChip=chart.GetExtendChartByClassName('StockChip');
9260
+ var StockChip=this.GetExtendChartByClassName('StockChip');
9261
9261
  if (StockChip)
9262
9262
  {
9263
9263
  var chipWidth=StockChip.Chart.Width;
9264
- var chipIndex=parseInt(StockChip.Index);
9265
- for(var i=chipIndex+1; i<this.ExtendChartPaint.length; ++i) //在筹码后面创建的需要筹码的宽度
9266
- {
9267
- var item=this.ExtendChartPaint[i];
9268
- if (item.ClassName=='DrawToolsButton')
9269
- {
9270
- item.Left-=chipWidth;
9271
- }
9272
- }
9273
9264
  this.DeleteExtendChart(StockChip);
9274
9265
  this.Frame.ChartBorder.Right-=chipWidth;
9275
9266
  this.SetSizeChange(true);
@@ -9641,6 +9632,7 @@ function CoordinateInfo()
9641
9632
  this.ExtendData; //扩展属性
9642
9633
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
9643
9634
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
9635
+ this.AreaData; //区域: { Start:, End:, BGColor:, Position:[0=左, 1=右] }
9644
9636
  }
9645
9637
 
9646
9638
 
@@ -12155,6 +12147,91 @@ function AverageWidthFrame()
12155
12147
  }
12156
12148
  }
12157
12149
 
12150
+ this.DrawCustomAreaItem=function(item) //自定义Y轴区域
12151
+ {
12152
+ if (!item.AreaData) return;
12153
+ if (this.IsHScreen) return; //暂时不支持横屏
12154
+
12155
+ //item.AreaData; //区域: { Value[], BGColor:, Position:[0=左, 1=右] }
12156
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.AreaData.Value) || item.AreaData.Value.length!=2) return;
12157
+
12158
+ var max=Math.max(item.AreaData.Value[0],item.AreaData.Value[1]);
12159
+ var min=Math.min(item.AreaData.Value[0],item.AreaData.Value[1]);
12160
+ if (min>=this.HorizontalMax) return;
12161
+ if (max<=this.HorizontalMin) return;
12162
+
12163
+ if (max>this.HorizontalMax) max=this.HorizontalMax;
12164
+ if (min<this.HorizontalMin) min=this.HorizontalMin;
12165
+
12166
+ var border=this.GetBorder();
12167
+ var left=border.Left;
12168
+ var right=border.Right;
12169
+ var borderRight = this.ChartBorder.Right;
12170
+ var borderLeft = this.ChartBorder.Left;
12171
+
12172
+ var yTop=this.GetYFromData(max);
12173
+ var yBottom=this.GetYFromData(min);
12174
+
12175
+ if (item.AreaData.Position.includes(0) && borderLeft>10) //左
12176
+ {
12177
+ var rtBG={ Left:0, Right:left-1, Top:yTop, Bottom:yBottom };
12178
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
12179
+ rtBG.Width=rtBG.Right-rtBG.Left;
12180
+ this.Canvas.fillStyle=item.AreaData.BGColor;
12181
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
12182
+ this.DrawCustomAreaText(rtBG, item, 0);
12183
+ }
12184
+
12185
+ if (item.AreaData.Position.includes(1) && borderRight>10) //右
12186
+ {
12187
+ var rtBG={ Left:right+1, Top:yTop, Bottom:yBottom };
12188
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
12189
+ if (this.YRightTextInfo && IFrameSplitOperator.IsNumber(this.YRightTextInfo.MainTextWidth)) //右侧自动调整 可以获取宽度
12190
+ {
12191
+ rtBG.Width=this.YRightTextInfo.MainTextWidth-1;
12192
+ rtBG.Right=rtBG.Left+rtBG.Width;
12193
+ }
12194
+ else
12195
+ {
12196
+ rtBG.Right=border.ChartWidth;
12197
+ rtBG.Width=rtBG.Right-rtBG.Left;
12198
+ }
12199
+
12200
+ this.Canvas.fillStyle=item.AreaData.BGColor;
12201
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
12202
+ this.DrawCustomAreaText(rtBG, item, 1);
12203
+ }
12204
+ }
12205
+
12206
+ this.DrawCustomAreaText=function(rtBG, item, position) //position 0=左 1=右
12207
+ {
12208
+ if (item.Font != null) this.Canvas.font = item.Font;
12209
+ var fontHeight=this.GetFontHeight();
12210
+ if (rtBG.Height<fontHeight) return;
12211
+
12212
+ var pixelTatio = GetDevicePixelRatio();
12213
+ var text, xText;
12214
+ if (position==0)
12215
+ {
12216
+ if (!item.Message[0]) return;
12217
+ this.Canvas.textAlign = "right";
12218
+ text=item.Message[0];
12219
+ xText=rtBG.Right-2*pixelTatio;
12220
+ }
12221
+ else if (position==1)
12222
+ {
12223
+ if (!item.Message[1]) return;
12224
+ this.Canvas.textAlign = "left";
12225
+ text=item.Message[1];
12226
+ xText=rtBG.Left+2*pixelTatio
12227
+ }
12228
+
12229
+ var yText=rtBG.Top+rtBG.Height/2;
12230
+ this.Canvas.textBaseline = "middle";
12231
+ this.Canvas.fillStyle = item.TextColor;
12232
+ this.Canvas.fillText(text, xText, yText);
12233
+ }
12234
+
12158
12235
  this.SendDrawCountDownEvent=function(sendData)
12159
12236
  {
12160
12237
  if (!this.GetEventCallback) return false;
@@ -15706,6 +15783,9 @@ function KLineFrame()
15706
15783
  case 4: //叠加K线涨幅刻度
15707
15784
  this.DrawCustomItem(item, mapTextRect);
15708
15785
  break;
15786
+ case 5:
15787
+ this.DrawCustomAreaItem(item);
15788
+ break;
15709
15789
  }
15710
15790
  }
15711
15791
  }
@@ -72814,7 +72894,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72814
72894
 
72815
72895
  { Name:"背景分割", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID, Args:[!bBGSpit]}, Checked:bBGSpit},
72816
72896
 
72817
- { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog()},
72897
+ { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog() },
72818
72898
 
72819
72899
  { Name:"移动筹码图", Data:{ ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID, Args:[]}, Checked:bShowStockChip},
72820
72900
  ]
@@ -103,6 +103,8 @@ function JSPopMenu()
103
103
  {
104
104
  var trDom=document.createElement("tr");
105
105
  trDom.className='UMyChart_MenuItem_Tr';
106
+
107
+ if (item.Disable===true) trDom.classList.add('UMyChart_DrawTool_Disable_Tr');
106
108
 
107
109
  var prtTdDom=null;
108
110
  for(var i=0;i<this.AryTDClassName.length;++i)
@@ -178,8 +180,15 @@ function JSPopMenu()
178
180
  }
179
181
  else
180
182
  {
181
- trDom.onmousedown=(e)=> { this.OnClickMenu(e, item, false); }; //菜单点击
182
- trDom.onmouseover=(e)=>{ this.OnMouseOver(e, parentItem); }
183
+ if (item.Disable===true)
184
+ {
185
+
186
+ }
187
+ else
188
+ {
189
+ trDom.onmousedown=(e)=> { this.OnClickMenu(e, item, false); }; //菜单点击
190
+ trDom.onmouseover=(e)=>{ this.OnMouseOver(e, parentItem); }
191
+ }
183
192
  }
184
193
 
185
194
  return trDom;
@@ -313,6 +322,8 @@ function JSPopMenu()
313
322
  subMenu.style.left=`${x}px`;
314
323
  subMenu.style.top=`${y}px`;
315
324
 
325
+
326
+
316
327
  trDom.classList.add(this.SelectedClassName);
317
328
 
318
329
  /*
@@ -1241,6 +1241,12 @@ input[type="color"] {
1241
1241
  height:20px;
1242
1242
  }
1243
1243
 
1244
+ .UMyChart_DrawTool_Disable_Tr
1245
+ {
1246
+ pointer-events: none;
1247
+ color:rgb(169,169,169)
1248
+ }
1249
+
1244
1250
  .UMyChart_MenuItem_Tr_Separator
1245
1251
  {
1246
1252
  height:5px;
@@ -60,6 +60,12 @@
60
60
  height:20px;
61
61
  }
62
62
 
63
+ .UMyChart_DrawTool_Disable_Tr
64
+ {
65
+ pointer-events: none;
66
+ color:rgb(169,169,169)
67
+ }
68
+
63
69
  .UMyChart_DrawTool_Span_Selected
64
70
  {
65
71
  background: rgb(128,128,128);
@@ -13149,19 +13149,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13149
13149
  this.Draw();
13150
13150
  break;
13151
13151
  case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:
13152
- var StockChip=chart.GetExtendChartByClassName('StockChip');
13152
+ var StockChip=this.GetExtendChartByClassName('StockChip');
13153
13153
  if (StockChip)
13154
13154
  {
13155
13155
  var chipWidth=StockChip.Chart.Width;
13156
- var chipIndex=parseInt(StockChip.Index);
13157
- for(var i=chipIndex+1; i<this.ExtendChartPaint.length; ++i) //在筹码后面创建的需要筹码的宽度
13158
- {
13159
- var item=this.ExtendChartPaint[i];
13160
- if (item.ClassName=='DrawToolsButton')
13161
- {
13162
- item.Left-=chipWidth;
13163
- }
13164
- }
13165
13156
  this.DeleteExtendChart(StockChip);
13166
13157
  this.Frame.ChartBorder.Right-=chipWidth;
13167
13158
  this.SetSizeChange(true);
@@ -13533,6 +13524,7 @@ function CoordinateInfo()
13533
13524
  this.ExtendData; //扩展属性
13534
13525
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
13535
13526
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
13527
+ this.AreaData; //区域: { Start:, End:, BGColor:, Position:[0=左, 1=右] }
13536
13528
  }
13537
13529
 
13538
13530
 
@@ -16047,6 +16039,91 @@ function AverageWidthFrame()
16047
16039
  }
16048
16040
  }
16049
16041
 
16042
+ this.DrawCustomAreaItem=function(item) //自定义Y轴区域
16043
+ {
16044
+ if (!item.AreaData) return;
16045
+ if (this.IsHScreen) return; //暂时不支持横屏
16046
+
16047
+ //item.AreaData; //区域: { Value[], BGColor:, Position:[0=左, 1=右] }
16048
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.AreaData.Value) || item.AreaData.Value.length!=2) return;
16049
+
16050
+ var max=Math.max(item.AreaData.Value[0],item.AreaData.Value[1]);
16051
+ var min=Math.min(item.AreaData.Value[0],item.AreaData.Value[1]);
16052
+ if (min>=this.HorizontalMax) return;
16053
+ if (max<=this.HorizontalMin) return;
16054
+
16055
+ if (max>this.HorizontalMax) max=this.HorizontalMax;
16056
+ if (min<this.HorizontalMin) min=this.HorizontalMin;
16057
+
16058
+ var border=this.GetBorder();
16059
+ var left=border.Left;
16060
+ var right=border.Right;
16061
+ var borderRight = this.ChartBorder.Right;
16062
+ var borderLeft = this.ChartBorder.Left;
16063
+
16064
+ var yTop=this.GetYFromData(max);
16065
+ var yBottom=this.GetYFromData(min);
16066
+
16067
+ if (item.AreaData.Position.includes(0) && borderLeft>10) //左
16068
+ {
16069
+ var rtBG={ Left:0, Right:left-1, Top:yTop, Bottom:yBottom };
16070
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
16071
+ rtBG.Width=rtBG.Right-rtBG.Left;
16072
+ this.Canvas.fillStyle=item.AreaData.BGColor;
16073
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
16074
+ this.DrawCustomAreaText(rtBG, item, 0);
16075
+ }
16076
+
16077
+ if (item.AreaData.Position.includes(1) && borderRight>10) //右
16078
+ {
16079
+ var rtBG={ Left:right+1, Top:yTop, Bottom:yBottom };
16080
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
16081
+ if (this.YRightTextInfo && IFrameSplitOperator.IsNumber(this.YRightTextInfo.MainTextWidth)) //右侧自动调整 可以获取宽度
16082
+ {
16083
+ rtBG.Width=this.YRightTextInfo.MainTextWidth-1;
16084
+ rtBG.Right=rtBG.Left+rtBG.Width;
16085
+ }
16086
+ else
16087
+ {
16088
+ rtBG.Right=border.ChartWidth;
16089
+ rtBG.Width=rtBG.Right-rtBG.Left;
16090
+ }
16091
+
16092
+ this.Canvas.fillStyle=item.AreaData.BGColor;
16093
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
16094
+ this.DrawCustomAreaText(rtBG, item, 1);
16095
+ }
16096
+ }
16097
+
16098
+ this.DrawCustomAreaText=function(rtBG, item, position) //position 0=左 1=右
16099
+ {
16100
+ if (item.Font != null) this.Canvas.font = item.Font;
16101
+ var fontHeight=this.GetFontHeight();
16102
+ if (rtBG.Height<fontHeight) return;
16103
+
16104
+ var pixelTatio = GetDevicePixelRatio();
16105
+ var text, xText;
16106
+ if (position==0)
16107
+ {
16108
+ if (!item.Message[0]) return;
16109
+ this.Canvas.textAlign = "right";
16110
+ text=item.Message[0];
16111
+ xText=rtBG.Right-2*pixelTatio;
16112
+ }
16113
+ else if (position==1)
16114
+ {
16115
+ if (!item.Message[1]) return;
16116
+ this.Canvas.textAlign = "left";
16117
+ text=item.Message[1];
16118
+ xText=rtBG.Left+2*pixelTatio
16119
+ }
16120
+
16121
+ var yText=rtBG.Top+rtBG.Height/2;
16122
+ this.Canvas.textBaseline = "middle";
16123
+ this.Canvas.fillStyle = item.TextColor;
16124
+ this.Canvas.fillText(text, xText, yText);
16125
+ }
16126
+
16050
16127
  this.SendDrawCountDownEvent=function(sendData)
16051
16128
  {
16052
16129
  if (!this.GetEventCallback) return false;
@@ -19598,6 +19675,9 @@ function KLineFrame()
19598
19675
  case 4: //叠加K线涨幅刻度
19599
19676
  this.DrawCustomItem(item, mapTextRect);
19600
19677
  break;
19678
+ case 5:
19679
+ this.DrawCustomAreaItem(item);
19680
+ break;
19601
19681
  }
19602
19682
  }
19603
19683
  }
@@ -76706,7 +76786,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
76706
76786
 
76707
76787
  { Name:"背景分割", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID, Args:[!bBGSpit]}, Checked:bBGSpit},
76708
76788
 
76709
- { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog()},
76789
+ { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog() },
76710
76790
 
76711
76791
  { Name:"移动筹码图", Data:{ ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID, Args:[]}, Checked:bShowStockChip},
76712
76792
  ]
@@ -131875,7 +131955,7 @@ function ScrollBarBGChart()
131875
131955
 
131876
131956
 
131877
131957
 
131878
- var HQCHART_VERSION="1.1.13244";
131958
+ var HQCHART_VERSION="1.1.13252";
131879
131959
 
131880
131960
  function PrintHQChartVersion()
131881
131961
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13244";
8
+ var HQCHART_VERSION="1.1.13252";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -13193,19 +13193,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13193
13193
  this.Draw();
13194
13194
  break;
13195
13195
  case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:
13196
- var StockChip=chart.GetExtendChartByClassName('StockChip');
13196
+ var StockChip=this.GetExtendChartByClassName('StockChip');
13197
13197
  if (StockChip)
13198
13198
  {
13199
13199
  var chipWidth=StockChip.Chart.Width;
13200
- var chipIndex=parseInt(StockChip.Index);
13201
- for(var i=chipIndex+1; i<this.ExtendChartPaint.length; ++i) //在筹码后面创建的需要筹码的宽度
13202
- {
13203
- var item=this.ExtendChartPaint[i];
13204
- if (item.ClassName=='DrawToolsButton')
13205
- {
13206
- item.Left-=chipWidth;
13207
- }
13208
- }
13209
13200
  this.DeleteExtendChart(StockChip);
13210
13201
  this.Frame.ChartBorder.Right-=chipWidth;
13211
13202
  this.SetSizeChange(true);
@@ -13577,6 +13568,7 @@ function CoordinateInfo()
13577
13568
  this.ExtendData; //扩展属性
13578
13569
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
13579
13570
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
13571
+ this.AreaData; //区域: { Start:, End:, BGColor:, Position:[0=左, 1=右] }
13580
13572
  }
13581
13573
 
13582
13574
 
@@ -16091,6 +16083,91 @@ function AverageWidthFrame()
16091
16083
  }
16092
16084
  }
16093
16085
 
16086
+ this.DrawCustomAreaItem=function(item) //自定义Y轴区域
16087
+ {
16088
+ if (!item.AreaData) return;
16089
+ if (this.IsHScreen) return; //暂时不支持横屏
16090
+
16091
+ //item.AreaData; //区域: { Value[], BGColor:, Position:[0=左, 1=右] }
16092
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.AreaData.Value) || item.AreaData.Value.length!=2) return;
16093
+
16094
+ var max=Math.max(item.AreaData.Value[0],item.AreaData.Value[1]);
16095
+ var min=Math.min(item.AreaData.Value[0],item.AreaData.Value[1]);
16096
+ if (min>=this.HorizontalMax) return;
16097
+ if (max<=this.HorizontalMin) return;
16098
+
16099
+ if (max>this.HorizontalMax) max=this.HorizontalMax;
16100
+ if (min<this.HorizontalMin) min=this.HorizontalMin;
16101
+
16102
+ var border=this.GetBorder();
16103
+ var left=border.Left;
16104
+ var right=border.Right;
16105
+ var borderRight = this.ChartBorder.Right;
16106
+ var borderLeft = this.ChartBorder.Left;
16107
+
16108
+ var yTop=this.GetYFromData(max);
16109
+ var yBottom=this.GetYFromData(min);
16110
+
16111
+ if (item.AreaData.Position.includes(0) && borderLeft>10) //左
16112
+ {
16113
+ var rtBG={ Left:0, Right:left-1, Top:yTop, Bottom:yBottom };
16114
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
16115
+ rtBG.Width=rtBG.Right-rtBG.Left;
16116
+ this.Canvas.fillStyle=item.AreaData.BGColor;
16117
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
16118
+ this.DrawCustomAreaText(rtBG, item, 0);
16119
+ }
16120
+
16121
+ if (item.AreaData.Position.includes(1) && borderRight>10) //右
16122
+ {
16123
+ var rtBG={ Left:right+1, Top:yTop, Bottom:yBottom };
16124
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
16125
+ if (this.YRightTextInfo && IFrameSplitOperator.IsNumber(this.YRightTextInfo.MainTextWidth)) //右侧自动调整 可以获取宽度
16126
+ {
16127
+ rtBG.Width=this.YRightTextInfo.MainTextWidth-1;
16128
+ rtBG.Right=rtBG.Left+rtBG.Width;
16129
+ }
16130
+ else
16131
+ {
16132
+ rtBG.Right=border.ChartWidth;
16133
+ rtBG.Width=rtBG.Right-rtBG.Left;
16134
+ }
16135
+
16136
+ this.Canvas.fillStyle=item.AreaData.BGColor;
16137
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
16138
+ this.DrawCustomAreaText(rtBG, item, 1);
16139
+ }
16140
+ }
16141
+
16142
+ this.DrawCustomAreaText=function(rtBG, item, position) //position 0=左 1=右
16143
+ {
16144
+ if (item.Font != null) this.Canvas.font = item.Font;
16145
+ var fontHeight=this.GetFontHeight();
16146
+ if (rtBG.Height<fontHeight) return;
16147
+
16148
+ var pixelTatio = GetDevicePixelRatio();
16149
+ var text, xText;
16150
+ if (position==0)
16151
+ {
16152
+ if (!item.Message[0]) return;
16153
+ this.Canvas.textAlign = "right";
16154
+ text=item.Message[0];
16155
+ xText=rtBG.Right-2*pixelTatio;
16156
+ }
16157
+ else if (position==1)
16158
+ {
16159
+ if (!item.Message[1]) return;
16160
+ this.Canvas.textAlign = "left";
16161
+ text=item.Message[1];
16162
+ xText=rtBG.Left+2*pixelTatio
16163
+ }
16164
+
16165
+ var yText=rtBG.Top+rtBG.Height/2;
16166
+ this.Canvas.textBaseline = "middle";
16167
+ this.Canvas.fillStyle = item.TextColor;
16168
+ this.Canvas.fillText(text, xText, yText);
16169
+ }
16170
+
16094
16171
  this.SendDrawCountDownEvent=function(sendData)
16095
16172
  {
16096
16173
  if (!this.GetEventCallback) return false;
@@ -19642,6 +19719,9 @@ function KLineFrame()
19642
19719
  case 4: //叠加K线涨幅刻度
19643
19720
  this.DrawCustomItem(item, mapTextRect);
19644
19721
  break;
19722
+ case 5:
19723
+ this.DrawCustomAreaItem(item);
19724
+ break;
19645
19725
  }
19646
19726
  }
19647
19727
  }
@@ -76750,7 +76830,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
76750
76830
 
76751
76831
  { Name:"背景分割", Data:{ ID:JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID, Args:[!bBGSpit]}, Checked:bBGSpit},
76752
76832
 
76753
- { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog()},
76833
+ { Name:"画图工具", Data:{ ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID, Args:[]}, Checked:this.IsShowDrawToolDialog() },
76754
76834
 
76755
76835
  { Name:"移动筹码图", Data:{ ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID, Args:[]}, Checked:bShowStockChip},
76756
76836
  ]
@@ -134423,6 +134503,8 @@ function JSPopMenu()
134423
134503
  {
134424
134504
  var trDom=document.createElement("tr");
134425
134505
  trDom.className='UMyChart_MenuItem_Tr';
134506
+
134507
+ if (item.Disable===true) trDom.classList.add('UMyChart_DrawTool_Disable_Tr');
134426
134508
 
134427
134509
  var prtTdDom=null;
134428
134510
  for(var i=0;i<this.AryTDClassName.length;++i)
@@ -134498,8 +134580,15 @@ function JSPopMenu()
134498
134580
  }
134499
134581
  else
134500
134582
  {
134501
- trDom.onmousedown=(e)=> { this.OnClickMenu(e, item, false); }; //菜单点击
134502
- trDom.onmouseover=(e)=>{ this.OnMouseOver(e, parentItem); }
134583
+ if (item.Disable===true)
134584
+ {
134585
+
134586
+ }
134587
+ else
134588
+ {
134589
+ trDom.onmousedown=(e)=> { this.OnClickMenu(e, item, false); }; //菜单点击
134590
+ trDom.onmouseover=(e)=>{ this.OnMouseOver(e, parentItem); }
134591
+ }
134503
134592
  }
134504
134593
 
134505
134594
  return trDom;
@@ -134633,6 +134722,8 @@ function JSPopMenu()
134633
134722
  subMenu.style.left=`${x}px`;
134634
134723
  subMenu.style.top=`${y}px`;
134635
134724
 
134725
+
134726
+
134636
134727
  trDom.classList.add(this.SelectedClassName);
134637
134728
 
134638
134729
  /*
@@ -134687,7 +134778,7 @@ JSPopMenu.SEPARATOR_LINE_NAME="MENU_SEPARATOR"; //分割线
134687
134778
  内置画图工具 设置框
134688
134779
  */
134689
134780
 
134690
- JS_DRAWTOOL_MENU_ID=
134781
+ var JS_DRAWTOOL_MENU_ID=
134691
134782
  {
134692
134783
  CMD_SELECTED_ID:1,
134693
134784
  CMD_CHANGE_LINE_COLOR_ID:2,
@@ -135223,7 +135314,7 @@ function HQChartScriptWorker()
135223
135314
 
135224
135315
 
135225
135316
 
135226
- var HQCHART_VERSION="1.1.13244";
135317
+ var HQCHART_VERSION="1.1.13252";
135227
135318
 
135228
135319
  function PrintHQChartVersion()
135229
135320
  {