hqchart 1.1.12798 → 1.1.12809

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.
@@ -2151,12 +2151,12 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
2151
2151
  }
2152
2152
  }
2153
2153
 
2154
- this.EnableSplashScreen=function(option)
2154
+ this.EnableSplashScreen=function(enable, option)
2155
2155
  {
2156
2156
  if(this.JSChartContainer && typeof(this.JSChartContainer.EnableSplashScreen)=='function')
2157
2157
  {
2158
2158
  JSConsole.Chart.Log('[JSChart:EnableSplashScreen] ');
2159
- this.JSChartContainer.EnableSplashScreen(option);
2159
+ this.JSChartContainer.EnableSplashScreen(enable, option);
2160
2160
  }
2161
2161
  }
2162
2162
 
@@ -2550,6 +2550,8 @@ var JSCHART_EVENT_ID=
2550
2550
  ON_CREATE_OVERLAY_FRAME:118, //创建叠加框架回调
2551
2551
 
2552
2552
  ON_CREATE_CUSTOM_Y_COORDINATE:119, //自定义Y轴刻度
2553
+
2554
+ ON_BEFORE_DRAW_SPLASH_SCREEN:120,
2553
2555
  }
2554
2556
 
2555
2557
  var JSCHART_OPERATOR_ID=
@@ -3121,6 +3123,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3121
3123
 
3122
3124
  this.UIOnDblClick=function(e)
3123
3125
  {
3126
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash) return;
3127
+
3124
3128
  var pixelTatio = GetDevicePixelRatio();
3125
3129
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
3126
3130
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
@@ -4996,7 +5000,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4996
5000
 
4997
5001
  this.Draw=function()
4998
5002
  {
4999
-
5000
5003
  if (this.ChartCorssCursor) this.ChartCorssCursor.Status=0;
5001
5004
  if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
5002
5005
 
@@ -5017,6 +5020,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5017
5020
 
5018
5021
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash)
5019
5022
  {
5023
+ var data=this.InvokeBeforeDrawSplashScreenCallback();
5024
+ if (data && data.PreventDefault===true) return;
5025
+
5020
5026
  this.Frame.ClearCoordinateText();
5021
5027
  this.Frame.Draw( { IsEnableSplash:this.ChartSplashPaint.IsEnableSplash} );
5022
5028
  this.ChartSplashPaint.Draw();
@@ -5446,6 +5452,48 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5446
5452
 
5447
5453
  return status;
5448
5454
  }
5455
+
5456
+ this.InvokeBeforeDrawSplashScreenCallback=function()
5457
+ {
5458
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW_SPLASH_SCREEN);
5459
+ if (!event || !event.Callback) return null;
5460
+
5461
+ var data={ PreventDefault:false };
5462
+ event.Callback(event,data,this);
5463
+
5464
+ return data;
5465
+ }
5466
+
5467
+ this.DrawSplashScreen=function(option)
5468
+ {
5469
+ var data=this.InvokeBeforeDrawSplashScreenCallback();
5470
+ if (data && data.PreventDefault===true) return;
5471
+
5472
+ if (this.Frame.ScreenImageData==null && !this.CacheCanvas) return;
5473
+
5474
+ if (this.Frame.ScreenImageData)
5475
+ {
5476
+ this.Canvas.putImageData(this.Frame.ScreenImageData,0,0);
5477
+ }
5478
+ else if (this.CacheCanvas)
5479
+ {
5480
+ this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height)
5481
+ this.Canvas.drawImage(this.CacheElement,0,0);
5482
+ }
5483
+
5484
+ var bgColor=g_JSChartResource.SplashScreen.BGColor;
5485
+ this.Canvas.fillStyle=bgColor;
5486
+ this.Canvas.fillRect(0,0,this.UIElement.width,this.UIElement.height)
5487
+
5488
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash)
5489
+ {
5490
+ var title=g_JSChartResource.SplashScreen.Title;
5491
+ if (option && option.Title) title=option.Title;
5492
+ this.ChartSplashPaint.SetTitle(title);
5493
+ this.ChartSplashPaint.Draw();
5494
+ }
5495
+ }
5496
+
5449
5497
  //画动态信息
5450
5498
  this.DrawDynamicInfo=function(option)
5451
5499
  {
@@ -6151,14 +6199,23 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6151
6199
  var cursorIndex={ ZoomType:this.ZoomType ,IsLockRight:this.IsZoomLockRight };
6152
6200
  cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
6153
6201
  if (!this.Frame.ZoomDown(cursorIndex, { ZoomDownloadDataCallback:(requestData)=>{ this.ZoomDownloadData(requestData) } })) break;
6202
+
6154
6203
  this.CursorIndex=cursorIndex.Index;
6155
6204
  this.UpdataDataoffset();
6156
6205
  this.UpdatePointByCursorIndex();
6157
6206
  this.UpdateFrameMaxMin();
6158
6207
  this.ResetFrameXSplit();
6159
- this.Draw();
6208
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true)
6209
+ {
6210
+
6211
+ }
6212
+ else
6213
+ {
6214
+ this.Draw();
6215
+ }
6160
6216
  this.ShowTooltipByKeyDown();
6161
6217
  this.OnKLinePageChange("keydown");
6218
+
6162
6219
  break;
6163
6220
  case 46: //del
6164
6221
  if (this.SelectChartDrawPicture)
@@ -7983,16 +8040,16 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7983
8040
  }
7984
8041
 
7985
8042
  //全屏提示信息 { Title:提示信息, Draw:false/true 是否立即重绘, }
7986
- this.EnableSplashScreen=function(option)
8043
+ this.EnableSplashScreen=function(enable, option)
7987
8044
  {
7988
8045
  if (!this.ChartSplashPaint) return;
7989
- if (!option) return;
7990
8046
 
7991
- if (IFrameSplitOperator.IsString(option.Title)) this.ChartSplashPaint.SetTitle(option.Title);
7992
- this.ChartSplashPaint.EnableSplash(true);
8047
+ this.ChartSplashPaint.EnableSplash(enable);
7993
8048
 
7994
- if (option.Draw===false) return;
7995
- this.Draw();
8049
+ if (option && option.Draw===false) return;
8050
+
8051
+ if (enable) this.DrawSplashScreen(option);
8052
+ else this.Draw();
7996
8053
  }
7997
8054
 
7998
8055
  //设置指标窗口属性 windowItem=SetOption.Windows[i], frameItem=SetOption.Frames[i];
@@ -17741,6 +17798,18 @@ function HQTradeFrame()
17741
17798
  return result;
17742
17799
  }
17743
17800
 
17801
+ this.GetXShowCount=function()
17802
+ {
17803
+ var xPointcount=-1;
17804
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.SubFrame)) return xPointcount;
17805
+
17806
+ var subFrame=this.SubFrame[0];
17807
+ if (!subFrame.Frame) return xPointcount;
17808
+
17809
+ xPointcount=subFrame.Frame.XPointCount;
17810
+ return xPointcount;
17811
+ }
17812
+
17744
17813
  this.XCoordinateZoom=function(step, isMoveLeft)
17745
17814
  {
17746
17815
  var result=this.SubFrame[0].Frame.XCoordinateZoom(step, isMoveLeft);
@@ -61992,6 +62061,12 @@ function JSChartResource()
61992
62061
  this.EmptyBarBGColor="rgb(255,255,255)"; //空心柱子背景色
61993
62062
  this.HighLowBarColor='rgb(41,98,255)'; //high low bar 颜色
61994
62063
 
62064
+ this.SplashScreen=
62065
+ {
62066
+ BGColor:"rgba(112,128,144,0.5)",
62067
+ Title:"下载数据中......"
62068
+ }
62069
+
61995
62070
  this.HLCArea=
61996
62071
  {
61997
62072
  HighLineColor:'rgb(242,54,69)',
@@ -63065,6 +63140,13 @@ function JSChartResource()
63065
63140
  if (style.EmptyBarBGColor) this.EmptyBarBGColor=style.EmptyBarBGColor;
63066
63141
  if (style.HighLowBarColor) this.HighLowBarColor=style.HighLowBarColor;
63067
63142
 
63143
+ if (style.SplashScreen)
63144
+ {
63145
+ var item=style.SplashScreen;
63146
+ if (item.BGColor) this.SplashScreen.BGColor=item.BGColor;
63147
+ if (item.Title) this.SplashScreen.Title=item.Title;
63148
+ }
63149
+
63068
63150
  if (style.HLCArea)
63069
63151
  {
63070
63152
  var item=style.HLCArea;
@@ -66244,7 +66326,14 @@ function KLineChartContainer(uielement,OffscreenElement)
66244
66326
  this.UpdatePointByCursorIndex();
66245
66327
  this.UpdateFrameMaxMin();
66246
66328
  this.ResetFrameXSplit();
66247
- this.Draw();
66329
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true)
66330
+ {
66331
+
66332
+ }
66333
+ else
66334
+ {
66335
+ this.Draw();
66336
+ }
66248
66337
  this.OnKLinePageChange("wheel");
66249
66338
  }
66250
66339
  }
@@ -71599,6 +71688,7 @@ function KLineChartContainer(uielement,OffscreenElement)
71599
71688
  {
71600
71689
  download.IsEnd=true;
71601
71690
  JSConsole.Chart.Log(`[KLineChartContainer.RecvPreviousMinuteData] ${this.Symbol} data end. FuncName=${option.FuncName}`);
71691
+ this.Draw();
71602
71692
  return;
71603
71693
  }
71604
71694
 
@@ -71639,6 +71729,12 @@ function KLineChartContainer(uielement,OffscreenElement)
71639
71729
 
71640
71730
  if (!this.IsApiPeriod)
71641
71731
  {
71732
+ if (bindData.Right>0 && this.RightFormula>=1) //复权
71733
+ {
71734
+ var rightData=bindData.GetRightData(bindData.Right, { AlgorithmType: this.RightFormula } );
71735
+ bindData.Data=rightData;
71736
+ }
71737
+
71642
71738
  if (ChartData.IsDayPeriod(bindData.Period,false) || ChartData.IsMinutePeriod(bindData.Period,false)) //周期数据 (0= 日线,4=1分钟线 不需要处理)
71643
71739
  {
71644
71740
  var periodData=bindData.GetPeriodData(bindData.Period);
@@ -71656,12 +71752,20 @@ function KLineChartContainer(uielement,OffscreenElement)
71656
71752
 
71657
71753
  //绑定数据
71658
71754
  this.UpdateMainData(bindData,lastDataCount);
71659
- if (option && option.ZoomData) //缩放需要调整当前屏的位置
71755
+ if (option) //缩放需要调整当前屏的位置
71660
71756
  {
71661
- var zoomData=option.ZoomData;
71662
- var showCount=zoomData.PageSize-zoomData.RightSpaceCount; //一屏显示的数据个数
71663
- bindData.DataOffset= bindData.Data.length-showCount;
71664
- if (bindData.DataOffset<0) bindData.DataOffset=0;
71757
+ if (option.ZoomData)
71758
+ {
71759
+ var zoomData=option.ZoomData;
71760
+ var showCount=zoomData.PageSize-zoomData.RightSpaceCount; //一屏显示的数据个数
71761
+ bindData.DataOffset= bindData.Data.length-showCount;
71762
+ if (bindData.DataOffset<0) bindData.DataOffset=0;
71763
+ }
71764
+ else if (IFrameSplitOperator.IsNumber(option.DataOffset))
71765
+ {
71766
+ bindData.DataOffset+=option.DataOffset;
71767
+ if (bindData.DataOffset<0) bindData.DataOffset=0;
71768
+ }
71665
71769
  }
71666
71770
 
71667
71771
  this.UpdateOverlayDragMinuteData(data);
@@ -71684,7 +71788,7 @@ function KLineChartContainer(uielement,OffscreenElement)
71684
71788
  this.BindAllOverlayIndexData(bindData);
71685
71789
  }
71686
71790
 
71687
- this.RequestZoomMinuteData=function()
71791
+ this.RequestZoomMinuteData=function(requestData)
71688
71792
  {
71689
71793
  var zoomData={ PageSize:requestData.PageSize, DataCount:requestData.DataCount, RightSpaceCount:requestData.RightSpaceCount };
71690
71794
 
@@ -71693,9 +71797,10 @@ function KLineChartContainer(uielement,OffscreenElement)
71693
71797
  FuncName:'KLineChartContainer::RequestZoomMinuteData',
71694
71798
  FuncExplain:"缩放分钟|秒K线数据下载",
71695
71799
  RecvFuncName:"RecvZoomMinuteData",
71696
- Download:this.DragDownload.Minute,
71800
+ Download:this.ZoomDownload.Minute,
71697
71801
  Url:this.ZoomMinuteKLineApiUrl,
71698
71802
  Count:this.MaxRequestMinuteDayCount,
71803
+ XShowCount:this.Frame.GetXShowCount(),
71699
71804
  ZoomData:zoomData
71700
71805
  };
71701
71806
 
@@ -71711,7 +71816,8 @@ function KLineChartContainer(uielement,OffscreenElement)
71711
71816
  RecvFuncName:"RecvDragMinuteData",
71712
71817
  Download:this.DragDownload.Minute,
71713
71818
  Url:this.DragMinuteKLineApiUrl,
71714
- Count:this.MaxRequestMinuteDayCount
71819
+ Count:this.MaxRequestMinuteDayCount,
71820
+ XShowCount:this.Frame.GetXShowCount(),
71715
71821
  };
71716
71822
 
71717
71823
  this.RequestPreviousMinuteData(option);