hqchart 1.1.14870 → 1.1.14876

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.
@@ -4401,6 +4401,16 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4401
4401
  }
4402
4402
  }
4403
4403
 
4404
+ /////////////////////////////////////////////////////////////////////////////////
4405
+ //属性设置
4406
+ //
4407
+
4408
+ this.SetPressKeyboardConfig=function(chart, option)
4409
+ {
4410
+ if (!chart || !option) return;
4411
+ if (IFrameSplitOperator.IsBool(option.PauseUpdate)) chart.PressKeyboardConfig.PauseUpdate=option.PauseUpdate;
4412
+ }
4413
+
4404
4414
  //历史K线图
4405
4415
  this.CreateKLineChartContainer=function(option)
4406
4416
  {
@@ -4561,6 +4571,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4561
4571
  if (IFrameSplitOperator.IsBool(item.EnableMoveOn)) chart.SelectedChart.EnableMoveOn=item.EnableMoveOn;
4562
4572
  }
4563
4573
 
4574
+ if (option.PressKeyboardConfig) this.SetPressKeyboardConfig(chart, option.PressKeyboardConfig);
4575
+
4564
4576
  if (!option.Windows || option.Windows.length<=0) return null;
4565
4577
 
4566
4578
  //K线扩展计算方法配置
@@ -5138,6 +5150,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5138
5150
  if (IFrameSplitOperator.IsBool(item.EnableMoveOn)) chart.SelectedChart.EnableMoveOn=item.EnableMoveOn;
5139
5151
  }
5140
5152
 
5153
+ if (option.PressKeyboardConfig) this.SetPressKeyboardConfig(chart, option.PressKeyboardConfig);
5154
+
5141
5155
  if (chart.ClassName=="MinuteChartContainer")
5142
5156
  {
5143
5157
  if (!option.DragSelectRect)
@@ -6042,18 +6056,6 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
6042
6056
  this.OnSize( {Type:1} );
6043
6057
  }
6044
6058
 
6045
- //创建工具条
6046
- this.CreateToolbar=function(option)
6047
- {
6048
-
6049
- }
6050
-
6051
- //创建设置div窗口
6052
- this.CreateSettingDiv=function(option)
6053
- {
6054
-
6055
- }
6056
-
6057
6059
  this.Focus=function()
6058
6060
  {
6059
6061
  if (this.CanvasElement) this.CanvasElement.focus();
@@ -7359,6 +7361,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7359
7361
  this.PressTime=500;
7360
7362
  this.IsPress=false; //是否长按
7361
7363
  this.IsPressKeyboard=false; //是否键盘按键
7364
+ this.PressKeyboardConfig={ PauseUpdate:false, }; //按键以后 是否涨停数据更新
7362
7365
 
7363
7366
  this.NetworkFilter; //网络请求回调 function(data, callback);
7364
7367
  this.LastMouseStatus={ MouseOnToolbar:null }; // MouseOnToolbar={ Rect:{}, Title: }
@@ -7946,6 +7949,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7946
7949
 
7947
7950
  this.DestroyPopMenu();
7948
7951
 
7952
+ if (this.DestroyPopMinuteChart) this.DestroyPopMinuteChart();
7953
+
7949
7954
  this.StopLatestPointFlash();
7950
7955
 
7951
7956
  document.oncontextmenu=null;
@@ -16255,6 +16260,16 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
16255
16260
 
16256
16261
  return false;
16257
16262
  }
16263
+
16264
+ //键盘下按暂停更新
16265
+ this.IsPauseUpdateByKeyboard=function()
16266
+ {
16267
+ if (!this.IsPressKeyboard) return false;
16268
+ if (!this.PressKeyboardConfig) return false;
16269
+ if (!this.PressKeyboardConfig.PauseUpdate) return false;
16270
+
16271
+ return true;
16272
+ }
16258
16273
  }
16259
16274
 
16260
16275
  function GetDevicePixelRatio()
@@ -37925,6 +37940,7 @@ function ChartKLineTable()
37925
37940
 
37926
37941
  this.TextFont;
37927
37942
  this.TextColor='rgb(0,0,0)';
37943
+ this.Style=0; //0=全部窗口模式 1=顶部指定行数 2=底部指定行数;
37928
37944
 
37929
37945
  this.AryTableData=[];
37930
37946
  this.MapCache=null; //key=date/date-time value={ Date:, Time:, Data:[ ] }
@@ -37950,9 +37966,15 @@ function ChartKLineTable()
37950
37966
  {
37951
37967
  if (!this.BGColor) return;
37952
37968
 
37953
- if (this.BGColor)
37969
+ this.Canvas.fillStyle=this.BGColor;
37970
+ if ((this.Style===1 || this.Style===2) && this.RowHeightType==1)
37971
+ {
37972
+ var height=this.RowCount*this.RowHeight;
37973
+ height=Math.min(rtBG.Height,height);
37974
+ this.Canvas.fillRect(rtBG.Left+1, rtBG.Top, rtBG.Width-2, height);
37975
+ }
37976
+ else
37954
37977
  {
37955
- this.Canvas.fillStyle=this.BGColor;
37956
37978
  this.Canvas.fillRect(rtBG.Left+1, rtBG.Top, rtBG.Width-1, rtBG.Height);
37957
37979
  }
37958
37980
  }
@@ -37961,8 +37983,11 @@ function ChartKLineTable()
37961
37983
  {
37962
37984
  if (!this.BorderColor) return;
37963
37985
 
37986
+ var lineCount=30;
37987
+ if (this.Style===1 || this.Style===2) lineCount=this.RowCount+1;
37988
+
37964
37989
  var yLine=rtBG.Top;
37965
- for(var i=0;i<30;++i)
37990
+ for(var i=0;i<lineCount;++i)
37966
37991
  {
37967
37992
  this.Canvas.beginPath();
37968
37993
  this.Canvas.moveTo(rtBG.Left,ToFixedPoint(yLine));
@@ -38012,12 +38037,29 @@ function ChartKLineTable()
38012
38037
  var bottom=border.Bottom;
38013
38038
 
38014
38039
  //绘制背景
38015
- var rtBG={ Left:border.LeftEx, Top:top, Right:border.RightEx, Bottom:bottom };
38016
- rtBG.Width=rtBG.Right-rtBG.Left;
38017
- rtBG.Height=rtBG.Bottom-rtBG.Top;
38018
- this.DrawBG(rtBG);
38019
-
38040
+ if (this.Style===1)
38041
+ {
38042
+ var rtBG={ Left:border.LeftEx, Top:border.TopTitle, Right:border.RightEx, Bottom:border.TopEx };
38043
+ rtBG.Width=rtBG.Right-rtBG.Left;
38044
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
38045
+ }
38046
+ else if (this.Style===2)
38047
+ {
38048
+ var rtBG={ Left:border.LeftEx, Top:border.BottomEx, Right:border.RightEx, Bottom:border.Bottom };
38049
+ rtBG.Width=rtBG.Right-rtBG.Left;
38050
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
38051
+ top=rtBG.Top;
38052
+ }
38053
+ else
38054
+ {
38055
+ var rtBG={ Left:border.LeftEx, Top:top, Right:border.RightEx, Bottom:bottom };
38056
+ rtBG.Width=rtBG.Right-rtBG.Left;
38057
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
38058
+ }
38059
+
38020
38060
  this.CalculateRowHeight(rtBG);
38061
+
38062
+ this.DrawBG(rtBG);
38021
38063
 
38022
38064
  var itemHeight=this.RowHeight;
38023
38065
  var itemWidth=dataWidth+distanceWidth;
@@ -38050,7 +38092,7 @@ function ChartKLineTable()
38050
38092
  if (!bDrawName) this.DrawRow(mapItem, top, bottom, left, right); //绘制一列
38051
38093
  }
38052
38094
 
38053
- if (this.RowNamePosition==3) this.DrawRightRowName();
38095
+ if (this.RowNamePosition==3) this.DrawRightRowName(rtBG);
38054
38096
 
38055
38097
  this.DrawBorder(rtBG);
38056
38098
  }
@@ -38097,20 +38139,51 @@ function ChartKLineTable()
38097
38139
  }
38098
38140
 
38099
38141
  //绘制右侧行名
38100
- this.DrawRightRowName=function()
38142
+ this.DrawRightRowName=function(rtBG)
38101
38143
  {
38102
38144
  var border=this.ChartFrame.GetBorder();
38103
38145
 
38104
38146
  if (this.BGColor)
38105
38147
  {
38106
- var rtRightBG={Left:border.RightEx, Top:border.Top, Right:border.ChartWidth, Bottom:border.Bottom };
38107
- rtRightBG.Width=rtRightBG.Right-rtRightBG.Left;
38108
- rtRightBG.Height=rtRightBG.Bottom-rtRightBG.Top;
38109
- this.Canvas.fillStyle=this.BGColor;
38110
- this.Canvas.fillRect(rtRightBG.Left+1, rtRightBG.Top, rtRightBG.Width-1, rtRightBG.Height);
38148
+ if (this.Style===1)
38149
+ {
38150
+ var height=this.RowCount*this.RowHeight;
38151
+ height=Math.min(rtBG.Height,height);
38152
+ var width=border.ChartWidth-rtBG.Right-2;
38153
+ var maxTextWidth=0;
38154
+ for(var i=0;i<this.RowName.length;++i)
38155
+ {
38156
+ var item=this.RowName[i];
38157
+ if (!item || !item.Name) continue;
38158
+
38159
+ var textWidth=this.Canvas.measureText(item.Name).width;
38160
+ if (textWidth>maxTextWidth) maxTextWidth=textWidth;
38161
+ }
38162
+ if (maxTextWidth>0)
38163
+ {
38164
+ maxTextWidth+=4;
38165
+ width=Math.min(width, maxTextWidth);
38166
+ }
38167
+
38168
+ var rtRightBG={Left:rtBG.Right+1, Top:rtBG.Top+1, Width:width, Height:height };
38169
+ rtRightBG.Right=rtRightBG.Left+rtRightBG.Width;
38170
+ rtRightBG.Bottom=rtRightBG.Top+rtRightBG.Height;
38171
+
38172
+
38173
+ this.Canvas.fillStyle=this.BGColor;
38174
+ this.Canvas.fillRect(rtRightBG.Left, rtRightBG.Top, rtRightBG.Width, rtRightBG.Height);
38175
+ }
38176
+ else
38177
+ {
38178
+ var rtRightBG={Left:border.RightEx, Top:border.Top, Right:border.ChartWidth, Bottom:border.Bottom };
38179
+ rtRightBG.Width=rtRightBG.Right-rtRightBG.Left;
38180
+ rtRightBG.Height=rtRightBG.Bottom-rtRightBG.Top;
38181
+ this.Canvas.fillStyle=this.BGColor;
38182
+ this.Canvas.fillRect(rtRightBG.Left+1, rtRightBG.Top, rtRightBG.Width-2, rtRightBG.Height);
38183
+ }
38111
38184
  }
38112
38185
 
38113
- var x=border.RightEx, y=border.TopTitle;
38186
+ var x=rtBG.Right, y=rtBG.Top;
38114
38187
  var yOffset=3;
38115
38188
  if (this.ItemMergin.YOffset) yOffset=this.ItemMergin.YOffset;
38116
38189
  for(var i=0;i<this.RowName.length;++i)
@@ -84912,6 +84985,13 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
84912
84985
  this.PopMinuteChart=null;
84913
84986
  }
84914
84987
 
84988
+ this.ClosePopMinuteChart=function()
84989
+ {
84990
+ if (!this.PopMinuteChart) return;
84991
+
84992
+ this.PopMinuteChart.Close();
84993
+ }
84994
+
84915
84995
  this.ShowMinuteChartDialog=function(data, x,y)
84916
84996
  {
84917
84997
  if (!this.PopMinuteChart) return;
@@ -86678,7 +86758,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86678
86758
  this.RecvRealtimeData=function(data)
86679
86759
  {
86680
86760
  if (this.IsOnTouch==true) return; //正在操作手势不更新数据
86681
- if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
86761
+ if (this.IsPauseUpdateByKeyboard()) return; //正在操作键盘不更新数据
86682
86762
 
86683
86763
  if (data.Ver==3.0)
86684
86764
  {
@@ -87025,7 +87105,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87025
87105
  this.RecvMinuteRealtimeDataV2=function(data) //新版本的
87026
87106
  {
87027
87107
  if (this.IsOnTouch==true) return; //正在操作中不更新数据
87028
- if (this.IsPressKeyboard==true) return; //正在操作键盘不更新数据
87108
+ if (this.IsPauseUpdateByKeyboard()) return; //正在操作键盘不更新数据
87029
87109
 
87030
87110
  if (this.EnableVerifyRecvData && data.symbol!=this.Symbol)
87031
87111
  {
@@ -87500,6 +87580,8 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87500
87580
  //周期切换
87501
87581
  this.ChangePeriod=function(period,option)
87502
87582
  {
87583
+ this.ClosePopMinuteChart();
87584
+
87503
87585
  var oldData={ Period:this.Period, Right:this.Right, KLineDrawType:this.KLineDrawType, Symbol:this.Symbol};
87504
87586
 
87505
87587
  var isChangeKLineDrawType=false;
@@ -89058,6 +89140,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89058
89140
  this.ClearIndexRunCount();
89059
89141
  this.UnlockCorssCursor();
89060
89142
  this.Frame.ClearYCoordinateMaxMin();
89143
+ this.ClosePopMinuteChart();
89061
89144
 
89062
89145
 
89063
89146
  this.Symbol=symbol;
@@ -96696,7 +96779,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96696
96779
  return;
96697
96780
  }
96698
96781
 
96699
- if (this.IsOnTouch==true || this.IsPressKeyboard==true) //正在操作中不更新数据
96782
+ if (this.IsOnTouch==true || this.IsPauseUpdateByKeyboard()) //正在操作中不更新数据
96700
96783
  {
96701
96784
  if (this.SourceData && IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data))
96702
96785
  {
@@ -130507,6 +130590,9 @@ function OverlayScriptIndex(name,script,args,option)
130507
130590
  case SCRIPT_CHART_NAME.BASELINE_BAR:
130508
130591
  this.CreateBaseLineBar(hqChart,windowIndex,item,i);
130509
130592
  break;
130593
+ case SCRIPT_CHART_NAME.KLINE_TABLE:
130594
+ this.CreateKLineTable(hqChart,windowIndex,item,i);
130595
+ break;
130510
130596
  case "DRAWCOLORKLINE":
130511
130597
  this.CreateDrawColorKLine(hqChart,windowIndex,item,i);
130512
130598
  break;
@@ -131316,6 +131402,7 @@ function OverlayScriptIndex(name,script,args,option)
131316
131402
  }
131317
131403
 
131318
131404
  chart.BuildCacheData();
131405
+ this.SetChartIndexName(chart);
131319
131406
  frame.ChartPaint.push(chart);
131320
131407
  }
131321
131408
 
@@ -131346,6 +131433,61 @@ function OverlayScriptIndex(name,script,args,option)
131346
131433
  frame.ChartPaint.push(chart);
131347
131434
  }
131348
131435
 
131436
+ this.CreateKLineTable=function(hqChart,windowIndex,varItem,id)
131437
+ {
131438
+ var overlayIndex=this.OverlayIndex;
131439
+ var frame=overlayIndex.Frame;
131440
+ var chart=new ChartKLineTable();
131441
+ chart.Canvas=hqChart.Canvas;
131442
+ chart.Name=varItem.Name;
131443
+ chart.HQChart=hqChart;
131444
+ chart.ChartBorder=frame.Frame.ChartBorder;
131445
+ chart.ChartFrame=frame.Frame;
131446
+ chart.Identify=overlayIndex.Identify;
131447
+
131448
+ chart.Data=hqChart.GetKData(); //绑定K线
131449
+ chart.AryTableData=varItem.Draw.DrawData;
131450
+ if (IFrameSplitOperator.IsNumber(varItem.Draw.RowCount)) chart.RowCount=varItem.Draw.RowCount;
131451
+ if (IFrameSplitOperator.IsNonEmptyArray(varItem.Draw.RowName)) chart.RowName=varItem.Draw.RowName;
131452
+
131453
+ var config=varItem.Draw.Config;
131454
+ if (config)
131455
+ {
131456
+ if (config.BGColor) chart.BGColor=config.BGColor;
131457
+ if (config.TextColor) chart.TextColor=config.TextColor;
131458
+ if (config.BorderColor) chart.BorderColor=config.BorderColor;
131459
+ if (IFrameSplitOperator.IsNumber(config.RowNamePosition)) chart.RowNamePosition=config.RowNamePosition;
131460
+ if (IFrameSplitOperator.IsNumber(config.RowHeightType)) chart.RowHeightType=config.RowHeightType;
131461
+ if (IFrameSplitOperator.IsNumber(config.Style)) chart.Style=config.Style;
131462
+
131463
+ if (config.ItemMergin)
131464
+ {
131465
+ var subItem=config.ItemMergin;
131466
+ if (IFrameSplitOperator.IsNumber(subItem.Left)) chart.ItemMergin.Left=subItem.Left;
131467
+ if (IFrameSplitOperator.IsNumber(subItem.Top)) chart.ItemMergin.Top=subItem.Top;
131468
+ if (IFrameSplitOperator.IsNumber(subItem.Bottom)) chart.ItemMergin.Bottom=subItem.Bottom;
131469
+ if (IFrameSplitOperator.IsNumber(subItem.Right)) chart.ItemMergin.Right=subItem.Right;
131470
+ if (IFrameSplitOperator.IsNumber(subItem.YOffset)) chart.ItemMergin.YOffset=subItem.YOffset;
131471
+ }
131472
+
131473
+ if (config.TextFont)
131474
+ {
131475
+ var subItem=config.TextFont;
131476
+ if (IFrameSplitOperator.IsNumber(subItem.FontMaxSize)) chart.TextFontConfig.FontMaxSize=subItem.FontMaxSize;
131477
+ if (subItem.Family) chart.TextFontConfig.Family=subItem.Family;
131478
+ }
131479
+ }
131480
+
131481
+ chart.BuildCacheData();
131482
+ frame.ChartPaint.push(chart);
131483
+
131484
+ var titleIndex=windowIndex+1;
131485
+ var titlePaint=hqChart.TitlePaint[titleIndex];
131486
+ var titleData=new DynamicTitleData(chart.Data,chart.BarName,chart.BarColor);
131487
+ titleData.DataType="ChartKLineTable";
131488
+ titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=titleData;
131489
+ }
131490
+
131349
131491
 
131350
131492
  //创建通道
131351
131493
  this.CreateChannel=function(hqChart,windowIndex,varItem,id)
@@ -161815,7 +161957,7 @@ function HQChartScriptWorker()
161815
161957
 
161816
161958
 
161817
161959
 
161818
- var HQCHART_VERSION="1.1.14869";
161960
+ var HQCHART_VERSION="1.1.14875";
161819
161961
 
161820
161962
  function PrintHQChartVersion()
161821
161963
  {