hqchart 1.1.14498 → 1.1.14506

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.
@@ -8215,6 +8215,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8215
8215
  drag.LastMove.X=e.clientX;
8216
8216
  drag.LastMove.Y=e.clientY;
8217
8217
  }
8218
+ else if (drag.Click && drag.Click.IsInFrameBottom)
8219
+ {
8220
+ this.OnDragXCoordinateZoom(drag, {X:moveSetp, Y:moveSetpY}, e);
8221
+ }
8218
8222
  else if ((bLButtonSelectRect || bRButtonSelectRect) && !isDragSelectRect && !isDragSubSelectRect) //左右键区间选择
8219
8223
  {
8220
8224
  var yMoveSetp=Math.abs(drag.LastMove.Y-e.clientY);
@@ -8236,6 +8240,38 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8236
8240
  }
8237
8241
  }
8238
8242
 
8243
+ this.OnDragXCoordinateZoom=function(drag, moveData, e)
8244
+ {
8245
+ var moveSetp=moveData.X;
8246
+ var moveSetpY=moveData.Y;
8247
+ if (moveSetp<5) return;
8248
+
8249
+ var isLeft=true;
8250
+ if (drag.LastMove.X<e.clientX) isLeft=false;//右移数据
8251
+
8252
+ var cursorStatus="ew-resize";
8253
+
8254
+ var oneStepWidth=this.GetMoveOneStepWidth();
8255
+ if (moveSetp<oneStepWidth)
8256
+ {
8257
+ this.SetCursor({Cursor:cursorStatus});
8258
+ return;
8259
+ }
8260
+
8261
+ if (this.XCoordinateZoom(moveSetp,isLeft))
8262
+ {
8263
+ this.UpdataDataoffset();
8264
+ this.UpdateFrameMaxMin();
8265
+ this.ResetFrameXYSplit();
8266
+
8267
+ this.Draw();
8268
+ this.OnKLinePageChange("datamove");
8269
+ }
8270
+
8271
+ drag.LastMove.X=e.clientX;
8272
+ this.SetCursor({Cursor:cursorStatus});
8273
+ }
8274
+
8239
8275
  this.OnDragMode_One=function(moveData, e)
8240
8276
  {
8241
8277
  var moveSetp=moveData.X;
@@ -8296,7 +8332,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8296
8332
  if (drag.LastMove.X<e.clientX) isLeft=false;//右移数据
8297
8333
 
8298
8334
  var cursorStatus="pointer";
8299
- if (drag.Click.IsInFrameBottom) cursorStatus="ew-resize";
8300
8335
  var oneStepWidth=this.GetMoveOneStepWidth();
8301
8336
  if (moveSetp<oneStepWidth)
8302
8337
  {
@@ -8307,18 +8342,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8307
8342
  }
8308
8343
  else
8309
8344
  {
8310
- if (drag.Click && drag.Click.IsInFrameBottom)
8311
- {
8312
-
8313
- if (this.XCoordinateZoom(moveSetp,isLeft))
8314
- {
8315
- this.UpdataDataoffset();
8316
- this.UpdateFrameMaxMin();
8317
- this.ResetFrameXYSplit();
8318
- bNeedDraw=true;
8319
- }
8320
- }
8321
- else if(this.DataMove(moveSetp,isLeft))
8345
+ if(this.DataMove(moveSetp,isLeft))
8322
8346
  {
8323
8347
  this.UpdataDataoffset();
8324
8348
  //this.UpdatePointByCursorIndex(); //推拽数据的时候不需要把鼠标位置更新到K线上
@@ -8443,9 +8467,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8443
8467
  }
8444
8468
  else if (IsMinuteChart)
8445
8469
  {
8446
- if (this.OnMinuteSelectRectMouseUp) this.OnMinuteSelectRectMouseUp(e);
8470
+ if (this.OnMinuteSelectRectMouseUp) this.OnMinuteSelectRectMouseUp(e); //分时图区间选择
8447
8471
  }
8448
- else if (bLButtonSelectRect || bRButtonSelectRect) //区间选择
8472
+ else if (bLButtonSelectRect || bRButtonSelectRect) //K线图区间选择
8449
8473
  {
8450
8474
  var drag=this.MouseDrag;
8451
8475
  drag.LastMove.X=e.clientX;
@@ -8460,49 +8484,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8460
8484
  selectData.YEnd=(drag.LastMove.Y-uielement.getBoundingClientRect().top)*pixelTatio;
8461
8485
  selectData.JSChartContainer=this;
8462
8486
  selectData.Stock={Symbol:this.Symbol, Name:this.Name};
8487
+ selectData.IsLButton=bLButtonSelectRect;
8488
+ selectData.IsRButton=bRButtonSelectRect;
8463
8489
 
8464
8490
  if (!this.BorderDrag && this.GetSelectRectData(selectData))
8465
8491
  {
8466
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);
8467
- var paint=this.GetRectSelectPaint();
8468
- var isShowMenu=true;
8469
- if (event && event.Callback)
8470
- {
8471
- var data=
8472
- {
8473
- X:drag.LastMove.X-uielement.getBoundingClientRect().left,
8474
- Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,
8475
- SelectData:selectData, //区间选择的数据
8476
- RectSelectPaint:paint, //区间选择背景
8477
- IsShowMenu:true,
8478
- e,e
8479
- };
8480
- event.Callback(event,data,this);
8481
- isShowMenu=data.IsShowMenu;
8482
- }
8483
-
8484
- if (IsMinuteChart) //分时图直接显示显示区间选择
8485
- {
8486
- this.HideSelectRect();
8487
- this.UpdateSelectRect(selectData.Start,selectData.End);
8488
- }
8489
- else
8490
- {
8491
- if (isShowMenu)
8492
- {
8493
- var data=
8494
- {
8495
- Chart:this,
8496
- X:drag.LastMove.X-uielement.getBoundingClientRect().left,
8497
- Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,
8498
- SelectData:selectData, //区间选择的数据
8499
- RectSelectPaint:paint //区间选择背景
8500
- };
8501
-
8502
- e.data=data;
8503
- this.PopupSelectRectMenuV2(data, e);
8504
- }
8505
- }
8492
+ this.FinishSelectRect(selectData, e);
8506
8493
  }
8507
8494
  else
8508
8495
  {
@@ -8542,6 +8529,92 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8542
8529
  this.ClearDocContextMenuTimer(5000);
8543
8530
  }
8544
8531
 
8532
+ //区间选择完成
8533
+ this.FinishSelectRect=function(selectData, e)
8534
+ {
8535
+ var bMinuteChart=this.IsMinuteContainer();
8536
+ var drag=this.MouseDrag;
8537
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);
8538
+ var paint=this.GetRectSelectPaint();
8539
+
8540
+ var x=drag.LastMove.X-uielement.getBoundingClientRect().left;
8541
+ var y=drag.LastMove.Y-uielement.getBoundingClientRect().top;
8542
+
8543
+ if (e) //往事件里面 写如我们的数据
8544
+ {
8545
+ var data=
8546
+ {
8547
+ Chart:this, X:x,Y:y,
8548
+ SelectData:selectData, //区间选择的数据
8549
+ RectSelectPaint:paint, //区间选择背景
8550
+ IsLButton:selectData.IsLButton, IsRButton:selectData.IsRButton,
8551
+ };
8552
+
8553
+ e.data=data;
8554
+ }
8555
+
8556
+ var aryMenu=null, command=null;
8557
+ if (bMinuteChart) //分时图 默认区间统计
8558
+ {
8559
+ command={ ID:JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID, Args:[e,selectData] };
8560
+ }
8561
+ else //K线默认 区间选择K线
8562
+ {
8563
+ aryMenu=
8564
+ [
8565
+ { Name:"区间统计", Data:{ ID:JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID, Args:[e,selectData] }},
8566
+ { Name:"区间放大", Data:{ ID:JSCHART_MENU_ID.CMD_SELECTED_ZOOM_ID, Args:[selectData] }}
8567
+ ];
8568
+ }
8569
+
8570
+ if (event && event.Callback)
8571
+
8572
+ var sendData=
8573
+ {
8574
+ X:x, Y:y, e:e,
8575
+ SelectData:selectData, //区间选择的数据
8576
+ RectSelectPaint:paint, //区间选择背景
8577
+ AryMenu:aryMenu, //菜单 填null 不就会弹菜单
8578
+ Command:command, //执行命令
8579
+ IsLButton:selectData.IsLButton, IsRButton:selectData.IsRButton,
8580
+ PreventDefault:false,
8581
+ };
8582
+ if (bMinuteChart) sendData.Command=null; //分时图 调用事件 不做任何事
8583
+
8584
+ event.Callback(event,sendData,this);
8585
+
8586
+ if (sendData.PreventDefault==true) return; //已被上层替换,不调用默认的网络请求
8587
+
8588
+ aryMenu=sendData.AryMenu;
8589
+ command=sendData.Command;
8590
+
8591
+
8592
+ if (aryMenu) //弹菜单
8593
+ {
8594
+ this.PopupSelectRectMenuV3(aryMenu, data, e);
8595
+ return;
8596
+ }
8597
+
8598
+ if (command) //执行命令
8599
+ {
8600
+ this.ExecuteMenuCommand(command.ID, command.Args);
8601
+ return;
8602
+ }
8603
+
8604
+ this.HideSelectRect();
8605
+ this.UpdateSelectRect(selectData.Start,selectData.End);
8606
+ }
8607
+
8608
+ this.PopupSelectRectMenuV3=function(aryMenu, data, e)
8609
+ {
8610
+ if (!aryMenu) return;
8611
+
8612
+ var menuData={ Menu:aryMenu, Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID };
8613
+ menuData.ClickCallback=(data)=>{ this.OnClickRightMenu(data); }
8614
+ var x=data.X, y=data.Y;
8615
+ this.PopupMenuByRClick(menuData, x, y);
8616
+ }
8617
+
8545
8618
  this.DocContextMenu=function(e)
8546
8619
  {
8547
8620
  e.preventDefault();
@@ -28982,12 +29055,12 @@ function IChartPainting()
28982
29055
  if (valueType==1) //K线收盘价
28983
29056
  {
28984
29057
  var kItem=this.Data.Data[i];
28985
- if (IFrameSplitOperator.IsNumber(kItem.Close)) value=kItem.Close
29058
+ if (kItem && IFrameSplitOperator.IsNumber(kItem.Close)) value=kItem.Close
28986
29059
  }
28987
29060
  else if (valueType==2)
28988
29061
  {
28989
29062
  var kItem=this.Data.Data[i];
28990
- if (IFrameSplitOperator.IsNumber(kItem.Vol)) value=kItem.Vol
29063
+ if (kItem && IFrameSplitOperator.IsNumber(kItem.Vol)) value=kItem.Vol
28991
29064
  }
28992
29065
  else if (valueType==3)
28993
29066
  {
@@ -62132,7 +62205,7 @@ function DynamicChartTitlePainting()
62132
62205
  return aryText;
62133
62206
  }
62134
62207
 
62135
- this.FromatKLineTitle=function(item, dataInfo)
62208
+ this.FormatKLineTitle=function(item, dataInfo)
62136
62209
  {
62137
62210
  var defaultfloatPrecision=GetfloatPrecision(dataInfo.Symbol);//价格小数位数
62138
62211
  var upperSymbol="";
@@ -62210,6 +62283,35 @@ function DynamicChartTitlePainting()
62210
62283
  return aryText;
62211
62284
  }
62212
62285
 
62286
+ this.FormatIndexTitle=function(value, dataInfo)
62287
+ {
62288
+ if (!value) return null;
62289
+
62290
+ if (IFrameSplitOperator.IsString(value)) return { Text:value, ArrayText:null };
62291
+
62292
+ if (IFrameSplitOperator.IsNonEmptyArray(value))
62293
+ {
62294
+ var aryText=[];
62295
+ for(var i=0;i<value.length;++i)
62296
+ {
62297
+ var item=value[i];
62298
+ if (!item) continue;
62299
+
62300
+ var textItem={ Name:null, Text:null };
62301
+ if (item.Name) textItem.Name=item.Name;
62302
+ if (item.Text) textItem.Text=item.Text;
62303
+ if (item.Color) textItem.Color=item.Color;
62304
+ if (IFrameSplitOperator.IsNumber(item.LeftSpace)) textItem.LeftSpace=item.LeftSpace;
62305
+
62306
+ aryText.push(textItem);
62307
+ }
62308
+
62309
+ return { Text:null, ArrayText:aryText }
62310
+ }
62311
+
62312
+ return null;
62313
+ }
62314
+
62213
62315
  this.GetColor=function(price,yClose)
62214
62316
  {
62215
62317
  if (!IFrameSplitOperator.IsNumber(yClose)) return this.UnchangeColor;
@@ -62707,15 +62809,14 @@ function DynamicChartTitlePainting()
62707
62809
  }
62708
62810
  else if (item.DataType=="DRAWKLINE")
62709
62811
  {
62710
- aryText=this.FromatKLineTitle(value, item);
62812
+ aryText=this.FormatKLineTitle(value, item);
62711
62813
  if (!aryText) return null;
62712
62814
  return { Text:null, ArrayText:aryText };
62713
62815
  }
62714
62816
  else if (item.DataType=="ChartIndexTitle")
62715
62817
  {
62716
- var text=item.Data.Data[dataIndex];
62717
- if (!IFrameSplitOperator.IsString(text)) return null;
62718
- return { Text:text, ArrayText:null };
62818
+ var outTitle=this.FormatIndexTitle(value, item);
62819
+ return outTitle;
62719
62820
  }
62720
62821
  else if (g_ScriptIndexChartFactory.Has(item.DataType)) //外部挂接
62721
62822
  {
@@ -63109,9 +63210,17 @@ function DynamicChartTitlePainting()
63109
63210
  }
63110
63211
  else if (item.DataType=="DRAWKLINE")
63111
63212
  {
63112
- aryText=this.FromatKLineTitle(value, item);
63213
+ aryText=this.FormatKLineTitle(value, item);
63113
63214
  if (!aryText) continue;
63114
63215
  }
63216
+ else if (item.DataType=="ChartIndexTitle")
63217
+ {
63218
+ var outTitle=this.FormatIndexTitle(value, item);
63219
+ if (!outTitle) continue;
63220
+
63221
+ valueText=outTitle.Text;
63222
+ aryText=outTitle.ArrayText;
63223
+ }
63115
63224
  else
63116
63225
  {
63117
63226
  valueText=this.FormatValue(value,item);
@@ -63129,6 +63238,8 @@ function DynamicChartTitlePainting()
63129
63238
  var textWidth=this.Canvas.measureText(text).width+2; //后空2个像素
63130
63239
  if ((x+textWidth)>right) break;
63131
63240
 
63241
+ if (IFrameSplitOperator.IsNumber(titleItem.LeftSpace)) x+=titleItem.LeftSpace*pixelRatio;
63242
+
63132
63243
  if (this.OverlayIndexType.BGColor)
63133
63244
  {
63134
63245
  this.Canvas.fillStyle=this.OverlayIndexType.BGColor;
@@ -80573,8 +80684,21 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
80573
80684
  x+=(rtClient.left+rtScroll.Left);
80574
80685
  y+=(rtClient.top+rtScroll.Top);
80575
80686
 
80576
- var date=data.Tooltip.Data.Date;
80577
- var symbol=data.Chart.Symbol;
80687
+ var item=data.Tooltip.Data;
80688
+ var date=item.Date;
80689
+ var symbol=null;
80690
+
80691
+ if (data.Tooltip.ChartPaint && data.Tooltip.ChartPaint.Name=="DRAWKLINE")
80692
+ {
80693
+ if (item.Symbol) symbol=item.Symbol;
80694
+ else if (data.Tooltip.Symbol) symbol=data.Tooltip.Symbol;
80695
+ }
80696
+ else
80697
+ {
80698
+ symbol=data.Chart.Symbol;
80699
+ }
80700
+
80701
+ if (!symbol) return;
80578
80702
 
80579
80703
  this.PopMinuteChart.Show({ Date:date, Symbol:symbol, Data:data.Tooltip.Data }, x/pixelRatio,y/pixelRatio);
80580
80704
  }
@@ -88139,6 +88263,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
88139
88263
  }
88140
88264
  else if ((bRButtonSelectRect || bLButtonSelectRect) && !this.BorderDrag && this.GetSelectRectData(selectData))
88141
88265
  {
88266
+ this.FinishSelectRect(selectData, e);
88267
+
88268
+ /*
88142
88269
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);
88143
88270
  var paint=this.GetRectSelectPaint();
88144
88271
  var isShowDialog=true; //是否显示内置区间选择框
@@ -88176,6 +88303,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
88176
88303
  this.HideSelectRect();
88177
88304
  this.UpdateSelectRect(selectData.Start,selectData.End);
88178
88305
  }
88306
+ */
88179
88307
  }
88180
88308
  else
88181
88309
  {
@@ -125552,6 +125680,12 @@ function OverlayScriptIndex(name,script,args,option)
125552
125680
  {
125553
125681
  this.CreateLine(hqChart,windowIndex,item,i, item.Type);
125554
125682
  }
125683
+ else if (item.Type==10)
125684
+ {
125685
+ this.CreateTitle(hqChart,windowIndex,item,i);
125686
+ }
125687
+
125688
+
125555
125689
 
125556
125690
  var titleData=titleInfo.Data[i];
125557
125691
  if (titleData)
@@ -126119,6 +126253,7 @@ function OverlayScriptIndex(name,script,args,option)
126119
126253
  chart.Name=varItem.Name;
126120
126254
  chart.ChartBorder=frame.Frame.ChartBorder;
126121
126255
  chart.ChartFrame=frame.Frame;
126256
+ chart.Identify=overlayIndex.Identify;
126122
126257
  if (varItem.Draw && varItem.Draw.DrawData)
126123
126258
  {
126124
126259
  var drawData=varItem.Draw.DrawData;
@@ -126130,6 +126265,32 @@ function OverlayScriptIndex(name,script,args,option)
126130
126265
  frame.ChartPaint.push(chart);
126131
126266
  }
126132
126267
 
126268
+ this.CreateTitle=function(hqChart,windowIndex,varItem,id)
126269
+ {
126270
+ var overlayIndex=this.OverlayIndex;
126271
+ var frame=overlayIndex.Frame;
126272
+ let chart=new ChartIndexTitle();
126273
+ chart.Canvas=hqChart.Canvas;
126274
+
126275
+ chart.Name=varItem.Name;
126276
+ chart.ChartBorder=frame.Frame.ChartBorder;
126277
+ chart.ChartFrame=frame.Frame;
126278
+ chart.Identify=overlayIndex.Identify;
126279
+
126280
+ if (varItem.Color) chart.Color=this.GetColor(varItem.Color);
126281
+ else chart.Color=this.GetDefaultColor(id);
126282
+ chart.Data.Data=varItem.Data;
126283
+
126284
+ var titleIndex=windowIndex+1;
126285
+ var titlePaint=hqChart.TitlePaint[titleIndex];
126286
+ var titleData=new DynamicTitleData(chart.Data,chart.Name,chart.Color);
126287
+ titleData.DataType="ChartIndexTitle";
126288
+ titlePaint.OverlayIndex.get(overlayIndex.Identify).Data[id]=titleData;
126289
+
126290
+ this.SetChartIndexName(chart);
126291
+ frame.ChartPaint.push(chart);
126292
+ }
126293
+
126133
126294
  this.CreateStackedBar=function(hqChart,windowIndex,varItem,id)
126134
126295
  {
126135
126296
  var overlayIndex=this.OverlayIndex;
@@ -154077,7 +154238,7 @@ function HQChartScriptWorker()
154077
154238
 
154078
154239
 
154079
154240
 
154080
- var HQCHART_VERSION="1.1.14497";
154241
+ var HQCHART_VERSION="1.1.14505";
154081
154242
 
154082
154243
  function PrintHQChartVersion()
154083
154244
  {