hqchart 1.1.13973 → 1.1.13981

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.
@@ -4855,10 +4855,6 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4855
4855
  if (IFrameSplitOperator.IsNumber(item.DelayTime)) chart.DrawDynamicInfoOption.DelayTime=item.DelayTime;
4856
4856
  }
4857
4857
 
4858
-
4859
- chart.SelectRectDialog=new MinuteSelectRectDialog(this.DivElement);
4860
-
4861
-
4862
4858
  if (option.Minute) //分钟走势图属性设置
4863
4859
  {
4864
4860
  if (option.Minute.IsShowTooltip==false) chart.IsShowTooltip=false;
@@ -5699,6 +5695,11 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5699
5695
  if (option.TooltipDialog && option.TooltipDialog.Enable)
5700
5696
  chart.InitalTooltipDialog(option.TooltipDialog);
5701
5697
 
5698
+ if (option.SelectRectDialog && option.SelectRectDialog.Enable)
5699
+ {
5700
+ chart.InitalSelectRectDialog(option.SelectRectDialog);
5701
+ }
5702
+
5702
5703
  //注册事件
5703
5704
  if (option.EventCallback)
5704
5705
  {
@@ -7007,6 +7008,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7007
7008
  this.DialogModifyDraw; //画图修改
7008
7009
 
7009
7010
  this.DialogTooltip; //tooltip信息
7011
+ this.DialogSelectRect; //区间统计
7010
7012
 
7011
7013
 
7012
7014
  this.ClearStockCache=function()
@@ -7049,6 +7051,27 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7049
7051
  this.DialogModifyDraw.Create();
7050
7052
  }
7051
7053
 
7054
+ this.InitalSelectRectDialog=function(option)
7055
+ {
7056
+ if (this.DialogSelectRect) return;
7057
+
7058
+ this.DialogSelectRect=new JSDialogSelectRect();
7059
+ this.DialogSelectRect.Inital(this, option);
7060
+ this.DialogSelectRect.Create();
7061
+ }
7062
+
7063
+ this.DrawSelectRectDialog=function()
7064
+ {
7065
+
7066
+ }
7067
+
7068
+ this.IsShowSelectRectDialog=function()
7069
+ {
7070
+ if (!this.DialogSelectRect) return false;
7071
+
7072
+ return this.DialogSelectRect.IsShow();
7073
+ }
7074
+
7052
7075
  this.ShowDrawToolDialog=function(x,y)
7053
7076
  {
7054
7077
  if (!this.DialogDrawTool) return;
@@ -7570,8 +7593,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7570
7593
  }
7571
7594
  }
7572
7595
  }
7573
-
7574
- if (!this.RectSelectDrag && this.ClearRectSelect(false)) this.Draw();
7596
+
7597
+ if (!this.IsShowSelectRectDialog()) //区间统计框存在,不清空区间背景色
7598
+ {
7599
+ if (!this.RectSelectDrag && this.ClearRectSelect(false)) this.Draw();
7600
+ }
7575
7601
 
7576
7602
  if (this.EnableBorderDrag && this.Frame)
7577
7603
  {
@@ -12048,6 +12074,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12048
12074
 
12049
12075
  if (this.PopMinuteChart) this.PopMinuteChart.ReloadResource(option);
12050
12076
  if (this.DialogTooltip) this.DialogTooltip.ReloadResource(option);
12077
+ if (this.DialogSelectRect) this.DialogSelectRect.ReloadResource(option);
12051
12078
  }
12052
12079
 
12053
12080
  this.ReloadBorder=function(option) //根据页面缩放调整对应边框的尺长
@@ -12798,6 +12825,20 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12798
12825
  event.Callback(event,data,this);
12799
12826
  }
12800
12827
 
12828
+ if (this.IsShowSelectRectDialog()) //区间统计
12829
+ {
12830
+ var selectData=paint.GetSelectRectData();
12831
+
12832
+ var data=
12833
+ {
12834
+ Chart:this, X:obj.X, Y:obj.Y,
12835
+ SelectData:selectData, //区间选择的数据
12836
+ RectSelectPaint:paint //区间选择背景
12837
+ };
12838
+ var e={ data:data }
12839
+ this.DrawSelectRectDialog(e);
12840
+ }
12841
+
12801
12842
  return true;
12802
12843
  }
12803
12844
 
@@ -13623,10 +13664,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13623
13664
  if (this.ShowSelectData && srcParam) this.ShowSelectData(srcParam);
13624
13665
  break;
13625
13666
  case JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID:
13626
- var dlg=new KLineSelectRectDialog(this.DivElement);
13627
- dlg.DoModal(srcParam);
13667
+ if (this.DialogSelectRect && srcParam) this.DrawSelectRectDialog(srcParam);
13628
13668
  break;
13629
-
13630
13669
  case JSCHART_MENU_ID.CMD_SHOW_INDEX_ID: //显示隐藏指标 [0]=windowIndex [1]=0=自动 1=隐藏 2=显示
13631
13670
  if (param==null || !IFrameSplitOperator.IsNumber(aryArgs[1])) return false;
13632
13671
  var windowIndex=param, showType=aryArgs[1];
@@ -73147,6 +73186,21 @@ function JSChartResource()
73147
73186
  DateTimeColor:'rgb(60,60,60)',
73148
73187
  TurnoverRateColor:'rgb(43,54,69)', //换手率
73149
73188
  PositionColor:"rgb(255,0,255)" //持仓
73189
+ },
73190
+
73191
+ //区间统计
73192
+ this.DialogSelectRect=
73193
+ {
73194
+ BGColor:'rgb(250,250,250)', //背景色
73195
+ BorderColor:'rgb(20,20,20)', //边框颜色
73196
+ TitleColor:'rgb(0,0,0)', //对话框标题颜色
73197
+
73198
+ TextColor:"rgb(0,0,0)", //数值名称
73199
+ ValueColor:"rgb(0,0,0)", //数值
73200
+ VolColor:"rgb(255, 185, 15)", //标题成交量
73201
+ AmountColor:"rgb(79, 79, 79)", //成交金额
73202
+ TurnoverRateColor:'rgb(43,54,69)', //换手率
73203
+ PositionColor:"rgb(255,0,255)" //持仓
73150
73204
  }
73151
73205
 
73152
73206
  //弹幕
@@ -74156,6 +74210,22 @@ function JSChartResource()
74156
74210
 
74157
74211
  }
74158
74212
 
74213
+ if (style.DialogSelectRect)
74214
+ {
74215
+ var item=style.DialogSelectRect;
74216
+ if (item.BGColor) this.DialogSelectRect.BGColor=item.BGColor;
74217
+ if (item.BorderColor) this.DialogSelectRect.BorderColor=item.BorderColor;
74218
+ if (item.TitleColor) this.DialogSelectRect.TitleColor=item.TitleColor;
74219
+
74220
+ if (item.TextColor) this.DialogSelectRect.TextColor=item.TextColor;
74221
+ if (item.ValueColor) this.DialogSelectRect.ValueColor=item.ValueColor;
74222
+ if (item.VolColor) this.DialogSelectRect.VolColor=item.VolColor;
74223
+ if (item.AmountColor) this.DialogSelectRect.AmountColor=item.AmountColor;
74224
+ if (item.TurnoverRateColor) this.DialogSelectRect.TurnoverRateColor=item.TurnoverRateColor;
74225
+ if (item.PositionColor) this.DialogSelectRect.PositionColor=item.PositionColor;
74226
+
74227
+ }
74228
+
74159
74229
  if (style.MinuteInfo)
74160
74230
  {
74161
74231
  var item=style.MinuteInfo;
@@ -75134,13 +75204,28 @@ function JSChartLocalization()
75134
75204
  ['DialogTooltip-Price', {CN:'价格', EN:'Price', TC:'價格'}],
75135
75205
  ['DialogTooltip-AvPrice', {CN:'均价', EN:'AVPrice:', TC:'均價'}],
75136
75206
  ['DialogTooltip-FClose', {CN:"结算价", EN:'Settlement', TC:'結算價'}],
75137
- ['DialogTooltip-Amplitude', {CN:'振幅', EN:'amplitude', TC:'價格'}],
75207
+ ['DialogTooltip-Amplitude', {CN:'振幅', EN:'amplitude', TC:'振幅'}],
75138
75208
  ['DialogTooltip-AC-Price', {CN:'匹配价', EN:'Price', TC:'匹配價'}],
75139
75209
  ['DialogTooltip-AC-AvPrice', {CN:'匹配均价', EN:'AVPrice', TC:'匹配均價'}],
75140
75210
  ['DialogTooltip-AC-Increase', {CN:'竞价涨幅', EN:'Increase', TC:'競價漲幅'}],
75141
75211
  ['DialogTooltip-AC-Vol', {CN:'匹配量', EN:'Vol', TC:'匹配量'}],
75142
75212
  ['DialogTooltip-Value', {CN:'数值', EN:'Value', TC:'数值'}],
75143
75213
 
75214
+
75215
+ ['DialogSelectRect-StartPrice', {CN:'起始价:', EN:'Start Price:', TC:'起始價'}],
75216
+ ['DialogSelectRect-EndPrice', {CN:'最终价:', EN:"End Price:", TC:'最终價'}],
75217
+ ['DialogSelectRect-High', {CN:'最高价:', EN:'High:', TC:'最高價'}],
75218
+ ['DialogSelectRect-Low', {CN:'最低价:', EN:"Low:", TC:'最低價'}],
75219
+ ['DialogSelectRect-Increase', {CN:'区间涨幅:', EN:'Increase', TC:'漲幅'}],
75220
+ ['DialogSelectRect-Amplitude', {CN:'区间振幅:', EN:'amplitude', TC:'振幅'}],
75221
+ ['DialogSelectRect-Vol', {CN:'成交量:', EN:'Volume', TC:'數量'}],
75222
+ ['DialogSelectRect-Amount', {CN:'成交额:', EN:'Amount', TC:'金額'}],
75223
+ ['DialogSelectRect-Up', {CN:'阳线:', EN:'Up', TC:'阳线'}],
75224
+ ['DialogSelectRect-Down', {CN:'阴线:', EN:'Down', TC:'阴线'}],
75225
+ ['DialogSelectRect-Unchanged', {CN:'平线:', EN:'Unchanged', TC:'平线'}],
75226
+ ['DialogSelectRect-DataCount', {CN:'数据个数:', EN:'Data Count:', TC:'数据个数'}],
75227
+
75228
+
75144
75229
  //走势图PC tooltip
75145
75230
  ['PCTooltip-Date', {CN:'日期', EN:'Date', TC:"日期"}],
75146
75231
  ['PCTooltip-Time', {CN:'时间', EN:'Time', TC:"時間"}],
@@ -77488,8 +77573,20 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
77488
77573
  event.Callback(event,data,this);
77489
77574
  isShowMenu=data.IsShowMenu;
77490
77575
  }
77491
-
77492
- if (isShowMenu)
77576
+
77577
+ if (this.IsShowSelectRectDialog()) //区间统计
77578
+ {
77579
+ var data=
77580
+ {
77581
+ Chart:this,X:x,Y:y,
77582
+ SelectData:selectData, //区间选择的数据
77583
+ RectSelectPaint:paint //区间选择背景
77584
+ };
77585
+ e.data=data;
77586
+
77587
+ this.DrawSelectRectDialog(e);
77588
+ }
77589
+ else if (isShowMenu)
77493
77590
  {
77494
77591
  var data=
77495
77592
  {
@@ -83486,6 +83583,42 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
83486
83583
 
83487
83584
  return true;
83488
83585
  }
83586
+
83587
+ this.DrawSelectRectDialog=function(e)
83588
+ {
83589
+ if (!this.DialogSelectRect) return;
83590
+
83591
+ this.UpdateSelectRectDialog(e);
83592
+ }
83593
+
83594
+ this.UpdateSelectRectDialog=function(e)
83595
+ {
83596
+ if (!this.DialogSelectRect) return false;
83597
+
83598
+ var data=e.data; //区间统计数据
83599
+ var x,y;
83600
+ if (data && IFrameSplitOperator.IsNumber(data.X) && IFrameSplitOperator.IsNumber(data.Y))
83601
+ {
83602
+ var pixelRatio=GetDevicePixelRatio();
83603
+ var rtClient=this.UIElement.getBoundingClientRect();
83604
+ var rtScroll=GetScrollPosition();
83605
+
83606
+ x=data.X
83607
+ y=data.Y;
83608
+ x+=(rtClient.left+rtScroll.Left);
83609
+ y+=(rtClient.top+rtScroll.Top);
83610
+ }
83611
+
83612
+ var sendData=
83613
+ {
83614
+ Symbol:this.Symbol, Name:this.Name,
83615
+ SelectData:data.SelectData,
83616
+ X:x, Y:y,
83617
+ e:e
83618
+ }
83619
+
83620
+ this.DialogSelectRect.Update(sendData);
83621
+ }
83489
83622
  }
83490
83623
 
83491
83624
  //API 返回数据 转化为array[]
@@ -83913,7 +84046,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
83913
84046
 
83914
84047
  this.ColorLineData; //主图价格线颜色自定义配置
83915
84048
  this.EnableSelectRect=false; //是否可以区间选择
83916
- this.SelectRectDialog=null; //区间选择对话框
83917
84049
 
83918
84050
  this.CorssCursorIndex={ DayIndex:-1, DataIndex:-1, Point:{X:-1, Y:-1} ,Type:-1 };
83919
84051
  this.EnableNewIndex=false //是否使用新的索引版本
@@ -84316,7 +84448,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84316
84448
  isShowDialog=false; //外部调用了区间选择事件,不弹框
84317
84449
  }
84318
84450
 
84319
- if (isShowDialog && this.SelectRectDialog)
84451
+ if (isShowDialog && this.DialogSelectRect)
84320
84452
  {
84321
84453
  e.data=
84322
84454
  {
@@ -84327,7 +84459,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84327
84459
  RectSelectPaint:paint //区间选择背景
84328
84460
  };
84329
84461
 
84330
- this.SelectRectDialog.DoModal(e);
84462
+ this.HideSelectRect();
84463
+ this.UpdateSelectRect(selectData.Start,selectData.End);
84464
+ this.DrawSelectRectDialog(e);
84331
84465
  }
84332
84466
  else
84333
84467
  {
@@ -84371,9 +84505,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84371
84505
  isShowDialog=data.IsShowDialog;
84372
84506
  }
84373
84507
 
84374
- if (isShowDialog && this.SelectRectDialog)
84508
+ if (isShowDialog)
84375
84509
  {
84376
- e.data=
84510
+ var data =
84377
84511
  {
84378
84512
  Chart:this,
84379
84513
  X:x,
@@ -84381,10 +84515,10 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84381
84515
  SelectData:selectData, //区间选择的数据
84382
84516
  RectSelectPaint:paint //区间选择背景
84383
84517
  };
84518
+ e.data=data;
84384
84519
 
84385
- this.SelectRectDialog.DoModal(e);
84520
+ this.UpdateSelectRectDialog(e);
84386
84521
  }
84387
-
84388
84522
  }
84389
84523
 
84390
84524
  this.UpdateSelectRect=function(start,end)
@@ -84441,6 +84575,14 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84441
84575
  event.Callback(event,data,this);
84442
84576
  }
84443
84577
 
84578
+ if (this.IsShowSelectRectDialog()) //区间统计
84579
+ {
84580
+ var selectData=paint.GetSelectRectData();
84581
+ var data={ X:obj.X, Y:obj.Y, SelectData:selectData, RectSelectPaint:paint };
84582
+ var e={ data:data };
84583
+ this.DrawSelectRectDialog(e);
84584
+ }
84585
+
84444
84586
  return true;
84445
84587
  }
84446
84588
 
@@ -85389,7 +85531,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
85389
85531
  event.Callback(event,data,this);
85390
85532
  }
85391
85533
 
85392
- if (this.SelectRectDialog)
85534
+ if (this.DialogSelectRect)
85393
85535
  {
85394
85536
  e.data=
85395
85537
  {
@@ -85399,7 +85541,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
85399
85541
  SelectData:selectData, //区间选择的数据
85400
85542
  RectSelectPaint:paint //区间选择背景
85401
85543
  };
85402
- this.SelectRectDialog.DoModal(e);
85544
+ this.DrawSelectRectDialog(e);
85403
85545
  }
85404
85546
  }
85405
85547
 
@@ -89339,6 +89481,42 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
89339
89481
 
89340
89482
  return true;
89341
89483
  }
89484
+
89485
+ this.DrawSelectRectDialog=function(e)
89486
+ {
89487
+ if (!this.DialogSelectRect) return;
89488
+
89489
+ this.UpdateSelectRectDialog(e);
89490
+ }
89491
+
89492
+ this.UpdateSelectRectDialog=function(e)
89493
+ {
89494
+ if (!this.DialogSelectRect) return false;
89495
+
89496
+ var data=e.data; //区间统计数据
89497
+ var x,y;
89498
+ if (data && IFrameSplitOperator.IsNumber(data.X) && IFrameSplitOperator.IsNumber(data.Y))
89499
+ {
89500
+ var pixelRatio=GetDevicePixelRatio();
89501
+ var rtClient=this.UIElement.getBoundingClientRect();
89502
+ var rtScroll=GetScrollPosition();
89503
+
89504
+ x=data.X
89505
+ y=data.Y;
89506
+ x+=(rtClient.left+rtScroll.Left);
89507
+ y+=(rtClient.top+rtScroll.Top);
89508
+ }
89509
+
89510
+ var sendData=
89511
+ {
89512
+ Symbol:this.Symbol, Name:this.Name,
89513
+ SelectData:data.SelectData,
89514
+ X:x, Y:y,
89515
+ e:e
89516
+ }
89517
+
89518
+ this.DialogSelectRect.Update(sendData);
89519
+ }
89342
89520
  }
89343
89521
 
89344
89522
  //盘前数据
@@ -94504,441 +94682,6 @@ function ChangeIndexDialog(divElement)
94504
94682
  }
94505
94683
  }
94506
94684
 
94507
- function MinuteSelectRectDialog(divElement)
94508
- {
94509
- this.newMethod=IDivDialog; //派生
94510
- this.newMethod(divElement);
94511
- delete this.newMethod;
94512
-
94513
- this.SelectData;
94514
- this.Dialog;
94515
- this.HQChart;
94516
- this.RectSelectPaint;
94517
-
94518
- //隐藏窗口
94519
- this.Close=function()
94520
- {
94521
- if (this.Dialog)
94522
- {
94523
- this.DivElement.removeChild(this.Dialog);
94524
- this.Dialog=null;
94525
- this.ID=null;
94526
- }
94527
-
94528
- if (this.RectSelectPaint) this.RectSelectPaint.PreventClose=false;
94529
- }
94530
-
94531
- //创建
94532
- this.Create=function()
94533
- {
94534
- this.ID=Guid();
94535
- var div=document.createElement('div');
94536
- div.className='jchart-select-statistics-box';
94537
- div.id=this.ID;
94538
- div.innerHTML=
94539
- "<div class='parameter jchart-select-section'>\
94540
- <div class='parameter-header'>\
94541
- <span>分时图区间统计</span>\
94542
- <strong id='close' class='icon iconfont icon-close'></strong>\
94543
- </div>\
94544
- <div class='parameter-content'>统计数据</div>\
94545
- <div class='parameter-footer'>\
94546
- <button id='close' class='submit' >确定</button>\
94547
- </div>\
94548
- </div>";
94549
-
94550
- this.DivElement.appendChild(div);
94551
- this.Dialog=div;
94552
-
94553
- //关闭按钮
94554
- $("#"+this.ID+" #close").click(
94555
- {
94556
- divBox:this,
94557
- },
94558
- function(event)
94559
- {
94560
- event.data.divBox.Close();
94561
- });
94562
- }
94563
-
94564
- this.BindData=function()
94565
- {
94566
- var hqData=this.SelectData.Data;
94567
- var start=this.SelectData.Start;
94568
- var end=this.SelectData.End;
94569
- this.HQChart.UpdateSelectRect(start,end);
94570
- if (this.RectSelectPaint) this.RectSelectPaint.PreventClose=true;
94571
-
94572
- var showData=
94573
- {
94574
- Open:0,Close:0,High:0,Low:0, //起始价格, 结束价格, 最高, 最低
94575
- Vol:0, Amount:0,
94576
- Date:
94577
- {
94578
- Start:{Time:null, Date:null },
94579
- End:{ Time:null, Date:null }
94580
- },
94581
- Count:0,
94582
- }
94583
-
94584
- for(var i=start; i<=end && i<hqData.Data.length; ++i)
94585
- {
94586
- var item=hqData.Data[i];
94587
- if (i==start)
94588
- {
94589
- showData.Date.Start.Date=item.Date;
94590
- showData.Date.Start.Time=item.Time;
94591
- showData.Open=item.Close;
94592
- showData.High=item.High;
94593
- showData.Low=item.Low;
94594
- }
94595
-
94596
- showData.Date.End.Date=item.Date;
94597
- showData.Date.End.Time=item.Time;
94598
- showData.Close=item.Close;
94599
- showData.Vol+=item.Vol;
94600
- showData.Amount+=item.Amount;
94601
- ++showData.Count;
94602
- if (showData.High<item.High) showData.High=item.High;
94603
- if(showData.Low>item.Low) showData.Low=item.Low;
94604
- }
94605
-
94606
- if (showData.Count<=0) return false;
94607
-
94608
- if (showData.Vol>0) showData.AvPrice=showData.Amount/showData.Vol; //均价
94609
- if (showData.Open>0)
94610
- {
94611
- showData.Increase = (showData.Close - showData.Open) / showData.Open *100; //区间涨幅
94612
- showData.Amplitude = (showData.High - showData.Low) / showData.Open * 100; //区间振幅
94613
- }
94614
-
94615
- // JSConsole.Chart.Log('[KLineSelectRectDialog::BindData]', showData);
94616
- var defaultfloatPrecision=GetfloatPrecision(this.SelectData.Symbol);
94617
- var startDate=IFrameSplitOperator.FormatDateString(showData.Date.Start.Date);
94618
- var endDate=IFrameSplitOperator.FormatDateString(showData.Date.End.Date);
94619
- startDate+=' '+IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM");
94620
- endDate+=" "+IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM");
94621
-
94622
- var startLeftClass="",startRightClass="",endLeftClass="",endRightClass="";
94623
- if(start<=0) startLeftClass = "BtnBackground";
94624
- if(start >= end) {
94625
- startRightClass = "BtnBackground";
94626
- endLeftClass = "BtnBackground";
94627
- }
94628
- if(end >= hqData.Data.length - 1) endRightClass = "BtnBackground";
94629
-
94630
- var div=document.createElement('div');
94631
- div.className='jchart-select-table-right';
94632
- div.innerHTML=
94633
- '<div class="jchart-select-date">\n' +
94634
- ' <span>开始: '+ startDate +'<i class="start-date-left '+ startLeftClass +'"><</i><i class="start-date-right '+ startRightClass +'">></i></span>\n' +
94635
- ' <span>结束: '+ endDate +'<i class="end-date-left '+ endLeftClass +'"><</i><i class="end-date-right '+ endRightClass +'">></i></span>\n' +
94636
- ' <span>总个数: '+ showData.Count +'</span>\n' +
94637
- ' </div>\n' +
94638
- ' <table>\n' +
94639
- ' <tr><td><strong>起始价: </strong><span>'+ showData.Open.toFixed(defaultfloatPrecision) +'</span></td>' +
94640
- ' <td><strong>终止价: </strong><span>'+ showData.Close.toFixed(defaultfloatPrecision) +'</span></td>' +
94641
- ' <td><strong>均价: </strong><span>'+ (IFrameSplitOperator.IsNumber(showData.AvPrice) ? showData.AvPrice.toFixed(defaultfloatPrecision):"--.--") +'</span></td></tr>\n' +
94642
- ' <tr><td><strong>最低价: </strong><span>'+ showData.Low.toFixed(defaultfloatPrecision) +'</span></td>' +
94643
- ' <td><strong>最高价: </strong><span>'+ showData.High.toFixed(defaultfloatPrecision) +'</span></td>' +
94644
- ' <td><strong>涨跌幅: </strong><span class="'+ IFrameSplitOperator.FormatValueColor(showData.Increase) +'">'+ showData.Increase.toFixed(2) +'%</span></td></tr>\n' +
94645
- ' <tr><td><strong>振幅: </strong><span>'+ showData.Amplitude.toFixed(2) +'%</span></td>' +
94646
- ' <td><strong>成交量: </strong><span>'+ IFrameSplitOperator.FormatValueString(showData.Vol,2) +'股</span></td>' +
94647
- ' <td><strong>金额: </strong><span>'+ IFrameSplitOperator.FormatValueString(showData.Amount,2) +'元</span></td></tr>\n' +
94648
- ' </table>';
94649
-
94650
- $(".parameter-content").html(div);
94651
- this.BindEvent();
94652
-
94653
- return true;
94654
- }
94655
-
94656
- this.BindEvent = function ()
94657
- {
94658
- var _self = this;
94659
- if(_self.SelectData.Start > 0){
94660
- $(".jchart-select-date .start-date-left").click(function () {
94661
- _self.SelectData.Start--;
94662
- _self.BindData();
94663
- _self.HQChart.UpdateSelectRect(_self.SelectData.Start,_self.SelectData.End);
94664
- })
94665
- }
94666
- if(_self.SelectData.Start < _self.SelectData.End){
94667
- $(".jchart-select-date .start-date-right").click(function () {
94668
- _self.SelectData.Start++;
94669
- _self.BindData();
94670
- _self.HQChart.UpdateSelectRect(_self.SelectData.Start,_self.SelectData.End);
94671
- })
94672
- $(".jchart-select-date .end-date-left").click(function () {
94673
- _self.SelectData.End--;
94674
- _self.BindData();
94675
- _self.HQChart.UpdateSelectRect(_self.SelectData.Start,_self.SelectData.End);
94676
- })
94677
- }
94678
- if(_self.SelectData.End < _self.SelectData.Data.Data.length - 1){
94679
- $(".jchart-select-date .end-date-right").click(function () {
94680
- _self.SelectData.End++;
94681
- _self.BindData();
94682
- _self.HQChart.UpdateSelectRect(_self.SelectData.Start,_self.SelectData.End);
94683
- })
94684
- }
94685
- }
94686
-
94687
-
94688
- //显示
94689
- this.DoModal=function(event)
94690
- {
94691
- var chart=event.data.Chart;
94692
- if (this.ID==null) this.Create(); //第1次 需要创建div
94693
- this.SelectData=event.data.SelectData;
94694
- this.RectSelectPaint=event.data.RectSelectPaint;
94695
- this.HQChart=chart;
94696
- this.HQChart.HideSelectRect();
94697
- if (!this.BindData()) return;
94698
-
94699
- this.Show(); //通过CSS居中显示
94700
- }
94701
-
94702
-
94703
- }
94704
-
94705
- //区间统计
94706
- function KLineSelectRectDialog(divElement)
94707
- {
94708
- this.newMethod=IDivDialog; //派生
94709
- this.newMethod(divElement);
94710
- delete this.newMethod;
94711
-
94712
- this.SelectData;
94713
- this.Dialog;
94714
- this.HQChart;
94715
- this.RectSelectPaint;
94716
-
94717
- //隐藏窗口
94718
- this.Close=function()
94719
- {
94720
- if (this.Dialog)
94721
- {
94722
- this.DivElement.removeChild(this.Dialog);
94723
- this.Dialog=null;
94724
- }
94725
-
94726
- if (this.RectSelectPaint) this.RectSelectPaint.PreventClose=false;
94727
- }
94728
-
94729
- //创建
94730
- this.Create=function()
94731
- {
94732
- this.ID=Guid();
94733
- var div=document.createElement('div');
94734
- div.className='jchart-select-statistics-box';
94735
- div.id=this.ID;
94736
- div.innerHTML=
94737
- "<div class='parameter jchart-select-section'>\
94738
- <div class='parameter-header'>\
94739
- <span>区间统计</span>\
94740
- <strong id='close' class='icon iconfont icon-close'></strong>\
94741
- </div>\
94742
- <div class='parameter-content'>统计数据</div>\
94743
- <div class='parameter-footer'>\
94744
- <button id='close' class='submit' >确定</button>\
94745
- <button id='match' class='submit' >形态匹配</button>\
94746
- </div>\
94747
- </div>";
94748
-
94749
- this.DivElement.appendChild(div);
94750
- this.Dialog=div;
94751
-
94752
- //关闭按钮
94753
- $("#"+this.ID+" #close").click(
94754
- {
94755
- divBox:this,
94756
- },
94757
- function(event)
94758
- {
94759
- event.data.divBox.Close();
94760
- });
94761
-
94762
- //形态匹配
94763
- $("#"+this.ID+" #match").click(
94764
- {
94765
- divBox:this,
94766
- },
94767
- function(event)
94768
- {
94769
- event.data.divBox.KLineMatch();
94770
- });
94771
- }
94772
-
94773
- this.BindData=function()
94774
- {
94775
- var hqData=this.SelectData.Data;
94776
- var start=this.SelectData.Start;
94777
- var end=this.SelectData.End;
94778
- this.HQChart.UpdateSelectRect(start,end);
94779
- if (this.RectSelectPaint) this.RectSelectPaint.PreventClose=true;
94780
-
94781
- var showData=
94782
- {
94783
- Open:0,Close:0,High:0,Low:0, YClose:0,
94784
- Vol:0, Amount:0,
94785
- Date:
94786
- {
94787
- Start:{Time:null, Date:null },
94788
- End:{ Time:null, Date:null }
94789
- },
94790
- Count:0,
94791
- KLine:{ Up:0,Down:0,Unchanged:0 } //阳线|阴线|平线
94792
- }
94793
-
94794
- for(var i=start; i<=end && i<hqData.Data.length; ++i)
94795
- {
94796
- var item=hqData.Data[i];
94797
- if (i==start)
94798
- {
94799
- showData.Date.Start.Date=item.Date;
94800
- showData.Date.Start.Time=item.Time;
94801
- showData.Open=item.Open;
94802
- showData.High=item.High;
94803
- showData.Low=item.Low;
94804
- showData.YClose=item.YClose;
94805
- }
94806
-
94807
- showData.Date.End.Date=item.Date;
94808
- showData.Date.End.Time=item.Time;
94809
- showData.Close=item.Close;
94810
- showData.Vol+=item.Vol;
94811
- showData.Amount+=item.Amount;
94812
- ++showData.Count;
94813
- if (showData.High<item.High) showData.High=item.High;
94814
- if(showData.Low>item.Low) showData.Low=item.Low;
94815
- if (item.Close>item.Open) ++showData.KLine.Up;
94816
- else if (item.Close<item.Open) ++showData.KLine.Down;
94817
- else ++showData.KLine.Unchanged;
94818
- }
94819
-
94820
- if (showData.Vol>0) showData.AvPrice=showData.Amount/showData.Vol; //均价
94821
- if (item.YClose>0)
94822
- {
94823
- showData.Increase = (showData.Close - showData.YClose) / showData.YClose *100; //涨幅
94824
- showData.Amplitude = (showData.High - showData.Low) / showData.YClose * 100; //振幅
94825
- }
94826
-
94827
- // JSConsole.Chart.Log('[KLineSelectRectDialog::BindData]', showData);
94828
- var defaultfloatPrecision=GetfloatPrecision(this.SelectData.Symbol);
94829
- var startDate=IFrameSplitOperator.FormatDateString(showData.Date.Start.Date);
94830
- var endDate=IFrameSplitOperator.FormatDateString(showData.Date.End.Date);
94831
- if (ChartData.IsMinutePeriod(this.HQChart.Period))
94832
- {
94833
- startDate+=' '+IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM");
94834
- endDate+=" "+IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM");
94835
- }
94836
- else if (ChartData.IsSecondPeriod(this.HQChart.Period) || ChartData.IsTickPeriod(this.HQChart.Period))
94837
- {
94838
- startDate+=' '+IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM:SS");
94839
- endDate+=" "+IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM:SS");
94840
- }
94841
-
94842
- var startLeftClass="",startRightClass="",endLeftClass="",endRightClass="";
94843
- if(start<=0) startLeftClass = "BtnBackground";
94844
- if(start >= end) {
94845
- startRightClass = "BtnBackground";
94846
- endLeftClass = "BtnBackground";
94847
- }
94848
- if(end >= hqData.Data.length - 1) endRightClass = "BtnBackground";
94849
-
94850
- var div=document.createElement('div');
94851
- div.className='jchart-select-table-right';
94852
- div.innerHTML=
94853
- '<div class="jchart-select-date">\n' +
94854
- ' <span>开始: '+ startDate +'<i class="start-date-left '+ startLeftClass +'"><</i><i class="start-date-right '+ startRightClass +'">></i></span>\n' +
94855
- ' <span>结束: '+ endDate +'<i class="end-date-left '+ endLeftClass +'"><</i><i class="end-date-right '+ endRightClass +'">></i></span>\n' +
94856
- ' <span>总个数: '+ showData.Count +'</span>\n' +
94857
- ' </div>\n' +
94858
- ' <table>\n' +
94859
- ' <tr><td><strong>起始价: </strong><span>'+ showData.YClose.toFixed(defaultfloatPrecision) +'</span></td>' +
94860
- ' <td><strong>最终价: </strong><span>'+ showData.Close.toFixed(defaultfloatPrecision) +'</span></td>' +
94861
- ' <td><strong>均价: </strong><span>'+ (IFrameSplitOperator.IsNumber(showData.AvPrice) ? showData.AvPrice.toFixed(defaultfloatPrecision):"--.--") +'</span></td></tr>\n' +
94862
- ' <tr><td><strong>最低价: </strong><span>'+ showData.Low.toFixed(defaultfloatPrecision) +'</span></td>' +
94863
- ' <td><strong>最高价: </strong><span>'+ showData.High.toFixed(defaultfloatPrecision) +'</span></td>' +
94864
- ' <td><strong>涨跌幅: </strong><span class="'+ IFrameSplitOperator.FormatValueColor(showData.Increase) +'">'+ showData.Increase.toFixed(2) +'%</span></td></tr>\n' +
94865
- ' <tr><td><strong>振幅: </strong><span>'+ showData.Amplitude.toFixed(2) +'%</span></td>' +
94866
- ' <td><strong>成交量: </strong><span>'+ IFrameSplitOperator.FormatValueString(showData.Vol,2) +'股</span></td>' +
94867
- ' <td><strong>金额: </strong><span>'+ IFrameSplitOperator.FormatValueString(showData.Amount,2) +'元</span></td></tr>\n' +
94868
- ' <tr><td><strong>阴线: </strong><span>'+ showData.KLine.Up +'</span></td>' +
94869
- ' <td><strong>阳线: </strong><span>'+ showData.KLine.Down +'</span></td>' +
94870
- ' <td><strong>平线: </strong><span>'+ showData.KLine.Unchanged +'</span></td></tr>\n' +
94871
- ' </table>';
94872
-
94873
- $(".parameter-content").html(div);
94874
- this.BindEvent();
94875
- }
94876
-
94877
- this.BindEvent = function () {
94878
- var _self = this;
94879
- if(_self.SelectData.Start > 0){
94880
- $(".jchart-select-date .start-date-left").click(function () {
94881
- _self.SelectData.Start--;
94882
- _self.BindData();
94883
- _self.HQChart.UpdateSelectRect(_self.SelectData.Start,_self.SelectData.End);
94884
- })
94885
- }
94886
- if(_self.SelectData.Start < _self.SelectData.End){
94887
- $(".jchart-select-date .start-date-right").click(function () {
94888
- _self.SelectData.Start++;
94889
- _self.BindData();
94890
- _self.HQChart.UpdateSelectRect(_self.SelectData.Start,_self.SelectData.End);
94891
- })
94892
- $(".jchart-select-date .end-date-left").click(function () {
94893
- _self.SelectData.End--;
94894
- _self.BindData();
94895
- _self.HQChart.UpdateSelectRect(_self.SelectData.Start,_self.SelectData.End);
94896
- })
94897
- }
94898
- if(_self.SelectData.End < _self.SelectData.Data.Data.length - 1){
94899
- $(".jchart-select-date .end-date-right").click(function () {
94900
- _self.SelectData.End++;
94901
- _self.BindData();
94902
- _self.HQChart.UpdateSelectRect(_self.SelectData.Start,_self.SelectData.End);
94903
- })
94904
- }
94905
- }
94906
-
94907
- //显示
94908
- this.DoModal=function(event)
94909
- {
94910
- var chart=event.data.Chart;
94911
- if (this.ID==null) this.Create(); //第1次 需要创建div
94912
- this.SelectData=event.data.SelectData;
94913
- this.RectSelectPaint=event.data.RectSelectPaint;
94914
- this.HQChart=chart;
94915
- this.HQChart.HideSelectRect();
94916
- this.BindData();
94917
-
94918
- this.Show(); //通过CSS居中显示
94919
- }
94920
-
94921
- //形态匹配
94922
- this.KLineMatch=function(data)
94923
- {
94924
- var waitDialog=new WaitDialog(this.DivElement);
94925
- waitDialog.DoModal(
94926
- {
94927
- data:
94928
- {
94929
- Title:'计算中......',
94930
- Chart:this.HQChart
94931
- }
94932
- });
94933
-
94934
- this.Close(); //关闭窗口
94935
-
94936
- var hqChart=this.HQChart;
94937
- var param= { Scope: { Plate:["CNA.ci"],Minsimilar:0.90 }, WaitDialog:waitDialog } //沪深A股, 相似度>=90%
94938
- hqChart.RequestKLineMatch(this.SelectData, param);
94939
- }
94940
- }
94941
-
94942
94685
  //形态选股
94943
94686
  function KLineMatchDialog(divElement)
94944
94687
  {
@@ -125671,6 +125414,19 @@ function GetBlackStyle()
125671
125414
  TurnoverRateColor:'rgb(43,54,69)', //换手率
125672
125415
  PositionColor:"rgb(255,0,255)" //持仓
125673
125416
  },
125417
+
125418
+ DialogSelectRect:
125419
+ {
125420
+ BGColor:'rgb(20,20,20)', //背景色
125421
+ BorderColor:'rgb(170,170,170)', //边框颜色
125422
+ TitleColor:'rgb(210,210,210)', //标题颜色
125423
+ VolColor:"rgb(255, 185, 15)", //标题成交量
125424
+ AmountColor:"rgb(210,210,210)", //成交金额
125425
+ TextColor:"rgb(210,210,210)", //数值名称
125426
+ ValueColor:"rgb(210,210,210)", //数值
125427
+ TurnoverRateColor:'rgb(43,54,69)', //换手率
125428
+ PositionColor:"rgb(255,0,255)" //持仓
125429
+ },
125674
125430
 
125675
125431
  //走势图 信息地雷
125676
125432
  MinuteInfo:
@@ -136619,10 +136375,11 @@ function JSTReportChartContainer(uielement)
136619
136375
 
136620
136376
  this.RecvStockListData=function(data)
136621
136377
  {
136378
+ this.MapExePriceData=new Map();
136379
+ this.MapStockData=new Map();
136380
+
136622
136381
  if (IFrameSplitOperator.IsNonEmptyArray(data.data))
136623
136382
  {
136624
- this.MapExePriceData=new Map();
136625
- this.MapStockData=new Map();
136626
136383
  //0=行权价格 1=左边期权代码 2=右侧期权代码 3=左侧期权名称 4=右侧期权名称
136627
136384
  for(var i=0;i<data.data.length;++i)
136628
136385
  {
@@ -136786,7 +136543,7 @@ function JSTReportChartContainer(uielement)
136786
136543
 
136787
136544
  if (rightData && IFrameSplitOperator.IsNumber(rightData.Position))
136788
136545
  {
136789
- if (leftMaxPosition.Max==null || leftMaxPosition.Max<rightData.Position)
136546
+ if (rightMaxPosition.Max==null || rightMaxPosition.Max<rightData.Position)
136790
136547
  {
136791
136548
  rightMaxPosition.Max=rightData.Position;
136792
136549
  rightMaxPosition.ExePrice=mapItem[0];
@@ -143577,6 +143334,7 @@ function JSPopKeyboard()
143577
143334
  this.Title="HQChart 键盘精灵"
143578
143335
  this.ID=Guid();
143579
143336
  this.ActiveDOM=null; //启动键盘精灵是的控件
143337
+ this.InputStatus=0; //0=空闲 1=输入中
143580
143338
 
143581
143339
  this.Keyboard=
143582
143340
  {
@@ -143633,6 +143391,10 @@ function JSPopKeyboard()
143633
143391
  input.addEventListener("keydown", (event)=>{ this.OnKeydown(event); });
143634
143392
  input.addEventListener("keyup", (event)=>{ this.OnKeyup(event); });
143635
143393
 
143394
+ input.addEventListener("compositionstart", (event)=>{ this.OnCompositionStart(event); });
143395
+ input.addEventListener("compositionupdate", (event)=>{ this.OnCompositionUpdate(event);} );
143396
+ input.addEventListener("compositionend", (event)=>{ this.OnCompositionEnd(event);} );
143397
+
143636
143398
  divInput.appendChild(input);
143637
143399
 
143638
143400
  var divChart=document.createElement("div");
@@ -143663,8 +143425,26 @@ function JSPopKeyboard()
143663
143425
 
143664
143426
  }
143665
143427
 
143428
+
143429
+ this.OnCompositionStart=function(event)
143430
+ {
143431
+ this.InputStatus=1;
143432
+ }
143433
+
143434
+ this.OnCompositionUpdate=function(event)
143435
+ {
143436
+
143437
+ }
143438
+
143439
+ this.OnCompositionEnd=function(event)
143440
+ {
143441
+ this.InputStatus=0;
143442
+ }
143443
+
143666
143444
  this.OnKeydown=function(event)
143667
143445
  {
143446
+ if (this.InputStatus!=0) return;
143447
+
143668
143448
  var aryKey=new Set([
143669
143449
  40,
143670
143450
  38,
@@ -143686,6 +143466,8 @@ function JSPopKeyboard()
143686
143466
 
143687
143467
  this.OnKeyup=function(event)
143688
143468
  {
143469
+ if (this.InputStatus!=0) return;
143470
+
143689
143471
  var code=event.keyCode;
143690
143472
  if ((code>=48 && code<=57) || (code>=65 && code<=90) || (code>=97 && code<=122) || code==8)
143691
143473
  {
@@ -144198,22 +143980,23 @@ function JSDialogTooltip()
144198
143980
  this.onmouseup = null;
144199
143981
  }
144200
143982
 
144201
- this.Show=function()
143983
+ this.Show=function(x, y)
144202
143984
  {
143985
+ if (this.IsShow()) return;
143986
+
144203
143987
  if (!this.DivDialog) return;
144204
143988
  if (!this.HQChart) return;
144205
143989
 
144206
- if (!this.DivDialog.style.top || !this.DivDialog.style.left) //上一次显示的位置
144207
- {
144208
- var top=this.HQChart.Frame.ChartBorder.GetTop();
144209
- var left=this.HQChart.Frame.ChartBorder.GetLeft();
144210
- var rtClient=this.HQChart.UIElement.getBoundingClientRect();
144211
-
144212
- var x=left+rtClient.left+5;
144213
- var y=top+rtClient.top+10;
144214
- this.DivDialog.style.top = y + "px";
144215
- this.DivDialog.style.left = x + "px";
144216
- }
143990
+
143991
+ var top=this.HQChart.Frame.ChartBorder.GetTop();
143992
+ var left=this.HQChart.Frame.ChartBorder.GetLeft();
143993
+ var rtClient=this.HQChart.UIElement.getBoundingClientRect();
143994
+
143995
+ var x=left+rtClient.left+5;
143996
+ var y=top+rtClient.top+10;
143997
+ this.DivDialog.style.top = y + "px";
143998
+ this.DivDialog.style.left = x + "px";
143999
+
144217
144000
 
144218
144001
  this.DivDialog.style.visibility='visible';
144219
144002
  }
@@ -144674,7 +144457,871 @@ function JSDialogTooltip()
144674
144457
  }
144675
144458
 
144676
144459
 
144677
- }///////////////////////////////////////////////////////////////////////////////////
144460
+ }
144461
+ /*
144462
+ Copyright (c) 2018 jones
144463
+
144464
+ http://www.apache.org/licenses/LICENSE-2.0
144465
+
144466
+ 开源项目 https://github.com/jones2000/HQChart
144467
+
144468
+ jones_2000@163.com
144469
+
144470
+ 内置区间统计框 设置框
144471
+ */
144472
+
144473
+
144474
+
144475
+ function JSDialogSelectRect()
144476
+ {
144477
+ this.DivDialog=null;
144478
+ this.DragTitle=null;
144479
+ this.HQChart=null;
144480
+
144481
+ this.UpColor=g_JSChartResource.UpTextColor;
144482
+ this.DownColor=g_JSChartResource.DownTextColor;
144483
+ this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
144484
+
144485
+ this.TitleColor=g_JSChartResource.DialogSelectRect.TitleColor;
144486
+ this.TitleBGColor=g_JSChartResource.DialogSelectRect.TitleBGColor;
144487
+ this.BGColor=g_JSChartResource.DialogSelectRect.BGColor;
144488
+
144489
+ this.TextColor=g_JSChartResource.DialogSelectRect.TextColor;
144490
+ this.ValueColor=g_JSChartResource.DialogSelectRect.ValueColor;
144491
+
144492
+ this.VolColor=g_JSChartResource.DialogSelectRect.VolColor;
144493
+ this.AmountColor=g_JSChartResource.DialogSelectRect.AmountColor;
144494
+ this.TurnoverRateColor=g_JSChartResource.DialogSelectRect.TurnoverRateColor;
144495
+ this.PositionColor=g_JSChartResource.DialogSelectRect.PositionColor;
144496
+
144497
+
144498
+ this.MaxRowCount=10;
144499
+ this.AryData=[];
144500
+ this.DateTimeBox={ Start:{ SpanText:null, SpanValue:null }, End:{ SpanText:null, SpanValue:null } };
144501
+ this.ShowData;
144502
+ this.SelectData;
144503
+
144504
+ this.Inital=function(hqchart, option)
144505
+ {
144506
+ this.HQChart=hqchart;
144507
+ if (option)
144508
+ {
144509
+
144510
+ }
144511
+ }
144512
+
144513
+ this.Destroy=function()
144514
+ {
144515
+ this.AryData=[];
144516
+ this.ShowData=null;
144517
+ this.DateTimeBox={ Start:{ SpanText:null, SpanValue:null }, End:{ SpanText:null, SpanValue:null } };
144518
+
144519
+ if (this.DivDialog)
144520
+ {
144521
+ document.body.removeChild(this.DivDialog);
144522
+ this.DivDialog=null;
144523
+ }
144524
+ }
144525
+
144526
+ this.Create=function()
144527
+ {
144528
+ var divDom=document.createElement("div");
144529
+ divDom.className='UMyChart_SelectRect_Dialog_Div';
144530
+
144531
+ var divTitle=document.createElement("div");
144532
+ divTitle.className='UMyChart_SelectRect_Title_Div';
144533
+ divTitle.onmousedown=(e)=>{ this.OnMouseDownTitle(e);}
144534
+
144535
+ var divName=document.createElement("div");
144536
+ divName.className='UMyChart_SelectRect_Name_Div';
144537
+ divName.innerText="区间统计";
144538
+ divTitle.appendChild(divName);
144539
+
144540
+ var divClose=document.createElement("div");
144541
+ divClose.className='UMyChart_SelectRect_Close_Div';
144542
+ divClose.innerText="x";
144543
+ divClose.onmousedown=(e)=>{ this.Close(e); }
144544
+ divTitle.appendChild(divClose);
144545
+
144546
+ divDom.appendChild(divTitle);
144547
+
144548
+ var divDateTime=document.createElement("div");
144549
+ divDateTime.className='UMyChart_SelectRect_DateTime_Div';
144550
+
144551
+ //起始日期
144552
+ var divStartDate=document.createElement("div");
144553
+ divDateTime.append(divStartDate);
144554
+ var spanText=document.createElement("span");
144555
+ spanText.className="UMyChart_SelectRect_DateTitle_Span";
144556
+ spanText.innerText="开始:";
144557
+ divStartDate.appendChild(spanText);
144558
+ this.DateTimeBox.Start.SpanText=spanText;
144559
+
144560
+ var spanDate=document.createElement("span");
144561
+ spanDate.className="UMyChart_SelectRect_DateValue_Span";
144562
+ spanDate.innerText="--/--";
144563
+ divStartDate.appendChild(spanDate);
144564
+ this.DateTimeBox.Start.SpanValue=spanDate;
144565
+
144566
+ var spanArrow=document.createElement("span");
144567
+ spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";
144568
+ spanArrow.innerText="<";
144569
+ spanArrow.onmousedown=(e)=>{ this.MoveStartDate(-1); }
144570
+ divStartDate.appendChild(spanArrow);
144571
+
144572
+ var spanArrow=document.createElement("span");
144573
+ spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";
144574
+ spanArrow.innerText=">";
144575
+ spanArrow.onmousedown=(e)=>{ this.MoveStartDate(1); }
144576
+ divStartDate.appendChild(spanArrow);
144577
+
144578
+ //结束日期
144579
+ var divEndDate=document.createElement("div");
144580
+ divDateTime.append(divEndDate);
144581
+ var spanText=document.createElement("span");
144582
+ spanText.className="UMyChart_SelectRect_DateTitle_Span";
144583
+ spanText.innerText="结束:";
144584
+ divEndDate.appendChild(spanText);
144585
+ this.DateTimeBox.End.SpanText=spanText;
144586
+
144587
+ var spanDate=document.createElement("span");
144588
+ spanDate.className="UMyChart_SelectRect_DateValue_Span";
144589
+ spanDate.innerText="--/--";
144590
+ divEndDate.appendChild(spanDate);
144591
+ this.DateTimeBox.SpanEnd=spanDate;
144592
+ this.DateTimeBox.End.SpanValue=spanDate;
144593
+
144594
+ var spanArrow=document.createElement("span");
144595
+ spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";
144596
+ spanArrow.innerText="<";
144597
+ spanArrow.onmousedown=(e)=>{ this.MoveEndDate(-1); }
144598
+ divEndDate.appendChild(spanArrow);
144599
+
144600
+ var spanArrow=document.createElement("span");
144601
+ spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";
144602
+ spanArrow.innerText=">";
144603
+ spanArrow.onmousedown=(e)=>{ this.MoveEndDate(1); }
144604
+ divEndDate.appendChild(spanArrow);
144605
+
144606
+ divDom.appendChild(divDateTime);
144607
+
144608
+
144609
+ var table=document.createElement("table");
144610
+ table.className="UMyChart_SelectRect_Table";
144611
+ divDom.appendChild(table);
144612
+
144613
+ var tbody=document.createElement("tbody");
144614
+ tbody.className="UMyChart_SelectRect_Tbody";
144615
+ table.appendChild(tbody);
144616
+
144617
+
144618
+ for(var i=0;i<this.MaxRowCount;++i)
144619
+ {
144620
+ var rowItem={ Tr:null, AryItem:[] };
144621
+
144622
+ var trDom=document.createElement("tr");
144623
+ trDom.className='UMyChart_SelectRect_Tr';
144624
+ tbody.appendChild(trDom);
144625
+ rowItem.Tr=trDom;
144626
+
144627
+ for(var j=0;j<3;++j)
144628
+ {
144629
+ var item={ Td:null, LeftSpan:null, RightSpan:null };
144630
+ var tdDom=document.createElement("td");
144631
+ tdDom.className="UMyChart_SelectRect_Td"; //标题+数值
144632
+ item.Td=tdDom;
144633
+ trDom.appendChild(tdDom);
144634
+
144635
+ var spanDom=document.createElement("span");
144636
+ spanDom.className='UMyChart_SelectRect_Item_Left_Span';
144637
+ spanDom.innerText='数值';
144638
+ item.LeftSpan=spanDom;
144639
+ tdDom.appendChild(spanDom);
144640
+
144641
+
144642
+ var spanDom=document.createElement("span");
144643
+ spanDom.className='UMyChart_SelectRect_Item_Right_Span';
144644
+ spanDom.innerText='--';
144645
+ item.RightSpan=spanDom;
144646
+ tdDom.appendChild(spanDom);
144647
+
144648
+ rowItem.AryItem.push(item);
144649
+ }
144650
+
144651
+ this.AryData.push(rowItem);
144652
+ }
144653
+
144654
+ document.body.appendChild(divDom);
144655
+
144656
+ this.DivDialog=divDom;
144657
+
144658
+ this.UpdateStyle();
144659
+ }
144660
+
144661
+ this.Close=function(e)
144662
+ {
144663
+ if (!this.DivDialog) return;
144664
+
144665
+ this.DivDialog.style.visibility='hidden';
144666
+ this.ShowData=null;
144667
+ this.SelectData=null;
144668
+ }
144669
+
144670
+ this.MoveStartDate=function(step)
144671
+ {
144672
+ if (!this.DivDialog || !this.HQChart) return;
144673
+ if (step==0) return;
144674
+ if (!this.SelectData) return;
144675
+
144676
+ var selectData=this.SelectData;
144677
+ var bUpdate=false;
144678
+ if (step>0)
144679
+ {
144680
+ var index=selectData.Start;
144681
+ var endIndex=selectData.End;
144682
+ for(i=0; i<step && index<endIndex; ++i)
144683
+ {
144684
+ ++index;
144685
+ }
144686
+
144687
+ if (selectData.Start!=index)
144688
+ {
144689
+ selectData.Start=index;
144690
+ bUpdate=true;
144691
+ }
144692
+ }
144693
+ else
144694
+ {
144695
+ step=Math.abs(step);
144696
+ var index=selectData.Start
144697
+ var endIndex=selectData.End;
144698
+ for(var i=0;i<step && index>0;++i)
144699
+ {
144700
+ --index;
144701
+ }
144702
+
144703
+ if (selectData.Start!=index)
144704
+ {
144705
+ selectData.Start=index;
144706
+ bUpdate=true;
144707
+ }
144708
+ }
144709
+
144710
+ if (bUpdate) this.UpdateSelectRect(selectData);
144711
+ }
144712
+
144713
+ this.MoveEndDate=function(step)
144714
+ {
144715
+ if (!this.DivDialog) return;
144716
+ if (step==0) return;
144717
+ if (!this.SelectData) return;
144718
+
144719
+ var selectData=this.SelectData;
144720
+ var bUpdate=false;
144721
+
144722
+ if (step>0)
144723
+ {
144724
+ var index=selectData.End;
144725
+ var startIndex=selectData.Start;
144726
+ for(i=0; i<step && index<this.ShowData.DataCount; ++i)
144727
+ {
144728
+ ++index;
144729
+ }
144730
+
144731
+ if (selectData.End!=index)
144732
+ {
144733
+ selectData.End=index;
144734
+ bUpdate=true;
144735
+ }
144736
+ }
144737
+ else
144738
+ {
144739
+ step=Math.abs(step);
144740
+ var index=selectData.End;
144741
+ var startIndex=selectData.Start;
144742
+ for(var i=0;i<step && index>startIndex;++i)
144743
+ {
144744
+ --index;
144745
+ }
144746
+
144747
+ if (selectData.End!=index)
144748
+ {
144749
+ selectData.End=index;
144750
+ bUpdate=true;
144751
+ }
144752
+ }
144753
+
144754
+ if (bUpdate) this.UpdateSelectRect(selectData);
144755
+ }
144756
+
144757
+ this.Show=function(x,y)
144758
+ {
144759
+ if (!this.DivDialog) return;
144760
+ if (!this.HQChart) return;
144761
+
144762
+ /*
144763
+ if (!this.DivDialog.style.top || !this.DivDialog.style.left) //上一次显示的位置
144764
+ {
144765
+ var top=this.HQChart.Frame.ChartBorder.GetTop();
144766
+ var left=this.HQChart.Frame.ChartBorder.GetLeft();
144767
+
144768
+
144769
+ var x=left+rtClient.left+5;
144770
+ var y=top+rtClient.top+10;
144771
+ this.DivDialog.style.top = y + "px";
144772
+ this.DivDialog.style.left = x + "px";
144773
+ }
144774
+ */
144775
+
144776
+ var top=this.HQChart.Frame.ChartBorder.GetTop();
144777
+ var left=this.HQChart.Frame.ChartBorder.GetLeft();
144778
+ var rtClient=this.HQChart.UIElement.getBoundingClientRect();
144779
+
144780
+ left=left+rtClient.left+5;
144781
+ top=top+rtClient.top+10;
144782
+ if (IFrameSplitOperator.IsNumber(x) && IFrameSplitOperator.IsNumber(y))
144783
+ {
144784
+ left=x;
144785
+ top=y;
144786
+ }
144787
+
144788
+ var right=x+this.DivDialog.offsetWidth;
144789
+ var bottom=y+ this.DivDialog.offsetHeight;
144790
+
144791
+ if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
144792
+ if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
144793
+
144794
+ this.DivDialog.style.top = top + "px";
144795
+ this.DivDialog.style.left = left + "px";
144796
+ this.DivDialog.style.visibility='visible';
144797
+ }
144798
+
144799
+ this.IsShow=function()
144800
+ {
144801
+ if (!this.DivDialog) return false;
144802
+
144803
+ return this.DivDialog.style.visibility==='visible';
144804
+ }
144805
+
144806
+ this.OnMouseDownTitle=function(e)
144807
+ {
144808
+ if (!this.DivDialog) return;
144809
+
144810
+ var dragData={ X:e.clientX, Y:e.clientY };
144811
+ dragData.YOffset=e.clientX - this.DivDialog.offsetLeft;
144812
+ dragData.XOffset=e.clientY - this.DivDialog.offsetTop;
144813
+ this.DragTitle=dragData;
144814
+
144815
+ document.onmousemove=(e)=>{ this.DocOnMouseMoveTitle(e); }
144816
+ document.onmouseup=(e)=>{ this.DocOnMouseUpTitle(e); }
144817
+ }
144818
+
144819
+ this.DocOnMouseMoveTitle=function(e)
144820
+ {
144821
+ if (!this.DragTitle) return;
144822
+
144823
+ var left = e.clientX - this.DragTitle.YOffset;
144824
+ var top = e.clientY - this.DragTitle.XOffset;
144825
+
144826
+ var right=left+this.DivDialog.offsetWidth;
144827
+ var bottom=top+ this.DivDialog.offsetHeight;
144828
+
144829
+ if ((right+5)>=window.innerWidth) left=window.innerWidth-this.DivDialog.offsetWidth-5;
144830
+ if ((bottom+5)>=window.innerHeight) top=window.innerHeight-this.DivDialog.offsetHeight-5;
144831
+
144832
+ this.DivDialog.style.left = left + 'px';
144833
+ this.DivDialog.style.top = top + 'px';
144834
+
144835
+ if(e.preventDefault) e.preventDefault();
144836
+ }
144837
+
144838
+ this.DocOnMouseUpTitle=function(e)
144839
+ {
144840
+ this.DragTitle=null;
144841
+ this.onmousemove = null;
144842
+ this.onmouseup = null;
144843
+ }
144844
+
144845
+
144846
+ //配色修改
144847
+ this.ReloadResource=function(option)
144848
+ {
144849
+ this.UpColor=g_JSChartResource.UpTextColor;
144850
+ this.DownColor=g_JSChartResource.DownTextColor;
144851
+ this.UnchangeColor=g_JSChartResource.UnchagneTextColor;
144852
+
144853
+ this.TitleColor=g_JSChartResource.DialogSelectRect.TitleColor;
144854
+ this.TitleBGColor=g_JSChartResource.DialogSelectRect.TitleBGColor;
144855
+ this.BGColor=g_JSChartResource.DialogSelectRect.BGColor;
144856
+ this.BorderColor=g_JSChartResource.DialogSelectRect.BorderColor;
144857
+
144858
+ this.TextColor=g_JSChartResource.DialogSelectRect.TextColor;
144859
+ this.ValueColor=g_JSChartResource.DialogSelectRect.ValueColor;
144860
+
144861
+ this.VolColor=g_JSChartResource.DialogSelectRect.VolColor;
144862
+ this.AmountColor=g_JSChartResource.DialogSelectRect.AmountColor;
144863
+ this.TurnoverRateColor=g_JSChartResource.DialogSelectRect.TurnoverRateColor;
144864
+ this.PositionColor=g_JSChartResource.DialogSelectRect.PositionColor;
144865
+
144866
+ if (!this.DivDialog) return;
144867
+
144868
+ this.UpdateStyle();
144869
+
144870
+ if (this.SelectData)
144871
+ {
144872
+ var selectData=this.SelectData;
144873
+ this.HQChart.UpdateSelectRect(selectData.Start,selectData.End);
144874
+ var showData=this.CalculateKLineData({ SelectData:selectData });
144875
+ this.FormatKLineText(showData);
144876
+ this.ShowData=showData;
144877
+ this.UpdateTableDOM(showData);
144878
+ }
144879
+
144880
+ }
144881
+
144882
+ this.UpdateStyle=function()
144883
+ {
144884
+ if (!this.DivDialog) return;
144885
+
144886
+ if (this.BGColor) this.DivDialog.style['background-color']=this.BGColor;
144887
+ if (this.BorderColor) this.DivDialog.style['border-color']=this.BorderColor;
144888
+
144889
+ if (this.DateTimeBox.Start)
144890
+ {
144891
+ var item=this.DateTimeBox.Start;
144892
+ item.SpanText.style["color"]=this.TextColor;
144893
+ item.SpanValue.style["color"]=this.ValueColor;
144894
+ }
144895
+
144896
+ if (this.DateTimeBox.End)
144897
+ {
144898
+ var item=this.DateTimeBox.End;
144899
+ item.SpanText.style["color"]=this.TextColor;
144900
+ item.SpanValue.style["color"]=this.ValueColor;
144901
+ }
144902
+
144903
+ //if (this.TitleBGColor) this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;
144904
+ }
144905
+
144906
+
144907
+ this.UpdateTableDOM=function(showData)
144908
+ {
144909
+ var index=0;
144910
+ for(var index=0,j=0, dataIndex=0;index<this.AryData.length && dataIndex<showData.AryText.length;++index)
144911
+ {
144912
+ var rowItem=this.AryData[index];
144913
+ for(j=0;j<rowItem.AryItem.length;++j, ++dataIndex)
144914
+ {
144915
+ if (dataIndex>=showData.AryText.length) break;
144916
+
144917
+ var item=rowItem.AryItem[j]
144918
+ var outItem=showData.AryText[dataIndex];
144919
+
144920
+ item.LeftSpan.innerText=outItem.Title;
144921
+ item.LeftSpan.style.color=this.TextColor;
144922
+
144923
+ item.RightSpan.innerText=outItem.Text;
144924
+ item.RightSpan.style.color=outItem.Color;
144925
+ }
144926
+ rowItem.Tr.style.display="";
144927
+ }
144928
+
144929
+ for(; index<this.AryData.length;++index)
144930
+ {
144931
+ var rowItem=this.AryData[index];
144932
+ rowItem.Tr.style.display="none";
144933
+ }
144934
+
144935
+ if (this.DateTimeBox.Start.SpanValue) this.DateTimeBox.Start.SpanValue.innerText=showData.Date.Start.Text;
144936
+ if (this.DateTimeBox.End.SpanValue) this.DateTimeBox.End.SpanValue.innerText=showData.Date.End.Text;
144937
+ }
144938
+
144939
+ this.UpdateSelectRect=function(selectData)
144940
+ {
144941
+ this.HQChart.UpdateSelectRect(selectData.Start,selectData.End);
144942
+ var showData=null;
144943
+ if (this.HQChart.ClassName=='KLineChartContainer')
144944
+ {
144945
+ showData=this.CalculateKLineData({ SelectData:selectData });
144946
+ this.FormatKLineText(showData);
144947
+ }
144948
+ else if (this.HQChart.ClassName=='MinuteChartContainer')
144949
+ {
144950
+ showData=this.CalculateMinuteData({ SelectData:selectData });
144951
+ this.FormatMinuteText(showData);
144952
+ }
144953
+
144954
+ if (showData)
144955
+ {
144956
+ this.ShowData=showData;
144957
+ this.UpdateTableDOM(showData);
144958
+ }
144959
+ }
144960
+
144961
+
144962
+ this.Update=function(data)
144963
+ {
144964
+ if (!this.DivDialog) return;
144965
+
144966
+ var showData;
144967
+ if (this.HQChart.ClassName=='KLineChartContainer')
144968
+ {
144969
+ showData=this.CalculateKLineData(data);
144970
+ this.FormatKLineText(showData);
144971
+ }
144972
+ else if (this.HQChart.ClassName=='MinuteChartContainer')
144973
+ {
144974
+ showData=this.CalculateMinuteData(data);
144975
+ this.FormatMinuteText(showData);
144976
+ }
144977
+
144978
+ if (!showData) return;
144979
+
144980
+ this.ShowData=showData;
144981
+ this.SelectData=data.SelectData;
144982
+ this.UpdateTableDOM(showData);
144983
+
144984
+ if (!this.IsShow()) this.Show(data.X, data.Y);
144985
+ }
144986
+
144987
+ this.CreateEmptyShowData=function()
144988
+ {
144989
+ var showData=
144990
+ {
144991
+ Open:null,Close:null,High:null,Low:null, YClose:null,
144992
+ Vol:0, Amount:0,
144993
+ Date:
144994
+ {
144995
+ Start:{ Time:null, Date:null, Text:"" },
144996
+ End:{ Time:null, Date:null, Text:"" }
144997
+ },
144998
+ Count:0,
144999
+ KLine:{ Up:0,Down:0,Unchanged:0 }, //阳线|阴线|平线
145000
+
145001
+ AryText:[],
145002
+
145003
+ DataCount:0,
145004
+ };
145005
+
145006
+ return showData;
145007
+ }
145008
+
145009
+ this.CalculateKLineData=function(data)
145010
+ {
145011
+ var selectData=data.SelectData;
145012
+ var hisData=selectData.Data;
145013
+ var start=selectData.Start;
145014
+ var end=selectData.End;
145015
+
145016
+ var showData=this.CreateEmptyShowData();
145017
+ showData.DataCount=hisData.Data.length;
145018
+
145019
+ for(var i=start;i<hisData.Data.length && i<=end;++i)
145020
+ {
145021
+ var item=hisData.Data[i];
145022
+ ++showData.Count;
145023
+
145024
+ if (!IFrameSplitOperator.IsNumber(showData.Open) && IFrameSplitOperator.IsNumber(item.Open)) showData.Open=item.Open;
145025
+ if (IFrameSplitOperator.IsNumber(item.Close)) showData.Close=item.Close;
145026
+
145027
+ if (IFrameSplitOperator.IsNumber(item.Vol)) showData.Vol+=item.Vol;
145028
+ if (IFrameSplitOperator.IsNumber(item.Amount)) showData.Amount+=item.Amount;
145029
+
145030
+ if (IFrameSplitOperator.IsNumber(item.High))
145031
+ {
145032
+ if (!IFrameSplitOperator.IsNumber(showData.High) || showData.High<item.High)
145033
+ showData.High=item.High;
145034
+ }
145035
+
145036
+ if (IFrameSplitOperator.IsNumber(item.Low))
145037
+ {
145038
+ if (!IFrameSplitOperator.IsNumber(showData.Low) || showData.Low>item.Low)
145039
+ showData.Low=item.Low;
145040
+ }
145041
+
145042
+ if (IFrameSplitOperator.IsNumber(item.Open) && IFrameSplitOperator.IsNumber(item.Close))
145043
+ {
145044
+ if (item.Close>item.Open) ++showData.KLine.Up;
145045
+ else if (item.Close<item.Open) ++showData.KLine.Down;
145046
+ else ++showData.KLine.Unchanged;
145047
+ }
145048
+
145049
+ if (IFrameSplitOperator.IsNumber(item.Date))
145050
+ {
145051
+ showData.Date.End.Date=item.Date;
145052
+ if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Date)) showData.Date.Start.Date=item.Date;
145053
+ }
145054
+
145055
+ if (IFrameSplitOperator.IsNumber(item.Time))
145056
+ {
145057
+ showData.Date.End.Time=item.Time;
145058
+ if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Time)) showData.Date.Start.Time=item.Time;
145059
+ }
145060
+ }
145061
+
145062
+ return showData;
145063
+ }
145064
+
145065
+ //格式化K线数据
145066
+ this.FormatKLineText=function(showData)
145067
+ {
145068
+ if (!showData) return;
145069
+
145070
+ var defaultfloatPrecision=GetfloatPrecision(this.HQChart.Symbol);
145071
+
145072
+ if (ChartData.IsMinutePeriod(this.HQChart.Period,true))
145073
+ {
145074
+ showData.Date.Start.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.Start.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM")}`;
145075
+ showData.Date.End.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.End.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM")}`;
145076
+ }
145077
+ else if (ChartData.IsSecondPeriod(this.HQChart.Period) || ChartData.IsTickPeriod(this.HQChart.Period))
145078
+ {
145079
+ showData.Date.Start.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.Start.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM:SS")}`;
145080
+ showData.Date.End.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.End.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM:SS")}`;
145081
+ }
145082
+ else
145083
+ {
145084
+ showData.Date.Start.Text=IFrameSplitOperator.FormatDateString(showData.Date.Start.Date);
145085
+ showData.Date.End.Text=IFrameSplitOperator.FormatDateString(showData.Date.End.Date);
145086
+ }
145087
+
145088
+ showData.AryText.push(this.ForamtPrice(showData.Open, showData.Open,defaultfloatPrecision, 'DialogSelectRect-StartPrice'));
145089
+ showData.AryText.push(this.ForamtPrice(showData.Close, showData.Open,defaultfloatPrecision, 'DialogSelectRect-EndPrice'));
145090
+ showData.AryText.push(this.FormatIncrease(showData.Close, showData.Open, 'DialogSelectRect-Increase'));
145091
+
145092
+ showData.AryText.push(this.ForamtPrice(showData.High, showData.Open,defaultfloatPrecision, 'DialogSelectRect-High'));
145093
+ showData.AryText.push(this.ForamtPrice(showData.Low, showData.Open,defaultfloatPrecision, 'DialogSelectRect-Low'));
145094
+ showData.AryText.push(this.FormatAmplitude(showData.High, showData.Low, showData.Open, 'DialogSelectRect-Amplitude'));
145095
+
145096
+ showData.AryText.push(this.FormatVol(showData.Vol, 'DialogSelectRect-Vol'));
145097
+ showData.AryText.push(this.FormatAmount(showData.Amount, 'DialogSelectRect-Amount'));
145098
+ showData.AryText.push(this.FormatNumber(showData.Count, null, 0, "DialogSelectRect-DataCount"));
145099
+
145100
+ showData.AryText.push(this.FormatNumber(showData.KLine.Up, this.UpColor, 0, 'DialogSelectRect-Up'));
145101
+ showData.AryText.push(this.FormatNumber(showData.KLine.Down, this.DownColor, 0, 'DialogSelectRect-Down'));
145102
+ showData.AryText.push(this.FormatNumber(showData.KLine.Unchanged, this.UnchangeColor, 0, 'DialogSelectRect-Unchanged'));
145103
+ }
145104
+
145105
+
145106
+ this.CalculateMinuteData=function(data)
145107
+ {
145108
+ var selectData=data.SelectData;
145109
+ var hisData=selectData.Data;
145110
+ var start=selectData.Start;
145111
+ var end=selectData.End;
145112
+
145113
+ var showData=this.CreateEmptyShowData();
145114
+ showData.DataCount=hisData.Data.length;
145115
+
145116
+ for(var i=start;i<hisData.Data.length && i<=end;++i)
145117
+ {
145118
+ var item=hisData.Data[i];
145119
+ ++showData.Count;
145120
+
145121
+ if (!IFrameSplitOperator.IsNumber(showData.Open) && IFrameSplitOperator.IsNumber(item.Open)) showData.Open=item.Open;
145122
+ if (IFrameSplitOperator.IsNumber(item.Close)) showData.Close=item.Close;
145123
+
145124
+ if (IFrameSplitOperator.IsNumber(item.Vol)) showData.Vol+=item.Vol;
145125
+ if (IFrameSplitOperator.IsNumber(item.Amount)) showData.Amount+=item.Amount;
145126
+
145127
+ if (IFrameSplitOperator.IsNumber(item.High))
145128
+ {
145129
+ if (!IFrameSplitOperator.IsNumber(showData.High) || showData.High<item.High)
145130
+ showData.High=item.High;
145131
+ }
145132
+
145133
+ if (IFrameSplitOperator.IsNumber(item.Low))
145134
+ {
145135
+ if (!IFrameSplitOperator.IsNumber(showData.Low) || showData.Low>item.Low)
145136
+ showData.Low=item.Low;
145137
+ }
145138
+
145139
+ if (IFrameSplitOperator.IsNumber(item.Open) && IFrameSplitOperator.IsNumber(item.Close))
145140
+ {
145141
+ if (item.Close>item.Open) ++showData.KLine.Up;
145142
+ else if (item.Close<item.Open) ++showData.KLine.Down;
145143
+ else ++showData.KLine.Unchanged;
145144
+ }
145145
+
145146
+ if (IFrameSplitOperator.IsNumber(item.Date))
145147
+ {
145148
+ showData.Date.End.Date=item.Date;
145149
+ if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Date)) showData.Date.Start.Date=item.Date;
145150
+ }
145151
+
145152
+ if (IFrameSplitOperator.IsNumber(item.Time))
145153
+ {
145154
+ showData.Date.End.Time=item.Time;
145155
+ if (!IFrameSplitOperator.IsNumber(showData.Date.Start.Time)) showData.Date.Start.Time=item.Time;
145156
+ }
145157
+ }
145158
+
145159
+ return showData;
145160
+ }
145161
+
145162
+ this.FormatMinuteText=function(showData)
145163
+ {
145164
+ if (!showData) return;
145165
+
145166
+ var defaultfloatPrecision=GetfloatPrecision(this.HQChart.Symbol);
145167
+
145168
+ showData.Date.Start.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.Start.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.Start.Time,"HH:MM")}`;
145169
+ showData.Date.End.Text=`${IFrameSplitOperator.FormatDateString(showData.Date.End.Date)} ${IFrameSplitOperator.FormatTimeString(showData.Date.End.Time,"HH:MM")}`;
145170
+
145171
+ showData.AryText.push(this.ForamtPrice(showData.Open, showData.Open,defaultfloatPrecision, 'DialogSelectRect-StartPrice'));
145172
+ showData.AryText.push(this.ForamtPrice(showData.Close, showData.Open,defaultfloatPrecision, 'DialogSelectRect-EndPrice'));
145173
+ showData.AryText.push(this.FormatIncrease(showData.Close, showData.Open, 'DialogSelectRect-Increase'));
145174
+
145175
+ showData.AryText.push(this.ForamtPrice(showData.High, showData.Open,defaultfloatPrecision, 'DialogSelectRect-High'));
145176
+ showData.AryText.push(this.ForamtPrice(showData.Low, showData.Open,defaultfloatPrecision, 'DialogSelectRect-Low'));
145177
+ showData.AryText.push(this.FormatAmplitude(showData.High, showData.Low, showData.Open, 'DialogSelectRect-Amplitude'));
145178
+
145179
+ showData.AryText.push(this.FormatVol(showData.Vol, 'DialogSelectRect-Vol'));
145180
+ showData.AryText.push(this.FormatAmount(showData.Amount, 'DialogSelectRect-Amount'));
145181
+ showData.AryText.push(this.FormatNumber(showData.Count, null, 0, "DialogSelectRect-DataCount"));
145182
+ }
145183
+
145184
+
145185
+ this.GetColor=function(price,yClose)
145186
+ {
145187
+ if(price>yClose) return this.UpColor;
145188
+ else if (price<yClose) return this.DownColor;
145189
+ else return this.UnchangeColor;
145190
+ }
145191
+
145192
+ this.GetPriceColor=function(price, yClose)
145193
+ {
145194
+ var color=this.GetColor(price, yClose);
145195
+ return color;
145196
+ }
145197
+
145198
+ this.FormatEmpty=function()
145199
+ {
145200
+ var item=
145201
+ {
145202
+ Title:"",
145203
+ Text:"",
145204
+ Color:this.ValueColor
145205
+ };
145206
+
145207
+ return item;
145208
+ }
145209
+
145210
+ this.FormatNumber=function(value, color, defaultfloatPrecision, TitleID, format)
145211
+ {
145212
+ var item=
145213
+ {
145214
+ Title:g_JSChartLocalization.GetText(TitleID, this.LanguageID),
145215
+ Text:"----",
145216
+ Color:this.ValueColor
145217
+ };
145218
+
145219
+ if (!IFrameSplitOperator.IsNumber(value)) return item;
145220
+
145221
+ item.Text=value.toFixed(defaultfloatPrecision);
145222
+ if (color) item.Color=color;
145223
+
145224
+ return item;
145225
+ }
145226
+
145227
+
145228
+ this.ForamtPrice=function(price, yClose, defaultfloatPrecision, TitleID)
145229
+ {
145230
+ var item=
145231
+ {
145232
+ Title:g_JSChartLocalization.GetText(TitleID, this.LanguageID),
145233
+ Text:"--.--",
145234
+ Color:this.ValueColor
145235
+ };
145236
+
145237
+ if (!IFrameSplitOperator.IsNumber(price)) return item;
145238
+
145239
+ item.Text=price.toFixed(defaultfloatPrecision);
145240
+ item.Color=this.GetColor(price, yClose);
145241
+
145242
+ return item;
145243
+ }
145244
+
145245
+ this.FormatIncrease=function(price, yClose, TitleID,)
145246
+ {
145247
+ //涨幅
145248
+ var item=
145249
+ {
145250
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
145251
+ Text:"--.--",
145252
+ Color:this.ValueColor
145253
+ };
145254
+
145255
+ if (!IFrameSplitOperator.IsNumber(price) || !IFrameSplitOperator.IsNumber(yClose)) return item;
145256
+
145257
+ var diffValue=price-yClose;
145258
+ var value=(diffValue)/yClose;
145259
+ item.Text=`${(value*100).toFixed(2)}%`;
145260
+
145261
+ item.Color=this.GetColor(value,0);
145262
+
145263
+ return item;
145264
+ }
145265
+
145266
+ this.FormatAmplitude=function(high, low, yClose, TitleID)
145267
+ {
145268
+ //振幅
145269
+ var item=
145270
+ {
145271
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
145272
+ Text:"--.--",
145273
+ Color:this.ValueColor
145274
+ };
145275
+
145276
+
145277
+ if (!IFrameSplitOperator.IsNumber(high) || !IFrameSplitOperator.IsNumber(low) || !IFrameSplitOperator.IsNumber(yClose)) return item;
145278
+
145279
+ var diffValue=high-low;
145280
+ var value=(diffValue)/yClose;
145281
+ item.Text=`${(value*100).toFixed(2)}%`;
145282
+ item.Color=this.GetColor(value,0);
145283
+
145284
+ return item;
145285
+ }
145286
+
145287
+ this.FormatVol=function(vol, TitleID)
145288
+ {
145289
+ var item=
145290
+ {
145291
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
145292
+ Text:'--',
145293
+ Color:this.VolColor
145294
+ };
145295
+
145296
+ if (!IFrameSplitOperator.IsNumber(vol)) return item;
145297
+
145298
+ item.Text=IFrameSplitOperator.FormatValueStringV2(vol,0,2,this.LanguageID);
145299
+
145300
+ return item;
145301
+ }
145302
+
145303
+ this.FormatAmount=function(amount, TitleID)
145304
+ {
145305
+ var item=
145306
+ {
145307
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
145308
+ Text:'--',
145309
+ Color:this.AmountColor
145310
+ };
145311
+
145312
+ if (!IFrameSplitOperator.IsNumber(amount)) return item;
145313
+
145314
+ item.Text=IFrameSplitOperator.FormatValueString(amount,2,this.LanguageID);
145315
+
145316
+ return item;
145317
+ }
145318
+
145319
+ }
145320
+
145321
+
145322
+
145323
+
145324
+ ///////////////////////////////////////////////////////////////////////////////////
144678
145325
  // 工作线程计算指标示例
144679
145326
  //
144680
145327
  //
@@ -144795,7 +145442,7 @@ function HQChartScriptWorker()
144795
145442
 
144796
145443
 
144797
145444
 
144798
- var HQCHART_VERSION="1.1.13972";
145445
+ var HQCHART_VERSION="1.1.13980";
144799
145446
 
144800
145447
  function PrintHQChartVersion()
144801
145448
  {