hqchart 1.1.15091 → 1.1.15106

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.
@@ -2618,12 +2618,6 @@ JSChart.RegisterScriptIndexChart=function(name, option)
2618
2618
  return g_ScriptIndexChartFactory.Add(name, option);
2619
2619
  }
2620
2620
 
2621
- //注册设置对话框类
2622
- //option:{ Create:创建类方法 }
2623
- JSChart.RegisterDialogClass=function(name, option)
2624
- {
2625
- return g_DialogFactory.Add(name, option);
2626
- }
2627
2621
 
2628
2622
  //注册框架类
2629
2623
  JSChart.RegisterChartFrameClass=function(name, option)
@@ -2896,6 +2890,8 @@ var JSCHART_EVENT_ID=
2896
2890
  ON_FORMAT_TVLONGPOSITION_LABEL:176,
2897
2891
 
2898
2892
  ON_FORMAT_COUNTDOWN_TEXT:177, //倒计时
2893
+ ON_CLICK_INDEX_LOCK:178, //点击指标锁
2894
+ ON_CORSSCURSOR_STATUS_CHANGE:179, //十字光标状态改变
2899
2895
  }
2900
2896
 
2901
2897
  var JSCHART_OPERATOR_ID=
@@ -3133,6 +3129,18 @@ var JSCHART_TRADE_STATUS_ID=
3133
3129
  SUSP_ID:1, //停牌
3134
3130
  }
3135
3131
 
3132
+ //十字光标状态
3133
+ var JSCHART_CORSSCURSOR_STATUS_ID=
3134
+ {
3135
+ NONE_ID:0,
3136
+ LINE_ID:1,
3137
+ LEFT_TEXT_ID:2,
3138
+ LEFT_INTER_TEXT_ID:4,
3139
+ RIGHT_TEXT_ID:8,
3140
+ RIGHT_INTER_TEXT_ID:16,
3141
+ BOTTOM_TEXT_ID:32,
3142
+ }
3143
+
3136
3144
 
3137
3145
  function PhoneDBClick()
3138
3146
  {
@@ -3349,6 +3357,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3349
3357
  //锁十字光标
3350
3358
  LockCorssCursor:{ X:{ Enable:false } },
3351
3359
 
3360
+ CorssCursorStatus:{ Value:null }, //十字光标状态 只读
3361
+
3352
3362
  //图形中的单元选中状态
3353
3363
  MapIndexChartCache:new Map(), //key 指标GUID
3354
3364
 
@@ -3515,6 +3525,29 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3515
3525
  this.BuySellData.ArySell=null;
3516
3526
  }
3517
3527
 
3528
+ this.UpdateCorssCursorStatus=function()
3529
+ {
3530
+ if (!this.ChartCorssCursor) return false;
3531
+ if (!this.GlobalOption || !this.GlobalOption.CorssCursorStatus) return false;
3532
+
3533
+ var status=this.ChartCorssCursor.Status;
3534
+
3535
+ //状态改变了
3536
+ if (this.GlobalOption.CorssCursorStatus.Value!=status)
3537
+ {
3538
+ this.GlobalOption.CorssCursorStatus.Value=status;
3539
+
3540
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CORSSCURSOR_STATUS_CHANGE);
3541
+ if (event && event.Callback)
3542
+ {
3543
+ var sendData={ Status:status, IsShowLine:(status&JSCHART_CORSSCURSOR_STATUS_ID.LINE_ID)>0 };
3544
+ event.Callback(event, sendData, this);
3545
+ }
3546
+ }
3547
+
3548
+ return true;
3549
+ }
3550
+
3518
3551
  this.InitalPopMenu=function() //初始化弹出窗口
3519
3552
  {
3520
3553
  if (this.JSPopMenu) return;
@@ -6482,6 +6515,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6482
6515
  this.Frame.ClearCoordinateText();
6483
6516
  this.Frame.Draw( { IsEnableSplash:this.ChartSplashPaint.IsEnableSplash} );
6484
6517
  this.ChartSplashPaint.Draw();
6518
+ this.UpdateCorssCursorStatus();
6485
6519
  return;
6486
6520
  }
6487
6521
 
@@ -6774,6 +6808,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6774
6808
  }
6775
6809
 
6776
6810
  ++this.TouchDrawCount;
6811
+
6812
+ this.UpdateCorssCursorStatus();
6777
6813
  }
6778
6814
 
6779
6815
  this.DrawExtendChartPaint=function(level, option)
@@ -7253,39 +7289,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7253
7289
  exChartOption.Tooltip=option.Tooltip;
7254
7290
  exChartOption.Point=option.Point;
7255
7291
  }
7256
- this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_25,exChartOption);
7257
- /*
7258
- for(var i=0;i<this.ExtendChartPaint.length;++i) //动态扩展图形 在动态标题以后画
7259
- {
7260
- var item=this.ExtendChartPaint[i];
7261
- if (item.IsCallbackDraw) continue;
7262
- if (item.DrawAfterPicture) continue;
7263
- if (item.ClassName=='KLineTooltipPaint' && option)
7264
- {
7265
- if (option.Tooltip==false) continue;
7266
- if (option.Point) item.LatestPoint=option.Point;
7267
- }
7268
- else if (item.ClassName=="MinuteTooltipPaint" && option)
7269
- {
7270
- if (option.Point) item.LatestPoint=option.Point;
7271
- }
7272
-
7273
- if (item.IsDynamic && item.DrawAfterTitle===true) item.Draw(moveonPoint, this.LastMouseStatus);
7274
- }
7275
- */
7276
7292
 
7293
+ this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_25,exChartOption);
7294
+
7277
7295
  if (this.EnableAnimation) this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_30);
7278
- /*
7279
- if (this.EnableAnimation)
7280
- {
7281
- for(var i=0;i<this.ExtendChartPaint.length;++i) //动画
7282
- {
7283
- var item=this.ExtendChartPaint[i];
7284
- if (item.IsAnimation===true) item.Draw();
7285
- }
7286
- }
7287
- */
7288
-
7296
+
7289
7297
  for(var i=0;i<this.ChartDrawPicture.length;++i)
7290
7298
  {
7291
7299
  var item=this.ChartDrawPicture[i];
@@ -7311,15 +7319,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7311
7319
  }
7312
7320
 
7313
7321
  this.DrawExtendChartPaint(IExtendChartPainting.DRAW_PRIORITY_ID.LEVEL_50);
7314
- /*
7315
- for(var i=0;i<this.ExtendChartPaint.length;++i) //动态扩展图形
7316
- {
7317
- var item=this.ExtendChartPaint[i];
7318
- if (item.DrawAfterPicture)
7319
- item.Draw();
7320
- }
7321
- */
7322
-
7322
+
7323
7323
  if (this.LastMouseStatus.MouseOnToolbar) //工具栏按钮提示信息
7324
7324
  {
7325
7325
  var frame=this.LastMouseStatus.MouseOnToolbar.Frame;
@@ -7331,6 +7331,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7331
7331
  if (bDrawDialogTooltip) this.DrawTooltipDialog();
7332
7332
 
7333
7333
  ++this.TouchDrawCount;
7334
+
7335
+ this.UpdateCorssCursorStatus();
7334
7336
  }
7335
7337
 
7336
7338
  this.DrawAnimation=function() //绘制动画 如弹幕
@@ -47786,7 +47788,6 @@ function ChartLock()
47786
47788
  delete this.newMethod;
47787
47789
 
47788
47790
  this.ClassName="ChartLock";
47789
- this.WidthDiv = 0.2; // 框子宽度占比
47790
47791
  this.LockCount = 20; // 锁最新的几个数据
47791
47792
  this.BGColor = g_JSChartResource.IndexLock.BGColor;
47792
47793
  this.TextColor = g_JSChartResource.IndexLock.TextColor;
@@ -47797,7 +47798,6 @@ function ChartLock()
47797
47798
  this.Callback; //回调
47798
47799
  this.IndexName; //指标名字
47799
47800
  this.IndexID; //指标ID
47800
- this.MinWidth=null; //最小宽度
47801
47801
 
47802
47802
 
47803
47803
  this.CalculateTextSize=function(aryText, defaultFont, out)
@@ -47805,17 +47805,40 @@ function ChartLock()
47805
47805
  if (!out || !IFrameSplitOperator.IsNonEmptyArray(aryText)) return false;
47806
47806
 
47807
47807
  this.Canvas.font=defaultFont;
47808
- var lineHeight=this.Canvas.measureText("擎").width; //行高
47808
+ var defaultLineHeight=this.Canvas.measureText("擎").width; //行高
47809
+ var lineHeight=defaultLineHeight;
47809
47810
  var height=0, width=0;
47810
47811
  out.AryText=[];
47811
47812
  for(var i=0;i<aryText.length;++i)
47812
47813
  {
47813
47814
  var item=aryText[i];
47814
- if (!item || !item.Text) continue;
47815
- var textWidth=this.Canvas.measureText(item.Text).width;
47815
+ if (!item || (!item.Text && !item.Image)) continue;
47816
+ if (item.Image)
47817
+ {
47818
+ textWidth=item.Image.Width;
47819
+ lineHeight=item.Image.Height;
47820
+ }
47821
+ else
47822
+ {
47823
+ if (item.Font)
47824
+ {
47825
+ this.Canvas.font=item.Font;
47826
+ lineHeight=this.Canvas.measureText("擎").width;
47827
+ }
47828
+ else
47829
+ {
47830
+ this.Canvas.font=defaultFont;
47831
+ lineHeight=defaultLineHeight;
47832
+ }
47833
+
47834
+ var textWidth=this.Canvas.measureText(item.Text).width;
47835
+ }
47816
47836
 
47817
47837
  var lineItem={ Text:item.Text, Width:textWidth, Height:lineHeight, Color:item.Color, TextMargin:{ Top:0, Bottom:0, Left:0, Right:0 }, YOffset:0 };
47818
47838
  if (IFrameSplitOperator.IsNumber(item.YOffset)) lineItem.YOffset=item.YOffset;
47839
+ if (item.Font) lineItem.Font=item.Font;
47840
+ if (IFrameSplitOperator.IsNumber(item.Align)) lineItem.Align=item.Align; //左右对齐 0=左 1=中 2=右
47841
+ if (item.Image) lineItem.Image=item.Image;
47819
47842
  if (item.TextMargin)
47820
47843
  {
47821
47844
  var margin=item.TextMargin;
@@ -47840,70 +47863,78 @@ function ChartLock()
47840
47863
  return true;
47841
47864
  }
47842
47865
 
47843
- this.Draw=function(isDraw)
47866
+ this.Draw=function(bDraw)
47844
47867
  {
47845
47868
  this.LockRect=null;
47869
+ if (!bDraw) return;
47846
47870
  if (this.NotSupportMessage)
47847
47871
  {
47848
47872
  this.DrawNotSupportmessage();
47849
47873
  return;
47850
47874
  }
47851
47875
 
47852
- if (this.ChartFrame.IsHScreen===true)
47876
+ var bHScreen=this.ChartFrame.IsHScreen;
47877
+ var bMinute=this.IsMinuteFrame();
47878
+ var dataWidth=this.ChartFrame.DataWidth;
47879
+ var distanceWidth=this.ChartFrame.DistanceWidth;
47880
+ var xPointCount=this.ChartFrame.XPointCount;
47881
+ var border=this.ChartFrame.GetBorder();
47882
+ if (bHScreen)
47853
47883
  {
47854
- this.HScreenDraw(isDraw);
47855
- return;
47884
+ var chartright=border.BottomEx;
47885
+ var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
47886
+ }
47887
+ else
47888
+ {
47889
+ var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
47890
+ var chartright=border.RightEx;
47856
47891
  }
47857
47892
 
47858
- var xOffset = this.ChartBorder.GetRight();
47859
- var border=this.ChartBorder.GetBorder();
47860
- var lOffsetWidth = 0;
47861
- if (this.ChartFrame.Data != null)
47893
+ var kData=this.ChartFrame.Data;
47894
+ var left=xOffset;
47895
+ if (kData && IFrameSplitOperator.IsNonEmptyArray(kData.Data))
47862
47896
  {
47863
- var dataWidth=this.ChartFrame.DataWidth;
47864
- var distanceWidth=this.ChartFrame.DistanceWidth;
47865
- xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+2.0;
47866
- var chartright=this.ChartBorder.GetRight();
47867
- var xPointCount=this.ChartFrame.XPointCount;
47868
- for(var i=this.ChartFrame.Data.DataOffset,j=0;i<this.ChartFrame.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
47897
+ for(var i=kData.DataOffset,j=0;i<kData.Data.length-this.LockCount && j<xPointCount-this.LockCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
47869
47898
  {
47870
- var data=this.ChartFrame.Data.Data[i];
47871
- if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
47899
+ var kItem=kData.Data[i];
47900
+ if (kItem.Open==null || kItem.High==null || kItem.Low==null || kItem.Close==null) continue;
47872
47901
 
47873
- var left=xOffset;
47874
- var right=xOffset+dataWidth;
47875
- if (right>chartright) break;
47902
+ if (bMinute)
47903
+ {
47904
+ left=this.ChartFrame.GetXFromIndex(j);
47905
+ }
47906
+ else
47907
+ {
47908
+ left=xOffset;
47909
+ var right=xOffset+dataWidth;
47910
+ if (right>chartright) break;
47911
+ }
47876
47912
  }
47877
- lOffsetWidth = (dataWidth + distanceWidth) * this.LockCount;
47878
47913
  }
47879
- if (lOffsetWidth == 0)
47914
+
47915
+ if (bHScreen)
47880
47916
  {
47881
- lOffsetWidth = (xOffset - this.ChartBorder.GetLeft()) * this.WidthDiv;
47882
- }
47883
- var lLeft = xOffset - lOffsetWidth;
47884
- if (lLeft < this.ChartBorder.GetLeft())
47885
- lLeft = this.ChartBorder.GetLeft();
47886
- var lWidth = this.ChartBorder.GetRight() - lLeft;
47917
+ var rtBG={ Left:border.Left, Right:border.RightEx, Top:left, Bottom:border.Bottom };
47918
+ rtBG.Width=rtBG.Right-rtBG.Left;
47919
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
47887
47920
 
47888
- if (this.MinWidth>10 && lWidth<this.MinWidth)
47921
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
47922
+ this.Canvas.fillStyle =bgColor;
47923
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
47924
+ this.LockRect=rtBG; //保存上锁区域
47925
+ }
47926
+ else
47889
47927
  {
47890
- lWidth=this.MinWidth;
47891
- lLeft=this.ChartBorder.GetRight()-lWidth;
47892
- if (lLeft < this.ChartBorder.GetLeft()) lLeft = this.ChartBorder.GetLeft();
47928
+ var rtBG={ Left:left, Right:border.RightEx, Top:border.TopTitle, Bottom:border.Bottom };
47929
+ rtBG.Width=rtBG.Right-rtBG.Left;
47930
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
47931
+ //上下渐变
47932
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
47933
+ this.Canvas.fillStyle =bgColor;
47934
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
47935
+ this.LockRect=rtBG; //保存上锁区域
47893
47936
  }
47894
47937
 
47895
- var rtBG={ Left:lLeft, Top:border.TopTitle, Bottom:border.Bottom, Width:lWidth };
47896
- rtBG.Right=rtBG.Width+rtBG.Left;
47897
- rtBG.Height=rtBG.Bottom-rtBG.Top;
47898
- this.LockRect=rtBG; //保存上锁区域
47899
-
47900
- if (!isDraw) return;
47901
-
47902
- //上下渐变
47903
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
47904
- this.Canvas.fillStyle =bgColor;
47905
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
47906
-
47907
47938
  var aryText=null;
47908
47939
  if (Array.isArray(this.Title)) aryText=this.Title;
47909
47940
  else aryText=[{Text:this.Title}];
@@ -47911,85 +47942,84 @@ function ChartLock()
47911
47942
  var outSize={ };
47912
47943
  if (!this.CalculateTextSize(aryText, this.Font, outSize)) return;
47913
47944
 
47914
- var left=rtBG.Left+(rtBG.Width-outSize.Width)/2;
47915
- if (outSize.Width>rtBG.Width) left=rtBG.Right-outSize.Width;
47916
- var top=rtBG.Top+(rtBG.Height-outSize.Height)/2;
47917
-
47918
47945
  this.Canvas.textAlign='left';
47919
47946
  this.Canvas.textBaseline='bottom';
47920
47947
  this.Canvas.font = this.Font;
47921
- var yText=top;
47922
- for(var i=0;i<outSize.AryText.length;++i)
47948
+
47949
+ if (bHScreen)
47923
47950
  {
47924
- var item=outSize.AryText[i];
47925
- if (item.Color) this.Canvas.fillStyle=item.Color;
47926
- else this.Canvas.fillStyle=this.TextColor;
47951
+ var top=rtBG.Top+(rtBG.Height-outSize.Width)/2;
47952
+ if (outSize.Width>rtBG.Height) top=rtBG.Bottom-outSize.Width;
47953
+ var left=rtBG.Left+(rtBG.Width-outSize.Height)/2;
47927
47954
 
47928
- yText+=item.Height;
47929
- this.Canvas.fillText(item.Text, left, yText+item.YOffset);
47930
- }
47931
- }
47955
+ this.Canvas.save();
47956
+ this.Canvas.translate(left, top);
47957
+ this.Canvas.rotate(90 * Math.PI / 180);
47958
+ var yText=0,xText=0;
47959
+ for(var i=0;i<outSize.AryText.length;++i)
47960
+ {
47961
+ var item=outSize.AryText[i];
47962
+ if (item.Color) this.Canvas.fillStyle=item.Color;
47963
+ else this.Canvas.fillStyle=this.TextColor;
47932
47964
 
47933
- this.HScreenDraw=function(isDraw)
47934
- {
47935
- var xOffset = this.ChartBorder.GetBottom();
47965
+ if (item.Font) this.Canvas.font = item.Font;
47966
+ else this.Canvas.font = this.Font;
47936
47967
 
47937
- var lOffsetWidth = 0;
47938
- if (this.ChartFrame.Data != null)
47939
- {
47940
- var dataWidth=this.ChartFrame.DataWidth;
47941
- var distanceWidth=this.ChartFrame.DistanceWidth;
47942
- xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+2.0;
47943
- var chartright=this.ChartBorder.GetBottom();
47944
- var xPointCount=this.ChartFrame.XPointCount;
47945
- //求最后1个数据的位置
47946
- for(var i=this.ChartFrame.Data.DataOffset,j=0;i<this.ChartFrame.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
47947
- {
47948
- var data=this.ChartFrame.Data.Data[i];
47949
- if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
47968
+ yText+=item.Height;
47969
+ this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
47970
+ }
47950
47971
 
47951
- var left=xOffset;
47952
- var right=xOffset+dataWidth;
47953
- if (right>chartright) break;
47954
- }
47955
- lOffsetWidth = (dataWidth + distanceWidth) * this.LockCount;
47972
+ this.Canvas.restore();
47956
47973
  }
47957
- if (lOffsetWidth == 0)
47974
+ else
47958
47975
  {
47959
- lOffsetWidth = (xOffset - this.ChartBorder.GetTop()) * this.WidthDiv;
47960
- }
47976
+ var left=rtBG.Left+(rtBG.Width-outSize.Width)/2;
47977
+ if (outSize.Width>rtBG.Width) left=rtBG.Right-outSize.Width;
47978
+ var top=rtBG.Top+(rtBG.Height-outSize.Height)/2;
47979
+
47980
+ var yText=top, xText=left;
47981
+ for(var i=0;i<outSize.AryText.length;++i)
47982
+ {
47983
+ var item=outSize.AryText[i];
47984
+ if (item.Image)
47985
+ {
47986
+ xText=left;
47987
+ if (item.Align===1)
47988
+ {
47989
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
47990
+ }
47961
47991
 
47962
- var lLeft = xOffset - lOffsetWidth;
47963
- if (lLeft < this.ChartBorder.GetTop()) lLeft = this.ChartBorder.GetTop();
47964
- var lHeight = this.ChartBorder.GetRight()-this.ChartBorder.GetLeft();
47965
- var lWidth = this.ChartBorder.GetBottom() - lLeft;
47992
+ this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
47966
47993
 
47967
- this.Canvas.fillStyle = this.BGColor;
47968
- this.Canvas.fillRect(this.ChartBorder.GetLeft(), lLeft,lHeight,lWidth);
47994
+ yText+=item.Height;
47995
+ }
47996
+ else
47997
+ {
47998
+ if (item.Color) this.Canvas.fillStyle=item.Color;
47999
+ else this.Canvas.fillStyle=this.TextColor;
47969
48000
 
47970
- var xCenter = this.ChartBorder.GetLeft() + lHeight / 2;
47971
- var yCenter = lLeft + lWidth / 2;
47972
- this.Canvas.save();
47973
- this.Canvas.translate(xCenter, yCenter);
47974
- this.Canvas.rotate(90 * Math.PI / 180);
47975
- this.Canvas.textAlign = 'center';
47976
- this.Canvas.textBaseline = 'middle';
47977
- this.Canvas.fillStyle = this.TextColor;
47978
- this.Canvas.font = this.Font;
47979
- this.Canvas.fillText(this.Title, 0, 0);
47980
- this.Canvas.restore();
48001
+ if (item.Font) this.Canvas.font = item.Font;
48002
+ else this.Canvas.font = this.Font;
48003
+
48004
+ yText+=item.Height;
48005
+ xText=left;
48006
+ if (item.Align===1)
48007
+ {
48008
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
48009
+ }
47981
48010
 
47982
- this.LockRect={Left:this.ChartBorder.GetLeft(),Top:lLeft,Width:lHeight,Heigh:lWidth}; //保存上锁区域
48011
+ this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
48012
+ }
48013
+ }
48014
+ }
47983
48015
  }
47984
48016
 
47985
48017
  //x,y是否在上锁区域
47986
48018
  this.GetTooltipData=function(x,y,tooltip)
47987
48019
  {
47988
- if (this.LockRect==null) return false;
48020
+ if (!this.LockRect) return false;
47989
48021
 
47990
- this.Canvas.beginPath();
47991
- this.Canvas.rect(this.LockRect.Left,this.LockRect.Top,this.LockRect.Width,this.LockRect.Height);
47992
- if (this.Canvas.isPointInPath(x,y))
48022
+ if (Path2DHelper.PtInRect(x,y,this.LockRect))
47993
48023
  {
47994
48024
  tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID };
47995
48025
  tooltip.ChartPaint=this;
@@ -58244,7 +58274,7 @@ function ChartCorssCursor()
58244
58274
 
58245
58275
  this.Draw=function()
58246
58276
  {
58247
- this.Status=0;
58277
+ this.Status=JSCHART_CORSSCURSOR_STATUS_ID.NONE_ID;
58248
58278
  this.RightButton.Rect=null;
58249
58279
  this.BottomButton.Rect=null;
58250
58280
  this.LastValue=null;
@@ -58391,6 +58421,7 @@ function ChartCorssCursor()
58391
58421
  }
58392
58422
  }
58393
58423
 
58424
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LINE_ID;
58394
58425
  this.Canvas.stroke();
58395
58426
  this.Canvas.restore();
58396
58427
 
@@ -58447,6 +58478,7 @@ function ChartCorssCursor()
58447
58478
  rtBG.Right=rtBG.Left+rtBG.Width;
58448
58479
  }
58449
58480
 
58481
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LEFT_TEXT_ID;
58450
58482
  }
58451
58483
  else if (this.ShowTextMode.Left==2) //在框架内显示
58452
58484
  {
@@ -58454,6 +58486,8 @@ function ChartCorssCursor()
58454
58486
  rtBG.Right=rtBG.Left+rtBG.Width;
58455
58487
  rtBG.Top=rtBG.YCenter-rtBG.Height/2;
58456
58488
  rtBG.Bottom=rtBG.Top+rtBG.Height;
58489
+
58490
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LEFT_INTER_TEXT_ID;
58457
58491
  }
58458
58492
 
58459
58493
  if (rtBG)
@@ -58463,6 +58497,7 @@ function ChartCorssCursor()
58463
58497
  this.Canvas.textBaseline="bottom";
58464
58498
  this.Canvas.fillStyle=this.TextColor;
58465
58499
  this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
58500
+
58466
58501
  }
58467
58502
 
58468
58503
  var complexText=
@@ -58584,6 +58619,8 @@ function ChartCorssCursor()
58584
58619
  this.DrawComplexRightText(rtBG,complexText,textSize);
58585
58620
 
58586
58621
  if (this.RightButton.Enable) this.DrawRightButtonV2(rtBG, complexText, textSize, buttonData);
58622
+
58623
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.RIGHT_TEXT_ID;
58587
58624
  }
58588
58625
  }
58589
58626
  else if (this.ShowTextMode.Right==2) //框架内侧显示
@@ -58597,6 +58634,8 @@ function ChartCorssCursor()
58597
58634
  this.DrawComplexRightText(rtBG,complexText,textSize);
58598
58635
 
58599
58636
  if (this.RightButton.Enable) this.DrawRightButtonV2(rtBG, complexText, textSize, buttonData);
58637
+
58638
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.RIGHT_INTER_TEXT_ID;
58600
58639
  }
58601
58640
  }
58602
58641
 
@@ -58662,6 +58701,8 @@ function ChartCorssCursor()
58662
58701
  if (this.StringFormatX.KItem) buttonData.KItem=this.StringFormatX.KItem;
58663
58702
  this.BottomButton.Rect=rtBG;
58664
58703
  this.BottomButton.Data=buttonData;
58704
+
58705
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.BOTTOM_TEXT_ID;
58665
58706
  }
58666
58707
  }
58667
58708
 
@@ -58710,8 +58751,6 @@ function ChartCorssCursor()
58710
58751
  this.Canvas.fillText(text,rtBG.Left+textOffset.X, rtBG.Bottom+textOffset.Y);
58711
58752
  }
58712
58753
  }
58713
-
58714
- this.Status=1;
58715
58754
  }
58716
58755
 
58717
58756
  this.DrawComplexRightText=function(rtBG, complexText, size)
@@ -58999,6 +59038,7 @@ function ChartCorssCursor()
58999
59038
 
59000
59039
  this.HScreenDraw=function()
59001
59040
  {
59041
+ this.Status=JSCHART_CORSSCURSOR_STATUS_ID.NONE_ID;
59002
59042
  var x=this.LastPoint.X;
59003
59043
  var y=this.LastPoint.Y;
59004
59044
 
@@ -59092,6 +59132,8 @@ function ChartCorssCursor()
59092
59132
  }
59093
59133
  }
59094
59134
 
59135
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LINE_ID;
59136
+
59095
59137
  this.Canvas.stroke();
59096
59138
  this.Canvas.restore();
59097
59139
 
@@ -59152,6 +59194,8 @@ function ChartCorssCursor()
59152
59194
  }
59153
59195
 
59154
59196
  this.Canvas.restore();
59197
+
59198
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LEFT_TEXT_ID;
59155
59199
  }
59156
59200
  else if (this.ShowTextMode.Left==2)
59157
59201
  {
@@ -59169,6 +59213,8 @@ function ChartCorssCursor()
59169
59213
  this.Canvas.fillText(text,2,0,textWidth);
59170
59214
 
59171
59215
  this.Canvas.restore();
59216
+
59217
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.LEFT_INTER_TEXT_ID;
59172
59218
  }
59173
59219
 
59174
59220
  if (this.StringFormatY.RText)
@@ -59239,6 +59285,8 @@ function ChartCorssCursor()
59239
59285
  }
59240
59286
 
59241
59287
  this.Canvas.restore();
59288
+
59289
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.RIGHT_TEXT_ID;
59242
59290
  }
59243
59291
  else if (this.ShowTextMode.Right==2)
59244
59292
  {
@@ -59256,6 +59304,8 @@ function ChartCorssCursor()
59256
59304
  this.Canvas.fillText(text,-2,0,textWidth);
59257
59305
 
59258
59306
  this.Canvas.restore();
59307
+
59308
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.RIGHT_INTER_TEXT_ID;
59259
59309
  }
59260
59310
  }
59261
59311
 
@@ -59329,10 +59379,10 @@ function ChartCorssCursor()
59329
59379
 
59330
59380
  this.Canvas.restore();
59331
59381
  }
59382
+
59383
+ this.Status|=JSCHART_CORSSCURSOR_STATUS_ID.BOTTOM_TEXT_ID;
59332
59384
  }
59333
59385
  }
59334
-
59335
- this.Status=1;
59336
59386
  }
59337
59387
 
59338
59388
  //data={ e:e, PreventDefault:false, KeyID, Draw:是否需要重绘 }
@@ -59404,6 +59454,7 @@ function ChartCorssCursor()
59404
59454
  }
59405
59455
 
59406
59456
 
59457
+
59407
59458
  ////////////////////////////////////////////////////////////////////////////////
59408
59459
  //深度图十字光标
59409
59460
  function DepthChartCorssCursor()
@@ -86589,6 +86640,13 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86589
86640
  if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
86590
86641
 
86591
86642
  tooltip.HQChart=this;
86643
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
86644
+ if (event && event.Callback)
86645
+ {
86646
+ var sendData={ FrameID:item.Frame.Identify, Data:tooltip };
86647
+ event.Callback(event,sendData,this);
86648
+ }
86649
+
86592
86650
  if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
86593
86651
  return true;
86594
86652
  }
@@ -100949,239 +101007,9 @@ function IsFundSymbol(symbol)
100949
101007
  return false;
100950
101008
  }
100951
101009
 
100952
- //设置对话框工厂类
100953
- function DialogFactory()
100954
- {
100955
- //[key:name, { Create:function(divElement) { return new class(divElement); }} ]
100956
- this.DataMap=new Map(
100957
- [
100958
- ["ChartPictureSettingMenu", { Create:function(divElement) { return new ChartPictureSettingMenu(divElement); } }],
100959
- ]);
100960
-
100961
- this.Create=function(name, option)
100962
- {
100963
- if (!this.DataMap.has(name))
100964
- {
100965
- JSConsole.Chart.Warn(`[DialogFactory::Create] can't find class=${name}.`);
100966
- return null;
100967
- }
100968
-
100969
- var item=this.DataMap.get(name);
100970
- return item.Create(option);
100971
- }
100972
-
100973
- this.Add=function(name, option)
100974
- {
100975
- this.DataMap.set(name, { Create:option.Create } );
100976
- }
100977
- }
100978
-
100979
- var g_DialogFactory=new DialogFactory();
100980
-
100981
- //设置窗口基类
100982
- function IDivDialog(divElement)
100983
- {
100984
- this.DivElement=divElement; //父节点
100985
- this.ID=null; //div id
100986
- this.TimeOut=null; //定时器
100987
-
100988
- //隐藏窗口
100989
- this.Hide=function()
100990
- {
100991
- $("#"+this.ID).hide();
100992
- }
100993
-
100994
- //显示窗口
100995
- this.Show=function(left,top,width,height)
100996
- {
100997
- var cssData={display:'block'};
100998
- if (IFrameSplitOperator.IsNumber(left)) cssData.left=left+'px';
100999
- if (IFrameSplitOperator.IsNumber(top)) cssData.top=top+'px';
101000
- if (IFrameSplitOperator.IsNumber(width)) cssData.width=width+'px';
101001
- if (IFrameSplitOperator.IsNumber(height)) cssData.height=height+'px';
101002
-
101003
- $("#"+this.ID).css(cssData);
101004
- }
101005
- }
101006
-
101007
- //等待动画窗口
101008
- function WaitDialog(divElement)
101009
- {
101010
- this.newMethod=IDivDialog; //派生
101011
- this.newMethod(divElement);
101012
- delete this.newMethod;
101013
-
101014
- this.Title='加载中......';
101015
- this.Dialog;
101016
-
101017
- //隐藏窗口
101018
- this.Close=function()
101019
- {
101020
- if (this.Dialog)
101021
- {
101022
- this.DivElement.removeChild(this.Dialog);
101023
- this.Dialog=null;
101024
- }
101025
- }
101026
-
101027
- this.SetTitle=function(title)
101028
- {
101029
- this.Title=title;
101030
- if (!this.Dialog) return;
101031
- //TODO: 更新标题数据
101032
- }
101033
-
101034
- this.Create=function()
101035
- {
101036
- this.ID=Guid();
101037
- var div=document.createElement('div');
101038
- div.className='jchart-wait-box';
101039
- div.id=this.ID;
101040
- div.innerHTML=
101041
- `<div class='parameter jchart-kline-match-box'>
101042
- <div class='parameter-header'>
101043
- <span>${this.Title}</span>
101044
- </div>
101045
- </div>`.trim();
101046
-
101047
- this.DivElement.appendChild(div);
101048
- this.Dialog=div;
101049
- }
101050
-
101051
- //显示
101052
- this.DoModal=function(event)
101053
- {
101054
- this.Title=event.data.Title;
101055
- var chart=event.data.Chart;
101056
- if (this.ID==null) this.Create(); //第1次 需要创建div
101057
-
101058
- //居中显示
101059
- var border=chart.Frame.ChartBorder;
101060
- var scrollPos=GetScrollPosition();
101061
- var left=border.GetWidth()/2;
101062
- var top=border.GetHeight()/2;
101063
-
101064
- this.Show(left,top,200,40); //显示
101065
- }
101066
- }
101067
-
101068
- //画图工具 单个图形设置
101069
- function ChartPictureSettingMenu(divElement)
101070
- {
101071
- this.newMethod=IDivDialog; //派生
101072
- this.newMethod(divElement);
101073
- delete this.newMethod;
101074
-
101075
- this.HQChart;
101076
- this.ChartPicture;
101077
- this.SubToolsDiv;
101078
- this.SettingMenu;
101079
- this.SettingPV;
101080
-
101081
- this.DoModal=function(event)
101082
- {
101083
- var $body;
101084
- if (!this.SubToolsDiv)
101085
- {
101086
- this.ID=Guid();
101087
- var div=document.createElement("div");
101088
- div.className='subTolls';
101089
- div.id=this.ID;
101090
- this.DivElement.appendChild(div);
101091
- //$body = $("."+event.data.HQChart.ClassName).context.body;
101092
- //$body.append(div);
101093
- this.SubToolsDiv=div;
101094
- }
101095
- this.HQChart=event.data.HQChart;
101096
- this.ChartPicture=event.data.ChartPicture;
101097
-
101098
- var pixelTatio = GetDevicePixelRatio();
101099
- var frame=this.HQChart.Frame.SubFrame[0].Frame;
101100
- // var top=frame.ChartBorder.GetTopTitle();
101101
- var top=frame.ChartBorder.Top + 40;
101102
- // var right=frame.ChartBorder.GetRight();
101103
- var right=frame.ChartBorder.Right;
101104
- var left=frame.ChartBorder.GetLeft();
101105
- var className = this.ChartPicture.ClassName; //='ChartDrawPictureText'时加“设置”
101106
- var lineColor=this.ChartPicture.LineColor;
101107
- if (lineColor.indexOf("rgb(")==0 || lineColor.indexOf("RGB(")==0)
101108
- lineColor=IChartDrawPicture.RGBToHex(lineColor.toLowerCase());
101109
- var toolsDiv = "";
101110
- if(className === 'ChartDrawPictureText')
101111
- {
101112
- toolsDiv = '<span class="changes-color" title="改变图形颜色">'+
101113
- '<i class="iconfont icon-bianji"></i>'+
101114
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'">'+
101115
- '</span>\n' +
101116
- '<span class="subtool-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
101117
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
101118
- }
101119
- else if (className=="ChartDrawVolProfile")
101120
- {
101121
- toolsDiv='<span class="vp-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
101122
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
101123
- }
101124
- else
101125
- {
101126
- toolsDiv =
101127
- '<p class="changes-color" title="改变图形颜色"><i class="iconfont icon-bianji"></i>' +
101128
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'"></p>\n' +
101129
- ' <p class="subtool-del"><i class="iconfont icon-recycle_bin"></i></p>';
101130
- }
101131
-
101132
-
101133
- this.SubToolsDiv.style.right = right/pixelTatio + "px";
101134
- this.SubToolsDiv.style.top = top/pixelTatio + "px";
101135
- this.SubToolsDiv.innerHTML = toolsDiv;
101136
- this.SubToolsDiv.style.position = "absolute";
101137
- this.SubToolsDiv.style.display = "block";
101138
-
101139
- var hqChart = this.HQChart;
101140
- var picture = this.ChartPicture;
101141
- var subToolDiv = this.SubToolsDiv;
101142
- $(".subtool-del").click(function(){
101143
- hqChart.SelectChartDrawPicture=null;
101144
- hqChart.ClearChartDrawPicture(picture);
101145
- // subToolDiv.innerHTML = "";
101146
- $(".subTolls").css("display","none");
101147
- });
101148
- var self = this;
101149
- $(".subtool-set").click(function(){
101150
- $(self.SubToolsDiv).hide();
101151
- //创建div设置窗口
101152
- if (!self.SettingMenu) self.SettingMenu=new ChartPictureTextSettingMenu(frame.ChartBorder.UIElement.parentNode);
101153
-
101154
- self.SettingMenu.ChartPicture=picture;
101155
- self.SettingMenu.HQChart=hqChart;
101156
- self.SettingMenu.Position={Left:right + 80,Top:top + 20};
101157
- self.SettingMenu.DoModal();
101158
- });
101159
- $(".changes-color").click(function () {
101160
- document.getElementById('color').click();
101161
- $(".change-color").change(function () {
101162
- var color = $(".change-color").val();
101163
- picture.LineColor = color;
101164
- picture.PointColor = color;
101165
- if (hqChart.ChartDrawStorage) hqChart.ChartDrawStorage.SaveDrawData(picture); //保存下
101166
- });
101167
- });
101168
-
101169
- //成交量分布图设置
101170
- $(".vp-set").click(function()
101171
- {
101172
- if (!self.SettingPV) self.SettingPV=new ChartPictureVolProfileSettingMenu(frame.ChartBorder.UIElement.parentNode);
101173
- self.SettingPV.ChartPicture=picture;
101174
- self.SettingPV.HQChart=hqChart;
101175
- self.SettingPV.Position={Left:right + 80,Top:top + 20};
101176
- self.SettingPV.DoModal();
101177
- });
101178
-
101179
-
101180
- JSConsole.Chart.Log("[ChartPictureSettingMenu::DoModal]", {Top:top,Left:left, Right:right});
101181
- }
101182
- }
101183
101010
 
101184
101011
 
101012
+ /*
101185
101013
  function ChartPictureVolProfileSettingMenu(divElement)
101186
101014
  {
101187
101015
  this.newMethod=IDivDialog; //派生
@@ -101270,6 +101098,7 @@ function ChartPictureVolProfileSettingMenu(divElement)
101270
101098
  }
101271
101099
  }
101272
101100
  }
101101
+ */
101273
101102
 
101274
101103
 
101275
101104