hqchart 1.1.15451 → 1.1.15474

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.
@@ -6840,6 +6840,15 @@ JSChart.GetShortSymbol=function(symbol)
6840
6840
  return symbol.slice(0,pos);
6841
6841
  }
6842
6842
 
6843
+ JSChart.CancelEvent=function(e)
6844
+ {
6845
+ if (!e) return;
6846
+
6847
+ if (e.preventDefault) e.preventDefault();
6848
+ if (e.stopPropagation) e.stopPropagation();
6849
+ e.returnValue=false;
6850
+ }
6851
+
6843
6852
 
6844
6853
  var JSCHART_EVENT_ID=
6845
6854
  {
@@ -6928,9 +6937,6 @@ var JSCHART_EVENT_ID=
6928
6937
  ON_DRAG_SUB_SELECT_RECT:66, //拖拽区间选择子区域
6929
6938
  ON_DRAG_SUB_SELECT_RECT_MOUSEUP:67, //拖拽区间选择子区域鼠标松开
6930
6939
 
6931
- ON_KEYBOARD_SELECTED:68, //键盘精灵选中回车
6932
- ON_KEYBOARD_MOUSEUP:69,
6933
-
6934
6940
  ON_CLICK_DRAWPICTURE_BUTTON:70, //画图工具按钮
6935
6941
  ON_FINISH_MOVE_DRAWPICTURE:71, //画图工具移动完成
6936
6942
 
@@ -7076,6 +7082,15 @@ var JSCHART_EVENT_ID=
7076
7082
 
7077
7083
  //工具条
7078
7084
  ON_CLICK_STATUSBAR_ITEM:301,
7085
+ ON_RCLICK_STATUSBAR_ITEM:302,
7086
+
7087
+ //5档买卖
7088
+ ON_CLICK_STOCKINFO_ITEM:350,
7089
+ ON_RCLICK_STOCKINFO_ITEM:351,
7090
+
7091
+ ON_KEYBOARD_SHOW:350, //显示键盘精灵
7092
+ ON_KEYBOARD_SELECTED:351, //键盘精灵选中回车
7093
+ ON_KEYBOARD_MOUSEUP:352,
7079
7094
  }
7080
7095
 
7081
7096
  var JSCHART_OPERATOR_ID=
@@ -31518,6 +31533,7 @@ function IChartPainting()
31518
31533
  if (!this.IsShow || this.ChartFrame.IsMinSize) return;
31519
31534
  var bHScreen=(this.ChartFrame.IsHScreen===true);
31520
31535
  if (bHScreen) return;
31536
+ if (!this.Data) return;
31521
31537
 
31522
31538
  var isMinute=this.IsMinuteFrame();
31523
31539
  var dataWidth=this.ChartFrame.DataWidth;
@@ -31658,6 +31674,7 @@ function IChartPainting()
31658
31674
  if (!this.IsShow || this.ChartFrame.IsMinSize) return null;
31659
31675
  var bHScreen=(this.ChartFrame.IsHScreen===true);
31660
31676
  if (bHScreen) return null;
31677
+ if (!this.Data) return null;
31661
31678
 
31662
31679
  var dataWidth=this.ChartFrame.DataWidth;
31663
31680
  var distanceWidth=this.ChartFrame.DistanceWidth;
@@ -60966,6 +60983,8 @@ function FrameSplitKLinePriceY()
60966
60983
  isLast=pageInfo.IsLast;
60967
60984
  }
60968
60985
  }
60986
+
60987
+ if (!latestItem || !IFrameSplitOperator.IsNumber(latestItem.Close)) return null;
60969
60988
 
60970
60989
  var info=new CoordinateInfo();
60971
60990
  info.Type=0;
@@ -84068,7 +84087,7 @@ function JSChartResource()
84068
84087
  TitleColor:"rgb(90,90,90)",
84069
84088
  VolColor:"rgb(90,90,90)",
84070
84089
  Margin:{ Left:0, Top:0, Bottom:0, Right:0 },
84071
- CellMargin:{ Top:5, Bottom:5, Left:5, Right:5, YOffset:0 },
84090
+ CellMargin:{ Top:3*GetDevicePixelRatio(), Bottom:3*GetDevicePixelRatio(), Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), YOffset:1*GetDevicePixelRatio() },
84072
84091
  BottomLine:{ Enable:true, Color:"rgb(192,192,192)"}, //底部分割线
84073
84092
  TopLine:{ Enable:false, Color:"rgb(192,192,192)"}, //底部分割线
84074
84093
 
@@ -84084,10 +84103,12 @@ function JSChartResource()
84084
84103
  Font:14*GetDevicePixelRatio() +'px 微软雅黑',
84085
84104
  TitleColor:"rgb(90,90,90)",
84086
84105
  TextColor:"rgb(90,90,90)",
84087
- Margin:{ Left:0, Top:0, Bottom:0, Right:0 },
84088
- CellMargin:{ Top:5, Bottom:5, Left:5, Right:5, YOffset:0 },
84106
+ Margin:{ Left:0, Top:2*GetDevicePixelRatio(), Bottom:0, Right:0 },
84107
+ CellMargin:{ Top:3*GetDevicePixelRatio(), Bottom:3*GetDevicePixelRatio(), Left:5, Right:5, YOffset:1*GetDevicePixelRatio() },
84089
84108
  },
84090
84109
 
84110
+ MouseOn:{ BGColor:"rgb(169,169,169)" },
84111
+
84091
84112
  UpTextColor:"rgb(238,21,21)", //上涨文字颜色
84092
84113
  DownTextColor:"rgb(25,158,0)", //下跌文字颜色
84093
84114
  UnchangeTextColor:"rgb(90,90,90)", //平盘文字颜色
@@ -85290,6 +85311,12 @@ function JSChartResource()
85290
85311
  }
85291
85312
  }
85292
85313
 
85314
+ if (style.MouseOn)
85315
+ {
85316
+ var item=style.MouseOn;
85317
+ if (item.BGColor) dest.MouseOn.BGColor=item.BGColor;
85318
+ }
85319
+
85293
85320
  if (style.UpTextColor) dest.UpTextColor=style.UpTextColor;
85294
85321
  if (style.DownTextColor) dest.DownTextColor=style.DownTextColor;
85295
85322
  if (style.UnchangeTextColor) dest.UnchangeTextColor=style.UnchangeTextColor;
@@ -107185,6 +107212,24 @@ var MARKET_SUFFIX_NAME=
107185
107212
  return false;
107186
107213
  },
107187
107214
 
107215
+ //是否包含前缀
107216
+ IsPrefixIncludes:function(symbol, aryPrefix)
107217
+ {
107218
+ if (!symbol) return false;
107219
+ var shortSymbol=this.GetShortSymbol(symbol);
107220
+ if (!shortSymbol) return false;
107221
+ shortSymbol=shortSymbol.toUpperCase();
107222
+
107223
+ for(var i=0;i<aryPrefix.length;++i)
107224
+ {
107225
+ var strValue=aryPrefix[i];
107226
+ if (!strValue) continue;
107227
+ if (shortSymbol.search(strValue)===0) return true;
107228
+ }
107229
+
107230
+ return false;
107231
+ },
107232
+
107188
107233
  IsChinaFutures:function(upperSymbol) //是否是国内期货 /期权
107189
107234
  {
107190
107235
  if (!upperSymbol) return false;
@@ -107299,15 +107344,26 @@ var MARKET_SUFFIX_NAME=
107299
107344
  return false;
107300
107345
  },
107301
107346
 
107347
+ //北交所股票代码全面启用“920”开头的六位数编码规则(如 920XXX),已于 2025 年 10 月 9 日完成存量与增量股票的统一切换,标志着其与新三板代码的脱钩。
107348
+ // 新代码通常将原 43、83、87 开头的旧代码前三位变更为 920,后三位保持不变
107302
107349
  IsBJStock:function(symbol) //北交所股票
107303
107350
  {
107304
107351
  if (!symbol) return false;
107305
107352
  var upperSymbol=symbol.toUpperCase();
107306
107353
  if (!this.IsBJ(upperSymbol)) return false;
107307
107354
 
107308
- var value=upperSymbol.charAt(0);
107355
+ if (upperSymbol.charAt(0)=='9' && upperSymbol.charAt(1)=='2' && upperSymbol.charAt(2)=='0') return true;
107356
+
107357
+ return false;
107358
+ },
107359
+
107360
+ IsBJIndex:function(symbol) //北交所指数 北交所指数代码通常以“899”开头,采用6位数字序列
107361
+ {
107362
+ if (!symbol) return false;
107363
+ var upperSymbol=symbol.toUpperCase();
107364
+ if (!this.IsBJ(upperSymbol)) return false;
107309
107365
 
107310
- if (value=='4' || value=='8') return true;
107366
+ if (upperSymbol.charAt(0)=='8' && upperSymbol.charAt(1)=='9' && upperSymbol.charAt(2)=='9') return true;
107311
107367
 
107312
107368
  return false;
107313
107369
  },
@@ -107323,11 +107379,11 @@ var MARKET_SUFFIX_NAME=
107323
107379
  return false;
107324
107380
  },
107325
107381
 
107326
- IsSHGEM:function(symbol) //创业板(growth enterprise market) 30开头
107382
+ IsSZGEM:function(symbol) //创业板(growth enterprise market) 30开头
107327
107383
  {
107328
107384
  if (!symbol) return false;
107329
107385
  var upperSymbol=symbol.toUpperCase();
107330
- if (!this.IsSH(upperSymbol)) return false;
107386
+ if (!this.IsSZ(upperSymbol)) return false;
107331
107387
  if (upperSymbol.charAt(0)=='3' && upperSymbol.charAt(1)=='0')
107332
107388
  return true;
107333
107389
 
@@ -107471,7 +107527,7 @@ var MARKET_SUFFIX_NAME=
107471
107527
  {
107472
107528
  if (!this.IsSHSZStockA(symbol)) return null;
107473
107529
  if (this.IsSHStockSTAR(symbol)) return {Max:0.2 , Min:-0.2}; //科创板 [20% - -20%]
107474
- if (this.IsSHGEM(symbol)) return { Max:0.2 , Min:-0.2}; //创业板 [20% - -20%]
107530
+ if (this.IsSZGEM(symbol)) return { Max:0.2 , Min:-0.2}; //创业板 [20% - -20%]
107475
107531
 
107476
107532
  if (!name) return null;
107477
107533
  if (name.indexOf('ST')>=0) return { Max:0.05, Min:-0.05 }; //ST 股票 [5% - -5%]
@@ -109388,6 +109444,7 @@ function FuturesTimeData()
109388
109444
  [MARKET_SUFFIX_NAME.SHFE + '-AO', {Time:4,Decimal:0,Name:'氧化铝'}],
109389
109445
  [MARKET_SUFFIX_NAME.SHFE + '-BR', {Time:6,Decimal:0,Name:'合成橡胶'}],
109390
109446
  [MARKET_SUFFIX_NAME.SHFE + '-AD', {Time:4,Decimal:0,Name:"铝合金"}],
109447
+ [MARKET_SUFFIX_NAME.SHFE + '-OP', {Time:6,Decimal:0,Name:"胶版印刷纸"}],
109391
109448
 
109392
109449
  //上期所-能源
109393
109450
  [MARKET_SUFFIX_NAME.SHFE + '-NR', {Time:6,Decimal:1,Name:'20号胶'}],
@@ -110949,59 +111006,6 @@ function GetfloatPrecision(symbol) //获取小数位数
110949
111006
  return defaultfloatPrecision;
110950
111007
  }
110951
111008
 
110952
- //把不连续的分时数据转成连续的分时数据
110953
- function GenerateMinuteStockJsonData(data)
110954
- {
110955
- var stock =
110956
- {
110957
- symbol:data.symbol, name:data.name,time:data.time, date:data.date,
110958
- price:data.price, open:data.open, yclose:data.yclose, high:data.high, low:data.low, vol:data.vol,amount:data.amount,
110959
- minute:[]
110960
- };
110961
-
110962
- var mapMinute=new Map();
110963
- for(var i in data.minute)
110964
- {
110965
- var item=data.minute[i];
110966
- mapMinute.set(item.time,item);
110967
- }
110968
-
110969
- var timeData=g_MinuteTimeStringData.GetTimeData(stock.symbol);
110970
- for(var i in timeData) //根据交易时间产生数据
110971
- {
110972
- var time=timeData[i];
110973
- var minuteItem={ time:time, vaild:false };
110974
- if (mapMinute.has(time))
110975
- {
110976
- var find=mapMinute.get(time);
110977
- minuteItem.vaild=true;
110978
- minuteItem.price=find.price;
110979
- minuteItem.open=find.open;
110980
- minuteItem.high=find.high;
110981
- minuteItem.low=find.low;
110982
- minuteItem.avprice=find.avprice;
110983
- minuteItem.vol=find.vol;
110984
- minuteItem.amount=find.amount;
110985
- if (IFrameSplitOperator.IsNumber(find.increase)) minuteItem.increase=find.increase;
110986
- if (IFrameSplitOperator.IsNumber(find.risefall)) minuteItem.risefall=find.risefall;
110987
- if (IFrameSplitOperator.IsNumber(find.position)) minuteItem.position=find.position;
110988
- }
110989
- stock.minute.push(minuteItem);
110990
- }
110991
-
110992
- var vaildCount=0;
110993
- for(var i=stock.minute.length-1;i>=0;--i)
110994
- {
110995
- vaildCount=i+1;
110996
- var item=stock.minute[i];
110997
- if (item.vaild==true) break;
110998
- }
110999
-
111000
- stock.minute=stock.minute.slice(0,vaildCount); //去掉最后无用的数据
111001
-
111002
- return stock;
111003
- }
111004
-
111005
111009
  function GetLocalTime(i) //得到标准时区的时间的函数
111006
111010
  {
111007
111011
  if (typeof i !== 'number') return;
@@ -140114,6 +140118,8 @@ function GetBlackStyle()
140114
140118
  //CellMargin:{ Top:5, Bottom:5, YOffset:0, Left:5, Right:5, YOffset:-5 },
140115
140119
  },
140116
140120
 
140121
+ MouseOn:{ BGColor:"rgb(54,54,54)" },
140122
+
140117
140123
  UpTextColor:"rgb(238,21,21)", //上涨文字颜色
140118
140124
  DownTextColor:"rgb(25,158,0)", //下跌文字颜色
140119
140125
  UnchangeTextColor:"rgb(90,90,90)", //平盘文字颜色
@@ -143110,6 +143116,7 @@ function JSReportChartContainer(uielement)
143110
143116
  this.DestroyMinuteChartTooltip();
143111
143117
  this.DestroyKLineChartTooltip();
143112
143118
  this.DestroyFloatTooltip();
143119
+ this.DestroyPopMenu();
143113
143120
  }
143114
143121
 
143115
143122
  this.StopAutoDragScrollTimer=function()
@@ -143131,6 +143138,14 @@ function JSReportChartContainer(uielement)
143131
143138
  this.JSPopMenu.Inital();
143132
143139
  }
143133
143140
 
143141
+ this.DestroyPopMenu=function()
143142
+ {
143143
+ if (!this.JSPopMenu) return;
143144
+
143145
+ this.JSPopMenu.Destroy();
143146
+ this.JSPopMenu=null;
143147
+ }
143148
+
143134
143149
  this.InitalMinuteChartTooltip=function(option)
143135
143150
  {
143136
143151
  if (this.TooltipMinuteChart) return;
@@ -160806,6 +160821,7 @@ function JSDialogDrawTool()
160806
160821
  this.Close=function(e)
160807
160822
  {
160808
160823
  if (!this.DivDialog) return;
160824
+ if (!this.IsShow()) return;
160809
160825
 
160810
160826
  this.DivDialog.style.visibility='hidden';
160811
160827
 
@@ -161151,6 +161167,8 @@ function JSDialogModifyDraw()
161151
161167
  if (!this.DivDialog) return;
161152
161168
 
161153
161169
  this.ChartPicture=null;
161170
+ if (!this.IsShow()) return;
161171
+
161154
161172
  this.DivDialog.style.visibility='hidden';
161155
161173
 
161156
161174
  if (this.HQChart) this.HQChart.RestoreFocus(this.RestoreFocusDelay);
@@ -163296,6 +163314,21 @@ function JSPopKeyboard()
163296
163314
  var x=xRight-width;
163297
163315
  var y=ybottom-height;
163298
163316
 
163317
+ if (this.Keyboard.JSChart && this.Keyboard.JSChart.JSChartContainer)
163318
+ {
163319
+ var event=this.Keyboard.JSChart.JSChartContainer.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SHOW);
163320
+ if (event && event.Callback)
163321
+ {
163322
+ var data={ PreventDefault:false, Y:y, X:x, Height:height, Width:width };
163323
+ event.Callback(event, data, this);
163324
+ if (data.PreventDefault) return;
163325
+
163326
+ //修改显示位置
163327
+ x=data.X;
163328
+ y=data.Y;
163329
+ }
163330
+ }
163331
+
163299
163332
  this.DivDialog.style.visibility='visible';
163300
163333
  this.DivDialog.style.top = y + "px";
163301
163334
  this.DivDialog.style.left = x + "px";
@@ -163321,6 +163354,19 @@ function JSPopKeyboard()
163321
163354
  return this.DivDialog.style.visibility==='visible';
163322
163355
  }
163323
163356
 
163357
+ this.PopKeyboard=function(search)
163358
+ {
163359
+ if (!this.DivDialog) return;
163360
+ if (this.IsShow()) return;
163361
+
163362
+ this.Show();
163363
+ this.InputDOM.focus();
163364
+ if (this.InputDOM.value=="")
163365
+ {
163366
+ if (search) this.InputDOM.value=search;
163367
+ }
163368
+ }
163369
+
163324
163370
  this.OnGlobalKeydown=function(event)
163325
163371
  {
163326
163372
  if (!this.DivDialog) return;
@@ -169057,6 +169103,7 @@ function JSStatusBarChartContainer(uielement)
169057
169103
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
169058
169104
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e); }
169059
169105
  this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
169106
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
169060
169107
 
169061
169108
  /*
169062
169109
  this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
@@ -169064,7 +169111,7 @@ function JSStatusBarChartContainer(uielement)
169064
169111
 
169065
169112
 
169066
169113
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
169067
- this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
169114
+
169068
169115
  */
169069
169116
 
169070
169117
  var frequency=500;
@@ -169081,8 +169128,30 @@ function JSStatusBarChartContainer(uielement)
169081
169128
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
169082
169129
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
169083
169130
 
169084
- var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
169085
- this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
169131
+ if (e)
169132
+ {
169133
+ if (e.button==0) //左键点击
169134
+ {
169135
+ var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
169136
+ this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
169137
+ }
169138
+ else if (e.button==2) //右键点击
169139
+ {
169140
+ this.HideAllTooltip();
169141
+ var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
169142
+ this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_RCLICK_STATUSBAR_ITEM, ptClick, e);
169143
+ }
169144
+ }
169145
+ }
169146
+
169147
+ this.UIOnContextMenu=function(e)
169148
+ {
169149
+ if (e) //去掉系统右键菜单
169150
+ {
169151
+ if (e.preventDefault) e.preventDefault();
169152
+ if (e.stopPropagation) e.stopPropagation();
169153
+ e.returnValue=false;
169154
+ }
169086
169155
  }
169087
169156
 
169088
169157
  this.GetChartTooltipData=function(x,y,option)
@@ -169157,7 +169226,7 @@ function JSStatusBarChartContainer(uielement)
169157
169226
  {
169158
169227
  if (toolTip.Data)
169159
169228
  {
169160
- var data= { X:e.clientX, Y:e.clientY, Tooltip:toolTip };
169229
+ var data= { X:e.clientX, Y:e.clientY, Tooltip:toolTip, e:e };
169161
169230
  event.Callback(event, data, this);
169162
169231
  return true;
169163
169232
  }
@@ -169886,6 +169955,7 @@ function JSStockInfoChart(divElement)
169886
169955
  this.DivElement.JSChart=this; //div中保存一份
169887
169956
 
169888
169957
  if (option.EnableResize==true) this.CreateResizeListener();
169958
+ if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
169889
169959
 
169890
169960
  if (option.Symbol)
169891
169961
  {
@@ -169925,6 +169995,8 @@ function JSStockInfoChart(divElement)
169925
169995
 
169926
169996
  if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
169927
169997
  if (IFrameSplitOperator.IsNonEmptyArray(option.HeaderColumn)) chart.SetHeaderColumn(option.HeaderColumn);
169998
+ if (IFrameSplitOperator.IsNonEmptyArray(option.MouseOnKey)) chart.SetMouseOnKey(option.MouseOnKey);
169999
+
169928
170000
  //是否自动更新
169929
170001
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
169930
170002
 
@@ -170085,6 +170157,8 @@ function JSStockInfoChartContainer(uielement)
170085
170157
  this.AutoUpdateTimer=null;
170086
170158
  this.AutoUpdateFrequency=15000; //15秒更新一次数据
170087
170159
 
170160
+ this.JSPopMenu; //内置菜单
170161
+
170088
170162
  this.UIElement=uielement;
170089
170163
 
170090
170164
  this.IsDestroy=false; //是否已经销毁了
@@ -170093,6 +170167,8 @@ function JSStockInfoChartContainer(uielement)
170093
170167
  {
170094
170168
  this.IsDestroy=true;
170095
170169
  this.StopAutoUpdate();
170170
+
170171
+ this.DestroyPopMenu();
170096
170172
  }
170097
170173
 
170098
170174
  //设置事件回调
@@ -170105,6 +170181,37 @@ function JSStockInfoChartContainer(uielement)
170105
170181
  this.mapEvent.set(object.event,data);
170106
170182
  }
170107
170183
 
170184
+ this.RemoveEventCallback=function(eventid)
170185
+ {
170186
+ if (!this.mapEvent.has(eventid)) return;
170187
+
170188
+ this.mapEvent.delete(eventid);
170189
+ }
170190
+
170191
+ this.GetEventCallback=function(id) //获取事件回调
170192
+ {
170193
+ if (!this.mapEvent.has(id)) return null;
170194
+ var item=this.mapEvent.get(id);
170195
+ return item;
170196
+ }
170197
+
170198
+ this.InitalPopMenu=function() //初始化弹出窗口
170199
+ {
170200
+ if (this.JSPopMenu) return;
170201
+
170202
+ this.JSPopMenu=new JSPopMenu(); //内置菜单
170203
+ this.JSPopMenu.Inital();
170204
+ }
170205
+
170206
+ this.DestroyPopMenu=function()
170207
+ {
170208
+ if (!this.JSPopMenu) return;
170209
+
170210
+ this.JSPopMenu.Destroy();
170211
+ this.JSPopMenu=null;
170212
+ }
170213
+
170214
+
170108
170215
  this.ClearData=function()
170109
170216
  {
170110
170217
  this.Data.Name=null;
@@ -170146,13 +170253,15 @@ function JSStockInfoChartContainer(uielement)
170146
170253
  {
170147
170254
  this.CancelAutoUpdate();
170148
170255
  this.ClearData();
170256
+ this.ChartClearMouseOnData();
170149
170257
  this.Symbol=symbol;
170150
170258
  this.Data.Symbol=symbol;
170151
170259
 
170152
170260
  if (option)
170153
170261
  {
170154
- if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) this.SetColumn(option.Column);
170262
+ if (IFrameSplitOperator.IsArray(option.Column)) this.SetColumn(option.Column);
170155
170263
  if (IFrameSplitOperator.IsNumber(option.BuySellCount)) this.SetBuySellCount(option.BuySellCount);
170264
+ if (IFrameSplitOperator.IsArray(option.MouseOnKey)) this.SetMouseOnKey(option.MouseOnKey);
170156
170265
  }
170157
170266
 
170158
170267
  this.Draw();
@@ -170300,17 +170409,220 @@ function JSStockInfoChartContainer(uielement)
170300
170409
  }
170301
170410
 
170302
170411
 
170303
-
170304
- /*
170305
- this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
170412
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
170306
170413
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
170307
170414
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
170308
170415
  this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
170309
170416
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
170310
- this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
170417
+ /*
170418
+ this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
170419
+
170311
170420
  */
170312
170421
  }
170313
170422
 
170423
+ this.UIOnMouseDown=function(e)
170424
+ {
170425
+ var pixelTatio = GetDevicePixelRatio();
170426
+ this.ClickDownPoint={ X:e.clientX, Y:e.clientY };
170427
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
170428
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
170429
+
170430
+ if (e)
170431
+ {
170432
+ if (e.button==0) //左键点击
170433
+ {
170434
+ var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
170435
+ this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STOCKINFO_ITEM, ptClick, e);
170436
+ }
170437
+ else if (e.button==2) //右键点击
170438
+ {
170439
+ var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
170440
+ this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_RCLICK_STOCKINFO_ITEM, ptClick, e);
170441
+ }
170442
+ }
170443
+ }
170444
+
170445
+ this.UIOnContextMenu=function(e)
170446
+ {
170447
+ if (e) //去掉系统右键菜单
170448
+ {
170449
+ if (e.preventDefault) e.preventDefault();
170450
+ if (e.stopPropagation) e.stopPropagation();
170451
+ e.returnValue=false;
170452
+ }
170453
+
170454
+ var x = e.clientX-this.UIElement.getBoundingClientRect().left;
170455
+ var y = e.clientY-this.UIElement.getBoundingClientRect().top;
170456
+
170457
+ this.OnRightMenu(x, y, e);
170458
+ }
170459
+
170460
+ this.OnRightMenu=function(x,y,e)
170461
+ {
170462
+ if (!this.JSPopMenu) return;
170463
+
170464
+ var pixelTatio = GetDevicePixelRatio();
170465
+ var toolTip=new TooltipData();
170466
+ var data=null;
170467
+ for(var i=0;i<this.ChartPaint.length;++i)
170468
+ {
170469
+ var item=this.ChartPaint[i];
170470
+ if (item.GetTooltipData(x*pixelTatio,y*pixelTatio,toolTip))
170471
+ {
170472
+ if (toolTip.Data)
170473
+ {
170474
+ data= { Cell:toolTip.Data};
170475
+ break;
170476
+ }
170477
+ }
170478
+ }
170479
+
170480
+ if (!data) return;
170481
+
170482
+ data.e=e;
170483
+ var menuData={ Menu:null, Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID };
170484
+ menuData.ClickCallback=(data)=>{ this.OnClickRightMenu(data); }
170485
+
170486
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_RIGHT_MENU);
170487
+ if (event && event.Callback)
170488
+ {
170489
+ var sendData={ MenuData:menuData, Data:data };
170490
+ event.Callback(event, sendData, this);
170491
+ }
170492
+
170493
+ if (menuData.Menu) this.PopupMenuByRClick(menuData, x, y);
170494
+ }
170495
+
170496
+ //右键菜单
170497
+ this.PopupMenuByRClick=function(menuData, x, y)
170498
+ {
170499
+ if (!this.JSPopMenu) return;
170500
+
170501
+ var rtClient=this.UIElement.getBoundingClientRect();
170502
+ var rtScroll=GetScrollPosition();
170503
+
170504
+ x+=rtClient.left+rtScroll.Left;
170505
+ y+=rtClient.top+rtScroll.Top;
170506
+
170507
+ this.JSPopMenu.CreatePopMenu(menuData);
170508
+ this.JSPopMenu.PopupMenuByRight(x,y);
170509
+ }
170510
+
170511
+ //点击右键菜单
170512
+ this.OnClickRightMenu=function(data)
170513
+ {
170514
+ JSConsole.Chart.Log('[JSStockInfoChartContainer::OnClickRightMenu] ',data);
170515
+ if (!data || !data.Data) return;
170516
+
170517
+ var cmdID=data.Data.ID; //命令ID
170518
+ var aryArgs=data.Data.Args; //参数
170519
+
170520
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MENU_COMMAND); //回调通知外部
170521
+ if (event && event.Callback)
170522
+ {
170523
+ var data={ PreventDefault:false, CommandID:cmdID, Args:aryArgs, SrcData:data };
170524
+ event.Callback(event,data,this);
170525
+ if (data.PreventDefault) return;
170526
+ }
170527
+
170528
+ this.ExecuteMenuCommand(cmdID, aryArgs);
170529
+ }
170530
+
170531
+ this.ExecuteMenuCommand=function(cmdID, aryArgs)
170532
+ {
170533
+
170534
+ }
170535
+
170536
+ this.UIOnMouseMove=function(e)
170537
+ {
170538
+ var pixelTatio = GetDevicePixelRatio();
170539
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
170540
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
170541
+
170542
+ var option={ Update:false };
170543
+
170544
+ this.OnChartMouseMove(x,y,e,option);
170545
+
170546
+ if (option.Update===true) this.Draw();
170547
+ }
170548
+
170549
+ this.OnChartMouseMove=function(x, y, e, option)
170550
+ {
170551
+ for(var i=0;i<this.ChartPaint.length;++i)
170552
+ {
170553
+ var item=this.ChartPaint[i];
170554
+ if (item && item.OnMouseMove)
170555
+ {
170556
+ if (item.OnMouseMove(x,y,e,option)) return true;
170557
+ }
170558
+ }
170559
+
170560
+ return false;
170561
+ }
170562
+
170563
+ this.TryClickPaintEvent=function(eventID, ptClick, e)
170564
+ {
170565
+ var event=this.GetEventCallback(eventID);
170566
+ if (!event) return false;
170567
+
170568
+ if (ptClick.X==e.clientX && ptClick.Y==e.clientY)
170569
+ {
170570
+ var pixelTatio = GetDevicePixelRatio();
170571
+ var x = (e.clientX-uielement.getBoundingClientRect().left)*pixelTatio;
170572
+ var y = (e.clientY-uielement.getBoundingClientRect().top)*pixelTatio;
170573
+
170574
+ var toolTip=new TooltipData();
170575
+ for(var i=0;i<this.ChartPaint.length;++i)
170576
+ {
170577
+ var item=this.ChartPaint[i];
170578
+ if (item.GetTooltipData(x,y,toolTip))
170579
+ {
170580
+ if (toolTip.Data)
170581
+ {
170582
+ var data= { X:e.clientX, Y:e.clientY, Tooltip:toolTip };
170583
+ event.Callback(event, data, this);
170584
+ return true;
170585
+ }
170586
+ }
170587
+ }
170588
+ }
170589
+
170590
+ return false;
170591
+ }
170592
+
170593
+ this.UIOnMouseleave=function(e)
170594
+ {
170595
+ var option={ Update:false }
170596
+
170597
+ this.ChartClearMouseOnData(option);
170598
+
170599
+ if (option.Update===true) this.Draw();
170600
+ }
170601
+
170602
+ this.UIOnMounseOut=function(e)
170603
+ {
170604
+ var option={ Update:false }
170605
+
170606
+ this.ChartClearMouseOnData(option);
170607
+
170608
+ if (option.Update===true) this.Draw();
170609
+
170610
+ //this.HideAllTooltip();
170611
+ }
170612
+
170613
+ this.ChartClearMouseOnData=function(option)
170614
+ {
170615
+ for(var i=0;i<this.ChartPaint.length;++i)
170616
+ {
170617
+ var item=this.ChartPaint[i];
170618
+ if (item && item.ClearMouseOnData)
170619
+ {
170620
+ item.ClearMouseOnData(option);
170621
+ }
170622
+ }
170623
+ }
170624
+
170625
+
170314
170626
  this.Draw=function()
170315
170627
  {
170316
170628
  if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
@@ -170396,6 +170708,14 @@ function JSStockInfoChartContainer(uielement)
170396
170708
 
170397
170709
  if (option && option.Redraw) this.Draw();
170398
170710
  }
170711
+
170712
+ this.SetMouseOnKey=function(aryKey)
170713
+ {
170714
+ var chart=this.ChartPaint[0];
170715
+ if (!chart) return;
170716
+
170717
+ chart.SetMouseOnKey(aryKey);
170718
+ }
170399
170719
  }
170400
170720
 
170401
170721
  function JSStockInfoFrame()
@@ -170527,7 +170847,15 @@ function ChartStockData()
170527
170847
  [{ Name:"内盘", Key:"InVol", ColorType:4, FloatPrecision:0 }, { Name:"外盘", Key:"OutVol",ColorType:5, FloatPrecision:0 }],
170528
170848
  [{ Name:"TTM", Key:"PE_TTM", FloatPrecision:2 }, { Name:"市净率", Key:"PB", FloatPrecision:2 }],
170529
170849
  [{ Name:"流通市值", Key:"FlowMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }, { Name:"总市值", Key:"TotalMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }],
170530
- ]
170850
+ ];
170851
+
170852
+ this.AryCellRect=[];
170853
+ this.MouseOnItem=null; //{ Key:, Rect: }
170854
+ //this.MouseOnItem={ Key:"SELL_PRICE_0" };
170855
+ this.MouseOnConfig=CloneData(g_JSChartResource.StockInfo.MouseOn);
170856
+
170857
+ this.MapMouseOnKey=new Map();
170858
+
170531
170859
 
170532
170860
  this.ReloadResource=function(resource)
170533
170861
  {
@@ -170541,6 +170869,17 @@ function ChartStockData()
170541
170869
  this.BuySellConfig=CloneData(g_JSChartResource.StockInfo.BuySell);
170542
170870
 
170543
170871
  this.TableConfig=CloneData(g_JSChartResource.StockInfo.Table);
170872
+
170873
+ this.MouseOnConfig=CloneData(g_JSChartResource.StockInfo.MouseOn);
170874
+ }
170875
+
170876
+ this.ClearMouseOnData=function(option)
170877
+ {
170878
+ if (this.MouseOnItem)
170879
+ {
170880
+ this.MouseOnItem=null;
170881
+ if (option) option.Update=true; //需要更新
170882
+ }
170544
170883
  }
170545
170884
 
170546
170885
  this.SetColumn=function(aryColumn)
@@ -170569,8 +170908,75 @@ function ChartStockData()
170569
170908
  }
170570
170909
  }
170571
170910
 
170911
+ this.SetMouseOnKey=function(aryKey)
170912
+ {
170913
+ this.MapMouseOnKey.clear();
170914
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryKey)) return;
170915
+
170916
+ for(var i=0;i<aryKey.length;++i)
170917
+ {
170918
+ var key=aryKey[i];
170919
+ if (!key) continue;
170920
+
170921
+ this.MapMouseOnKey.set(key, { Key:key });
170922
+ }
170923
+
170924
+ }
170925
+
170926
+ this.OnMouseMove=function(x, y, e, option)
170927
+ {
170928
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryCellRect)) return false;
170929
+
170930
+ if (this.MouseOnItem && this.MouseOnItem.Rect)
170931
+ {
170932
+ var rect=this.MouseOnItem.Rect;
170933
+ if (Path2DHelper.PtInRect(x,y,rect )) return true;
170934
+ }
170935
+
170936
+ for(var i=0;i<this.AryCellRect.length;++i)
170937
+ {
170938
+ var item=this.AryCellRect[i];
170939
+ var rect=item.Rect;
170940
+ if (Path2DHelper.PtInRect(x,y, rect))
170941
+ {
170942
+ this.MouseOnItem={ Key:item.Data.Key, Rect:rect };
170943
+ if (option) option.Update=true;
170944
+ return true;
170945
+ }
170946
+ }
170947
+
170948
+ if (this.MouseOnItem)
170949
+ {
170950
+ this.MouseOnItem=null;
170951
+ if (option) option.Update=true;
170952
+ }
170953
+
170954
+ return false;
170955
+ }
170956
+
170957
+ this.GetTooltipData=function(x,y,tooltip)
170958
+ {
170959
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryCellRect)) return false;
170960
+
170961
+ for(var i=0;i<this.AryCellRect.length;++i)
170962
+ {
170963
+ var item=this.AryCellRect[i];
170964
+ var rect=item.Rect;
170965
+ if (Path2DHelper.PtInRect(x,y, rect))
170966
+ {
170967
+ tooltip.Data=item;
170968
+ tooltip.ChartPaint=this;
170969
+ tooltip.Type=151;
170970
+ return true;
170971
+ }
170972
+ }
170973
+
170974
+ return false;
170975
+ }
170976
+
170572
170977
  this.Draw=function()
170573
170978
  {
170979
+ this.AryCellRect=[];
170574
170980
  this.Decimal=GetfloatPrecision(this.Data.Symbol);
170575
170981
  var border=this.ChartBorder.GetBorder();
170576
170982
  var position = { Left:border.Left, Right:border.Right, Top:border.Top, Width:border.Right-border.Left, Border:border };
@@ -170688,11 +171094,13 @@ function ChartStockData()
170688
171094
  {
170689
171095
  var xLeft=position.Border.Left, xRight=position.Border.Right;
170690
171096
  this.Canvas.strokeStyle=config.BottomLine.Color;
170691
- this.Canvas.lineWidth=1*GetDevicePixelRatio();
171097
+ var lineWidth=1*GetDevicePixelRatio();;
171098
+ this.Canvas.lineWidth=lineWidth;
170692
171099
  this.Canvas.beginPath();
170693
171100
  this.Canvas.moveTo(xLeft,ToFixedPoint(yText));
170694
171101
  this.Canvas.lineTo(xRight,ToFixedPoint(yText));
170695
171102
  this.Canvas.stroke();
171103
+ position.Top=ToFixedPoint(yText);
170696
171104
  }
170697
171105
  }
170698
171106
 
@@ -170719,7 +171127,7 @@ function ChartStockData()
170719
171127
  {
170720
171128
  xText=left;
170721
171129
  var item=this.Data.Sells[i];
170722
- this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
171130
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight, { Type:1, Index:i});
170723
171131
  if (IFrameSplitOperator.IsNumber(item.Vol)) sellVol+=item.Vol;
170724
171132
  yText+=cellHeight;
170725
171133
  }
@@ -170738,7 +171146,7 @@ function ChartStockData()
170738
171146
  {
170739
171147
  xText=left;
170740
171148
  var item=this.Data.Buys[i];
170741
- this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
171149
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight, { Type:2, Index:i});
170742
171150
  if (IFrameSplitOperator.IsNumber(item.Vol)) buyVol+=item.Vol;
170743
171151
  yText+=cellHeight;
170744
171152
  }
@@ -170803,7 +171211,8 @@ function ChartStockData()
170803
171211
  }
170804
171212
  }
170805
171213
 
170806
- this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight)
171214
+ //itemInfo={ Type:2(1=买 2=卖), Index:数据索引 }
171215
+ this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight, itemInfo)
170807
171216
  {
170808
171217
  var config=this.BuySellConfig;
170809
171218
  var xText=left;
@@ -170818,11 +171227,22 @@ function ChartStockData()
170818
171227
 
170819
171228
  if (IFrameSplitOperator.IsNumber(item.Price))
170820
171229
  {
171230
+ var key=`${itemInfo.Type==1?"BUY":"SELL"}_PRICE_${itemInfo.Index}`;
171231
+ var mouseOnItem=this.IsMouseOn(key);
171232
+
170821
171233
  var text=item.Price.toFixed(this.Decimal);
170822
171234
  var textWidth=this.Canvas.measureText(text).width;
170823
171235
  var x=xText+cellWidth-textWidth-config.CellMargin.Right;
171236
+ var rtCell={ Left:xText, Width:cellWidth, Top:top, Height:cellHeight };
171237
+ rtCell.Right=rtCell.Left+rtCell.Width;
171238
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
171239
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
171240
+
170824
171241
  this.Canvas.fillStyle=this.GetPriceColor(item.Price);
170825
171242
  this.Canvas.fillText(text,x,yBottom);
171243
+
171244
+ if (this.MapMouseOnKey.has(key))
171245
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:1, Key:key, Value:item.Price }});
170826
171246
  }
170827
171247
  xText+=cellWidth;
170828
171248
 
@@ -170838,6 +171258,25 @@ function ChartStockData()
170838
171258
  }
170839
171259
  }
170840
171260
 
171261
+ this.IsMouseOn=function(key)
171262
+ {
171263
+ if (!this.MouseOnItem) return null;
171264
+
171265
+ if (this.MouseOnItem.Key===key) return this.MouseOnItem;
171266
+
171267
+ return null;
171268
+ }
171269
+
171270
+ this.DrawMouseOnRect=function(rect)
171271
+ {
171272
+ if (!this.MouseOnItem) return;
171273
+
171274
+ this.Canvas.fillStyle=this.MouseOnConfig.BGColor;
171275
+ this.Canvas.fillRect(rect.Left, rect.Top, rect.Width, rect.Height);
171276
+
171277
+ this.MouseOnItem.Rect=rect;
171278
+ }
171279
+
170841
171280
 
170842
171281
  this.DrawTable=function(position)
170843
171282
  {
@@ -170907,18 +171346,36 @@ function ChartStockData()
170907
171346
  {
170908
171347
  if (i==0 && item.ShowType==1) //整行显示
170909
171348
  {
171349
+ var mouseOnItem=this.IsMouseOn(item.Key);
170910
171350
  var textWidth=this.Canvas.measureText(text).width;
170911
171351
  var x=xText+(cellWidth*3)-textWidth-config.CellMargin.Right;
171352
+ var rtCell={ Left:xText+cellWidth, Top:top, Width:cellWidth*2, Height:cellHeight};
171353
+ rtCell.Right=rtCell.Left+rtCell.Width;
171354
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
171355
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
171356
+
170912
171357
  this.Canvas.fillStyle=color;
170913
171358
  this.Canvas.fillText(text,x,yBottom);
171359
+
171360
+ if (this.MapMouseOnKey.has(item.Key))
171361
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:2, Key:item.Key, Value:dataItem }});
170914
171362
  break;
170915
171363
  }
170916
171364
  else
170917
171365
  {
171366
+ var mouseOnItem=this.IsMouseOn(item.Key);
170918
171367
  var textWidth=this.Canvas.measureText(text).width;
170919
171368
  var x=xText+cellWidth-textWidth-config.CellMargin.Right;
171369
+ var rtCell={ Left:xText, Top:top, Width:cellWidth, Height:cellHeight};
171370
+ rtCell.Right=rtCell.Left+rtCell.Width;
171371
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
171372
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
171373
+
170920
171374
  this.Canvas.fillStyle=color;
170921
171375
  this.Canvas.fillText(text,x,yBottom);
171376
+
171377
+ if (this.MapMouseOnKey.has(item.Key))
171378
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:2, Key:item.Key, Value:dataItem }});
170922
171379
  }
170923
171380
 
170924
171381
  }
@@ -171018,7 +171475,7 @@ function ChartStockData()
171018
171475
 
171019
171476
 
171020
171477
 
171021
- var HQCHART_VERSION="1.1.15450";
171478
+ var HQCHART_VERSION="1.1.15473";
171022
171479
 
171023
171480
  function PrintHQChartVersion()
171024
171481
  {