hqchart 1.1.14286 → 1.1.14291

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.
@@ -3053,12 +3053,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3053
3053
  IsDisplayLatest:false,
3054
3054
  SelectedBorder:{ Mode:0, SelFrame:0 }, //边框选中模式 Mode:0=禁用 1=右侧标记选中 2=指标窗口标记选中
3055
3055
  SelectedXBorder: { Mode:0, Date:null }, //X边框选中模式 Mode:0=禁用 分时图图有效
3056
- //XDateFormat (多日分时图x轴底部日期格式)
3056
+ //XDateFormat (多日分时图x轴底部日期格式)
3057
+
3058
+ //右侧框架外部坐标和间距
3057
3059
  RightHorizontal:
3058
3060
  {
3059
3061
  //Show:true,
3060
3062
  //Width:5
3061
- } //右侧框架外部坐标和间距
3063
+ },
3064
+
3065
+ //锁十字光标
3066
+ LockCorssCursor:{ X:{ Enable:false } }
3062
3067
  };
3063
3068
 
3064
3069
  this.VerticalDrag; //通过X轴左右拖动数据(手势才有)
@@ -4464,7 +4469,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4464
4469
  this.UIOnMounseOut=function(e)
4465
4470
  {
4466
4471
  JSConsole.Chart.Log('[KLineChartContainer::UIOnMounseOut]',e);
4467
- this.UIOnMouseMove(e);
4472
+ if (!this.IsLockCorssCursor()) this.UIOnMouseMove(e); //锁十字光标时, 始终显示十字光标
4468
4473
  }
4469
4474
 
4470
4475
  this.UIOnMouseleave=function(e)
@@ -5685,15 +5690,16 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5685
5690
 
5686
5691
  var bDrawDialogTooltip=false;
5687
5692
  var ptPosition=null; //鼠标位置 null 无效 -1 在外面 >=0 对应的指标窗口中ID
5688
- if (this.LastPoint.X!=null || this.LastPoint.Y!=null)
5693
+ var corssCursorPos=this.GetCorssCursorPosition()
5694
+ if (corssCursorPos.LastPoint.X!=null || corssCursorPos.LastPoint.Y!=null)
5689
5695
  {
5690
5696
  if (this.ChartCorssCursor)
5691
5697
  {
5692
- this.ChartCorssCursor.LastPoint=this.LastPoint;
5693
- this.ChartCorssCursor.CursorIndex=this.CursorIndex;
5698
+ this.ChartCorssCursor.LastPoint=corssCursorPos.LastPoint;
5699
+ this.ChartCorssCursor.CursorIndex=corssCursorPos.CursorIndex;
5694
5700
  if (this.EnableNewIndex)
5695
5701
  {
5696
- this.ChartCorssCursor.CorssCursorIndex=this.CorssCursorIndex;
5702
+ this.ChartCorssCursor.CorssCursorIndex=corssCursorPos.CorssCursorIndex;
5697
5703
  this.ChartCorssCursor.EnableNewIndex=this.EnableNewIndex;
5698
5704
  }
5699
5705
 
@@ -5743,8 +5749,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5743
5749
  var item=this.TitlePaint[i];
5744
5750
  if (!item.IsDynamic) continue;
5745
5751
 
5746
- item.CursorIndex=this.CursorIndex;
5747
- item.LastPoint=this.LastPoint;
5752
+ item.CursorIndex=corssCursorPos.CursorIndex;
5753
+ item.LastPoint=corssCursorPos.LastPoint;
5748
5754
  if (item.ClassName=='DynamicChartTitlePainting') item.OnDrawEvent=eventIndexTitleDraw
5749
5755
  else item.OnDrawEvent=eventTitleDraw;
5750
5756
 
@@ -5752,6 +5758,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5752
5758
  {
5753
5759
  item.OnDrawEvent.FunctionName='Draw';
5754
5760
  item.OnDrawEvent.PointPosition=ptPosition;
5761
+ if (this.IsLockCorssCursor())
5762
+ {
5763
+ if (item.OnDrawEvent.PointPosition<0) item.OnDrawEvent.PointPosition=0;
5764
+ }
5755
5765
  }
5756
5766
 
5757
5767
  item.DrawStatus=drawStatus;
@@ -6061,6 +6071,25 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6061
6071
  }
6062
6072
  }
6063
6073
 
6074
+ //十字光标坐标
6075
+ this.GetCorssCursorPosition=function()
6076
+ {
6077
+ var position=
6078
+ {
6079
+ LastPoint:{ X:this.LastPoint.X, Y:this.LastPoint.Y },
6080
+ CursorIndex:this.CursorIndex,
6081
+ };
6082
+
6083
+ return position;
6084
+ }
6085
+
6086
+ this.IsLockCorssCursor=function()
6087
+ {
6088
+ if (!this.GlobalOption || !this.GlobalOption.LockCorssCursor) return false;
6089
+
6090
+ return this.GlobalOption.LockCorssCursor.X.Enable;
6091
+ }
6092
+
6064
6093
  //画动态信息
6065
6094
  this.DrawDynamicInfo=function(option)
6066
6095
  {
@@ -6138,13 +6167,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6138
6167
 
6139
6168
  this.DrawDrawPictureXYCoordinate();
6140
6169
  var bDrawDialogTooltip=false;
6170
+ var corssCursorPos=this.GetCorssCursorPosition(); //十字光标的位置
6141
6171
  if (this.ChartCorssCursor)
6142
6172
  {
6143
- this.ChartCorssCursor.LastPoint=this.LastPoint;
6144
- this.ChartCorssCursor.CursorIndex=this.CursorIndex;
6173
+ this.ChartCorssCursor.LastPoint=corssCursorPos.LastPoint;
6174
+ this.ChartCorssCursor.CursorIndex=corssCursorPos.CursorIndex;
6145
6175
  if (this.EnableNewIndex)
6146
6176
  {
6147
- this.ChartCorssCursor.CorssCursorIndex=this.CorssCursorIndex;
6177
+ this.ChartCorssCursor.CorssCursorIndex=corssCursorPos.CorssCursorIndex;
6148
6178
  this.ChartCorssCursor.EnableNewIndex=this.EnableNewIndex;
6149
6179
  }
6150
6180
 
@@ -6198,18 +6228,29 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6198
6228
  var item=this.TitlePaint[i];
6199
6229
  if (!item.IsDynamic) continue;
6200
6230
 
6201
- item.CursorIndex=this.CursorIndex;
6231
+ item.CursorIndex=corssCursorPos.CursorIndex;
6202
6232
  item.LastPoint=this.LastPoint;
6203
6233
  if (item.OnDrawEvent)
6204
6234
  {
6205
6235
  item.OnDrawEvent.FunctionName='DrawDynamicInfo';
6206
6236
  item.OnDrawEvent.PointPosition=ptPosition;
6237
+ if (this.IsLockCorssCursor())
6238
+ {
6239
+ if (item.OnDrawEvent.PointPosition<0) item.OnDrawEvent.PointPosition=0;
6240
+ }
6207
6241
  }
6208
6242
  item.DrawStatus=drawStatus;
6209
6243
 
6210
6244
  var pointInfo=null;
6211
6245
  if (option && IFrameSplitOperator.IsNumber(option.ClientPos) && option.Point) //当前鼠标所在位置的详细信息 包含盘前盘后
6246
+ {
6212
6247
  pointInfo={ ClientPos:option.ClientPos, Point:{ X:option.Point.X, Y:option.Point.Y }};
6248
+ if (this.IsLockCorssCursor())
6249
+ {
6250
+ if (pointInfo.ClientPos<=0) pointInfo.ClientPos=1;
6251
+ }
6252
+ }
6253
+
6213
6254
  item.PointInfo=pointInfo;
6214
6255
 
6215
6256
  item.Draw(moveonPoint, this.LastMouseStatus);
@@ -56099,6 +56140,9 @@ function DynamicMinuteTitlePainting()
56099
56140
  isShowLastData=true;
56100
56141
  }
56101
56142
 
56143
+ //十字光标锁定状态 禁用显示最后一个数据
56144
+ if (this.GlobalOption && this.GlobalOption.LockCorssCursor && this.GlobalOption.LockCorssCursor.X.Enable) isShowLastData=false;
56145
+
56102
56146
  var isLastOne=false;
56103
56147
  if (isShowLastData)
56104
56148
  {
@@ -56657,6 +56701,9 @@ function DynamicChartTitlePainting()
56657
56701
  isShowLastData=true;
56658
56702
  }
56659
56703
 
56704
+ //十字光标锁定状态 禁用显示最后一个数据
56705
+ if (this.GlobalOption && this.GlobalOption.LockCorssCursor && this.GlobalOption.LockCorssCursor.X.Enable) isShowLastData=false;
56706
+
56660
56707
  return isShowLastData;
56661
56708
  }
56662
56709
 
@@ -76940,6 +76987,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
76940
76987
  this.Frame.ClearUpDonwFrameYData();
76941
76988
  this.ClearCustomKLine();
76942
76989
  this.ClearKLineCaluate();
76990
+ this.UnlockCorssCursor();
76943
76991
 
76944
76992
 
76945
76993
  var kLineDrawType=this.GetKLineDrawType();
@@ -76977,6 +77025,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
76977
77025
  this.ResetOverlaySymbolStatus();
76978
77026
  this.ClearIndexRunCount();
76979
77027
  this.Frame.ClearYCoordinateMaxMin();
77028
+ this.UnlockCorssCursor();
76980
77029
  this.RequestHistoryData(); //请求日线数据
76981
77030
  //this.ReqeustKLineInfoData();
76982
77031
  }
@@ -76988,6 +77037,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
76988
77037
  this.ResetOverlaySymbolStatus();
76989
77038
  this.ClearIndexRunCount();
76990
77039
  this.Frame.ClearYCoordinateMaxMin();
77040
+ this.UnlockCorssCursor();
76991
77041
  this.RequestHistoryMinuteData(); //请求分钟数据
76992
77042
  }
76993
77043
  else if (ChartData.IsTickPeriod(this.Period))
@@ -76997,6 +77047,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
76997
77047
  this.ResetScrollBar();
76998
77048
  this.ClearIndexRunCount();
76999
77049
  this.Frame.ClearYCoordinateMaxMin();
77050
+ this.UnlockCorssCursor();
77000
77051
  this.RequestTickData(); //请求分笔数据
77001
77052
  }
77002
77053
  }
@@ -77047,6 +77098,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
77047
77098
  this.ResetOverlaySymbolStatus();
77048
77099
  this.ResetScrollBar();
77049
77100
  this.Frame.ClearYCoordinateMaxMin();
77101
+ this.UnlockCorssCursor();
77050
77102
  this.RequestHistoryData(); //请求日线数据
77051
77103
  }
77052
77104
  else if (ChartData.IsMinutePeriod(this.Period,true) || ChartData.IsSecondPeriod(this.Period) || ChartData.IsMilliSecondPeriod(this.Period))
@@ -77057,6 +77109,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
77057
77109
  this.ResetOverlaySymbolStatus();
77058
77110
  this.ResetScrollBar();
77059
77111
  this.Frame.ClearYCoordinateMaxMin();
77112
+ this.UnlockCorssCursor();
77060
77113
  this.RequestHistoryMinuteData(); //请求分钟数据
77061
77114
  }
77062
77115
  }
@@ -78401,6 +78454,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
78401
78454
  this.HideTooltip();
78402
78455
  this.ResetScrollBar();
78403
78456
  this.ClearIndexRunCount();
78457
+ this.UnlockCorssCursor();
78404
78458
  this.Frame.ClearYCoordinateMaxMin();
78405
78459
 
78406
78460
 
@@ -81160,6 +81214,40 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
81160
81214
 
81161
81215
  return data;
81162
81216
  }
81217
+
81218
+ //十字光标解锁
81219
+ this.UnlockCorssCursor=function()
81220
+ {
81221
+ var xItem=this.GlobalOption.LockCorssCursor.X;
81222
+ xItem.Enable=false;
81223
+ xItem.KLine=null;
81224
+ }
81225
+
81226
+ this.LockCorssCursor=function()
81227
+ {
81228
+ var xItem=this.GlobalOption.LockCorssCursor.X;
81229
+ xItem.KLine={ DataIndex:null, Date:null, Time:null };
81230
+ xItem.Enable=true;
81231
+ }
81232
+
81233
+ this.GetCorssCursorPosition=function()
81234
+ {
81235
+ var position=
81236
+ {
81237
+ LastPoint:{ X:this.LastPoint.X, Y:this.LastPoint.Y },
81238
+ CursorIndex:this.CursorIndex,
81239
+ };
81240
+
81241
+ if (!this.GlobalOption || !this.GlobalOption.LockCorssCursor) return position;
81242
+
81243
+ var xItem=this.GlobalOption.LockCorssCursor.X;
81244
+ if (xItem.Enable && xItem.KLine)
81245
+ {
81246
+ position.CursorIndex=xItem.KLine.CursorIndex;
81247
+ }
81248
+
81249
+ return position;
81250
+ }
81163
81251
  }
81164
81252
 
81165
81253
  //API 返回数据 转化为array[]
@@ -81591,7 +81679,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
81591
81679
  this.ColorLineData; //主图价格线颜色自定义配置
81592
81680
  this.EnableSelectRect=false; //是否可以区间选择
81593
81681
 
81594
- this.CorssCursorIndex={ DayIndex:-1, DataIndex:-1, Point:{X:-1, Y:-1} ,Type:-1 };
81682
+ this.CorssCursorIndex={ DayIndex:-1, DataIndex:-1, Point:{X:-1, Y:-1} ,Type:-1 }; //Type: 单日(1=主图 2=盘前 3=盘后) 多日(10=主图 20=盘前 30=盘后)
81595
81683
  this.EnableNewIndex=false //是否使用新的索引版本
81596
81684
 
81597
81685
  this.DayOffset={ Offset:0, ShowDayCount:-1, DataOffset:0, DayCount:1, }; //Offset 日期偏移 , DataOffset数据偏移
@@ -82348,6 +82436,118 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
82348
82436
  }
82349
82437
  }
82350
82438
 
82439
+ this.LockCorssCursor=function()
82440
+ {
82441
+ var xItem=this.GlobalOption.LockCorssCursor.X;
82442
+
82443
+ if (this.EnableNewIndex)
82444
+ {
82445
+ if (this.CorssCursorIndex.Type!=1 && this.CorssCursorIndex.Type!=10) return; //目前只支持连续交易时间段
82446
+
82447
+ xItem.Minute=
82448
+ {
82449
+ DayIndex:this.CorssCursorIndex.DayIndex,
82450
+ DataIndex:this.CorssCursorIndex.DataIndex,
82451
+ Type:this.CorssCursorIndex.Type,
82452
+ CursorIndex:this.CursorIndex,
82453
+ };
82454
+ }
82455
+ else
82456
+ {
82457
+ xItem.Minute={ CursorIndex:this.CursorIndex };
82458
+ }
82459
+
82460
+ xItem.Enable=true;
82461
+ }
82462
+
82463
+ this.UnlockCorssCursor=function()
82464
+ {
82465
+ var xItem=this.GlobalOption.LockCorssCursor.X;
82466
+ xItem.Enable=false;
82467
+ xItem.Minute=null;
82468
+ }
82469
+
82470
+ this.GetCorssCursorPosition=function()
82471
+ {
82472
+ var position=
82473
+ {
82474
+ LastPoint:{ X:this.LastPoint.X, Y:this.LastPoint.Y },
82475
+ CursorIndex:this.CursorIndex,
82476
+ CorssCursorIndex:this.CorssCursorIndex,
82477
+ };
82478
+
82479
+ if (!this.GlobalOption || !this.GlobalOption.LockCorssCursor) return position;
82480
+
82481
+ var xItem=this.GlobalOption.LockCorssCursor.X;
82482
+ if (xItem.Enable && xItem.Minute)
82483
+ {
82484
+ if (this.EnableNewIndex)
82485
+ {
82486
+ var type=xItem.Minute.Type;
82487
+ position.CorssCursorIndex={ DayIndex:xItem.Minute.DayIndex, DataIndex:xItem.Minute.DataIndex, Type:type };
82488
+ position.CursorIndex=xItem.Minute.CursorIndex;
82489
+ position.LastPoint.X=this.GetXPointByCorssCursorIndex(position.CorssCursorIndex);
82490
+ }
82491
+ else
82492
+ {
82493
+ var index=xItem.Minute.CursorIndex;
82494
+ var x=this.Frame.GetXFromIndex(index,false);
82495
+ position.LastPoint.X=x;
82496
+ position.CursorIndex=xItem.Minute.CursorIndex;
82497
+ }
82498
+
82499
+ var border=this.Frame.ChartBorder.GetBorder();
82500
+ if (position.LastPoint.Y<border.Top || position.LastPoint.Y>border.Bottom) //超出图形框子, 调整为收盘价
82501
+ {
82502
+ var kData=this.GetKData();
82503
+ if (kData && IFrameSplitOperator.IsNonEmptyArray(kData.Data))
82504
+ {
82505
+ var index=parseInt(position.CursorIndex.toFixed(0));
82506
+ var item=kData.Data[index];
82507
+ if (item && IFrameSplitOperator.IsNumber(item.Close))
82508
+ {
82509
+ var y = this.Frame.SubFrame[0].Frame.GetYFromData(item.Close);
82510
+ position.LastPoint.Y=y;
82511
+ }
82512
+ }
82513
+ }
82514
+ }
82515
+
82516
+ return position;
82517
+ }
82518
+
82519
+ this.GetXPointByCorssCursorIndex=function(corssCursorIndex)
82520
+ {
82521
+ if (!corssCursorIndex) return;
82522
+
82523
+ var x=null;
82524
+ var dayIndex=corssCursorIndex.DayIndex;
82525
+ var dataIndex=corssCursorIndex.DataIndex;
82526
+ switch(corssCursorIndex.Type) //单日 1=主图 2=盘前 3=盘后 //多日 10=主图 20=盘前 30=盘后
82527
+ {
82528
+ case 1: //单日 1=主图
82529
+ case 10: //多日 10=主图
82530
+ x=this.Frame.GetXFromIndex(dataIndex)
82531
+ break;
82532
+ /*
82533
+ case 2: //单日 2=盘前
82534
+ x=this.Frame.SubFrame[0].Frame.GetLeftExtendXFromIndex(dataIndex,this.GetBeforeOpenData());
82535
+ break;
82536
+ case 20: //多日 20=盘前
82537
+ x=this.Frame.SubFrame[0].Frame.GetLeftExtendXFromIndex(dataIndex,{ Data:this.MultiDayBeforeOpenData, });
82538
+ break;
82539
+ case 3: //单日 3=盘后
82540
+ x=this.Frame.SubFrame[0].Frame.GetRightExtendXFromIndex(dataIndex,this.GetAfterCloseData());
82541
+ break;
82542
+ case 30: //多日 30=盘后
82543
+ x=this.Frame.SubFrame[0].Frame.GetRightExtendXFromIndex(dataIndex,{ Data:this.MultiDayAfterCloseData} );
82544
+ break;
82545
+ */
82546
+ }
82547
+
82548
+ return x;
82549
+ }
82550
+
82351
82551
  this.SetCorssCursorIndex=function(option)
82352
82552
  {
82353
82553
  if (!this.EnableNewIndex) return;
@@ -84241,6 +84441,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84241
84441
  this.ReloadChartDrawPicture();
84242
84442
  this.ClearIndexRunCount();
84243
84443
  this.ClearStockCache();
84444
+ this.UnlockCorssCursor();
84244
84445
  this.Frame.ClearYCoordinateMaxMin();
84245
84446
 
84246
84447
  if (option)
@@ -84376,6 +84577,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84376
84577
  this.AutoUpdateEvent(false, "MinuteChartContainer::ChangeDayCount");
84377
84578
  this.DayCount=count;
84378
84579
  this.ClearMinuteData();
84580
+ this.UnlockCorssCursor();
84379
84581
 
84380
84582
  if (option && option.PageInfo)
84381
84583
  {