hqchart 1.1.14501 → 1.1.14506

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.
@@ -8215,6 +8215,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8215
8215
  drag.LastMove.X=e.clientX;
8216
8216
  drag.LastMove.Y=e.clientY;
8217
8217
  }
8218
+ else if (drag.Click && drag.Click.IsInFrameBottom)
8219
+ {
8220
+ this.OnDragXCoordinateZoom(drag, {X:moveSetp, Y:moveSetpY}, e);
8221
+ }
8218
8222
  else if ((bLButtonSelectRect || bRButtonSelectRect) && !isDragSelectRect && !isDragSubSelectRect) //左右键区间选择
8219
8223
  {
8220
8224
  var yMoveSetp=Math.abs(drag.LastMove.Y-e.clientY);
@@ -8236,6 +8240,38 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8236
8240
  }
8237
8241
  }
8238
8242
 
8243
+ this.OnDragXCoordinateZoom=function(drag, moveData, e)
8244
+ {
8245
+ var moveSetp=moveData.X;
8246
+ var moveSetpY=moveData.Y;
8247
+ if (moveSetp<5) return;
8248
+
8249
+ var isLeft=true;
8250
+ if (drag.LastMove.X<e.clientX) isLeft=false;//右移数据
8251
+
8252
+ var cursorStatus="ew-resize";
8253
+
8254
+ var oneStepWidth=this.GetMoveOneStepWidth();
8255
+ if (moveSetp<oneStepWidth)
8256
+ {
8257
+ this.SetCursor({Cursor:cursorStatus});
8258
+ return;
8259
+ }
8260
+
8261
+ if (this.XCoordinateZoom(moveSetp,isLeft))
8262
+ {
8263
+ this.UpdataDataoffset();
8264
+ this.UpdateFrameMaxMin();
8265
+ this.ResetFrameXYSplit();
8266
+
8267
+ this.Draw();
8268
+ this.OnKLinePageChange("datamove");
8269
+ }
8270
+
8271
+ drag.LastMove.X=e.clientX;
8272
+ this.SetCursor({Cursor:cursorStatus});
8273
+ }
8274
+
8239
8275
  this.OnDragMode_One=function(moveData, e)
8240
8276
  {
8241
8277
  var moveSetp=moveData.X;
@@ -8296,7 +8332,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8296
8332
  if (drag.LastMove.X<e.clientX) isLeft=false;//右移数据
8297
8333
 
8298
8334
  var cursorStatus="pointer";
8299
- if (drag.Click.IsInFrameBottom) cursorStatus="ew-resize";
8300
8335
  var oneStepWidth=this.GetMoveOneStepWidth();
8301
8336
  if (moveSetp<oneStepWidth)
8302
8337
  {
@@ -8307,18 +8342,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8307
8342
  }
8308
8343
  else
8309
8344
  {
8310
- if (drag.Click && drag.Click.IsInFrameBottom)
8311
- {
8312
-
8313
- if (this.XCoordinateZoom(moveSetp,isLeft))
8314
- {
8315
- this.UpdataDataoffset();
8316
- this.UpdateFrameMaxMin();
8317
- this.ResetFrameXYSplit();
8318
- bNeedDraw=true;
8319
- }
8320
- }
8321
- else if(this.DataMove(moveSetp,isLeft))
8345
+ if(this.DataMove(moveSetp,isLeft))
8322
8346
  {
8323
8347
  this.UpdataDataoffset();
8324
8348
  //this.UpdatePointByCursorIndex(); //推拽数据的时候不需要把鼠标位置更新到K线上
@@ -8443,9 +8467,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8443
8467
  }
8444
8468
  else if (IsMinuteChart)
8445
8469
  {
8446
- if (this.OnMinuteSelectRectMouseUp) this.OnMinuteSelectRectMouseUp(e);
8470
+ if (this.OnMinuteSelectRectMouseUp) this.OnMinuteSelectRectMouseUp(e); //分时图区间选择
8447
8471
  }
8448
- else if (bLButtonSelectRect || bRButtonSelectRect) //区间选择
8472
+ else if (bLButtonSelectRect || bRButtonSelectRect) //K线图区间选择
8449
8473
  {
8450
8474
  var drag=this.MouseDrag;
8451
8475
  drag.LastMove.X=e.clientX;
@@ -8460,49 +8484,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8460
8484
  selectData.YEnd=(drag.LastMove.Y-uielement.getBoundingClientRect().top)*pixelTatio;
8461
8485
  selectData.JSChartContainer=this;
8462
8486
  selectData.Stock={Symbol:this.Symbol, Name:this.Name};
8487
+ selectData.IsLButton=bLButtonSelectRect;
8488
+ selectData.IsRButton=bRButtonSelectRect;
8463
8489
 
8464
8490
  if (!this.BorderDrag && this.GetSelectRectData(selectData))
8465
8491
  {
8466
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);
8467
- var paint=this.GetRectSelectPaint();
8468
- var isShowMenu=true;
8469
- if (event && event.Callback)
8470
- {
8471
- var data=
8472
- {
8473
- X:drag.LastMove.X-uielement.getBoundingClientRect().left,
8474
- Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,
8475
- SelectData:selectData, //区间选择的数据
8476
- RectSelectPaint:paint, //区间选择背景
8477
- IsShowMenu:true,
8478
- e,e
8479
- };
8480
- event.Callback(event,data,this);
8481
- isShowMenu=data.IsShowMenu;
8482
- }
8483
-
8484
- if (IsMinuteChart) //分时图直接显示显示区间选择
8485
- {
8486
- this.HideSelectRect();
8487
- this.UpdateSelectRect(selectData.Start,selectData.End);
8488
- }
8489
- else
8490
- {
8491
- if (isShowMenu)
8492
- {
8493
- var data=
8494
- {
8495
- Chart:this,
8496
- X:drag.LastMove.X-uielement.getBoundingClientRect().left,
8497
- Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,
8498
- SelectData:selectData, //区间选择的数据
8499
- RectSelectPaint:paint //区间选择背景
8500
- };
8501
-
8502
- e.data=data;
8503
- this.PopupSelectRectMenuV2(data, e);
8504
- }
8505
- }
8492
+ this.FinishSelectRect(selectData, e);
8506
8493
  }
8507
8494
  else
8508
8495
  {
@@ -8542,6 +8529,92 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8542
8529
  this.ClearDocContextMenuTimer(5000);
8543
8530
  }
8544
8531
 
8532
+ //区间选择完成
8533
+ this.FinishSelectRect=function(selectData, e)
8534
+ {
8535
+ var bMinuteChart=this.IsMinuteContainer();
8536
+ var drag=this.MouseDrag;
8537
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);
8538
+ var paint=this.GetRectSelectPaint();
8539
+
8540
+ var x=drag.LastMove.X-uielement.getBoundingClientRect().left;
8541
+ var y=drag.LastMove.Y-uielement.getBoundingClientRect().top;
8542
+
8543
+ if (e) //往事件里面 写如我们的数据
8544
+ {
8545
+ var data=
8546
+ {
8547
+ Chart:this, X:x,Y:y,
8548
+ SelectData:selectData, //区间选择的数据
8549
+ RectSelectPaint:paint, //区间选择背景
8550
+ IsLButton:selectData.IsLButton, IsRButton:selectData.IsRButton,
8551
+ };
8552
+
8553
+ e.data=data;
8554
+ }
8555
+
8556
+ var aryMenu=null, command=null;
8557
+ if (bMinuteChart) //分时图 默认区间统计
8558
+ {
8559
+ command={ ID:JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID, Args:[e,selectData] };
8560
+ }
8561
+ else //K线默认 区间选择K线
8562
+ {
8563
+ aryMenu=
8564
+ [
8565
+ { Name:"区间统计", Data:{ ID:JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID, Args:[e,selectData] }},
8566
+ { Name:"区间放大", Data:{ ID:JSCHART_MENU_ID.CMD_SELECTED_ZOOM_ID, Args:[selectData] }}
8567
+ ];
8568
+ }
8569
+
8570
+ if (event && event.Callback)
8571
+
8572
+ var sendData=
8573
+ {
8574
+ X:x, Y:y, e:e,
8575
+ SelectData:selectData, //区间选择的数据
8576
+ RectSelectPaint:paint, //区间选择背景
8577
+ AryMenu:aryMenu, //菜单 填null 不就会弹菜单
8578
+ Command:command, //执行命令
8579
+ IsLButton:selectData.IsLButton, IsRButton:selectData.IsRButton,
8580
+ PreventDefault:false,
8581
+ };
8582
+ if (bMinuteChart) sendData.Command=null; //分时图 调用事件 不做任何事
8583
+
8584
+ event.Callback(event,sendData,this);
8585
+
8586
+ if (sendData.PreventDefault==true) return; //已被上层替换,不调用默认的网络请求
8587
+
8588
+ aryMenu=sendData.AryMenu;
8589
+ command=sendData.Command;
8590
+
8591
+
8592
+ if (aryMenu) //弹菜单
8593
+ {
8594
+ this.PopupSelectRectMenuV3(aryMenu, data, e);
8595
+ return;
8596
+ }
8597
+
8598
+ if (command) //执行命令
8599
+ {
8600
+ this.ExecuteMenuCommand(command.ID, command.Args);
8601
+ return;
8602
+ }
8603
+
8604
+ this.HideSelectRect();
8605
+ this.UpdateSelectRect(selectData.Start,selectData.End);
8606
+ }
8607
+
8608
+ this.PopupSelectRectMenuV3=function(aryMenu, data, e)
8609
+ {
8610
+ if (!aryMenu) return;
8611
+
8612
+ var menuData={ Menu:aryMenu, Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID };
8613
+ menuData.ClickCallback=(data)=>{ this.OnClickRightMenu(data); }
8614
+ var x=data.X, y=data.Y;
8615
+ this.PopupMenuByRClick(menuData, x, y);
8616
+ }
8617
+
8545
8618
  this.DocContextMenu=function(e)
8546
8619
  {
8547
8620
  e.preventDefault();
@@ -28982,12 +29055,12 @@ function IChartPainting()
28982
29055
  if (valueType==1) //K线收盘价
28983
29056
  {
28984
29057
  var kItem=this.Data.Data[i];
28985
- if (IFrameSplitOperator.IsNumber(kItem.Close)) value=kItem.Close
29058
+ if (kItem && IFrameSplitOperator.IsNumber(kItem.Close)) value=kItem.Close
28986
29059
  }
28987
29060
  else if (valueType==2)
28988
29061
  {
28989
29062
  var kItem=this.Data.Data[i];
28990
- if (IFrameSplitOperator.IsNumber(kItem.Vol)) value=kItem.Vol
29063
+ if (kItem && IFrameSplitOperator.IsNumber(kItem.Vol)) value=kItem.Vol
28991
29064
  }
28992
29065
  else if (valueType==3)
28993
29066
  {
@@ -80611,8 +80684,21 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
80611
80684
  x+=(rtClient.left+rtScroll.Left);
80612
80685
  y+=(rtClient.top+rtScroll.Top);
80613
80686
 
80614
- var date=data.Tooltip.Data.Date;
80615
- var symbol=data.Chart.Symbol;
80687
+ var item=data.Tooltip.Data;
80688
+ var date=item.Date;
80689
+ var symbol=null;
80690
+
80691
+ if (data.Tooltip.ChartPaint && data.Tooltip.ChartPaint.Name=="DRAWKLINE")
80692
+ {
80693
+ if (item.Symbol) symbol=item.Symbol;
80694
+ else if (data.Tooltip.Symbol) symbol=data.Tooltip.Symbol;
80695
+ }
80696
+ else
80697
+ {
80698
+ symbol=data.Chart.Symbol;
80699
+ }
80700
+
80701
+ if (!symbol) return;
80616
80702
 
80617
80703
  this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x/pixelRatio,y/pixelRatio);
80618
80704
  }
@@ -88177,6 +88263,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
88177
88263
  }
88178
88264
  else if ((bRButtonSelectRect || bLButtonSelectRect) && !this.BorderDrag && this.GetSelectRectData(selectData))
88179
88265
  {
88266
+ this.FinishSelectRect(selectData, e);
88267
+
88268
+ /*
88180
88269
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);
88181
88270
  var paint=this.GetRectSelectPaint();
88182
88271
  var isShowDialog=true; //是否显示内置区间选择框
@@ -88214,6 +88303,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
88214
88303
  this.HideSelectRect();
88215
88304
  this.UpdateSelectRect(selectData.Start,selectData.End);
88216
88305
  }
88306
+ */
88217
88307
  }
88218
88308
  else
88219
88309
  {
@@ -154148,7 +154238,7 @@ function HQChartScriptWorker()
154148
154238
 
154149
154239
 
154150
154240
 
154151
- var HQCHART_VERSION="1.1.14500";
154241
+ var HQCHART_VERSION="1.1.14505";
154152
154242
 
154153
154243
  function PrintHQChartVersion()
154154
154244
  {