hqchart 1.1.12450 → 1.1.12453

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.
@@ -1596,7 +1596,7 @@ ON_RECV_REALTIME_DATA:109,//实时数据
1596
1596
  ON_CUSTOM_OVERLAY_TOOLBAR:110,//自定义叠加指标按钮
1597
1597
  //绘图之前的事件
1598
1598
  ON_BEFORE_DRAW:111,ON_BEFORE_DRAW_DYNAMIC_INFO:112,//自定义图形拖拽
1599
- ON_CUSTOM_DRAG_MOUSE_DOWN:113,ON_CUSTOM_DRAG_DOC_MOUSE_MOVE:114,ON_CUSTOM_DRAG_DOC_MOUSE_UP:115,ON_CUSTOM_DRAG_MOUSE_MOVE:116};var JSCHART_OPERATOR_ID={OP_SCROLL_LEFT:1,//往左移动
1599
+ ON_CUSTOM_DRAG_MOUSE_DOWN:113,ON_CUSTOM_DRAG_DOC_MOUSE_MOVE:114,ON_CUSTOM_DRAG_DOC_MOUSE_UP:115,ON_CUSTOM_DRAG_MOUSE_MOVE:116,ON_KEYDOWN:117};var JSCHART_OPERATOR_ID={OP_SCROLL_LEFT:1,//往左移动
1600
1600
  OP_SCROLL_RIGHT:2,//往右移动
1601
1601
  OP_ZOOM_OUT:3,//缩小
1602
1602
  OP_ZOOM_IN:4,//放大
@@ -1873,7 +1873,8 @@ var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=
1873
1873
  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;//是否正在画图
1874
1874
  if(this.CurrentChartDrawPicture){var index=this.Frame.PtInChartFrame(x,y);if(this.CurrentChartDrawPicture.Status!=20){var bDrawValid=false;//是否在有效绘图区域里面
1875
1875
  if(IFrameSplitOperator.IsNumber(this.CurrentChartDrawPicture.LimitFrameID)){if(index>=0&&index==this.CurrentChartDrawPicture.LimitFrameID)bDrawValid=true;}else{if(index>=0)bDrawValid=true;}mouseStatus={Cursor:bDrawValid?"crosshair":"not-allowed",Name:"CurrentChartDrawPicture"};}if(this.CurrentChartDrawPicture.SetLastPoint)this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});bDrawPicture=true;}else{var drawPictrueData={};drawPictrueData.X=x;drawPictrueData.Y=y;if(this.GetChartDrawPictureByPoint(drawPictrueData)&&drawPictrueData.ChartDrawPicture&&drawPictrueData.ChartDrawPicture.EnableMove==true){if(drawPictrueData.PointIndex===100){if(drawPictrueData.Cursor)this.UIElement.style.cursor=drawPictrueData.Cursor;else this.UIElement.style.cursor="move";}else{if(drawPictrueData.Cursor)this.UIElement.style.cursor=drawPictrueData.Cursor;else this.UIElement.style.cursor="pointer";}bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.UIElement.style.cursor="default";}}var clientPos=this.PtInClient(x,y);var option={ParentFunction:'OnMouseMove',Point:{X:x,Y:y},IsPhone:isPhone===true,ClientPos:clientPos};if(e&&(e.type=="mouseout"||e.type=="mouseleave")||button)option.Corss=false;//鼠标移开,在按钮上,不显示十字光标
1876
- if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){_this9.DrawDynamicInfo(option);},this.DrawDynamicInfoOption.DelayTime);}else{this.DrawDynamicInfo(option);}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;if(this.IsShowTooltip&&bDrawPicture==false){var toolTip=this.GetChartTooltipData(x,y);if(toolTip&&toolTip.Data){if(isPhone===true){var touche=e.touches[0];var xTooltip=touche.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=touche.clientY-this.UIElement.getBoundingClientRect().top;}else{var xTooltip=e.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=e.clientY-this.UIElement.getBoundingClientRect().top;}this.ShowTooltip(xTooltip,yTooltip,toolTip);}else{this.HideTooltip();}}};this.OnKeyDown=function(e){var _this10=this;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
1876
+ if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){_this9.DrawDynamicInfo(option);},this.DrawDynamicInfoOption.DelayTime);}else{this.DrawDynamicInfo(option);}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;if(this.IsShowTooltip&&bDrawPicture==false){var toolTip=this.GetChartTooltipData(x,y);if(toolTip&&toolTip.Data){if(isPhone===true){var touche=e.touches[0];var xTooltip=touche.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=touche.clientY-this.UIElement.getBoundingClientRect().top;}else{var xTooltip=e.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=e.clientY-this.UIElement.getBoundingClientRect().top;}this.ShowTooltip(xTooltip,yTooltip,toolTip);}else{this.HideTooltip();}}};this.OnKeyDown=function(e){var _this10=this;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;//回调事件
1877
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);if(event&&event.Callback){var sendData={e:e,PreventDefault:false};event.Callback(event,sendData,this);if(sendData.PreventDefault)return;}var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
1877
1878
  if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft()){//左移数据到头了 触发下载新数据
1878
1879
  if(this.DragDownloadData)this.DragDownloadData();break;}this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");}else{--this.CursorIndex;this.UpdatePointByCursorIndex();this.DrawDynamicInfo();this.ShowTooltipByKeyDown();}break;case 39://right
1879
1880
  if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}var xPointcount=0;if(this.Frame.XPointCount)xPointcount=this.Frame.XPointCount;else xPointcount=this.Frame.SubFrame[0].Frame.XPointCount;if(this.CursorIndex+1>=xPointcount){if(!this.DataMoveRight())break;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");}else{//判断是否在最后一个数据上
@@ -5626,7 +5627,9 @@ return 180-angle;return angle;};//复制
5626
5627
  // 转成16进制
5627
5628
  for(var i=0;i<colorArr.length;i++){var hex=Number(colorArr[i]).toString(16);if(hex==="0")hex+=hex;strHex+=hex;}color=strHex;}return"rgba("+parseInt("0x"+color.slice(1,3))+","+parseInt("0x"+color.slice(3,5))+","+parseInt("0x"+color.slice(5,7))+","+opacity+")";};IChartDrawPicture.RGBToHex=function(rgb){// Choose correct separator
5628
5629
  var sep=rgb.indexOf(",")>-1?",":" ";// Turn "rgb(r,g,b)" into [r,g,b]
5629
- rgb=rgb.substr(4).split(")")[0].split(sep);var r=(+rgb[0]).toString(16),g=(+rgb[1]).toString(16),b=(+rgb[2]).toString(16);if(r.length==1)r="0"+r;if(g.length==1)g="0"+g;if(b.length==1)b="0"+b;return"#"+r+g+b;};IChartDrawPicture.ArrayDrawPricture=[{Name:"线段",ClassName:'ChartDrawPictureLine',Create:function Create(){return new ChartDrawPictureLine();}},{Name:"射线",ClassName:'ChartDrawPictureHaflLine',Create:function Create(){return new ChartDrawPictureHaflLine();}},{Name:"箭头",ClassName:"ChartDrawArrowLine",Create:function Create(){return new ChartDrawArrowLine();}},{Name:"水平线",ClassName:'ChartDrawPictureHorizontalLine',Create:function Create(){return new ChartDrawPictureHorizontalLine();}},{Name:"趋势线",ClassName:'ChartDrawPictureTrendLine',Create:function Create(){return new ChartDrawPictureTrendLine();}},{Name:"矩形",ClassName:'ChartDrawPictureRect',Create:function Create(){return new ChartDrawPictureRect();}},{Name:"圆弧线",ClassName:'ChartDrawPictureArc',Create:function Create(){return new ChartDrawPictureArc();}},{Name:"M头W底",ClassName:'ChartDrawPictureWaveMW',Create:function Create(){return new ChartDrawPictureWaveMW();}},{Name:"头肩型",ClassName:"ChartDrawHeadShouldersBT",Create:function Create(){return new ChartDrawHeadShouldersBT();}},{Name:"平行线",ClassName:'ChartDrawPictureParallelLines',Create:function Create(){return new ChartDrawPictureParallelLines();}},{Name:"平行通道",ClassName:'ChartDrawPictureParallelChannel',Create:function Create(){return new ChartDrawPictureParallelChannel();}},{Name:"价格通道线",ClassName:'ChartDrawPicturePriceChannel',Create:function Create(){return new ChartDrawPicturePriceChannel();}},{Name:"文本",ClassName:'ChartDrawPictureText',Create:function Create(){return new ChartDrawPictureText();}},{Name:"江恩角度线",ClassName:'ChartDrawPictureGannFan',Create:function Create(){return new ChartDrawPictureGannFan();}},{Name:"阻速线",ClassName:'ChartDrawPictureResistanceLine',Create:function Create(){return new ChartDrawPictureResistanceLine();}},{Name:"黄金分割",ClassName:'ChartDrawPictureGoldenSection',Create:function Create(){return new ChartDrawPictureGoldenSection();}},{Name:"百分比线",ClassName:'ChartDrawPicturePercentage',Create:function Create(){return new ChartDrawPicturePercentage();}},{Name:"波段线",ClassName:'ChartDrawPictureWaveBand',Create:function Create(){return new ChartDrawPictureWaveBand();}},{Name:"三角形",ClassName:'ChartDrawPictureTriangle',Create:function Create(){return new ChartDrawPictureTriangle();}},{Name:"对称角度",ClassName:'ChartDrawPictureSymmetryAngle',Create:function Create(){return new ChartDrawPictureSymmetryAngle();}},{Name:"圆",ClassName:'ChartDrawPictureCircle',Create:function Create(){return new ChartDrawPictureCircle();}},{Name:"平行四边形",ClassName:'ChartDrawPictureQuadrangle',Create:function Create(){return new ChartDrawPictureQuadrangle();}},{Name:"斐波那契周期线",ClassName:'ChartDrawPictureFibonacci',Create:function Create(){return new ChartDrawPictureFibonacci();}},{Name:"线形回归线",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression();}},{Name:"线形回归带",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression({IsShowMaxMinLine:true});}},{Name:"延长线形回归带",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression({IsShowMaxMinLine:true,IsShowExtendLine:true});}},{Name:"尺子",ClassName:"ChartDrawRuler",Create:function Create(){return new ChartDrawRuler();}},{Name:"标价线",ClassName:"ChartDrawPriceLine",Create:function Create(){return new ChartDrawPriceLine();}},{Name:"标价线2",ClassName:"ChartDrawPriceLineV2",Create:function Create(){return new ChartDrawPriceLineV2();}},{Name:"垂直线",ClassName:"ChartDrawVerticalLine",Create:function Create(){return new ChartDrawVerticalLine();}},{Name:"波浪尺",ClassName:"ChartDrawWaveRuler",Create:function Create(){return new ChartDrawWaveRuler();}},{Name:"AB波浪尺",ClassName:"ChartDrawWaveRuler2Point",Create:function Create(){return new ChartDrawWaveRuler2Point();}},{Name:"箱型线",ClassName:"ChartDrawBox",Create:function Create(){return new ChartDrawBox();}},{Name:"2点画图例子",ClassName:"ChartDrawTwoPointDemo",Create:function Create(){return new ChartDrawTwoPointDemo();}},{Name:"3点画图例子",ClassName:"ChartDrawThreePointDemo",Create:function Create(){return new ChartDrawThreePointDemo();}},{Name:"水平线段",ClassName:"ChartDrawHLineSegment",Create:function Create(){return new ChartDrawHLineSegment();}},{Name:"平行射线",ClassName:"ChartDrawParallelRaysLines",Create:function Create(){return new ChartDrawParallelRaysLines();}},{ClassName:'ChartDrawPictureIconFont',Create:function Create(){return new ChartDrawPictureIconFont();}},//涂鸦 不绑定K线坐标
5630
+ rgb=rgb.substr(4).split(")")[0].split(sep);var r=(+rgb[0]).toString(16),g=(+rgb[1]).toString(16),b=(+rgb[2]).toString(16);if(r.length==1)r="0"+r;if(g.length==1)g="0"+g;if(b.length==1)b="0"+b;return"#"+r+g+b;};//16进制颜色转rgb
5631
+ IChartDrawPicture.HexToRGB=function(color){color=color.toLowerCase();var reg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;if(color&&reg.test(color)){if(color.length===4){var sColorNew="#";for(var i=1;i<4;i+=1){sColorNew+=color.slice(i,i+1).concat(color.slice(i,i+1));}color=sColorNew;}//处理六位的颜色值
5632
+ var sColorChange=[];for(var i=1;i<7;i+=2){sColorChange.push(parseInt("0x"+color.slice(i,i+2)));}return"rgb("+sColorChange.join(",")+")";}return null;};IChartDrawPicture.ArrayDrawPricture=[{Name:"线段",ClassName:'ChartDrawPictureLine',Create:function Create(){return new ChartDrawPictureLine();}},{Name:"射线",ClassName:'ChartDrawPictureHaflLine',Create:function Create(){return new ChartDrawPictureHaflLine();}},{Name:"箭头",ClassName:"ChartDrawArrowLine",Create:function Create(){return new ChartDrawArrowLine();}},{Name:"水平线",ClassName:'ChartDrawPictureHorizontalLine',Create:function Create(){return new ChartDrawPictureHorizontalLine();}},{Name:"趋势线",ClassName:'ChartDrawPictureTrendLine',Create:function Create(){return new ChartDrawPictureTrendLine();}},{Name:"矩形",ClassName:'ChartDrawPictureRect',Create:function Create(){return new ChartDrawPictureRect();}},{Name:"圆弧线",ClassName:'ChartDrawPictureArc',Create:function Create(){return new ChartDrawPictureArc();}},{Name:"M头W底",ClassName:'ChartDrawPictureWaveMW',Create:function Create(){return new ChartDrawPictureWaveMW();}},{Name:"头肩型",ClassName:"ChartDrawHeadShouldersBT",Create:function Create(){return new ChartDrawHeadShouldersBT();}},{Name:"平行线",ClassName:'ChartDrawPictureParallelLines',Create:function Create(){return new ChartDrawPictureParallelLines();}},{Name:"平行通道",ClassName:'ChartDrawPictureParallelChannel',Create:function Create(){return new ChartDrawPictureParallelChannel();}},{Name:"价格通道线",ClassName:'ChartDrawPicturePriceChannel',Create:function Create(){return new ChartDrawPicturePriceChannel();}},{Name:"文本",ClassName:'ChartDrawPictureText',Create:function Create(){return new ChartDrawPictureText();}},{Name:"江恩角度线",ClassName:'ChartDrawPictureGannFan',Create:function Create(){return new ChartDrawPictureGannFan();}},{Name:"阻速线",ClassName:'ChartDrawPictureResistanceLine',Create:function Create(){return new ChartDrawPictureResistanceLine();}},{Name:"黄金分割",ClassName:'ChartDrawPictureGoldenSection',Create:function Create(){return new ChartDrawPictureGoldenSection();}},{Name:"百分比线",ClassName:'ChartDrawPicturePercentage',Create:function Create(){return new ChartDrawPicturePercentage();}},{Name:"波段线",ClassName:'ChartDrawPictureWaveBand',Create:function Create(){return new ChartDrawPictureWaveBand();}},{Name:"三角形",ClassName:'ChartDrawPictureTriangle',Create:function Create(){return new ChartDrawPictureTriangle();}},{Name:"对称角度",ClassName:'ChartDrawPictureSymmetryAngle',Create:function Create(){return new ChartDrawPictureSymmetryAngle();}},{Name:"圆",ClassName:'ChartDrawPictureCircle',Create:function Create(){return new ChartDrawPictureCircle();}},{Name:"平行四边形",ClassName:'ChartDrawPictureQuadrangle',Create:function Create(){return new ChartDrawPictureQuadrangle();}},{Name:"斐波那契周期线",ClassName:'ChartDrawPictureFibonacci',Create:function Create(){return new ChartDrawPictureFibonacci();}},{Name:"线形回归线",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression();}},{Name:"线形回归带",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression({IsShowMaxMinLine:true});}},{Name:"延长线形回归带",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression({IsShowMaxMinLine:true,IsShowExtendLine:true});}},{Name:"尺子",ClassName:"ChartDrawRuler",Create:function Create(){return new ChartDrawRuler();}},{Name:"标价线",ClassName:"ChartDrawPriceLine",Create:function Create(){return new ChartDrawPriceLine();}},{Name:"标价线2",ClassName:"ChartDrawPriceLineV2",Create:function Create(){return new ChartDrawPriceLineV2();}},{Name:"垂直线",ClassName:"ChartDrawVerticalLine",Create:function Create(){return new ChartDrawVerticalLine();}},{Name:"波浪尺",ClassName:"ChartDrawWaveRuler",Create:function Create(){return new ChartDrawWaveRuler();}},{Name:"AB波浪尺",ClassName:"ChartDrawWaveRuler2Point",Create:function Create(){return new ChartDrawWaveRuler2Point();}},{Name:"箱型线",ClassName:"ChartDrawBox",Create:function Create(){return new ChartDrawBox();}},{Name:"2点画图例子",ClassName:"ChartDrawTwoPointDemo",Create:function Create(){return new ChartDrawTwoPointDemo();}},{Name:"3点画图例子",ClassName:"ChartDrawThreePointDemo",Create:function Create(){return new ChartDrawThreePointDemo();}},{Name:"水平线段",ClassName:"ChartDrawHLineSegment",Create:function Create(){return new ChartDrawHLineSegment();}},{Name:"平行射线",ClassName:"ChartDrawParallelRaysLines",Create:function Create(){return new ChartDrawParallelRaysLines();}},{ClassName:'ChartDrawPictureIconFont',Create:function Create(){return new ChartDrawPictureIconFont();}},//涂鸦 不绑定K线坐标
5630
5633
  {Name:"涂鸦线段",ClassName:'ChartDrawGraffitiLine',Create:function Create(){return new ChartDrawGraffitiLine();}},{Name:"固定范围成交量分布图",ClassName:"ChartDrawVolProfile",Create:function Create(){return new ChartDrawVolProfile();}},{Name:"DisjointChannel",ClassName:"ChartDrawDisjontChannel",Create:function Create(){return new ChartDrawDisjontChannel();}},{Name:"FlatTop",ClassName:"ChartDrawDisjontChannel",Create:function Create(){return new ChartDrawFlatTop();}},{Name:"水平线2",ClassName:"ChartDrawHLine",Create:function Create(){return new ChartDrawHLine();}},//trading view样式
5631
5634
  {Name:"Note",ClassName:"ChartDrawNote",Create:function Create(){return new ChartDrawNote();}},{Name:"AnchoredText",ClassName:"ChartDrawAnchoredText",Create:function Create(){return new ChartDrawAnchoredText();}},{Name:"PriceLabel",ClassName:"ChartDrawPriceLabel",Create:function Create(){return new ChartDrawPriceLabel();}},{Name:"PriceNote",ClassName:"ChartDrawPriceNote",Create:function Create(){return new ChartDrawPriceNote();}},{Name:"FibWedge",ClassName:"ChartDrawFibWedge",Create:function Create(){return new ChartDrawFibWedge();}}];IChartDrawPicture.MapIonFont=new _map2.default([["icon-arrow_up",{Text:'\uE683',Color:'#318757',Family:"iconfont"}],["icon-arrow_down",{Text:'\uE681',Color:'#db563e',Family:"iconfont"}],["icon-arrow_right",{Text:'\uE682',Color:'#318757',Family:"iconfont"}],["icon-arrow_left",{Text:'\uE680',Color:'#318757',Family:"iconfont"}]]);IChartDrawPicture.GetDrawPictureByName=function(value){for(var i in IChartDrawPicture.ArrayDrawPricture){var item=IChartDrawPicture.ArrayDrawPricture[i];if(item.Name==value)return item;}return null;};IChartDrawPicture.GetDrawPictureByClassName=function(value){for(var i in IChartDrawPicture.ArrayDrawPricture){var item=IChartDrawPicture.ArrayDrawPricture[i];if(item.ClassName==value)return item;}return null;};//注册一个新的画图工具 {Name:中文名字, ClassName:类名, Create:function()}
5632
5635
  IChartDrawPicture.RegisterDrawPicture=function(obj){if(!obj.Name||!obj.ClassName||!obj.Create)return false;var item={Name:obj.Name,ClassName:obj.ClassName,Create:obj.Create};IChartDrawPicture.ArrayDrawPricture.push(item);JSConsole.Chart.Log('[IChartDrawPicture.RegisterDrawPicture] registered new draw picture class. item=',item);return true;};//注册一个新图标 {Name:, Text: , Color:, Family:}
@@ -7432,7 +7435,8 @@ if(_event2&&_event2.Callback){var sendData={DrawPicture:drawPictrueData.ChartDra
7432
7435
  if((moveUpDown>0&&moveSetp<=3||moveAngle<=this.TouchMoveMinAngle)&&this.EnableScrollUpDown==true){this.StopDragTimer();return;}this.PreventTouchEvent(e);this.MouseDrag=null;var pixelTatio=GetDevicePixelRatio();var x=touches[0].clientX-uielement.getBoundingClientRect().left*pixelTatio;var y=touches[0].clientY-uielement.getBoundingClientRect().top*pixelTatio;this.OnMouseMove(x,y,e);}}if(this.PhoneTouchInfo){this.PhoneTouchInfo.End.X=touches[0].clientX;this.PhoneTouchInfo.End.Y=touches[0].clientY;}}else if(this.IsPhonePinching(e)){this.PreventTouchEvent(e);var phonePinch=this.PhonePinch;if(!phonePinch)return;var yHeight=Math.abs(touches[0].pageY-touches[1].pageY);var yLastHeight=Math.abs(phonePinch.Last.Y-phonePinch.Last.Y2);var yStep=yHeight-yLastHeight;var xHeight=Math.abs(touches[0].pageX-touches[1].pageX);var xLastHeight=Math.abs(phonePinch.Last.X-phonePinch.Last.X2);var xStep=xHeight-xLastHeight;var minStep=this.ZoomStepPixel;if(Math.abs(xStep)>minStep){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MINUTE_TOUCH_ZOOM);if(event&&event.Callback){var data={XStep:xStep,YStep:yStep,PreventDefault:false};event.Callback(event,data,this);if(data.PreventDefault){this.PhonePinch=null;this.StopDragTimer();return;}}}phonePinch.Last={"X":touches[0].pageX,"Y":touches[0].pageY,"X2":touches[1].pageX,"Y2":touches[1].pageY};}if(this.EnableScrollUpDown==false){e.preventDefault();}else{if(drag==null){this.PreventTouchEvent(e);//十字光标出来了,阻止消息
7433
7436
  }else{this.StopDragTimer();//上下推动图片,停止定时器,消息传递下去
7434
7437
  }}};this.OnTouchEnd=function(e){JSConsole.Chart.Log('[MinuteChartContainer::OnTouchEnd]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var bClearDrawPicture=true;if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2||drawPicture.Status==1||drawPicture.Status==3){drawPicture.PointStatus=drawPicture.Status;if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo();else bClearDrawPicture=false;}else if(drawPicture.Status==20){if(this.FinishMoveChartDrawPicture())this.DrawDynamicInfo();}}if(this.EnableZoomIndexWindow){var time=Date.now();this.PhoneDBClick.AddTouchEnd(time);if(this.PhoneDBClick.IsVaildDBClick()){this.OnTouchDBClick(this.PhoneDBClick.Start);this.PhoneDBClick.Clear();}}this.IsOnTouch=false;this.StopDragTimer();this.TouchEvent({EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH,FunctionName:"OnTouchEnd"},e);this.OnTouchFinished();this.TouchDrawCount=0;};//键盘左右移动十字光标
7435
- this.OnKeyDown=function(e){this.StopDisplayLatest();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
7438
+ this.OnKeyDown=function(e){this.StopDisplayLatest();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;//回调事件
7439
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);if(event&&event.Callback){var sendData={e:e,PreventDefault:false};event.Callback(event,sendData,this);if(sendData.PreventDefault)return;}var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
7436
7440
  if(this.EnableNewIndex){this.MoveCorssCursorIndex({IsMoveLeft:true});}else{if(!IFrameSplitOperator.IsNumber(this.CursorIndex)){var xPointcount=0;if(this.Frame.XPointCount)xPointcount=this.Frame.XPointCount;else xPointcount=this.Frame.SubFrame[0].Frame.XPointCount;this.CursorIndex=xPointcount-1;}this.CursorIndex=parseInt(this.CursorIndex);if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft())break;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();}else{--this.CursorIndex;this.UpdatePointByCursorIndex();this.DrawDynamicInfo();}}break;case 39://right
7437
7441
  if(this.EnableNewIndex){this.MoveCorssCursorIndex({IsMoveLeft:false});}else{var xPointcount=0;if(this.Frame.XPointCount)xPointcount=this.Frame.XPointCount;else xPointcount=this.Frame.SubFrame[0].Frame.XPointCount;if(!IFrameSplitOperator.IsNumber(this.CursorIndex))this.CursorIndex=0;this.CursorIndex=parseInt(this.CursorIndex);if(this.CursorIndex+1>=xPointcount){if(!this.DataMoveRight())break;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();}else{//判断是否在最后一个数据上
7438
7442
  var data=null;if(this.Frame.Data)data=this.Frame.Data;else data=this.Frame.SubFrame[0].Frame.Data;if(!data)break;if(this.CursorIndex+data.DataOffset+1>=data.Data.length)break;++this.CursorIndex;this.UpdatePointByCursorIndex();this.DrawDynamicInfo();}}break;case 46://del
@@ -12471,7 +12475,7 @@ this.AreaColor=g_JSChartResource.ScrollBar.BGChart.AreaColor;//面积图颜色
12471
12475
  };this.Draw=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;this.Canvas.save();if(this.LineWidth>0)this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();var bottom=this.ChartBorder.GetBottom();this.Canvas.strokeStyle=this.Color;var bFirstPoint=true;var drawCount=0,x,y;var firstPoint={};for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var value=item.Close;if(!IFrameSplitOperator.IsNumber(value))continue;x=this.ChartFrame.GetXFromIndex(i);y=this.ChartFrame.GetYFromData(value);if(bFirstPoint){this.Canvas.beginPath();this.Canvas.moveTo(x,y);bFirstPoint=false;firstPoint={X:x,Y:y};}else{this.Canvas.lineTo(x,y);}++drawCount;}if(drawCount>0){this.Canvas.stroke();this.Canvas.lineTo(x,bottom);this.Canvas.lineTo(firstPoint.X,bottom);this.Canvas.closePath();this.Canvas.fillStyle=this.AreaColor;this.Canvas.fill();}this.Canvas.restore();};this.GetMaxMin=function(){var range={Max:null,Min:null};if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return range;for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var value=item.Close;if(!IFrameSplitOperator.IsNumber(value))continue;if(range.Max==null||range.Max<value)range.Max=value;if(range.Min==null||range.Min>value)range.Min=value;}return range;};}/********************************************************************************
12472
12476
  * 版本信息输出
12473
12477
  *
12474
- */var HQCHART_VERSION="1.1.12449";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();//把给外界调用的方法暴露出来
12478
+ */var HQCHART_VERSION="1.1.12452";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();//把给外界调用的方法暴露出来
12475
12479
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12476
12480
  // BaseIndex:BaseIndex,
12477
12481
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "hqchart",
3
3
  "description": "stock chart",
4
4
  "author": "jones2000",
5
- "version": "1.1.12450",
5
+ "version": "1.1.12453",
6
6
  "main": "lib/main.js",
7
7
  "private": false,
8
8
  "license": "Apache License 2.0",
@@ -2494,6 +2494,8 @@ var JSCHART_EVENT_ID=
2494
2494
  ON_CUSTOM_DRAG_DOC_MOUSE_MOVE:114,
2495
2495
  ON_CUSTOM_DRAG_DOC_MOUSE_UP:115,
2496
2496
  ON_CUSTOM_DRAG_MOUSE_MOVE:116,
2497
+
2498
+ ON_KEYDOWN:117
2497
2499
  }
2498
2500
 
2499
2501
  var JSCHART_OPERATOR_ID=
@@ -5895,6 +5897,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5895
5897
  this.OnKeyDown=function(e)
5896
5898
  {
5897
5899
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
5900
+
5901
+ //回调事件
5902
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
5903
+ if (event && event.Callback)
5904
+ {
5905
+ var sendData={ e:e, PreventDefault:false };
5906
+ event.Callback(event, sendData, this);
5907
+ if (sendData.PreventDefault) return;
5908
+ }
5898
5909
 
5899
5910
  var keyID = e.keyCode ? e.keyCode :e.which;
5900
5911
  switch(keyID)
@@ -51371,6 +51382,36 @@ IChartDrawPicture.RGBToHex=function(rgb)
51371
51382
  return "#" + r + g + b;
51372
51383
  }
51373
51384
 
51385
+ //16进制颜色转rgb
51386
+ IChartDrawPicture.HexToRGB=function(color)
51387
+ {
51388
+ color = color.toLowerCase();
51389
+ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
51390
+ if (color && reg.test(color))
51391
+ {
51392
+ if (color.length === 4)
51393
+ {
51394
+ var sColorNew = "#";
51395
+ for (var i=1; i<4; i+=1)
51396
+ {
51397
+ sColorNew += color.slice(i, i+1).concat(color.slice(i, i+1));
51398
+ }
51399
+ color = sColorNew;
51400
+ }
51401
+
51402
+ //处理六位的颜色值
51403
+ var sColorChange = [];
51404
+ for (var i=1; i<7; i+=2)
51405
+ {
51406
+ sColorChange.push(parseInt("0x"+color.slice(i, i+2)));
51407
+ }
51408
+
51409
+ return "rgb(" + sColorChange.join(",") + ")";
51410
+ }
51411
+
51412
+ return null;
51413
+ }
51414
+
51374
51415
  IChartDrawPicture.ArrayDrawPricture=
51375
51416
  [
51376
51417
  { Name:"线段", ClassName:'ChartDrawPictureLine', Create:function() { return new ChartDrawPictureLine(); } },
@@ -71159,6 +71200,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
71159
71200
 
71160
71201
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
71161
71202
 
71203
+ //回调事件
71204
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
71205
+ if (event && event.Callback)
71206
+ {
71207
+ var sendData={ e:e, PreventDefault:false };
71208
+ event.Callback(event, sendData, this);
71209
+ if (sendData.PreventDefault) return;
71210
+ }
71211
+
71162
71212
  var keyID = e.keyCode ? e.keyCode :e.which;
71163
71213
  switch(keyID)
71164
71214
  {
@@ -6574,6 +6574,8 @@ var JSCHART_EVENT_ID=
6574
6574
  ON_CUSTOM_DRAG_DOC_MOUSE_MOVE:114,
6575
6575
  ON_CUSTOM_DRAG_DOC_MOUSE_UP:115,
6576
6576
  ON_CUSTOM_DRAG_MOUSE_MOVE:116,
6577
+
6578
+ ON_KEYDOWN:117
6577
6579
  }
6578
6580
 
6579
6581
  var JSCHART_OPERATOR_ID=
@@ -9975,6 +9977,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9975
9977
  this.OnKeyDown=function(e)
9976
9978
  {
9977
9979
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
9980
+
9981
+ //回调事件
9982
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
9983
+ if (event && event.Callback)
9984
+ {
9985
+ var sendData={ e:e, PreventDefault:false };
9986
+ event.Callback(event, sendData, this);
9987
+ if (sendData.PreventDefault) return;
9988
+ }
9978
9989
 
9979
9990
  var keyID = e.keyCode ? e.keyCode :e.which;
9980
9991
  switch(keyID)
@@ -55451,6 +55462,36 @@ IChartDrawPicture.RGBToHex=function(rgb)
55451
55462
  return "#" + r + g + b;
55452
55463
  }
55453
55464
 
55465
+ //16进制颜色转rgb
55466
+ IChartDrawPicture.HexToRGB=function(color)
55467
+ {
55468
+ color = color.toLowerCase();
55469
+ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
55470
+ if (color && reg.test(color))
55471
+ {
55472
+ if (color.length === 4)
55473
+ {
55474
+ var sColorNew = "#";
55475
+ for (var i=1; i<4; i+=1)
55476
+ {
55477
+ sColorNew += color.slice(i, i+1).concat(color.slice(i, i+1));
55478
+ }
55479
+ color = sColorNew;
55480
+ }
55481
+
55482
+ //处理六位的颜色值
55483
+ var sColorChange = [];
55484
+ for (var i=1; i<7; i+=2)
55485
+ {
55486
+ sColorChange.push(parseInt("0x"+color.slice(i, i+2)));
55487
+ }
55488
+
55489
+ return "rgb(" + sColorChange.join(",") + ")";
55490
+ }
55491
+
55492
+ return null;
55493
+ }
55494
+
55454
55495
  IChartDrawPicture.ArrayDrawPricture=
55455
55496
  [
55456
55497
  { Name:"线段", ClassName:'ChartDrawPictureLine', Create:function() { return new ChartDrawPictureLine(); } },
@@ -75239,6 +75280,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
75239
75280
 
75240
75281
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
75241
75282
 
75283
+ //回调事件
75284
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
75285
+ if (event && event.Callback)
75286
+ {
75287
+ var sendData={ e:e, PreventDefault:false };
75288
+ event.Callback(event, sendData, this);
75289
+ if (sendData.PreventDefault) return;
75290
+ }
75291
+
75242
75292
  var keyID = e.keyCode ? e.keyCode :e.which;
75243
75293
  switch(keyID)
75244
75294
  {
@@ -127725,7 +127775,7 @@ function ScrollBarBGChart()
127725
127775
 
127726
127776
 
127727
127777
 
127728
- var HQCHART_VERSION="1.1.12449";
127778
+ var HQCHART_VERSION="1.1.12452";
127729
127779
 
127730
127780
  function PrintHQChartVersion()
127731
127781
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12449";
8
+ var HQCHART_VERSION="1.1.12452";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -6618,6 +6618,8 @@ var JSCHART_EVENT_ID=
6618
6618
  ON_CUSTOM_DRAG_DOC_MOUSE_MOVE:114,
6619
6619
  ON_CUSTOM_DRAG_DOC_MOUSE_UP:115,
6620
6620
  ON_CUSTOM_DRAG_MOUSE_MOVE:116,
6621
+
6622
+ ON_KEYDOWN:117
6621
6623
  }
6622
6624
 
6623
6625
  var JSCHART_OPERATOR_ID=
@@ -10019,6 +10021,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10019
10021
  this.OnKeyDown=function(e)
10020
10022
  {
10021
10023
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
10024
+
10025
+ //回调事件
10026
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
10027
+ if (event && event.Callback)
10028
+ {
10029
+ var sendData={ e:e, PreventDefault:false };
10030
+ event.Callback(event, sendData, this);
10031
+ if (sendData.PreventDefault) return;
10032
+ }
10022
10033
 
10023
10034
  var keyID = e.keyCode ? e.keyCode :e.which;
10024
10035
  switch(keyID)
@@ -55495,6 +55506,36 @@ IChartDrawPicture.RGBToHex=function(rgb)
55495
55506
  return "#" + r + g + b;
55496
55507
  }
55497
55508
 
55509
+ //16进制颜色转rgb
55510
+ IChartDrawPicture.HexToRGB=function(color)
55511
+ {
55512
+ color = color.toLowerCase();
55513
+ var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
55514
+ if (color && reg.test(color))
55515
+ {
55516
+ if (color.length === 4)
55517
+ {
55518
+ var sColorNew = "#";
55519
+ for (var i=1; i<4; i+=1)
55520
+ {
55521
+ sColorNew += color.slice(i, i+1).concat(color.slice(i, i+1));
55522
+ }
55523
+ color = sColorNew;
55524
+ }
55525
+
55526
+ //处理六位的颜色值
55527
+ var sColorChange = [];
55528
+ for (var i=1; i<7; i+=2)
55529
+ {
55530
+ sColorChange.push(parseInt("0x"+color.slice(i, i+2)));
55531
+ }
55532
+
55533
+ return "rgb(" + sColorChange.join(",") + ")";
55534
+ }
55535
+
55536
+ return null;
55537
+ }
55538
+
55498
55539
  IChartDrawPicture.ArrayDrawPricture=
55499
55540
  [
55500
55541
  { Name:"线段", ClassName:'ChartDrawPictureLine', Create:function() { return new ChartDrawPictureLine(); } },
@@ -75283,6 +75324,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
75283
75324
 
75284
75325
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
75285
75326
 
75327
+ //回调事件
75328
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);
75329
+ if (event && event.Callback)
75330
+ {
75331
+ var sendData={ e:e, PreventDefault:false };
75332
+ event.Callback(event, sendData, this);
75333
+ if (sendData.PreventDefault) return;
75334
+ }
75335
+
75286
75336
  var keyID = e.keyCode ? e.keyCode :e.which;
75287
75337
  switch(keyID)
75288
75338
  {
@@ -127769,7 +127819,7 @@ function ScrollBarBGChart()
127769
127819
 
127770
127820
 
127771
127821
 
127772
- var HQCHART_VERSION="1.1.12449";
127822
+ var HQCHART_VERSION="1.1.12452";
127773
127823
 
127774
127824
  function PrintHQChartVersion()
127775
127825
  {