hqchart 1.1.13823 → 1.1.13828

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.
@@ -1504,7 +1504,8 @@ ON_FORMAT_CALL_AUCTION_INDEX_TITLE:153,//集合竞价指标窗口标题内容
1504
1504
  ON_FORMAT_KLINE_HIGH_LOW_TITLE:154,//K线最高最低价格式化内容
1505
1505
  ON_CUSTOM_CORSSCURSOR_POSITION:155,//自定义十字光标X轴的输出的位置
1506
1506
  ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX:156,//日盘夜盘的分界线
1507
- ON_CUSTOM_MINUTE_BG:157//自定义分时图背景颜色
1507
+ ON_CUSTOM_MINUTE_BG:157,//自定义分时图背景颜色
1508
+ ON_CLICK_HORIZONTAL_LABEL:158//点击Y轴刻度标签
1508
1509
  };var JSCHART_OPERATOR_ID={OP_SCROLL_LEFT:1,//往左移动
1509
1510
  OP_SCROLL_RIGHT:2,//往右移动
1510
1511
  OP_ZOOM_OUT:3,//缩小
@@ -1693,7 +1694,7 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MOUSE_MOVE);var titleChart=t
1693
1694
  if(titleChart)titleChart.OnMouseMoveEvent=null;this.StartStopDisplayLatest();};this.IsMouseOnClient=function(x,y){var rect={Left:this.Frame.ChartBorder.GetLeft(),Top:this.Frame.ChartBorder.GetTop(),Width:this.Frame.ChartBorder.GetWidth(),Height:this.Frame.ChartBorder.GetHeight()};rect.Right=rect.Left+rect.Width;rect.Bottom=rect.Top+rect.Height;if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom)return true;return false;};this.UIOnContextMenu=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;if(!this.IsShowRightMenu)return;var x=e.clientX-this.UIElement.getBoundingClientRect().left;var y=e.clientY-this.UIElement.getBoundingClientRect().top;if(typeof this.OnRightMenu=='function')this.OnRightMenu(x,y,e);//右键菜单事件
1694
1695
  return false;};this.UIOnDblClick=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;this.OnDoubleClick(x,y,e);};//是否在拖拽Y轴上
1695
1696
  this.TryYDrag=function(x,y){if(!this.EnableYDrag)return null;if(!this.EnableYDrag.Left&&!this.EnableYDrag.Right)return null;if(!this.Frame||!this.Frame.PtInFrameY)return null;var dragY=this.Frame.PtInFrameY(x,y);if(!dragY||dragY.Index<0)return null;if(dragY.IsOverlay===true){if(!dragY.Right||!this.EnableYDrag.Right)return null;if(this.Frame.IsEnableOverlayDragY(dragY.Index,dragY.OverlayIndex))return dragY;return null;}if(dragY.Left&&this.EnableYDrag.Left&&this.Frame.IsEnableDragY(dragY.Index)){return dragY;}if(dragY.Right&&this.EnableYDrag.Right&&this.Frame.IsEnableDragY(dragY.Index)){return dragY;}return null;};//是否可以上下拖拽
1696
- this.TryUpDownDrag=function(x,y){var windowIndex=this.Frame.PtInFrame(x,y);if(windowIndex<0)return null;var item=this.Frame.SubFrame[windowIndex];if(!item||!item.Frame)return null;var frame=item.Frame;if(!frame.YSplitOperator||!frame.YSplitOperator.FixedYMaxMin)return null;return{Index:windowIndex,X:x,Y:y};};this.TryRectSelectDrag=function(x,y){var paint=this.GetRectSelectPaint();if(!paint)return null;if(paint.GetPointCount()<=0)return null;var item=paint.PtInPaint(x,y);return{Item:item,X:x,Y:y};};this.TryClickCrossCursor=function(x,y,e){if(!this.ChartCorssCursor)return;var button=this.ChartCorssCursor.PtInButton(x,y);if(!button)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_CROSSCURSOR_RIGHT);if(event&&event.Callback){var sendData={Button:button,e:e};event.Callback(event,sendData,this);}return true;};this.TryClickButton=function(x,y,e){var button=this.Frame.PtInButtons(x,y);if(button&&this.ClickFrameButton){this.ClickFrameButton(button,e);return true;}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}button=this.PtInDrawPictureButtons(x,y);if(button&&this.ClickDrawPictureButton){this.ClickDrawPictureButton(button,e);return true;}button=this.PtInTitleButtons(x,y);if(button&&this.ClickTitleButton){this.ClickTitleButton(button,e);return true;}return false;};this.TryMouseMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);if(!event||!event.Callback)return false;return event.Callback(event,sendData,this);};this.TryClick_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_DOWN);if(!event||!event.Callback)return false;sendData.ChartDrag=null;sendData.Cusrsor=null;event.Callback(event,sendData,this);this.CustomChartDrag=sendData.ChartDrag;this.SetCursor(sendData);};this.TryDragMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_MOVE);if(!event||!event.Callback)return;var e=sendData.e;var drag=sendData.Drag;if(Math.abs(drag.LastMove.Y-e.clientY)<2&&Math.abs(drag.LastMove.X-e.clientX)<2)return;if(event.Callback(event,sendData,this)){drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.TryMouseUp_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_UP);if(!event||!event.Callback)return;event.Callback(event,sendData,this);};this.UIOnMouseDown=function(e){var _this7=this;this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.ClickDownPoint={X:e.clientX,Y:e.clientY};this.IsOnTouch=true;this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.TryClickButton(x,y,e)){this.IsOnTouch=false;return;}var bDrawDynamicInfo=false;if(this.GlobalOption.SelectedBorder&&this.GlobalOption.SelectedBorder.Mode>=1){var item=this.GlobalOption.SelectedBorder;var frameId=this.Frame.PtInFrame(x,y);if(frameId>=0&&frameId!=item.SelFrame){item.SelFrame=frameId;bDrawDynamicInfo=true;}}var bRedraw=false;if(this.GlobalOption.SelectedXBorder&&this.GlobalOption.SelectedXBorder.Mode>=1){if(this.PtInMulitDayMinute){var item=this.GlobalOption.SelectedXBorder;var selectedDate=this.PtInMulitDayMinute(x,y);if(item.Date!=selectedDate){item.Date=selectedDate;bRedraw=true;}}}if(this.TryClickCrossCursor(x,y,e)){this.IsOnTouch=false;return;}if(this.TryClickChartTooltipData&&this.TryClickChartTooltipData(x,y,e))//预留给外部点击图标什么用的
1697
+ this.TryUpDownDrag=function(x,y){var windowIndex=this.Frame.PtInFrame(x,y);if(windowIndex<0)return null;var item=this.Frame.SubFrame[windowIndex];if(!item||!item.Frame)return null;var frame=item.Frame;if(!frame.YSplitOperator||!frame.YSplitOperator.FixedYMaxMin)return null;return{Index:windowIndex,X:x,Y:y};};this.TryRectSelectDrag=function(x,y){var paint=this.GetRectSelectPaint();if(!paint)return null;if(paint.GetPointCount()<=0)return null;var item=paint.PtInPaint(x,y);return{Item:item,X:x,Y:y};};this.TryClickCrossCursor=function(x,y,e){if(!this.ChartCorssCursor)return;var button=this.ChartCorssCursor.PtInButton(x,y);if(!button)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_CROSSCURSOR_RIGHT);if(event&&event.Callback){var sendData={Button:button,e:e};event.Callback(event,sendData,this);}return true;};this.TryClickButton=function(x,y,e){var button=this.Frame.PtInButtons(x,y);if(button&&this.ClickFrameButton){this.ClickFrameButton(button,e);return true;}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}button=this.PtInDrawPictureButtons(x,y);if(button&&this.ClickDrawPictureButton){this.ClickDrawPictureButton(button,e);return true;}button=this.PtInTitleButtons(x,y);if(button&&this.ClickTitleButton){this.ClickTitleButton(button,e);return true;}var label=this.Frame.PtInHorizontalLabel(x,y);if(label&&this.ClickHorizontalLabel){this.ClickHorizontalLabel(label,e);return true;}return false;};this.TryMouseMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);if(!event||!event.Callback)return false;return event.Callback(event,sendData,this);};this.TryClick_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_DOWN);if(!event||!event.Callback)return false;sendData.ChartDrag=null;sendData.Cusrsor=null;event.Callback(event,sendData,this);this.CustomChartDrag=sendData.ChartDrag;this.SetCursor(sendData);};this.TryDragMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_MOVE);if(!event||!event.Callback)return;var e=sendData.e;var drag=sendData.Drag;if(Math.abs(drag.LastMove.Y-e.clientY)<2&&Math.abs(drag.LastMove.X-e.clientX)<2)return;if(event.Callback(event,sendData,this)){drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.TryMouseUp_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_UP);if(!event||!event.Callback)return;event.Callback(event,sendData,this);};this.UIOnMouseDown=function(e){var _this7=this;this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.ClickDownPoint={X:e.clientX,Y:e.clientY};this.IsOnTouch=true;this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.TryClickButton(x,y,e)){this.IsOnTouch=false;return;}var bDrawDynamicInfo=false;if(this.GlobalOption.SelectedBorder&&this.GlobalOption.SelectedBorder.Mode>=1){var item=this.GlobalOption.SelectedBorder;var frameId=this.Frame.PtInFrame(x,y);if(frameId>=0&&frameId!=item.SelFrame){item.SelFrame=frameId;bDrawDynamicInfo=true;}}var bRedraw=false;if(this.GlobalOption.SelectedXBorder&&this.GlobalOption.SelectedXBorder.Mode>=1){if(this.PtInMulitDayMinute){var item=this.GlobalOption.SelectedXBorder;var selectedDate=this.PtInMulitDayMinute(x,y);if(item.Date!=selectedDate){item.Date=selectedDate;bRedraw=true;}}}if(this.TryClickCrossCursor(x,y,e)){this.IsOnTouch=false;return;}if(this.TryClickChartTooltipData&&this.TryClickChartTooltipData(x,y,e))//预留给外部点击图标什么用的
1697
1698
  {this.IsOnTouch=false;return;}if(this.TryClickLock){//JSConsole.Chart.Log('[uielement.onmousedown] left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
1698
1699
  if(this.TryClickLock(x,y))return;}this.HideSelectRect();this.ClearDragSelectRect();if(this.ChartPictureMenu)this.ChartPictureMenu.Hide();var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4){//this.UIElement.style.cursor="pointer";
1699
1700
  this.SetCursor({Cursor:"pointer"});var obj={X:e.clientX};if(this.GetXDataIndex(obj)){this.RectSelectDrag={DataIndex:obj.DataIndex,Type:item.Type,X:e.clientX};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag sub rect select ",obj);}}else{//this.UIElement.style.cursor="ew-resize";
@@ -1856,7 +1857,7 @@ event.Callback(event,data,this);if(data.PreventDefault)return;}if(button.ID==JSC
1856
1857
  }else if(button.ID==JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING){}};this.PtInTitleButtons=function(x,y){for(var i=0;i<this.TitlePaint.length;++i){var item=this.TitlePaint[i];if(!item.PtInButtons)continue;var button=item.PtInButtons(x,y);if(button){button.Chart=item;return button;}}return null;};this.OnMouseMove=function(x,y,e,isPhone){var _this9=this;this.StopDrawDynamicInfo();this.LastPoint.X=x;this.LastPoint.Y=y;var mouseStatus=null;//鼠标状态
1857
1858
  var button=null;//当前鼠标所在按钮
1858
1859
  var frameID=this.Frame.PtInFrame(x,y);if(IFrameSplitOperator.IsNumber(frameID)&&frameID>=0)//在K线内部移动,调整K线索引
1859
- this.CursorIndex=this.Frame.GetXData(x);if(this.EnableBorderDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragY=this.TryYDrag(x,y);if(dragY){mouseStatus={Cursor:dragY.Position==0?"n-resize":"row-resize",Name:"DragY"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag y ",dragY);}}if(!this.CurrentChartDrawPicture){button=this.PtInButton(x,y);if(button){mouseStatus={Cursor:"pointer",Name:button.Name};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ",button);}}if(this.ChartCorssCursor){var crossButton=this.ChartCorssCursor.PtInButton(x,y);if(crossButton){mouseStatus={Cursor:"pointer",Name:"CorssCursorButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] cross cursor button ",crossButton);}}if(this.ClassName=="KLineChartContainer"&&this.Frame.PtInFrameBottom(x,y)){mouseStatus={Cursor:"ew-resize",Name:"FrameButtom"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");}if(this.SelectedChart.EnableMoveOn&&this.PtInChart&&!this.CurrentChartDrawPicture){var chartInfo=this.PtInChart(x,y);if(chartInfo&&chartInfo.Identify){mouseStatus={Cursor:"pointer",Name:"PtInChart"};this.SelectedChart.MoveOn.Identify=chartInfo.Identify;this.SelectedChart.MoveOn.Identify=null;JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] Point in chart ",chartInfo);}else{this.SelectedChart.MoveOn.Identify=null;}}else{this.SelectedChart.MoveOn.Identify=null;}//区间选择
1860
+ this.CursorIndex=this.Frame.GetXData(x);if(this.EnableBorderDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragY=this.TryYDrag(x,y);if(dragY){mouseStatus={Cursor:dragY.Position==0?"n-resize":"row-resize",Name:"DragY"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag y ",dragY);}}if(!this.CurrentChartDrawPicture){button=this.PtInButton(x,y);if(button){mouseStatus={Cursor:"pointer",Name:button.Name};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ",button);}}if(this.ChartCorssCursor){var crossButton=this.ChartCorssCursor.PtInButton(x,y);if(crossButton){mouseStatus={Cursor:"pointer",Name:"CorssCursorButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] cross cursor button ",crossButton);}}if(this.ClassName=="KLineChartContainer"&&this.Frame.PtInFrameBottom(x,y)){mouseStatus={Cursor:"ew-resize",Name:"FrameButtom"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");}if(this.Frame.PtInHorizontalLabel&&this.Frame.PtInHorizontalLabel(x,y)){mouseStatus={Cursor:"pointer",Name:"HorizontalLabel"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame Horizontal Label ");}if(this.SelectedChart.EnableMoveOn&&this.PtInChart&&!this.CurrentChartDrawPicture){var chartInfo=this.PtInChart(x,y);if(chartInfo&&chartInfo.Identify){mouseStatus={Cursor:"pointer",Name:"PtInChart"};this.SelectedChart.MoveOn.Identify=chartInfo.Identify;this.SelectedChart.MoveOn.Identify=null;JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] Point in chart ",chartInfo);}else{this.SelectedChart.MoveOn.Identify=null;}}else{this.SelectedChart.MoveOn.Identify=null;}//区间选择
1860
1861
  var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4)mouseStatus={Cursor:"pointer",Name:"DragRectSelect"};//子区域选中
1861
1862
  else mouseStatus={Cursor:"ew-resize",Name:"DragRectSelect"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag rect select ",item);}}var sendData={MouseStatus:null,X:x,Y:y,FrameID:frameID,e:e};if(this.TryMouseMove_CustomChartDrag(sendData)){if(sendData.MouseStatus)mouseStatus=sendData.MouseStatus;}var bDrawPicture=false;//是否正在画图
1862
1863
  if(this.CurrentChartDrawPicture){var index=this.Frame.PtInChartFrame(x,y);if(this.CurrentChartDrawPicture.Status!=20){var bDrawValid=false;//是否在有效绘图区域里面
@@ -2125,7 +2126,8 @@ var bindData=this.ChartPaint[0].Data;this.BindIndexData(windowIndex,bindData);//
2125
2126
  for(var i=0;i<aryOverlayIndex.length;++i)//请求叠加指标
2126
2127
  {var item=aryOverlayIndex[i];this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);}this.UpdataDataoffset();//更新数据偏移
2127
2128
  this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
2128
- this.Draw();};}function GetDevicePixelRatio(){if(typeof window=='undefined')return 1;return window.devicePixelRatio||1;}function GetFontHeight(context,font,word){if(!context)return null;if(font)context.font=font;var text='擎';if(IFrameSplitOperator.IsString(word))text=word;var fontInfo=context.measureText(text);var textHeight=fontInfo.fontBoundingBoxAscent+fontInfo.fontBoundingBoxDescent;if(!IFrameSplitOperator.IsNumber(textHeight))textHeight=fontInfo.width+2*GetDevicePixelRatio();return textHeight;}function IsPhoneWeb(){var userAgentInfo=navigator.userAgent;var Agents=new Array("Android","iPhone","SymbianOS","Windows Phone","iPad","iPod");for(var v=0;v<Agents.length;v++){if(userAgentInfo.indexOf(Agents[v])>0)return true;}return false;}function OnKeyDown(e)//键盘事件
2129
+ this.Draw();};this.ClickHorizontalLabel=function(lable,e){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_HORIZONTAL_LABEL);if(event&&event.Callback){var data={Info:lable,PreventDefault:false};//PreventDefault 是否阻止内置的点击处理
2130
+ event.Callback(event,data,this);if(data.PreventDefault)return;}};}function GetDevicePixelRatio(){if(typeof window=='undefined')return 1;return window.devicePixelRatio||1;}function GetFontHeight(context,font,word){if(!context)return null;if(font)context.font=font;var text='擎';if(IFrameSplitOperator.IsString(word))text=word;var fontInfo=context.measureText(text);var textHeight=fontInfo.fontBoundingBoxAscent+fontInfo.fontBoundingBoxDescent;if(!IFrameSplitOperator.IsNumber(textHeight))textHeight=fontInfo.width+2*GetDevicePixelRatio();return textHeight;}function IsPhoneWeb(){var userAgentInfo=navigator.userAgent;var Agents=new Array("Android","iPhone","SymbianOS","Windows Phone","iPad","iPod");for(var v=0;v<Agents.length;v++){if(userAgentInfo.indexOf(Agents[v])>0)return true;}return false;}function OnKeyDown(e)//键盘事件
2129
2131
  {if(this.JSChartContainer&&this.JSChartContainer.OnKeyDown)this.JSChartContainer.OnKeyDown(e);}function OnWheel(e)//上下滚动事件
2130
2132
  {if(this.JSChartContainer&&this.JSChartContainer.OnWheel)this.JSChartContainer.OnWheel(e);}function ToFixed(number,precision){var b=1;if(isNaN(number))return number;if(number<0)b=-1;var multiplier=Math.pow(10,precision);var value=Math.round(Math.abs(number)*multiplier)/multiplier*b;if(/^(\d+(?:\.\d+)?)(e)([\-]?\d+)$/.test(value))var s=value.toFixed2(precision);else var s=value.toString();var rs=s.indexOf('.');if(rs<0&&precision>0){rs=s.length;s+='.';}while(s.length<=rs+precision){s+='0';}return s;}Number.prototype.toFixed2=Number.prototype.toFixed;//备份下老的
2131
2133
  Number.prototype.toFixed=function(precision){return ToFixed(this,precision);};function Guid(){function S4(){return((1+Math.random())*0x10000|0).toString(16).substring(1);}return"guid"+(S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());}function GetScrollPosition(){var scrollPos={};var scrollTop=0;var scrollLeft=0;if(document.documentElement&&(document.documentElement.scrollTop||document.documentElement.scrollLeft)){scrollTop=document.documentElement.scrollTop;scrollLeft=document.documentElement.scrollLeft;}else if(document.body){scrollTop=document.body.scrollTop;scrollLeft=document.body.scrollLeft;}scrollPos.Top=scrollTop;scrollPos.Left=scrollLeft;return scrollPos;}//修正线段有毛刺
@@ -2137,7 +2139,7 @@ return fixValue;}function ToFixedRect(value){// With a bitwise or.
2137
2139
  //rounded = ~~ (0.5 + somenum);
2138
2140
  // Finally, a left bitwise shift.
2139
2141
  //value*=GetDevicePixelRatio();
2140
- var rounded;return rounded=0.5+value<<0;}//深拷贝
2142
+ var rounded;return rounded=0.5+value<<0;}function PtInRect(x,y,rect){if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom)return true;return false;}//深拷贝
2141
2143
  function CloneData(data){if(!data)return null;var strData=(0,_stringify2.default)(data);var item=JSON.parse(strData);return item;}function IsRecvOverlap(rect1,rect2){return Math.max(rect1.Left,rect2.Left)<Math.min(rect1.Right,rect2.Right)&&Math.max(rect1.Top,rect2.Top)<Math.min(rect1.Bottom,rect2.Bottom);}function CopyMarginConfig(dest,src){if(!src||!dest)return;if(IFrameSplitOperator.IsNumber(src.Left))dest.Left=src.Left;if(IFrameSplitOperator.IsNumber(src.Top))dest.Top=src.Top;if(IFrameSplitOperator.IsNumber(src.Right))dest.Right=src.Right;if(IFrameSplitOperator.IsNumber(src.Bottom))dest.Bottom=src.Bottom;}//兼容老版本
2142
2144
  function CopyMerginConfig(dest,src){CopyMarginConfig(dest,src);}//数值比较
2143
2145
  function NumberCompare(){}//<
@@ -2232,8 +2234,10 @@ this.IsMinSize=false;//窗口是否最小化
2232
2234
  this.LogoTextColor=g_JSChartResource.FrameLogo.TextColor;this.LogoTextFont=g_JSChartResource.FrameLogo.Font;this.LogoBGColor=g_JSChartResource.FrameLogo.BGColor;this.GlobalOption;//this.IsDrawLeftBorder;
2233
2235
  this.IsDrawRightBorder=false;//是否绘制右侧刻度空白的边框
2234
2236
  this.IsDrawLeftBorder=false;//是否绘制右侧刻度空白的边框
2237
+ this.HorizontalLabel;//Y轴刻度标签页 (支持点击的才会有)[ { ID:, Args:[], }]
2235
2238
  this.PtInButtons=function(x,y)//坐标是否在按钮上
2236
- {for(var i=0;i<this.Buttons.length;++i){var item=this.Buttons[i];if(!item.Rect)continue;var rect=item.Rect;this.Canvas.beginPath();this.Canvas.rect(rect.Left,rect.Top,rect.Width,rect.Height);if(this.Canvas.isPointInPath(x,y)){return{ID:item.ID,Rect:rect};}}return null;};this.GetBorder=function(){if(this.IsHScreen)return this.ChartBorder.GetHScreenBorder();else return this.ChartBorder.GetBorder();};this.Draw=function(){this.Buttons=[];this.DrawClientBG();this.DrawFrame();this.DrawBorder();this.SizeChange=false;this.XYSplit=false;this.XSplit=false;this.YCustomSplit=false;//自定义Y轴分割线
2239
+ {for(var i=0;i<this.Buttons.length;++i){var item=this.Buttons[i];if(!item.Rect)continue;var rect=item.Rect;this.Canvas.beginPath();this.Canvas.rect(rect.Left,rect.Top,rect.Width,rect.Height);if(this.Canvas.isPointInPath(x,y)){return{ID:item.ID,Rect:rect};}}return null;};//Y轴标签文字
2240
+ this.PtInHorizontalLabel=function(x,y){if(!IFrameSplitOperator.IsNonEmptyArray(this.HorizontalLabel))return null;for(var i=0;i<this.HorizontalLabel.length;++i){var item=this.HorizontalLabel[i];var rect=item.Rect;if(PtInRect(x,y,rect)){return{ID:item.ID,Rect:rect,Item:item.Item,LineID:item.LineID};}}return;};this.GetBorder=function(){if(this.IsHScreen)return this.ChartBorder.GetHScreenBorder();else return this.ChartBorder.GetBorder();};this.Draw=function(){this.Buttons=[];this.HorizontalLabel=[];this.DrawClientBG();this.DrawFrame();this.DrawBorder();this.SizeChange=false;this.XYSplit=false;this.XSplit=false;this.YCustomSplit=false;//自定义Y轴分割线
2237
2241
  };this.DrawFrame=function(){};this.DrawClientBG=function(){if(!this.ClientBGColor)return;var border=this.IsHScreen==true?this.ChartBorder.GetHScreenBorder():this.ChartBorder.GetBorder();var left=ToFixedPoint(border.Left);var top=ToFixedPoint(border.Top);//var top=ToFixedPoint(border.TopEx);
2238
2242
  var right=ToFixedPoint(border.Right);var bottom=ToFixedPoint(border.Bottom);var width=right-left;var height=bottom-top;this.Canvas.fillStyle=this.ClientBGColor;this.Canvas.fillRect(left,top,width,height);};this.ClearCoordinateText=function(option){if(IFrameSplitOperator.IsNonEmptyArray(this.HorizontalInfo)){for(var i=0;i<this.HorizontalInfo.length;++i){var item=this.HorizontalInfo[i];if(item&&item.Message&&Array.isArray(item.Message))item.Message[0]=item.Message[1]=null;}}if(IFrameSplitOperator.IsNonEmptyArray(this.VerticalInfo)){for(var i=0;i<this.VerticalInfo.length;++i){var item=this.VerticalInfo[i];if(item&&item.Message&&Array.isArray(item.Message))item.Message[0]=item.Message[1]=null;}}};//画边框
2239
2243
  this.DrawBorder=function(){if(!this.IsShowBorder)return;if(this.IsMinSize)return;var border=this.IsHScreen==true?this.ChartBorder.GetHScreenBorder():this.ChartBorder.GetBorder();var left=ToFixedPoint(border.Left);var top=ToFixedPoint(border.Top);//var top=ToFixedPoint(border.TopEx);
@@ -2378,16 +2382,18 @@ this.Canvas.strokeStyle=outRange.Border.Color;this.Canvas.strokeRect(ToFixedPoin
2378
2382
  if(item.BGColor)bgColor=item.BGColor;var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=top;var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;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(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){}else{if(position==2)left=border.LeftEx-textInfo.MaxWidth;var bgTop=yText-textHeight/2-1*pixelTatio;var textLeft=left+1*pixelTatio;if(item.ExtendLine&&item.ExtendLine[0]&&position==2)//左侧延长线
2379
2383
  {var exLine=item.ExtendLine[0];if(IFrameSplitOperator.IsNumber(exLine.Width)){var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(exLine.Type))lineType=exLine.Type;//外部设置延长线样式
2380
2384
  if(i==0){var yLine=border.LeftEx-exLine.Width;this.DrawLine(yLine,yLine+exLine.Width,y,item.LineColor,lineType,item);}textLeft-=exLine.Width;//rectLeft-=exLine.Width
2381
- }}this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);if(i==0){if(position==2)this.DrawLine(border.LeftEx,right,yText,item.LineColor,item.LineType,item);else this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);}yText+=textHeight+1*pixelTatio;}}}}else{if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){if(i==0)var bgTop=top-itemText.Width;else var bgTop=top-textWidth;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(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{var bgTop=yText-textHeight/2-1*pixelTatio;if(i==0){var rectLeft=left-itemText.Width;var textLeft=left;}else{var rectLeft=left-textWidth;var textLeft=left-(textWidth-itemText.Width);}if(item.ExtendLine&&item.ExtendLine[0])//右侧延长线
2385
+ }}this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);if(i==0){if(position==2)this.DrawLine(border.LeftEx,right,yText,item.LineColor,item.LineType,item);else this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);}if(item.ClickData)this.AddHorizontalLabel(textLeft,bgTop,itemText.Width,textHeight,item,i);yText+=textHeight+1*pixelTatio;}}}}else{if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){if(i==0)var bgTop=top-itemText.Width;else var bgTop=top-textWidth;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(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{var bgTop=yText-textHeight/2-1*pixelTatio;if(i==0){var rectLeft=left-itemText.Width;var textLeft=left;}else{var rectLeft=left-textWidth;var textLeft=left-(textWidth-itemText.Width);}if(item.ExtendLine&&item.ExtendLine[0])//右侧延长线
2382
2386
  {var exLine=item.ExtendLine[0];if(IFrameSplitOperator.IsNumber(exLine.Width)){var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(exLine.Type))lineType=exLine.Type;//外部设置延长线样式
2383
- if(i==0)this.DrawLine(left,left-exLine.Width,y,item.LineColor,lineType,item);textLeft-=exLine.Width;rectLeft-=exLine.Width;}}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(rectLeft-1,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(rectLeft-1),ToFixedPoint(bgTop),ToFixedPoint(itemText.Width+1),ToFixedPoint(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}else{this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;}}}}else if(item.Message[1])//右
2387
+ if(i==0)this.DrawLine(left,left-exLine.Width,y,item.LineColor,lineType,item);textLeft-=exLine.Width;rectLeft-=exLine.Width;}}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(rectLeft-1,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(rectLeft-1),ToFixedPoint(bgTop),ToFixedPoint(itemText.Width+1),ToFixedPoint(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}else{this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);if(item.ClickData)//点击事件
2388
+ this.AddHorizontalLabel(textLeft,bgTop,itemText.Width,textHeight,item,i);yText+=textHeight+1*pixelTatio;}}}}else if(item.Message[1])//右
2384
2389
  {if(borderRight<10||position==1){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 bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
2385
2390
  var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=bottom-itemText.Width;var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;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,Right:right,Height:null,IsShow:true,BGColor:item.LineColor,TextColor:item.TextColor,PixelTatio:pixelTatio,Position:"Right",IsInside:true};if(this.SendDrawCountDownEvent(sendData)){if(IFrameSplitOperator.IsPlusNumber(sendData.Height))yText+=textHeight+1*pixelTatio;}}}else{var bgTop=yText-textHeight/2-1*pixelTatio;var textLeft=right-itemText.Width;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);//文本背景区域
2386
2391
  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);
2387
2392
  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])//右侧延长线
2388
2393
  {var exLine=item.ExtendLine[1];if(IFrameSplitOperator.IsNumber(exLine.Width)){var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(exLine.Type))lineType=exLine.Type;//外部设置延长线样式
2389
- if(i==0)this.DrawLine(right,textLeft+exLine.Width,y,item.LineColor,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+')';//内部刻度 背景增加透明度
2390
- 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轴区域
2394
+ if(i==0)this.DrawLine(right,textLeft+exLine.Width,y,item.LineColor,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);if(item.ClickData)//点击事件
2395
+ this.AddHorizontalLabel(textLeft,bgTop,itemText.Width,textHeight,item,i);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+')';//内部刻度 背景增加透明度
2396
+ 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.AddHorizontalLabel=function(left,top,width,height,item,lineID){var rtLabel={Left:left,Top:top,Width:width,Height:height};rtLabel.Right=rtLabel.Left+rtLabel.Width;rtLabel.Bottom=rtLabel.Top+rtLabel.Height;var lableItem={Rect:rtLabel,Item:item,ID:item.ClickData.ID,Args:item.ClickData.Args,LineID:lineID};this.HorizontalLabel.push(lableItem);};this.DrawCustomAreaItem=function(item)//自定义Y轴区域
2391
2397
  {if(!item.AreaData)return;if(this.IsHScreen)return;//暂时不支持横屏
2392
2398
  //item.AreaData; //区域: { Value[], BGColor:, Position:[0=左, 1=右] }
2393
2399
  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)//左
@@ -2395,7 +2401,8 @@ if(!IFrameSplitOperator.IsNonEmptyArray(item.AreaData.Value)||item.AreaData.Valu
2395
2401
  {var rtBG={Left:right+1,Top:yTop,Bottom:yBottom};rtBG.Height=rtBG.Bottom-rtBG.Top;if(this.YRightTextInfo&&IFrameSplitOperator.IsNumber(this.YRightTextInfo.MainTextWidth))//右侧自动调整 可以获取宽度
2396
2402
  {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=右
2397
2403
  {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]);//虚线
2398
- 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();//获取设备的分辨率
2404
+ 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 if(lineType==2)//绘制短线
2405
+ {var lineWidth=10*GetDevicePixelRatio();this.Canvas.strokeStyle=color;this.Canvas.beginPath();if(this.IsHScreen){this.Canvas.moveTo(ToFixedPoint(y),left);this.Canvas.lineTo(ToFixedPoint(y),left+lineWidth);}else{this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(left+lineWidth,ToFixedPoint(y));}this.Canvas.stroke();}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();//获取设备的分辨率
2399
2406
  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;//是否是百分比坐标
2400
2407
  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}`);
2401
2408
  }if(item.Message[1]!=null&&isDrawRight){if(item.Font!=null)this.Canvas.font=item.Font;if(Array.isArray(item.Message[1])){if(this.MultiTextFormat==1)//显示1行 格式:价格/百分比
@@ -2958,7 +2965,8 @@ var yValue=frame.GetYData(y);if(frame.YSplitOperator.CoordinateType==1)//百分
2958
2965
  }}var bottom=this.ChartBorder.GetBottom();var chartHeight=this.ChartBorder.GetChartHeight();var left=this.ChartBorder.GetLeft();var right=this.ChartBorder.GetRight();//底部
2959
2966
  if(x>=left&&x<=right&&y>bottom&&y<chartHeight)return-3;return-1;};this.PtInChartFrame=function(x,y)//鼠标在图形区域, 取出上下空白
2960
2967
  {for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];var left=item.Frame.ChartBorder.GetLeft();var top=item.Frame.ChartBorder.GetTopEx();var width=item.Frame.ChartBorder.GetWidth();var height=item.Frame.ChartBorder.GetHeightEx();item.Frame.Canvas.beginPath();item.Frame.Canvas.rect(left,top,width,height);if(item.Frame.Canvas.isPointInPath(x,y)){return i;//转成整形
2961
- }}return-1;};this.PtInButtons=function(x,y){for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(item.Height<=0)continue;var button=item.Frame.PtInButtons(x,y);if(button){button.Frame=item.Frame;button.FrameID=i;return button;}for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];var overlayFrame=overlayItem.Frame;if(!overlayFrame||!overlayFrame.PtInButtons)continue;var button=overlayFrame.PtInButtons(x,y);if(button){button.IndexID=overlayItem.Identify;button.FrameID=i;button.OverlayFrame=overlayFrame;button.Frame=item.Frame;return button;}}}return null;};//是否在X轴坐标上
2968
+ }}return-1;};//Y轴刻度标签
2969
+ this.PtInHorizontalLabel=function(x,y){for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(item.Height<=0)continue;var label=item.Frame.PtInHorizontalLabel(x,y);if(label){label.Frame=item.Frame;label.FrameID=i;return label;}}return null;};this.PtInButtons=function(x,y){for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(item.Height<=0)continue;var button=item.Frame.PtInButtons(x,y);if(button){button.Frame=item.Frame;button.FrameID=i;return button;}for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];var overlayFrame=overlayItem.Frame;if(!overlayFrame||!overlayFrame.PtInButtons)continue;var button=overlayFrame.PtInButtons(x,y);if(button){button.IndexID=overlayItem.Identify;button.FrameID=i;button.OverlayFrame=overlayFrame;button.Frame=item.Frame;return button;}}}return null;};//是否在X轴坐标上
2962
2970
  this.PtInFrameBottom=function(x,y){var left=this.ChartBorder.GetLeft();var top=this.ChartBorder.GetBottom();var width=this.ChartBorder.GetWidth();var height=this.ChartBorder.Bottom;this.Canvas.beginPath();this.Canvas.rect(left,top,width,height);if(this.Canvas.isPointInPath(x,y))return true;return false;};this.PtInFrameVertical=function(x,y){for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(item.Height<=0)continue;if(!item.Frame.PtInVertical)continue;if(item.Frame.PtInVertical(x,y)){return{Frame:item.Frame};}}return null;};this.GetXFromIndex=function(index){return this.SubFrame[0].Frame.GetXFromIndex(index);};this.GetYFromData=function(value){return this.SubFrame[0].Frame.GetYFromData(value);};this.ZoomUp=function(cursorIndex){var result=this.SubFrame[0].Frame.ZoomUp(cursorIndex);this.UpdateAllFrame();return result;};this.ZoomDown=function(cursorIndex,option){var result=this.SubFrame[0].Frame.ZoomDown(cursorIndex,option);this.UpdateAllFrame();return result;};this.SetXShowCount=function(showCount){var result=this.SubFrame[0].Frame.SetXShowCount(showCount);this.UpdateAllFrame();return result;};this.GetXShowCount=function(){var xPointcount=-1;if(!IFrameSplitOperator.IsNonEmptyArray(this.SubFrame))return xPointcount;var subFrame=this.SubFrame[0];if(!subFrame.Frame)return xPointcount;xPointcount=subFrame.Frame.XPointCount;return xPointcount;};this.XCoordinateZoom=function(step,isMoveLeft){var result=this.SubFrame[0].Frame.XCoordinateZoom(step,isMoveLeft);this.UpdateAllFrame();return result;};//设置重新计算刻度坐标
2963
2971
  this.ResetXYSplit=function(){for(var _i in this.SubFrame){this.SubFrame[_i].Frame.XYSplit=true;}};this.ResetXSplit=function(){for(var _i2 in this.SubFrame){this.SubFrame[_i2].Frame.XSplit=true;}};this.ResetYCustomSplit=function(windowIndex){if(!IFrameSplitOperator.IsNonEmptyArray(this.SubFrame))return;if(IFrameSplitOperator.IsNumber(windowIndex)&&windowIndex>=0){var item=this.SubFrame[windowIndex];if(item.Frame)item.Frame.YCustomSplit=true;}else{for(var i=0;i<this.SubFrame.length;++i){this.SubFrame[i].Frame.YCustomSplit=true;}}};//清空Y轴坐标的最大最小值
2964
2972
  this.ClearYCoordinateMaxMin=function(windowIndex){if(IFrameSplitOperator.IsNumber(windowIndex)){var subItem=this.SubFrame[windowIndex];if(!subItem||!subItem.Frame)return;var frame=subItem.Frame;if(frame.YMaxMin){frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;}}else{for(var i=0;i<this.SubFrame.length;++i){var subItem=this.SubFrame[i];var frame=subItem.Frame;if(frame.YMaxMin){frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;}}}};this.SetLanguage=function(languageID){for(var _i3 in this.SubFrame){var item=this.SubFrame[_i3];if(item&&item.Frame){if(item.Frame.YSplitOperator)item.Frame.YSplitOperator.LanguageID=languageID;if(item.Frame.XSplitOperator)item.Frame.XSplitOperator.LanguageID=languageID;}}};this.GetCurrentPageSize=function()//获取当前页显示的数据个数
@@ -13740,7 +13748,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
13740
13748
  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);};}/********************************************************************************
13741
13749
  * 版本信息输出
13742
13750
  *
13743
- */var HQCHART_VERSION="1.1.13822";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();//把给外界调用的方法暴露出来
13751
+ */var HQCHART_VERSION="1.1.13827";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();//把给外界调用的方法暴露出来
13744
13752
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
13745
13753
  // BaseIndex:BaseIndex,
13746
13754
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13823",
3
+ "version": "1.1.13828",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -2621,6 +2621,7 @@ var JSCHART_EVENT_ID=
2621
2621
 
2622
2622
  ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX:156, //日盘夜盘的分界线
2623
2623
  ON_CUSTOM_MINUTE_BG:157, //自定义分时图背景颜色
2624
+ ON_CLICK_HORIZONTAL_LABEL:158, //点击Y轴刻度标签
2624
2625
  }
2625
2626
 
2626
2627
  var JSCHART_OPERATOR_ID=
@@ -3390,6 +3391,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3390
3391
  return true;
3391
3392
  }
3392
3393
 
3394
+ var label=this.Frame.PtInHorizontalLabel(x,y);
3395
+ if (label && this.ClickHorizontalLabel)
3396
+ {
3397
+ this.ClickHorizontalLabel(label, e);
3398
+ return true;
3399
+ }
3400
+
3393
3401
  return false;
3394
3402
  }
3395
3403
 
@@ -6198,6 +6206,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6198
6206
  JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");
6199
6207
  }
6200
6208
 
6209
+ if (this.Frame.PtInHorizontalLabel && this.Frame.PtInHorizontalLabel(x,y))
6210
+ {
6211
+ mouseStatus={ Cursor:"pointer", Name:"HorizontalLabel"};
6212
+ JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame Horizontal Label ");
6213
+ }
6214
+
6201
6215
  if (this.SelectedChart.EnableMoveOn && this.PtInChart && !this.CurrentChartDrawPicture)
6202
6216
  {
6203
6217
  var chartInfo=this.PtInChart(x,y);
@@ -9900,6 +9914,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9900
9914
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
9901
9915
  this.Draw();
9902
9916
  }
9917
+
9918
+ this.ClickHorizontalLabel=function(lable, e)
9919
+ {
9920
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_HORIZONTAL_LABEL);
9921
+ if (event && event.Callback)
9922
+ {
9923
+ var data={ Info:lable, PreventDefault:false }; //PreventDefault 是否阻止内置的点击处理
9924
+ event.Callback(event,data,this);
9925
+ if (data.PreventDefault) return;
9926
+ }
9927
+ }
9903
9928
  }
9904
9929
 
9905
9930
  function GetDevicePixelRatio()
@@ -10038,6 +10063,13 @@ function ToFixedRect(value)
10038
10063
  return rounded = (0.5 + value) << 0;
10039
10064
  }
10040
10065
 
10066
+ function PtInRect(x,y, rect)
10067
+ {
10068
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom) return true;
10069
+
10070
+ return false;
10071
+ }
10072
+
10041
10073
  //深拷贝
10042
10074
  function CloneData(data)
10043
10075
  {
@@ -10505,6 +10537,8 @@ function IChartFramePainting()
10505
10537
  this.IsDrawRightBorder=false; //是否绘制右侧刻度空白的边框
10506
10538
  this.IsDrawLeftBorder=false; //是否绘制右侧刻度空白的边框
10507
10539
 
10540
+ this.HorizontalLabel; //Y轴刻度标签页 (支持点击的才会有)[ { ID:, Args:[], }]
10541
+
10508
10542
  this.PtInButtons=function(x,y) //坐标是否在按钮上
10509
10543
  {
10510
10544
  for(var i=0;i<this.Buttons.length;++i)
@@ -10525,6 +10559,24 @@ function IChartFramePainting()
10525
10559
  return null;
10526
10560
  }
10527
10561
 
10562
+ //Y轴标签文字
10563
+ this.PtInHorizontalLabel=function(x,y)
10564
+ {
10565
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.HorizontalLabel)) return null;
10566
+
10567
+ for(var i=0;i<this.HorizontalLabel.length;++i)
10568
+ {
10569
+ var item=this.HorizontalLabel[i];
10570
+ var rect=item.Rect;
10571
+ if (PtInRect(x,y, rect))
10572
+ {
10573
+ return { ID:item.ID, Rect:rect, Item:item.Item, LineID:item.LineID };
10574
+ }
10575
+ }
10576
+
10577
+ return;
10578
+ }
10579
+
10528
10580
  this.GetBorder=function()
10529
10581
  {
10530
10582
  if (this.IsHScreen) return this.ChartBorder.GetHScreenBorder();
@@ -10534,6 +10586,7 @@ function IChartFramePainting()
10534
10586
  this.Draw=function()
10535
10587
  {
10536
10588
  this.Buttons=[];
10589
+ this.HorizontalLabel=[];
10537
10590
  this.DrawClientBG();
10538
10591
  this.DrawFrame();
10539
10592
  this.DrawBorder();
@@ -12608,7 +12661,10 @@ function AverageWidthFrame()
12608
12661
  if (position==2) this.DrawLine(border.LeftEx,right,yText,item.LineColor,item.LineType,item);
12609
12662
  else this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);
12610
12663
  }
12611
-
12664
+
12665
+ if (item.ClickData)
12666
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
12667
+
12612
12668
  yText+=textHeight+1*pixelTatio;
12613
12669
  }
12614
12670
  }
@@ -12687,7 +12743,10 @@ function AverageWidthFrame()
12687
12743
  }
12688
12744
 
12689
12745
  if (i==0) this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);
12690
-
12746
+
12747
+ if (item.ClickData) //点击事件
12748
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
12749
+
12691
12750
  yText+=textHeight+1*pixelTatio;
12692
12751
  }
12693
12752
  }
@@ -12878,6 +12937,9 @@ function AverageWidthFrame()
12878
12937
  }
12879
12938
 
12880
12939
  if (i==0) this.DrawLine(left,right,y,item.LineColor,item.LineType,item);
12940
+
12941
+ if (item.ClickData) //点击事件
12942
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
12881
12943
 
12882
12944
  yText+=textHeight+1*pixelTatio;
12883
12945
 
@@ -12922,6 +12984,15 @@ function AverageWidthFrame()
12922
12984
  }
12923
12985
  }
12924
12986
 
12987
+ this.AddHorizontalLabel=function(left, top, width, height, item, lineID)
12988
+ {
12989
+ var rtLabel={ Left:left, Top:top, Width:width, Height:height };
12990
+ rtLabel.Right=rtLabel.Left+rtLabel.Width;
12991
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
12992
+ var lableItem={ Rect:rtLabel, Item:item, ID:item.ClickData.ID, Args:item.ClickData.Args, LineID:lineID };
12993
+ this.HorizontalLabel.push(lableItem);
12994
+ }
12995
+
12925
12996
  this.DrawCustomAreaItem=function(item) //自定义Y轴区域
12926
12997
  {
12927
12998
  if (!item.AreaData) return;
@@ -13073,6 +13144,23 @@ function AverageWidthFrame()
13073
13144
  this.Canvas.lineWidth=pixelRatio;
13074
13145
  }
13075
13146
  }
13147
+ else if (lineType==2) //绘制短线
13148
+ {
13149
+ var lineWidth=10*GetDevicePixelRatio();
13150
+ this.Canvas.strokeStyle=color;
13151
+ this.Canvas.beginPath();
13152
+ if (this.IsHScreen)
13153
+ {
13154
+ this.Canvas.moveTo(ToFixedPoint(y),left);
13155
+ this.Canvas.lineTo(ToFixedPoint(y),left+lineWidth);
13156
+ }
13157
+ else
13158
+ {
13159
+ this.Canvas.moveTo(left,ToFixedPoint(y));
13160
+ this.Canvas.lineTo(left+lineWidth,ToFixedPoint(y));
13161
+ }
13162
+ this.Canvas.stroke();
13163
+ }
13076
13164
  else
13077
13165
  {
13078
13166
  this.DrawDotLine(left,right,y, color, option);
@@ -19737,6 +19825,25 @@ function HQTradeFrame()
19737
19825
  return -1;
19738
19826
  }
19739
19827
 
19828
+ //Y轴刻度标签
19829
+ this.PtInHorizontalLabel=function(x,y)
19830
+ {
19831
+ for(var i=0; i<this.SubFrame.length; ++i)
19832
+ {
19833
+ var item=this.SubFrame[i];
19834
+ if (item.Height<=0) continue;
19835
+ var label=item.Frame.PtInHorizontalLabel(x,y);
19836
+ if (label)
19837
+ {
19838
+ label.Frame=item.Frame;
19839
+ label.FrameID=i;
19840
+ return label;
19841
+ }
19842
+ }
19843
+
19844
+ return null;
19845
+ }
19846
+
19740
19847
  this.PtInButtons=function(x,y)
19741
19848
  {
19742
19849
  for(var i=0; i<this.SubFrame.length; ++i)
@@ -6546,6 +6546,7 @@ var JSCHART_EVENT_ID=
6546
6546
 
6547
6547
  ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX:156, //日盘夜盘的分界线
6548
6548
  ON_CUSTOM_MINUTE_BG:157, //自定义分时图背景颜色
6549
+ ON_CLICK_HORIZONTAL_LABEL:158, //点击Y轴刻度标签
6549
6550
  }
6550
6551
 
6551
6552
  var JSCHART_OPERATOR_ID=
@@ -7315,6 +7316,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7315
7316
  return true;
7316
7317
  }
7317
7318
 
7319
+ var label=this.Frame.PtInHorizontalLabel(x,y);
7320
+ if (label && this.ClickHorizontalLabel)
7321
+ {
7322
+ this.ClickHorizontalLabel(label, e);
7323
+ return true;
7324
+ }
7325
+
7318
7326
  return false;
7319
7327
  }
7320
7328
 
@@ -10123,6 +10131,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10123
10131
  JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");
10124
10132
  }
10125
10133
 
10134
+ if (this.Frame.PtInHorizontalLabel && this.Frame.PtInHorizontalLabel(x,y))
10135
+ {
10136
+ mouseStatus={ Cursor:"pointer", Name:"HorizontalLabel"};
10137
+ JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame Horizontal Label ");
10138
+ }
10139
+
10126
10140
  if (this.SelectedChart.EnableMoveOn && this.PtInChart && !this.CurrentChartDrawPicture)
10127
10141
  {
10128
10142
  var chartInfo=this.PtInChart(x,y);
@@ -13825,6 +13839,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13825
13839
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
13826
13840
  this.Draw();
13827
13841
  }
13842
+
13843
+ this.ClickHorizontalLabel=function(lable, e)
13844
+ {
13845
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_HORIZONTAL_LABEL);
13846
+ if (event && event.Callback)
13847
+ {
13848
+ var data={ Info:lable, PreventDefault:false }; //PreventDefault 是否阻止内置的点击处理
13849
+ event.Callback(event,data,this);
13850
+ if (data.PreventDefault) return;
13851
+ }
13852
+ }
13828
13853
  }
13829
13854
 
13830
13855
  function GetDevicePixelRatio()
@@ -13963,6 +13988,13 @@ function ToFixedRect(value)
13963
13988
  return rounded = (0.5 + value) << 0;
13964
13989
  }
13965
13990
 
13991
+ function PtInRect(x,y, rect)
13992
+ {
13993
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom) return true;
13994
+
13995
+ return false;
13996
+ }
13997
+
13966
13998
  //深拷贝
13967
13999
  function CloneData(data)
13968
14000
  {
@@ -14430,6 +14462,8 @@ function IChartFramePainting()
14430
14462
  this.IsDrawRightBorder=false; //是否绘制右侧刻度空白的边框
14431
14463
  this.IsDrawLeftBorder=false; //是否绘制右侧刻度空白的边框
14432
14464
 
14465
+ this.HorizontalLabel; //Y轴刻度标签页 (支持点击的才会有)[ { ID:, Args:[], }]
14466
+
14433
14467
  this.PtInButtons=function(x,y) //坐标是否在按钮上
14434
14468
  {
14435
14469
  for(var i=0;i<this.Buttons.length;++i)
@@ -14450,6 +14484,24 @@ function IChartFramePainting()
14450
14484
  return null;
14451
14485
  }
14452
14486
 
14487
+ //Y轴标签文字
14488
+ this.PtInHorizontalLabel=function(x,y)
14489
+ {
14490
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.HorizontalLabel)) return null;
14491
+
14492
+ for(var i=0;i<this.HorizontalLabel.length;++i)
14493
+ {
14494
+ var item=this.HorizontalLabel[i];
14495
+ var rect=item.Rect;
14496
+ if (PtInRect(x,y, rect))
14497
+ {
14498
+ return { ID:item.ID, Rect:rect, Item:item.Item, LineID:item.LineID };
14499
+ }
14500
+ }
14501
+
14502
+ return;
14503
+ }
14504
+
14453
14505
  this.GetBorder=function()
14454
14506
  {
14455
14507
  if (this.IsHScreen) return this.ChartBorder.GetHScreenBorder();
@@ -14459,6 +14511,7 @@ function IChartFramePainting()
14459
14511
  this.Draw=function()
14460
14512
  {
14461
14513
  this.Buttons=[];
14514
+ this.HorizontalLabel=[];
14462
14515
  this.DrawClientBG();
14463
14516
  this.DrawFrame();
14464
14517
  this.DrawBorder();
@@ -16533,7 +16586,10 @@ function AverageWidthFrame()
16533
16586
  if (position==2) this.DrawLine(border.LeftEx,right,yText,item.LineColor,item.LineType,item);
16534
16587
  else this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);
16535
16588
  }
16536
-
16589
+
16590
+ if (item.ClickData)
16591
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
16592
+
16537
16593
  yText+=textHeight+1*pixelTatio;
16538
16594
  }
16539
16595
  }
@@ -16612,7 +16668,10 @@ function AverageWidthFrame()
16612
16668
  }
16613
16669
 
16614
16670
  if (i==0) this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);
16615
-
16671
+
16672
+ if (item.ClickData) //点击事件
16673
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
16674
+
16616
16675
  yText+=textHeight+1*pixelTatio;
16617
16676
  }
16618
16677
  }
@@ -16803,6 +16862,9 @@ function AverageWidthFrame()
16803
16862
  }
16804
16863
 
16805
16864
  if (i==0) this.DrawLine(left,right,y,item.LineColor,item.LineType,item);
16865
+
16866
+ if (item.ClickData) //点击事件
16867
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
16806
16868
 
16807
16869
  yText+=textHeight+1*pixelTatio;
16808
16870
 
@@ -16847,6 +16909,15 @@ function AverageWidthFrame()
16847
16909
  }
16848
16910
  }
16849
16911
 
16912
+ this.AddHorizontalLabel=function(left, top, width, height, item, lineID)
16913
+ {
16914
+ var rtLabel={ Left:left, Top:top, Width:width, Height:height };
16915
+ rtLabel.Right=rtLabel.Left+rtLabel.Width;
16916
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
16917
+ var lableItem={ Rect:rtLabel, Item:item, ID:item.ClickData.ID, Args:item.ClickData.Args, LineID:lineID };
16918
+ this.HorizontalLabel.push(lableItem);
16919
+ }
16920
+
16850
16921
  this.DrawCustomAreaItem=function(item) //自定义Y轴区域
16851
16922
  {
16852
16923
  if (!item.AreaData) return;
@@ -16998,6 +17069,23 @@ function AverageWidthFrame()
16998
17069
  this.Canvas.lineWidth=pixelRatio;
16999
17070
  }
17000
17071
  }
17072
+ else if (lineType==2) //绘制短线
17073
+ {
17074
+ var lineWidth=10*GetDevicePixelRatio();
17075
+ this.Canvas.strokeStyle=color;
17076
+ this.Canvas.beginPath();
17077
+ if (this.IsHScreen)
17078
+ {
17079
+ this.Canvas.moveTo(ToFixedPoint(y),left);
17080
+ this.Canvas.lineTo(ToFixedPoint(y),left+lineWidth);
17081
+ }
17082
+ else
17083
+ {
17084
+ this.Canvas.moveTo(left,ToFixedPoint(y));
17085
+ this.Canvas.lineTo(left+lineWidth,ToFixedPoint(y));
17086
+ }
17087
+ this.Canvas.stroke();
17088
+ }
17001
17089
  else
17002
17090
  {
17003
17091
  this.DrawDotLine(left,right,y, color, option);
@@ -23662,6 +23750,25 @@ function HQTradeFrame()
23662
23750
  return -1;
23663
23751
  }
23664
23752
 
23753
+ //Y轴刻度标签
23754
+ this.PtInHorizontalLabel=function(x,y)
23755
+ {
23756
+ for(var i=0; i<this.SubFrame.length; ++i)
23757
+ {
23758
+ var item=this.SubFrame[i];
23759
+ if (item.Height<=0) continue;
23760
+ var label=item.Frame.PtInHorizontalLabel(x,y);
23761
+ if (label)
23762
+ {
23763
+ label.Frame=item.Frame;
23764
+ label.FrameID=i;
23765
+ return label;
23766
+ }
23767
+ }
23768
+
23769
+ return null;
23770
+ }
23771
+
23665
23772
  this.PtInButtons=function(x,y)
23666
23773
  {
23667
23774
  for(var i=0; i<this.SubFrame.length; ++i)
@@ -138267,7 +138374,7 @@ function ScrollBarBGChart()
138267
138374
 
138268
138375
 
138269
138376
 
138270
- var HQCHART_VERSION="1.1.13822";
138377
+ var HQCHART_VERSION="1.1.13827";
138271
138378
 
138272
138379
  function PrintHQChartVersion()
138273
138380
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13822";
8
+ var HQCHART_VERSION="1.1.13827";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -6590,6 +6590,7 @@ var JSCHART_EVENT_ID=
6590
6590
 
6591
6591
  ON_CUSTOM_MINUTE_NIGHT_DAY_X_INDEX:156, //日盘夜盘的分界线
6592
6592
  ON_CUSTOM_MINUTE_BG:157, //自定义分时图背景颜色
6593
+ ON_CLICK_HORIZONTAL_LABEL:158, //点击Y轴刻度标签
6593
6594
  }
6594
6595
 
6595
6596
  var JSCHART_OPERATOR_ID=
@@ -7359,6 +7360,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7359
7360
  return true;
7360
7361
  }
7361
7362
 
7363
+ var label=this.Frame.PtInHorizontalLabel(x,y);
7364
+ if (label && this.ClickHorizontalLabel)
7365
+ {
7366
+ this.ClickHorizontalLabel(label, e);
7367
+ return true;
7368
+ }
7369
+
7362
7370
  return false;
7363
7371
  }
7364
7372
 
@@ -10167,6 +10175,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10167
10175
  JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");
10168
10176
  }
10169
10177
 
10178
+ if (this.Frame.PtInHorizontalLabel && this.Frame.PtInHorizontalLabel(x,y))
10179
+ {
10180
+ mouseStatus={ Cursor:"pointer", Name:"HorizontalLabel"};
10181
+ JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame Horizontal Label ");
10182
+ }
10183
+
10170
10184
  if (this.SelectedChart.EnableMoveOn && this.PtInChart && !this.CurrentChartDrawPicture)
10171
10185
  {
10172
10186
  var chartInfo=this.PtInChart(x,y);
@@ -13869,6 +13883,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13869
13883
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
13870
13884
  this.Draw();
13871
13885
  }
13886
+
13887
+ this.ClickHorizontalLabel=function(lable, e)
13888
+ {
13889
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_HORIZONTAL_LABEL);
13890
+ if (event && event.Callback)
13891
+ {
13892
+ var data={ Info:lable, PreventDefault:false }; //PreventDefault 是否阻止内置的点击处理
13893
+ event.Callback(event,data,this);
13894
+ if (data.PreventDefault) return;
13895
+ }
13896
+ }
13872
13897
  }
13873
13898
 
13874
13899
  function GetDevicePixelRatio()
@@ -14007,6 +14032,13 @@ function ToFixedRect(value)
14007
14032
  return rounded = (0.5 + value) << 0;
14008
14033
  }
14009
14034
 
14035
+ function PtInRect(x,y, rect)
14036
+ {
14037
+ if (x>=rect.Left && x<=rect.Right && y>=rect.Top && y<=rect.Bottom) return true;
14038
+
14039
+ return false;
14040
+ }
14041
+
14010
14042
  //深拷贝
14011
14043
  function CloneData(data)
14012
14044
  {
@@ -14474,6 +14506,8 @@ function IChartFramePainting()
14474
14506
  this.IsDrawRightBorder=false; //是否绘制右侧刻度空白的边框
14475
14507
  this.IsDrawLeftBorder=false; //是否绘制右侧刻度空白的边框
14476
14508
 
14509
+ this.HorizontalLabel; //Y轴刻度标签页 (支持点击的才会有)[ { ID:, Args:[], }]
14510
+
14477
14511
  this.PtInButtons=function(x,y) //坐标是否在按钮上
14478
14512
  {
14479
14513
  for(var i=0;i<this.Buttons.length;++i)
@@ -14494,6 +14528,24 @@ function IChartFramePainting()
14494
14528
  return null;
14495
14529
  }
14496
14530
 
14531
+ //Y轴标签文字
14532
+ this.PtInHorizontalLabel=function(x,y)
14533
+ {
14534
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.HorizontalLabel)) return null;
14535
+
14536
+ for(var i=0;i<this.HorizontalLabel.length;++i)
14537
+ {
14538
+ var item=this.HorizontalLabel[i];
14539
+ var rect=item.Rect;
14540
+ if (PtInRect(x,y, rect))
14541
+ {
14542
+ return { ID:item.ID, Rect:rect, Item:item.Item, LineID:item.LineID };
14543
+ }
14544
+ }
14545
+
14546
+ return;
14547
+ }
14548
+
14497
14549
  this.GetBorder=function()
14498
14550
  {
14499
14551
  if (this.IsHScreen) return this.ChartBorder.GetHScreenBorder();
@@ -14503,6 +14555,7 @@ function IChartFramePainting()
14503
14555
  this.Draw=function()
14504
14556
  {
14505
14557
  this.Buttons=[];
14558
+ this.HorizontalLabel=[];
14506
14559
  this.DrawClientBG();
14507
14560
  this.DrawFrame();
14508
14561
  this.DrawBorder();
@@ -16577,7 +16630,10 @@ function AverageWidthFrame()
16577
16630
  if (position==2) this.DrawLine(border.LeftEx,right,yText,item.LineColor,item.LineType,item);
16578
16631
  else this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);
16579
16632
  }
16580
-
16633
+
16634
+ if (item.ClickData)
16635
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
16636
+
16581
16637
  yText+=textHeight+1*pixelTatio;
16582
16638
  }
16583
16639
  }
@@ -16656,7 +16712,10 @@ function AverageWidthFrame()
16656
16712
  }
16657
16713
 
16658
16714
  if (i==0) this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);
16659
-
16715
+
16716
+ if (item.ClickData) //点击事件
16717
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
16718
+
16660
16719
  yText+=textHeight+1*pixelTatio;
16661
16720
  }
16662
16721
  }
@@ -16847,6 +16906,9 @@ function AverageWidthFrame()
16847
16906
  }
16848
16907
 
16849
16908
  if (i==0) this.DrawLine(left,right,y,item.LineColor,item.LineType,item);
16909
+
16910
+ if (item.ClickData) //点击事件
16911
+ this.AddHorizontalLabel(textLeft, bgTop, itemText.Width,textHeight, item, i);
16850
16912
 
16851
16913
  yText+=textHeight+1*pixelTatio;
16852
16914
 
@@ -16891,6 +16953,15 @@ function AverageWidthFrame()
16891
16953
  }
16892
16954
  }
16893
16955
 
16956
+ this.AddHorizontalLabel=function(left, top, width, height, item, lineID)
16957
+ {
16958
+ var rtLabel={ Left:left, Top:top, Width:width, Height:height };
16959
+ rtLabel.Right=rtLabel.Left+rtLabel.Width;
16960
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
16961
+ var lableItem={ Rect:rtLabel, Item:item, ID:item.ClickData.ID, Args:item.ClickData.Args, LineID:lineID };
16962
+ this.HorizontalLabel.push(lableItem);
16963
+ }
16964
+
16894
16965
  this.DrawCustomAreaItem=function(item) //自定义Y轴区域
16895
16966
  {
16896
16967
  if (!item.AreaData) return;
@@ -17042,6 +17113,23 @@ function AverageWidthFrame()
17042
17113
  this.Canvas.lineWidth=pixelRatio;
17043
17114
  }
17044
17115
  }
17116
+ else if (lineType==2) //绘制短线
17117
+ {
17118
+ var lineWidth=10*GetDevicePixelRatio();
17119
+ this.Canvas.strokeStyle=color;
17120
+ this.Canvas.beginPath();
17121
+ if (this.IsHScreen)
17122
+ {
17123
+ this.Canvas.moveTo(ToFixedPoint(y),left);
17124
+ this.Canvas.lineTo(ToFixedPoint(y),left+lineWidth);
17125
+ }
17126
+ else
17127
+ {
17128
+ this.Canvas.moveTo(left,ToFixedPoint(y));
17129
+ this.Canvas.lineTo(left+lineWidth,ToFixedPoint(y));
17130
+ }
17131
+ this.Canvas.stroke();
17132
+ }
17045
17133
  else
17046
17134
  {
17047
17135
  this.DrawDotLine(left,right,y, color, option);
@@ -23706,6 +23794,25 @@ function HQTradeFrame()
23706
23794
  return -1;
23707
23795
  }
23708
23796
 
23797
+ //Y轴刻度标签
23798
+ this.PtInHorizontalLabel=function(x,y)
23799
+ {
23800
+ for(var i=0; i<this.SubFrame.length; ++i)
23801
+ {
23802
+ var item=this.SubFrame[i];
23803
+ if (item.Height<=0) continue;
23804
+ var label=item.Frame.PtInHorizontalLabel(x,y);
23805
+ if (label)
23806
+ {
23807
+ label.Frame=item.Frame;
23808
+ label.FrameID=i;
23809
+ return label;
23810
+ }
23811
+ }
23812
+
23813
+ return null;
23814
+ }
23815
+
23709
23816
  this.PtInButtons=function(x,y)
23710
23817
  {
23711
23818
  for(var i=0; i<this.SubFrame.length; ++i)
@@ -142823,7 +142930,7 @@ function HQChartScriptWorker()
142823
142930
 
142824
142931
 
142825
142932
 
142826
- var HQCHART_VERSION="1.1.13822";
142933
+ var HQCHART_VERSION="1.1.13827";
142827
142934
 
142828
142935
  function PrintHQChartVersion()
142829
142936
  {